Compare commits
50 Commits
#29_cannot
...
2.5
Author | SHA1 | Date | |
---|---|---|---|
47b58ed770 | |||
1cebc2da0a | |||
414030cbd2 | |||
8011585113 | |||
270a004037 | |||
2aa4160400 | |||
c8e416966b | |||
20cb208719 | |||
e30aff82ee | |||
ad2937c332 | |||
0e8a757d6e | |||
220eaea73c | |||
24d6085ded | |||
8a66734279 | |||
f6e2224651 | |||
5d85c12bb8 | |||
2b1cb7856f | |||
f1d080983a | |||
767b083a22 | |||
348ffe20d6 | |||
f3494e7562 | |||
9b6908f193 | |||
0cfcc8c118 | |||
ec5cd209c6 | |||
5933bcd512 | |||
14ac6654b9 | |||
cea11743eb | |||
210d925987 | |||
ffbffd88f1 | |||
ec8d54dca3 | |||
e8682e446b | |||
e87e1791c3 | |||
f5a4e3c39e | |||
306e20d14f | |||
c76805d133 | |||
8ebb2dc3a6 | |||
669fd6a881 | |||
8e66e5fe0b | |||
674aa7d3ce | |||
2b7c9a240f | |||
18f2a110f0 | |||
27f1e8ca6a | |||
3565a6a05b | |||
aef4901b2b | |||
d77aaa3865 | |||
2ccc5274aa | |||
77302521b2 | |||
0634556256 | |||
2f81529f93 | |||
0fa0d4a5b8 |
@ -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;
|
||||||
@ -80,6 +81,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
|
if(file.isDirectory() || !file.exists()) return false;
|
||||||
this.db=db;
|
this.db=db;
|
||||||
try {
|
try {
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
@ -91,6 +93,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);
|
||||||
|
@ -28,7 +28,6 @@ import com.minres.scviewer.database.IWaveform
|
|||||||
import com.minres.scviewer.database.IWaveformDb
|
import com.minres.scviewer.database.IWaveformDb
|
||||||
import com.minres.scviewer.database.IWaveformDbLoader
|
import com.minres.scviewer.database.IWaveformDbLoader
|
||||||
import com.minres.scviewer.database.RelationType
|
import com.minres.scviewer.database.RelationType
|
||||||
import com.minres.scviewer.database.DataType
|
|
||||||
|
|
||||||
public class TextDbLoader implements IWaveformDbLoader{
|
public class TextDbLoader implements IWaveformDbLoader{
|
||||||
|
|
||||||
@ -65,6 +64,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean load(IWaveformDb db, File file) throws Exception {
|
boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
|
if(file.isDirectory() || !file.exists()) return false;
|
||||||
this.db=db
|
this.db=db
|
||||||
this.streams=[]
|
this.streams=[]
|
||||||
try {
|
try {
|
||||||
@ -88,6 +88,8 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
}
|
}
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
return false
|
return false
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return false
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return false
|
return false
|
||||||
} catch(EOFException e) {
|
} catch(EOFException e) {
|
||||||
|
@ -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.0.2.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.0.2-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;
|
||||||
|
}
|
||||||
|
}
|
@ -46,7 +46,6 @@ public class RulerPainter implements IPainter {
|
|||||||
long startPos=area.x*scaleFactor;
|
long startPos=area.x*scaleFactor;
|
||||||
long startVal=startPos + waveCanvas.getXOffset()*scaleFactor;
|
long startVal=startPos + waveCanvas.getXOffset()*scaleFactor;
|
||||||
long endPos=startPos+area.width*scaleFactor;
|
long endPos=startPos+area.width*scaleFactor;
|
||||||
long endVal=startVal+area.width*scaleFactor;
|
|
||||||
|
|
||||||
long rulerTickMinor = rulerTickMinorC*scaleFactor;
|
long rulerTickMinor = rulerTickMinorC*scaleFactor;
|
||||||
long rulerTickMajor = rulerTickMajorC*scaleFactor;
|
long rulerTickMajor = rulerTickMajorC*scaleFactor;
|
||||||
@ -68,12 +67,9 @@ public class RulerPainter implements IPainter {
|
|||||||
gc.setForeground(headerFgColor);
|
gc.setForeground(headerFgColor);
|
||||||
gc.drawLine(area.x, area.y+bottom, area.x+area.width, area.y+bottom);
|
gc.drawLine(area.x, area.y+bottom, area.x+area.width, area.y+bottom);
|
||||||
|
|
||||||
int x0_max = 0;
|
|
||||||
|
|
||||||
for (long pos = startMinorIncrPos, tick = startMinorIncrVal; pos < endPos; pos+= rulerTickMinor, tick += rulerTickMinor) {
|
for (long pos = startMinorIncrPos, tick = startMinorIncrVal; pos < endPos; pos+= rulerTickMinor, tick += rulerTickMinor) {
|
||||||
int x0_pos = (int) (pos/scaleFactor);
|
int x0_pos = (int) (pos/scaleFactor);
|
||||||
long x0_val = tick/scaleFactor;
|
long x0_val = tick/scaleFactor;
|
||||||
x0_max = x0_pos;
|
|
||||||
if ((tick % rulerTickMajor) == 0) {
|
if ((tick % rulerTickMajor) == 0) {
|
||||||
gc.drawText(df.format(x0_val*unitMultiplier)+unit, x0_pos, area.y+textY);
|
gc.drawText(df.format(x0_val*unitMultiplier)+unit, x0_pos, area.y+textY);
|
||||||
gc.drawLine(x0_pos, area.y+majorTickY, x0_pos,area.y+ bottom);
|
gc.drawLine(x0_pos, area.y+majorTickY, x0_pos,area.y+ bottom);
|
||||||
|
@ -78,11 +78,6 @@ public class SignalPainter extends TrackPainter {
|
|||||||
this.waveCanvas = txDisplay;
|
this.waveCanvas = txDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getXValEnd(long time) {
|
|
||||||
long ltmp = time / this.waveCanvas.getScaleFactor();
|
|
||||||
return ltmp > maxValX ? maxValX : (int) ltmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getXPosEnd(long time) {
|
private int getXPosEnd(long time) {
|
||||||
long ltmp = time / this.waveCanvas.getScaleFactor() - waveCanvas.getXOffset();
|
long ltmp = time / this.waveCanvas.getScaleFactor() - waveCanvas.getXOffset();
|
||||||
return ltmp > maxPosX ? maxPosX : (int) ltmp;
|
return ltmp > maxPosX ? maxPosX : (int) ltmp;
|
||||||
@ -100,7 +95,6 @@ public class SignalPainter extends TrackPainter {
|
|||||||
long scaleFactor = this.waveCanvas.getScaleFactor();
|
long scaleFactor = this.waveCanvas.getScaleFactor();
|
||||||
long beginPos = area.x;
|
long beginPos = area.x;
|
||||||
long beginTime = (beginPos + waveCanvas.getXOffset())*scaleFactor;
|
long beginTime = (beginPos + waveCanvas.getXOffset())*scaleFactor;
|
||||||
long endPos = beginPos + area.width;
|
|
||||||
long endTime = beginTime + area.width*scaleFactor;
|
long endTime = beginTime + area.width*scaleFactor;
|
||||||
|
|
||||||
Entry<Long, ?> first = signal.getEvents().floorEntry(beginTime);
|
Entry<Long, ?> first = signal.getEvents().floorEntry(beginTime);
|
||||||
@ -125,7 +119,6 @@ public class SignalPainter extends TrackPainter {
|
|||||||
yOffsetB = 4 * this.waveCanvas.getTrackHeight() / 5 + area.y;
|
yOffsetB = 4 * this.waveCanvas.getTrackHeight() / 5 + area.y;
|
||||||
int xSigChangeBeginVal = Math.max(area.x + (int)waveCanvas.getXOffset(), (int) (left.time / this.waveCanvas.getScaleFactor()));
|
int xSigChangeBeginVal = Math.max(area.x + (int)waveCanvas.getXOffset(), (int) (left.time / this.waveCanvas.getScaleFactor()));
|
||||||
int xSigChangeBeginPos = area.x;
|
int xSigChangeBeginPos = area.x;
|
||||||
int xSigChangeEndVal = Math.max(area.x + (int)waveCanvas.getXOffset(), getXValEnd(right.time));
|
|
||||||
int xSigChangeEndPos = Math.max(area.x, getXPosEnd(right.time));
|
int xSigChangeEndPos = Math.max(area.x, getXPosEnd(right.time));
|
||||||
|
|
||||||
boolean multiple = false;
|
boolean multiple = false;
|
||||||
|
@ -0,0 +1,142 @@
|
|||||||
|
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.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.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);
|
||||||
|
}
|
||||||
|
}
|
@ -229,7 +229,13 @@ public class WaveformCanvas extends Canvas{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setZoomLevel(int level) {
|
public void setZoomLevel(int level) {
|
||||||
|
long tc=cursorPainters.get(0).getTime(); // cursor time
|
||||||
|
setZoomLevel(level, tc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZoomLevel(int level, long centerTime) {
|
||||||
long oldScaleFactor=scaleFactor;
|
long oldScaleFactor=scaleFactor;
|
||||||
|
if(level<0) level = 0;
|
||||||
if(level<Constants.unitMultiplier.length*Constants.unitString.length){
|
if(level<Constants.unitMultiplier.length*Constants.unitString.length){
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.scaleFactor = (long) Math.pow(10, level/2);
|
this.scaleFactor = (long) Math.pow(10, level/2);
|
||||||
@ -242,10 +248,9 @@ public class WaveformCanvas extends Canvas{
|
|||||||
* xcn = tc/newScaleFactor
|
* xcn = tc/newScaleFactor
|
||||||
* t0n = (xcn-xoffs)*scaleFactor
|
* t0n = (xcn-xoffs)*scaleFactor
|
||||||
*/
|
*/
|
||||||
long tc=cursorPainters.get(0).getTime(); // cursor time
|
long xc=centerTime/oldScaleFactor; // cursor total x-offset
|
||||||
long xc=tc/oldScaleFactor; // cursor total x-offset
|
|
||||||
long xoffs=xc+origin.x; // cursor offset relative to left border
|
long xoffs=xc+origin.x; // cursor offset relative to left border
|
||||||
long xcn=tc/scaleFactor; // new total x-offset
|
long xcn=centerTime/scaleFactor; // new total x-offset
|
||||||
long originX=xcn-xoffs;
|
long originX=xcn-xoffs;
|
||||||
if(originX>0) {
|
if(originX>0) {
|
||||||
origin.x=(int) -originX; // new cursor time offset relative to left border
|
origin.x=(int) -originX; // new cursor time offset relative to left border
|
||||||
@ -421,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) {
|
||||||
@ -557,7 +562,7 @@ public class WaveformCanvas extends Canvas{
|
|||||||
return (getClientArea().width+origin.x)*scaleFactor;
|
return (getClientArea().width+origin.x)*scaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
long getOriginTime() {
|
long getMinVisibleTime() {
|
||||||
return origin.x * scaleFactor;
|
return origin.x * scaleFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -50,6 +52,9 @@ import org.eclipse.swt.events.DisposeListener;
|
|||||||
import org.eclipse.swt.events.MouseAdapter;
|
import org.eclipse.swt.events.MouseAdapter;
|
||||||
import org.eclipse.swt.events.MouseEvent;
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
import org.eclipse.swt.events.MouseListener;
|
import org.eclipse.swt.events.MouseListener;
|
||||||
|
import org.eclipse.swt.events.MouseMoveListener;
|
||||||
|
import org.eclipse.swt.events.PaintEvent;
|
||||||
|
import org.eclipse.swt.events.PaintListener;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.graphics.Font;
|
import org.eclipse.swt.graphics.Font;
|
||||||
@ -94,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;
|
||||||
|
|
||||||
@ -112,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;
|
||||||
@ -139,45 +146,113 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected MouseListener waveformMouseListener = new MouseAdapter(){
|
class WaveformMouseListener implements MouseMoveListener, MouseListener, PaintListener {
|
||||||
Point start;
|
Point start, end;
|
||||||
List<Object> initialSelected;
|
List<Object> initialSelected;
|
||||||
|
boolean down=false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseDoubleClick(MouseEvent e) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseDown(MouseEvent e) {
|
public void mouseDown(MouseEvent e) {
|
||||||
start=new Point(e.x, e.y);
|
start=new Point(e.x, e.y);
|
||||||
|
end=new Point(e.x, e.y);
|
||||||
|
down=true;
|
||||||
if((e.stateMask&SWT.MODIFIER_MASK)!=0) return; //don't react on modifier
|
if((e.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseMove(MouseEvent e) {
|
||||||
|
if(down) {
|
||||||
|
end=new Point(e.x, e.y);
|
||||||
|
asyncUpdate(e.widget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paintControl(PaintEvent e) {
|
||||||
|
if(down) {
|
||||||
|
GC gc = e.gc;
|
||||||
|
gc.setAlpha(128);
|
||||||
|
int minX = Math.min(start.x, end.x);
|
||||||
|
int width = Math.max(start.x, end.x) - minX;
|
||||||
|
Point origin = waveformCanvas.getOrigin();
|
||||||
|
int y_top = waveformCanvas.getRulerHeight()- origin.y;
|
||||||
|
int y_bottom = waveformCanvas.getSize().y;
|
||||||
|
gc.fillRectangle(minX, y_top, width,y_bottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseUp(MouseEvent e) {
|
public void mouseUp(MouseEvent e) {
|
||||||
|
down=false;
|
||||||
if(start==null) return;
|
if(start==null) return;
|
||||||
if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier
|
if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier except shift
|
||||||
if (e.button == 1 && ((e.stateMask&SWT.SHIFT)==0)) {
|
if(!start.equals(end)){
|
||||||
|
asyncUpdate(e.widget);
|
||||||
|
long startTime = waveformCanvas.getTimeForOffset(start.x);
|
||||||
|
long endTime = waveformCanvas.getTimeForOffset(end.x);
|
||||||
|
long targetTimeRange = endTime-startTime;
|
||||||
|
long currentTimeRange = waveformCanvas.getMaxVisibleTime()-waveformCanvas.getMinVisibleTime();
|
||||||
|
if(targetTimeRange==0) return;
|
||||||
|
long relation = currentTimeRange/targetTimeRange;
|
||||||
|
long i = 1;
|
||||||
|
int level=0;//relation>0?0:0;
|
||||||
|
do {
|
||||||
|
if(relation<0 ) {
|
||||||
|
if(-relation<i) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
level--;
|
||||||
|
if(-relation<i*3) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
level--;
|
||||||
|
} else {
|
||||||
|
if(relation<i) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
level++;
|
||||||
|
if(relation<i*3) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
level++;
|
||||||
|
}
|
||||||
|
i=i*10;
|
||||||
|
} while(i<10000);
|
||||||
|
if(i<10000) {
|
||||||
|
int curLevel = waveformCanvas.getZoomLevel();
|
||||||
|
waveformCanvas.setZoomLevel(curLevel-level, (startTime+endTime)/2);
|
||||||
|
}
|
||||||
|
} else if (e.button == 1 && ((e.stateMask&SWT.SHIFT)==0)) {
|
||||||
|
// set cursor (button 1 and no shift)
|
||||||
if(Math.abs(e.x-start.x)<3 && Math.abs(e.y-start.y)<3){
|
if(Math.abs(e.x-start.x)<3 && Math.abs(e.y-start.y)<3){
|
||||||
// first set cursor time
|
// first set cursor time
|
||||||
setCursorTime(snapOffsetToEvent(e));
|
setCursorTime(snapOffsetToEvent(start));
|
||||||
// then set selection and reveal
|
// then set selection and reveal
|
||||||
setSelection(new StructuredSelection(initialSelected));
|
setSelection(new StructuredSelection(initialSelected));
|
||||||
asyncUpdate(e.widget);
|
asyncUpdate(e.widget);
|
||||||
}
|
}
|
||||||
}else if (e.button == 2 ||(e.button==1 && (e.stateMask&SWT.SHIFT)!=0)) {
|
}else if (e.button == 2 ||(e.button==1 && (e.stateMask&SWT.SHIFT)!=0)) {
|
||||||
setMarkerTime(snapOffsetToEvent(e), selectedMarker);
|
// set marker (button 1 and shift)
|
||||||
|
setMarkerTime(snapOffsetToEvent(start), selectedMarker);
|
||||||
asyncUpdate(e.widget);
|
asyncUpdate(e.widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long snapOffsetToEvent(MouseEvent e) {
|
protected long snapOffsetToEvent(Point p) {
|
||||||
long time= waveformCanvas.getTimeForOffset(e.x);
|
long time= waveformCanvas.getTimeForOffset(p.x);
|
||||||
long scaling=5*waveformCanvas.getScaleFactor();
|
long scaling=5*waveformCanvas.getScaleFactor();
|
||||||
for(Object o:waveformCanvas.getClicked(start)){
|
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;
|
||||||
@ -209,7 +284,9 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
}
|
}
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener();
|
||||||
|
|
||||||
public WaveformViewer(Composite parent) {
|
public WaveformViewer(Composite parent) {
|
||||||
pcs=new PropertyChangeSupport(this);
|
pcs=new PropertyChangeSupport(this);
|
||||||
@ -309,6 +386,8 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
|
|
||||||
waveformCanvas.setMaxTime(1);
|
waveformCanvas.setMaxTime(1);
|
||||||
waveformCanvas.addMouseListener(waveformMouseListener);
|
waveformCanvas.addMouseListener(waveformMouseListener);
|
||||||
|
waveformCanvas.addMouseMoveListener(waveformMouseListener);
|
||||||
|
waveformCanvas.addPaintListener(waveformMouseListener);
|
||||||
|
|
||||||
nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
|
nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
@ -342,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) {
|
||||||
@ -734,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)
|
||||||
*/
|
*/
|
||||||
@ -1055,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);
|
||||||
@ -1062,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));
|
||||||
@ -1075,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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1230,13 +1332,6 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
if(percent<-100) percent=-100;
|
if(percent<-100) percent=-100;
|
||||||
if(percent>100) percent=100;
|
if(percent>100) percent=100;
|
||||||
int diff = (waveformCanvas.getWidth()*percent)/100;
|
int diff = (waveformCanvas.getWidth()*percent)/100;
|
||||||
// ScrollBar sb = waveformCanvas.getHorizontalBar();
|
|
||||||
// int x = sb.getSelection();
|
|
||||||
// System.out.println("Setting sb to "+ (x+diff));
|
|
||||||
// if((x+diff)>0)
|
|
||||||
// sb.setSelection(x+diff);
|
|
||||||
// else
|
|
||||||
// sb.setSelection(0);
|
|
||||||
Point o = waveformCanvas.getOrigin();
|
Point o = waveformCanvas.getOrigin();
|
||||||
waveformCanvas.setOrigin(o.x-diff, o.y);
|
waveformCanvas.setOrigin(o.x-diff, o.y);
|
||||||
waveformCanvas.redraw();
|
waveformCanvas.redraw();
|
||||||
|
@ -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);
|
||||||
|
@ -12,7 +12,6 @@ package com.minres.scviewer.database.vcd;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -80,6 +79,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
|
if(file.isDirectory() || !file.exists()) return false;
|
||||||
this.db=db;
|
this.db=db;
|
||||||
this.maxTime=0;
|
this.maxTime=0;
|
||||||
String name = file.getCanonicalFile().getName();
|
String name = file.getCanonicalFile().getName();
|
||||||
|
@ -5,7 +5,8 @@ Bundle-SymbolicName: com.minres.scviewer.database
|
|||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Export-Package: com.minres.scviewer.database
|
Export-Package: com.minres.scviewer.database,
|
||||||
|
com.minres.scviewer.database.internal;x-internal:=true
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
|
Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
|
||||||
Automatic-Module-Name: com.minres.scviewer.database
|
Automatic-Module-Name: com.minres.scviewer.database
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_95PfsHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ide.application" bindingContexts="_95PfuXNmEeWBq8z1Dv39LA">
|
<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_95PfsHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ide.application" bindingContexts="_95PfuXNmEeWBq8z1Dv39LA">
|
||||||
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" width="980" height="700">
|
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="980" height="700">
|
||||||
<children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA">
|
<children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA">
|
||||||
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
|
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
|
||||||
<children xsi:type="basic:PartSashContainer" xmi:id="_95QGyHNmEeWBq8z1Dv39LA" horizontal="true">
|
<children xsi:type="basic:PartSashContainer" xmi:id="_95QGyHNmEeWBq8z1Dv39LA" horizontal="true">
|
||||||
<children xsi:type="basic:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser" containerData="20" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser">
|
<children xsi:type="basic:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser" containerData="2000" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser" bindingContexts="_iQ3kQGVmEeqSQM-A6dw9ig">
|
||||||
<handlers xmi:id="_JIWOYIq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.addWaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.AddWaveformHandler" command="_2PehEHr9EeWVM_sKoXvptg"/>
|
<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">
|
<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">
|
<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">
|
||||||
@ -25,19 +25,19 @@
|
|||||||
</children>
|
</children>
|
||||||
</menus>
|
</menus>
|
||||||
</children>
|
</children>
|
||||||
<children xsi:type="basic:PartSashContainer" xmi:id="_uT9BIHgtEeWwZ-9vrAR2UQ" elementId="" containerData="80">
|
<children xsi:type="basic:PartSashContainer" xmi:id="_uT9BIHgtEeWwZ-9vrAR2UQ" elementId="" containerData="8000">
|
||||||
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="75">
|
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
|
||||||
<tags>NoAutoCollapse</tags>
|
<tags>NoAutoCollapse</tags>
|
||||||
</children>
|
</children>
|
||||||
<children xsi:type="basic:Part" xmi:id="_vtfm8HgtEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parts.WaveformDetails" containerData="25" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.TransactionDetails" label="Waveform Details"/>
|
<children xsi:type="basic:Part" xmi:id="_vtfm8HgtEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parts.WaveformDetails" containerData="2500" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.TransactionDetails" label="Waveform Details"/>
|
||||||
</children>
|
</children>
|
||||||
</children>
|
</children>
|
||||||
</children>
|
</children>
|
||||||
</children>
|
</children>
|
||||||
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog" label="About SCViewer"/>
|
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog" label="About SCViewer" bindingContexts="_95Pfu3NmEeWBq8z1Dv39LA"/>
|
||||||
<mainMenu xmi:id="_95PfyXNmEeWBq8z1Dv39LA" elementId="menu:org.eclipse.ui.main.menu">
|
<mainMenu xmi:id="_95PfyXNmEeWBq8z1Dv39LA" elementId="menu:org.eclipse.ui.main.menu">
|
||||||
<children xsi:type="menu:Menu" xmi:id="_95QGwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.file" label="File">
|
<children xsi:type="menu:Menu" xmi:id="_95QGwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.file" label="File">
|
||||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" mnemonics="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_e7MOYJedEeW09eyIbHsdvg" elementId="" label="Load active tab settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
<children xsi:type="menu:HandledMenuItem" xmi:id="_e7MOYJedEeW09eyIbHsdvg" elementId="" label="Load active tab settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||||
<parameters xmi:id="_4vtYgJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.30" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
<parameters xmi:id="_4vtYgJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.30" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||||
</children>
|
</children>
|
||||||
@ -88,7 +88,9 @@
|
|||||||
<children xsi:type="menu:HandledToolItem" xmi:id="_o9UBUJeiEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handledtoolitem.loadsettings" label="Load settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
<children xsi:type="menu:HandledToolItem" xmi:id="_o9UBUJeiEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handledtoolitem.loadsettings" label="Load settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||||
<parameters xmi:id="_tQZAEJeiEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.32" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
<parameters xmi:id="_tQZAEJeiEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.32" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||||
</children>
|
</children>
|
||||||
<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 xsi:type="menu:HandledToolItem" xmi:id="_95QGznNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handledtoolitem.savesettings" toBeRendered="false" visible="false" label="Save settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/save_edit.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||||
|
<parameters xmi:id="_HHALEGVSEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.32" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="store"/>
|
||||||
|
</children>
|
||||||
</children>
|
</children>
|
||||||
<children xsi:type="menu:ToolBar" xmi:id="_VUv_AHckEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbar.0">
|
<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" tooltip="Remove stream/waveform from list" 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"/>
|
||||||
@ -121,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">
|
||||||
@ -154,17 +161,51 @@
|
|||||||
<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" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.quit" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA">
|
||||||
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" keySequence="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
<tags>type:user</tags>
|
||||||
<bindings xmi:id="_95PfxXNmEeWBq8z1Dv39LA" keySequence="M1+S" command="_95Pfw3NmEeWBq8z1Dv39LA"/>
|
</bindings>
|
||||||
<bindings xmi:id="_95PfyHNmEeWBq8z1Dv39LA" keySequence="M1+A" command="_bV-TMHXHEeWwZ-9vrAR2UQ"/>
|
</bindingTables>
|
||||||
|
<bindingTables xmi:id="_zZFy0GVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.waveform" bindingContext="_q4VSsGVNEeqSQM-A6dw9ig">
|
||||||
|
<bindings xmi:id="_1o3dEGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.zoom_in" keySequence="M1++" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||||
|
<tags>type:user</tags>
|
||||||
|
<parameters xmi:id="_53UagGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.33" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/>
|
||||||
|
</bindings>
|
||||||
|
<bindings xmi:id="_8i3awGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.zoom_out" keySequence="M1+-" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||||
|
<tags>type:user</tags>
|
||||||
|
<parameters xmi:id="__UCh4GVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.34" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/>
|
||||||
|
</bindings>
|
||||||
|
</bindingTables>
|
||||||
|
<bindingTables xmi:id="_XullMGVOEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.window" bindingContext="_95PfunNmEeWBq8z1Dv39LA">
|
||||||
|
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.load" keySequence="M1+L" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||||
|
<tags>type:user</tags>
|
||||||
|
<parameters xmi:id="_G_ulwGVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.35" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||||
|
</bindings>
|
||||||
|
<bindings xmi:id="_95PfxXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.save" keySequence="M1+S" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||||
|
<tags>type:user</tags>
|
||||||
|
<parameters xmi:id="_NJlf8GVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.36" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="store"/>
|
||||||
|
</bindings>
|
||||||
|
<bindings xmi:id="_s7JNEGVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.preferences" keySequence="M1+," command="_AxH6sIl_EeWxJ_wPkM6yGQ">
|
||||||
|
<tags>type:user</tags>
|
||||||
|
</bindings>
|
||||||
|
<bindings xmi:id="_3PRIQGVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.open" keySequence="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA">
|
||||||
|
<tags>type:user</tags>
|
||||||
|
</bindings>
|
||||||
|
</bindingTables>
|
||||||
|
<bindingTables xmi:id="_mnMrUGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.0" bindingContext="_iQ3kQGVmEeqSQM-A6dw9ig">
|
||||||
|
<bindings xmi:id="_n9yDwGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.0" keySequence="M1+A" command="_bV-TMHXHEeWwZ-9vrAR2UQ">
|
||||||
|
<tags>type:user</tags>
|
||||||
|
</bindings>
|
||||||
</bindingTables>
|
</bindingTables>
|
||||||
<rootContext xmi:id="_95PfuXNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows">
|
<rootContext xmi:id="_95PfuXNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows">
|
||||||
<children xmi:id="_95PfunNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.window" name="In Windows"/>
|
<children xmi:id="_95PfunNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.window" name="In Windows">
|
||||||
|
<children xmi:id="_q4VSsGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingcontext.waveform" name="In Waveform Part"/>
|
||||||
|
<children xmi:id="_iQ3kQGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingcontext.indesignbrowser" name="In DesignBrowser"/>
|
||||||
|
</children>
|
||||||
<children xmi:id="_95Pfu3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs"/>
|
<children xmi:id="_95Pfu3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs"/>
|
||||||
</rootContext>
|
</rootContext>
|
||||||
<descriptors xmi:id="_KicY0HRMEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.partdescriptor.waveformviewer" label="SCViewer" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/scviewer.png" allowMultiple="true" category="General" closeable="true" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.WaveformViewer">
|
<descriptors xmi:id="_KicY0HRMEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.partdescriptor.waveformviewer" label="SCViewer" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/scviewer.png" bindingContexts="_q4VSsGVNEeqSQM-A6dw9ig" allowMultiple="true" category="General" closeable="true" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.WaveformViewer">
|
||||||
<tags>categoryTag:General</tags>
|
<tags>categoryTag:General</tags>
|
||||||
<handlers xmi:id="_BSIuEHacEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.navigateEventCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.NavigateEvent" command="_79rx4HabEeWwZ-9vrAR2UQ"/>
|
<handlers xmi:id="_BSIuEHacEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.navigateEventCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.NavigateEvent" command="_79rx4HabEeWwZ-9vrAR2UQ"/>
|
||||||
<handlers xmi:id="_JpdGwHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.navigateTransCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.NavigateTrans" command="_Gn3lEHXKEeWwZ-9vrAR2UQ"/>
|
<handlers xmi:id="_JpdGwHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.navigateTransCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.NavigateTrans" command="_Gn3lEHXKEeWwZ-9vrAR2UQ"/>
|
||||||
@ -251,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,39 @@ 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.1.6.qualifier
|
Bundle-Version: 2.5.0.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",
|
||||||
|
org.eclipse.core.resources;bundle-version="3.13.0",
|
||||||
|
com.opcoach.e4.preferences.mainmenu;bundle-version="1.2.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
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
output.. = bin/
|
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
.,\
|
.,\
|
||||||
plugin.xml,\
|
plugin.xml,\
|
||||||
|
BIN
com.minres.scviewer.e4.application/icons/arrow_up.png
Normal file
BIN
com.minres.scviewer.e4.application/icons/arrow_up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 372 B |
BIN
com.minres.scviewer.e4.application/icons/lightbulb.png
Normal file
BIN
com.minres.scviewer.e4.application/icons/lightbulb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 782 B |
BIN
com.minres.scviewer.e4.application/icons/magifier_zoom_out.png
Executable file
BIN
com.minres.scviewer.e4.application/icons/magifier_zoom_out.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 657 B |
BIN
com.minres.scviewer.e4.application/icons/magnifier.png
Executable file
BIN
com.minres.scviewer.e4.application/icons/magnifier.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 615 B |
BIN
com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png
Executable file
BIN
com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 680 B |
BIN
com.minres.scviewer.e4.application/icons/page_white.png
Normal file
BIN
com.minres.scviewer.e4.application/icons/page_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 294 B |
@ -84,5 +84,12 @@
|
|||||||
category="com.minres.scviewer.e4.application.preferences.scviewer">
|
category="com.minres.scviewer.e4.application.preferences.scviewer">
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="com.opcoach.e4.preferences.e4PreferenceStoreProvider">
|
||||||
|
<preferenceStoreProvider
|
||||||
|
class="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.preferences.PreferencesStoreProvider"
|
||||||
|
pluginId="com.minres.scviewer.e4.application">
|
||||||
|
</preferenceStoreProvider>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -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.1.6-SNAPSHOT</version>
|
<version>2.5.0-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>
|
||||||
|
@ -11,10 +11,12 @@
|
|||||||
package com.minres.scviewer.e4.application;
|
package com.minres.scviewer.e4.application;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||||
@ -30,6 +32,7 @@ import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
|||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
||||||
import org.eclipse.equinox.app.IApplicationContext;
|
import org.eclipse.equinox.app.IApplicationContext;
|
||||||
|
import org.eclipse.osgi.service.datalocation.Location;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
import org.osgi.service.event.EventHandler;
|
import org.osgi.service.event.EventHandler;
|
||||||
|
|
||||||
@ -86,11 +89,25 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new EventHandler() {
|
||||||
|
@Override
|
||||||
|
public void handleEvent(Event event) {
|
||||||
|
Location instanceLocation = Platform.getInstanceLocation();
|
||||||
|
try {
|
||||||
|
boolean isLocked = instanceLocation.isLocked();
|
||||||
|
if(isLocked)
|
||||||
|
instanceLocation.release();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -158,19 +175,29 @@ public class E4LifeCycle {
|
|||||||
* @param name the name
|
* @param name the name
|
||||||
*/
|
*/
|
||||||
public void openViewForFile(String name){
|
public void openViewForFile(String name){
|
||||||
File file = new File(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$
|
||||||
partStack.getChildren().add(part);
|
partStack.getChildren().add(part);
|
||||||
partService.showPart(part, PartState.ACTIVATE);
|
partService.showPart(part, PartState.ACTIVATE);
|
||||||
IEclipseContext ctx=part.getContext();
|
IEclipseContext ctx=part.getContext();
|
||||||
ctx.modify("input", file); //$NON-NLS-1$
|
ctx.modify("input", name); //$NON-NLS-1$
|
||||||
//ctx.declareModifiable("input"); //$NON-NLS-1$
|
//ctx.declareModifiable("input"); //$NON-NLS-1$
|
||||||
ctx.modify("config", confFile); //$NON-NLS-1$
|
ctx.modify("config", confFile); //$NON-NLS-1$
|
||||||
//ctx.declareModifiable("config"); //$NON-NLS-1$
|
//ctx.declareModifiable("config"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getFirstFileName(String name) {
|
||||||
|
if(name.contains(",")) {
|
||||||
|
String[] tokens = name.split(",");
|
||||||
|
return tokens[0];
|
||||||
|
} else
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
public void setConfigFile(String confFile) {
|
public void setConfigFile(String confFile) {
|
||||||
this.confFile=confFile;
|
this.confFile=confFile;
|
||||||
}
|
}
|
||||||
|
@ -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,48 @@
|
|||||||
|
|
||||||
|
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.ConfigurationScope;
|
||||||
|
import org.eclipse.e4.core.contexts.Active;
|
||||||
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
|
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 org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||||
|
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||||
|
|
||||||
|
public class EnableHover {
|
||||||
|
static final String TAG_NAME = "EnableHover"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@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
|
||||||
|
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
|
boolean state = store.getBoolean(PreferenceConstants.SHOW_HOVER);
|
||||||
|
for( MHandledItem hi : elements ){
|
||||||
|
hi.setSelected(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Execute
|
||||||
|
public void execute(@Active MPart part, @Active MWindow window, MHandledItem handledItem, EModelService modelService ) {
|
||||||
|
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
|
store.setValue(PreferenceConstants.SHOW_HOVER, handledItem.isSelected());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -11,6 +11,7 @@
|
|||||||
package com.minres.scviewer.e4.application.handlers;
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
@ -20,32 +21,31 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
|
|||||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
import com.minres.scviewer.e4.application.parts.FileBrowserDialog;
|
||||||
public class OpenHandler {
|
public class OpenHandler {
|
||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
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);
|
FileBrowserDialog dlg = new FileBrowserDialog(shell);
|
||||||
dialog.setFilterExtensions (new String []{Messages.OpenHandler_0});
|
//dlg.create();
|
||||||
dialog.open();
|
dlg.setFilterExtensions (new String []{Messages.OpenHandler_0, "*"});
|
||||||
String path = dialog.getFilterPath();
|
if (dlg.open() != Window.OK) return;
|
||||||
for(String fileName: dialog.getFileNames()){
|
List<File> files = dlg.getSelectedFiles();
|
||||||
File file = new File(path+File.separator+fileName);
|
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||||
if(file.exists()){
|
part.setLabel(files.get(0).getName());
|
||||||
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||||
part.setLabel(file.getName());
|
partStack.getChildren().add(part);
|
||||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
partService.showPart(part, PartState.ACTIVATE);
|
||||||
partStack.getChildren().add(part);
|
final IEclipseContext ctx=part.getContext();
|
||||||
partService.showPart(part, PartState.ACTIVATE);
|
files.stream()
|
||||||
IEclipseContext ctx=part.getContext();
|
.map(x -> x.getAbsolutePath())
|
||||||
ctx.modify("input", file); //$NON-NLS-1$
|
.reduce((s1, s2) -> s1 + "," + s2)
|
||||||
ctx.modify("config", ""); //$NON-NLS-1$
|
.ifPresent(s -> ctx.modify("input", s)); //$NON-NLS-1$
|
||||||
}
|
ctx.modify("config", ""); //$NON-NLS-1$
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,33 @@
|
|||||||
|
|
||||||
package com.minres.scviewer.e4.application.handlers;
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
|
import org.eclipse.e4.core.di.annotations.Optional;
|
||||||
|
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.DesignBrowser;
|
||||||
|
|
||||||
public class SelectAllHandler {
|
public class SelectAllHandler {
|
||||||
|
|
||||||
|
@Inject @Optional DesignBrowser designBrowser;
|
||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
public void execute() {
|
public void execute(EPartService partService) {
|
||||||
|
if(designBrowser==null) designBrowser = getListPart(partService);
|
||||||
|
if(designBrowser!=null){
|
||||||
|
designBrowser.selectAllWaveforms();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected DesignBrowser getListPart(EPartService partService){
|
||||||
|
MPart part = partService.getActivePart();
|
||||||
|
if(part.getObject() instanceof DesignBrowser)
|
||||||
|
return (DesignBrowser) part.getObject();
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,13 +9,14 @@ DesignBrowser_8=Insert before
|
|||||||
LoadingWaveformDb_0=Database loading...
|
LoadingWaveformDb_0=Database loading...
|
||||||
LoadStoreSettingsHandler_2=*.scview
|
LoadStoreSettingsHandler_2=*.scview
|
||||||
LoadStoreSettingsHandler_3=SCViewer.scview
|
LoadStoreSettingsHandler_3=SCViewer.scview
|
||||||
OpenHandler_0=*.vcd;*.txdb;*.txlog;CURRENT
|
OpenHandler_0=*.vcd;*.txdb;*.txlog;*.fbrdb
|
||||||
QuitHandler_0=Confirmation
|
QuitHandler_0=Confirmation
|
||||||
QuitHandler_1=Do you want to exit?
|
QuitHandler_1=Do you want to exit?
|
||||||
RelationTypeToolControl_0=------------
|
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:
|
||||||
@ -44,7 +45,7 @@ WaveformViewer_18=Would you like to reload the database?
|
|||||||
WaveformViewer_19=vcd
|
WaveformViewer_19=vcd
|
||||||
WaveformViewer_20=txdb
|
WaveformViewer_20=txdb
|
||||||
WaveformViewer_21=txlog
|
WaveformViewer_21=txlog
|
||||||
WaveformViewer_22=txldb
|
WaveformViewer_22=fbrdb
|
||||||
WaveformViewer_37=Database open
|
WaveformViewer_37=Database open
|
||||||
WaveformViewer_38=Would you like to open the adjacent database
|
WaveformViewer_38=Would you like to open the adjacent database
|
||||||
WaveformViewer_39=\ as well?
|
WaveformViewer_39=\ as well?
|
||||||
|
@ -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);
|
||||||
@ -139,6 +136,7 @@ public class AboutDialog extends Dialog {
|
|||||||
// links are activated on mouse down when the control key is held down
|
// links are activated on mouse down when the control key is held down
|
||||||
// if ((event.stateMask & SWT.MOD1) != 0) {
|
// if ((event.stateMask & SWT.MOD1) != 0) {
|
||||||
try {
|
try {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
int offset = ((StyledText)event.widget).getOffsetAtLocation(new Point (event.x, event.y));
|
int offset = ((StyledText)event.widget).getOffsetAtLocation(new Point (event.x, event.y));
|
||||||
StyleRange style = ((StyledText)event.widget).getStyleRangeAtOffset(offset);
|
StyleRange style = ((StyledText)event.widget).getStyleRangeAtOffset(offset);
|
||||||
if (style != null && style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) {
|
if (style != null && style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) {
|
||||||
|
@ -13,8 +13,10 @@ package com.minres.scviewer.e4.application.parts;
|
|||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import java.util.regex.PatternSyntaxException;
|
import java.util.regex.PatternSyntaxException;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
@ -35,14 +37,18 @@ import org.eclipse.e4.ui.services.IServiceConstants;
|
|||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||||
|
import org.eclipse.jface.viewers.IContentProvider;
|
||||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.ITreePathContentProvider;
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.jface.viewers.TableViewer;
|
import org.eclipse.jface.viewers.TableViewer;
|
||||||
|
import org.eclipse.jface.viewers.TreePath;
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.jface.viewers.ViewerFilter;
|
import org.eclipse.jface.viewers.ViewerFilter;
|
||||||
@ -115,19 +121,19 @@ public class DesignBrowser {
|
|||||||
private Text treeNameFilter;
|
private Text treeNameFilter;
|
||||||
|
|
||||||
/** The attribute filter. */
|
/** The attribute filter. */
|
||||||
WaveformAttributeFilter treeAttributeFilter;
|
StreamTTreeFilter treeAttributeFilter;
|
||||||
|
|
||||||
/** The name filter. */
|
/** The name filter. */
|
||||||
private Text tableNameFilter;
|
private Text tableNameFilter;
|
||||||
|
|
||||||
/** The attribute filter. */
|
/** The attribute filter. */
|
||||||
WaveformAttributeFilter tableAttributeFilter;
|
StreamTableFilter tableAttributeFilter;
|
||||||
|
|
||||||
/** The tx table viewer. */
|
/** The tx table viewer. */
|
||||||
private TableViewer txTableViewer;
|
private TableViewer txTableViewer;
|
||||||
|
|
||||||
/** The append all item. */
|
/** The append all item. */
|
||||||
ToolItem appendItem, insertItem, insertAllItem, appendAllItem;
|
ToolItem appendItem, insertItem;
|
||||||
|
|
||||||
/** The other selection count. */
|
/** The other selection count. */
|
||||||
int thisSelectionCount=0, otherSelectionCount=0;
|
int thisSelectionCount=0, otherSelectionCount=0;
|
||||||
@ -208,7 +214,7 @@ public class DesignBrowser {
|
|||||||
});
|
});
|
||||||
treeNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
treeNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
treeAttributeFilter = new WaveformAttributeFilter();
|
treeAttributeFilter = new StreamTTreeFilter();
|
||||||
|
|
||||||
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||||
treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
@ -257,7 +263,7 @@ public class DesignBrowser {
|
|||||||
});
|
});
|
||||||
tableNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
tableNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
tableAttributeFilter = new WaveformAttributeFilter();
|
tableAttributeFilter = new StreamTableFilter();
|
||||||
|
|
||||||
txTableViewer = new TableViewer(parent);
|
txTableViewer = new TableViewer(parent);
|
||||||
txTableViewer.setContentProvider(new TxDbContentProvider(true));
|
txTableViewer.setContentProvider(new TxDbContentProvider(true));
|
||||||
@ -281,7 +287,6 @@ public class DesignBrowser {
|
|||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
menuService.registerContextMenu(txTableViewer.getControl(), POPUP_ID);
|
menuService.registerContextMenu(txTableViewer.getControl(), POPUP_ID);
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.RIGHT);
|
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.RIGHT);
|
||||||
@ -316,48 +321,6 @@ public class DesignBrowser {
|
|||||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
new ToolItem(toolBar, SWT.SEPARATOR);
|
|
||||||
|
|
||||||
appendAllItem = new ToolItem(toolBar, SWT.NONE);
|
|
||||||
appendAllItem.setToolTipText(Messages.DesignBrowser_12);
|
|
||||||
appendAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_all_waves.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
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); //$NON-NLS-1$
|
|
||||||
if(result!=null && (Boolean)result)
|
|
||||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
|
||||||
selectionService.setSelection(oldSel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
insertAllItem = new ToolItem(toolBar, SWT.NONE);
|
|
||||||
insertAllItem.setToolTipText(Messages.DesignBrowser_16);
|
|
||||||
insertAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_all_waves.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
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); //$NON-NLS-1$
|
|
||||||
if(result!=null && (Boolean)result)
|
|
||||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
|
||||||
selectionService.setSelection(oldSel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -385,6 +348,16 @@ public class DesignBrowser {
|
|||||||
txTableViewer.setSelection(null);
|
txTableViewer.setSelection(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void selectAllWaveforms() {
|
||||||
|
int itemCount = txTableViewer.getTable().getItemCount();
|
||||||
|
ArrayList<Object> list = new ArrayList<>();
|
||||||
|
for(int i=0; i<itemCount; i++) {
|
||||||
|
list.add(txTableViewer.getElementAt(i));
|
||||||
|
}
|
||||||
|
StructuredSelection sel = new StructuredSelection(list);
|
||||||
|
txTableViewer.setSelection(sel);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the status event.
|
* Gets the status event.
|
||||||
*
|
*
|
||||||
@ -452,27 +425,23 @@ public class DesignBrowser {
|
|||||||
* Update buttons.
|
* Update buttons.
|
||||||
*/
|
*/
|
||||||
private void updateButtons() {
|
private void updateButtons() {
|
||||||
if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed() &&
|
if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed()){
|
||||||
!appendAllItem.isDisposed() && !insertAllItem.isDisposed()){
|
|
||||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||||
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
||||||
appendItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
appendItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||||
result = runCommand(myHandler, CanExecute.class, "after", true); //$NON-NLS-1$
|
|
||||||
appendAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
|
||||||
result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
|
result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
|
||||||
insertItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
insertItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||||
result = runCommand(myHandler, CanExecute.class, "before", true); //$NON-NLS-1$
|
|
||||||
insertAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class WaveformAttributeFilter.
|
* The Class StreamTableFilter.
|
||||||
*/
|
*/
|
||||||
public class WaveformAttributeFilter extends ViewerFilter {
|
public class StreamTableFilter extends ViewerFilter {
|
||||||
|
|
||||||
/** The search string. */
|
/** The search string. */
|
||||||
private String searchString;
|
private String searchString;
|
||||||
|
private Pattern pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the search text.
|
* Sets the search text.
|
||||||
@ -480,7 +449,10 @@ public class DesignBrowser {
|
|||||||
* @param s the new search text
|
* @param s the new search text
|
||||||
*/
|
*/
|
||||||
public void setSearchText(String s) {
|
public void setSearchText(String s) {
|
||||||
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
try {
|
||||||
|
pattern = Pattern.compile(".*" + s + ".*"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
} catch (PatternSyntaxException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@ -492,28 +464,102 @@ public class DesignBrowser {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(element instanceof IWaveform) {
|
if(element instanceof IWaveform) {
|
||||||
IWaveform p = (IWaveform) element;
|
if (pattern.matcher(((IWaveform) element).getName()).matches())
|
||||||
try {
|
|
||||||
if (p.getName().matches(searchString))
|
|
||||||
return true;
|
|
||||||
} catch (PatternSyntaxException e) {
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StreamTTreeFilter extends ViewerFilter {
|
||||||
|
|
||||||
|
/** The search string. */
|
||||||
|
private String searchString;
|
||||||
|
private Pattern pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the search text.
|
||||||
|
*
|
||||||
|
* @param s the new search text
|
||||||
|
*/
|
||||||
|
public void setSearchText(String s) {
|
||||||
|
try {
|
||||||
|
pattern = Pattern.compile(".*" + s + ".*");
|
||||||
|
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
} catch (PatternSyntaxException e) {}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
|
return selectTreePath(viewer, new TreePath(new Object[] { parentElement }), element);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean selectTreePath(Viewer viewer, TreePath parentPath, Object element) {
|
||||||
|
// Cut off children of elements that are shown repeatedly.
|
||||||
|
for (int i = 0; i < parentPath.getSegmentCount() - 1; i++) {
|
||||||
|
if (element.equals(parentPath.getSegment(i))) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else if(element instanceof IWaveformDb) {
|
}
|
||||||
|
|
||||||
|
if (!(viewer instanceof TreeViewer)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
if (searchString == null || searchString.length() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
TreeViewer treeViewer = (TreeViewer) viewer;
|
||||||
|
Boolean matchingResult = isMatchingOrNull(element);
|
||||||
|
if (matchingResult != null) {
|
||||||
|
return matchingResult;
|
||||||
|
}
|
||||||
|
return hasUnfilteredChild(treeViewer, parentPath, element);
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean isMatchingOrNull(Object element) {
|
||||||
|
if(element instanceof IWaveform) {
|
||||||
|
if (pattern.matcher(((IWaveform) element).getName()).matches())
|
||||||
|
return Boolean.TRUE;
|
||||||
|
} else if(element instanceof IWaveformDb) {
|
||||||
|
return Boolean.TRUE;
|
||||||
} else if(element instanceof HierNode) {
|
} else if(element instanceof HierNode) {
|
||||||
HierNode n = (HierNode) element;
|
HierNode n = (HierNode) element;
|
||||||
try {
|
try {
|
||||||
if (n.getFullName().matches(searchString))
|
if (pattern.matcher(n.getFullName()).matches())
|
||||||
return true;
|
return Boolean.TRUE;
|
||||||
} catch (PatternSyntaxException e) {
|
} catch (PatternSyntaxException e) {
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
/* maybe children are matching */
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasUnfilteredChild(TreeViewer viewer, TreePath parentPath, Object element) {
|
||||||
|
TreePath elementPath = parentPath.createChildPath(element);
|
||||||
|
IContentProvider contentProvider = viewer.getContentProvider();
|
||||||
|
Object[] children = contentProvider instanceof ITreePathContentProvider
|
||||||
|
? ((ITreePathContentProvider) contentProvider).getChildren(elementPath)
|
||||||
|
: ((ITreeContentProvider) contentProvider).getChildren(element);
|
||||||
|
|
||||||
|
/* avoid NPE + guard close */
|
||||||
|
if (children == null || children.length == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < children.length; i++) {
|
||||||
|
if (selectTreePath(viewer, elementPath, children[i])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the filtered children.
|
* Gets the filtered children.
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,482 @@
|
|||||||
|
package com.minres.scviewer.e4.application.parts;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.FileSystems;
|
||||||
|
import java.nio.file.PathMatcher;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.jface.dialogs.TrayDialog;
|
||||||
|
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||||
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.TableViewer;
|
||||||
|
import org.eclipse.jface.viewers.TableViewerColumn;
|
||||||
|
import org.eclipse.jface.viewers.TreePath;
|
||||||
|
import org.eclipse.jface.viewers.TreeSelection;
|
||||||
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
import org.eclipse.jface.viewers.ViewerComparator;
|
||||||
|
import org.eclipse.jface.viewers.ViewerFilter;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.custom.SashForm;
|
||||||
|
import org.eclipse.swt.events.MouseAdapter;
|
||||||
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
|
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.Combo;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.swt.widgets.Table;
|
||||||
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
import org.eclipse.swt.widgets.ToolBar;
|
||||||
|
import org.eclipse.swt.widgets.ToolItem;
|
||||||
|
import org.eclipse.wb.swt.ResourceManager;
|
||||||
|
|
||||||
|
public class FileBrowserDialog extends TrayDialog {
|
||||||
|
|
||||||
|
private Image folderImage;
|
||||||
|
|
||||||
|
private Image fileImage;
|
||||||
|
|
||||||
|
private Image dbImage;
|
||||||
|
|
||||||
|
File currentDirFile;
|
||||||
|
|
||||||
|
TreeViewer dirTreeViewer;
|
||||||
|
|
||||||
|
TableViewer tableViewer;
|
||||||
|
|
||||||
|
Text fileNameEntry;
|
||||||
|
|
||||||
|
Combo filterCombo;
|
||||||
|
|
||||||
|
FileTableComparator fileTableComparator;
|
||||||
|
|
||||||
|
private FileGlobber globber = new FileGlobber();
|
||||||
|
|
||||||
|
private FileGlobber imageGlobber = new FileGlobber();
|
||||||
|
|
||||||
|
private File selectedDir;
|
||||||
|
|
||||||
|
private List<File> selectedFiles;
|
||||||
|
|
||||||
|
String[] filterStrings = new String[] {"*"};
|
||||||
|
|
||||||
|
public FileBrowserDialog(Shell parentShell) {
|
||||||
|
super(parentShell);
|
||||||
|
folderImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
dbImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
fileImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/page_white.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
currentDirFile = new File(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilterExtensions(String[] filterStrings) {
|
||||||
|
if(filterStrings.length==0){
|
||||||
|
globber = new FileGlobber();
|
||||||
|
} else {
|
||||||
|
globber= new FileGlobber(filterStrings[0]);
|
||||||
|
imageGlobber = new FileGlobber(filterStrings[0]);
|
||||||
|
if(filterCombo!=null) {
|
||||||
|
filterCombo.setItems(filterStrings);
|
||||||
|
filterCombo.select(0);
|
||||||
|
filterCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.filterStrings=filterStrings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<File> getSelectedFiles(){
|
||||||
|
return selectedFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Control createContents(Composite parent) {
|
||||||
|
Control ret = super.createContents(parent);
|
||||||
|
setDirSelection(currentDirFile.getAbsoluteFile().getParentFile());
|
||||||
|
getButton(IDialogConstants.OK_ID).setEnabled(!tableViewer.getSelection().isEmpty());
|
||||||
|
if(parent instanceof Shell) {
|
||||||
|
Point size = ((Shell)parent).computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
|
((Shell)parent).setSize(size.x, 400);
|
||||||
|
((Shell)parent).setText("Select database");
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Control createDialogArea(Composite parent) {
|
||||||
|
Composite area = (Composite) super.createDialogArea(parent);
|
||||||
|
final SashForm sashForm = new SashForm(area, SWT.HORIZONTAL);
|
||||||
|
sashForm.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
|
||||||
|
|
||||||
|
dirTreeViewer = new TreeViewer(sashForm);
|
||||||
|
dirTreeViewer.setContentProvider(new FileTreeContentProvider());
|
||||||
|
dirTreeViewer.setLabelProvider(new FileTreeLabelProvider());
|
||||||
|
dirTreeViewer.addSelectionChangedListener(event -> {
|
||||||
|
IStructuredSelection sel = event.getStructuredSelection();
|
||||||
|
File entry = (File) sel.getFirstElement();
|
||||||
|
if(entry!=null && entry.isDirectory()) {
|
||||||
|
selectedDir = entry;
|
||||||
|
tableViewer.setInput(selectedDir.listFiles());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dirTreeViewer.setInput("root");
|
||||||
|
|
||||||
|
final Composite tableViewerParent = new Composite(sashForm, SWT.NONE);
|
||||||
|
GridLayout gridLayout = new GridLayout(1, true);
|
||||||
|
gridLayout.horizontalSpacing=0;
|
||||||
|
gridLayout.verticalSpacing=5;
|
||||||
|
gridLayout.marginHeight=0;
|
||||||
|
gridLayout.marginHeight=0;
|
||||||
|
tableViewerParent.setLayout(gridLayout);
|
||||||
|
final ToolBar toolBar = new ToolBar(tableViewerParent, SWT.HORIZONTAL |SWT.SHADOW_OUT);
|
||||||
|
toolBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
final ToolItem toolbarItemUp = new ToolItem(toolBar, SWT.PUSH);
|
||||||
|
toolbarItemUp.setToolTipText("up one level");
|
||||||
|
toolbarItemUp.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/arrow_up.png")); //$NON-NLS-1$ //$NON-NLS-2$);
|
||||||
|
toolbarItemUp.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
if(selectedDir.getParentFile()!=null) {
|
||||||
|
selectedDir=selectedDir.getParentFile();
|
||||||
|
tableViewer.setInput(selectedDir.listFiles());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tableViewer = new TableViewer(tableViewerParent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
|
||||||
|
tableViewer.getTable().setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
tableViewer.addSelectionChangedListener(event -> {
|
||||||
|
IStructuredSelection sel = event.getStructuredSelection();
|
||||||
|
getButton(IDialogConstants.OK_ID).setEnabled(!sel.isEmpty());
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Object text = sel.toList().stream().map(e -> ((File)e).getName()).collect(Collectors.joining(";"));
|
||||||
|
fileNameEntry.setText(text.toString());
|
||||||
|
});
|
||||||
|
tableViewer.addDoubleClickListener(event -> {
|
||||||
|
IStructuredSelection sel = tableViewer.getStructuredSelection();
|
||||||
|
if(sel.isEmpty()) return;
|
||||||
|
if(sel.size()==1) {
|
||||||
|
File elem = (File) sel.getFirstElement();
|
||||||
|
if(globber.matches(elem))
|
||||||
|
buttonPressed(IDialogConstants.OK_ID);
|
||||||
|
else if(elem.isDirectory())
|
||||||
|
setDirSelection(elem);
|
||||||
|
} else
|
||||||
|
buttonPressed(IDialogConstants.OK_ID);
|
||||||
|
});
|
||||||
|
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
|
||||||
|
tableViewer.getTable().setHeaderVisible(true);
|
||||||
|
tableViewer.getTable().setLinesVisible(true);
|
||||||
|
tableViewer.getTable().addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseDown(MouseEvent e) { mouseUp(e); }
|
||||||
|
@Override
|
||||||
|
public void mouseUp(MouseEvent e) {
|
||||||
|
TableItem element = (TableItem)tableViewer.getTable().getItem(new Point(e.x, e.y));
|
||||||
|
final Table table = tableViewer.getTable();
|
||||||
|
if (element == null )//&& (e.stateMask&SWT.MODIFIER_MASK)!=0)
|
||||||
|
table.deselectAll();
|
||||||
|
else {
|
||||||
|
int[] indices = table.getSelectionIndices();
|
||||||
|
if(indices.length==1) {
|
||||||
|
TableItem ti = table.getItem(indices[0]);
|
||||||
|
if(!globber.matches(ti.getData()) && !((File)ti.getData()).isDirectory())
|
||||||
|
table.deselect(indices[0]);
|
||||||
|
} else {
|
||||||
|
for (int idx : indices) {
|
||||||
|
TableItem ti = table.getItem(idx);
|
||||||
|
if(!globber.matches(ti.getData()))
|
||||||
|
table.deselect(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
TableViewerColumn colName = new TableViewerColumn(tableViewer, SWT.NONE);
|
||||||
|
colName.setLabelProvider(new FileTableLabelProvider() {
|
||||||
|
@Override public String getText(Object element) { return ((File) element).getName(); }
|
||||||
|
@Override public Image getImage(Object element){
|
||||||
|
if(imageGlobber.matches(element)) return dbImage;
|
||||||
|
return ((File) element).isDirectory()?folderImage:fileImage;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
colName.getColumn().setWidth(300);
|
||||||
|
colName.getColumn().setText("Name");
|
||||||
|
colName.getColumn().addSelectionListener(getSelectionAdapter(colName.getColumn(), 0));
|
||||||
|
|
||||||
|
TableViewerColumn colSize = new TableViewerColumn(tableViewer, SWT.RIGHT);
|
||||||
|
colSize.setLabelProvider(new FileTableLabelProvider() {
|
||||||
|
@Override public String getText(Object element) { return String.format("%d", ((File) element).length()); }
|
||||||
|
});
|
||||||
|
colSize.getColumn().setWidth(100);
|
||||||
|
colSize.getColumn().setText("Size");
|
||||||
|
colSize.getColumn().addSelectionListener(getSelectionAdapter(colSize.getColumn(), 1));
|
||||||
|
|
||||||
|
TableViewerColumn colEmpty = new TableViewerColumn(tableViewer, SWT.CENTER);
|
||||||
|
colEmpty.setLabelProvider(new FileTableLabelProvider() {
|
||||||
|
@Override public String getText(Object element) { return ""; }
|
||||||
|
});
|
||||||
|
//colEmpty.getColumn().setWidth(200);
|
||||||
|
colEmpty.getColumn().setText("");
|
||||||
|
|
||||||
|
fileTableComparator = new FileTableComparator();
|
||||||
|
tableViewer.setComparator(fileTableComparator);
|
||||||
|
tableViewer.addFilter(new FileTableFilter());
|
||||||
|
|
||||||
|
Composite bottomBar = new Composite(tableViewerParent, SWT.NONE);
|
||||||
|
bottomBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
GridLayout gridLayoutBottom = new GridLayout(2, false);
|
||||||
|
gridLayoutBottom.horizontalSpacing=0;
|
||||||
|
gridLayoutBottom.verticalSpacing=0;
|
||||||
|
gridLayoutBottom.marginHeight=0;
|
||||||
|
gridLayoutBottom.marginWidth=0;
|
||||||
|
bottomBar.setLayout(gridLayoutBottom);
|
||||||
|
|
||||||
|
fileNameEntry = new Text(bottomBar, SWT.BORDER);
|
||||||
|
fileNameEntry.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
fileNameEntry.setEditable(false); //TODO: temporary disabled
|
||||||
|
fileNameEntry.setEnabled(false);
|
||||||
|
|
||||||
|
filterCombo = new Combo(bottomBar, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
|
||||||
|
filterCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
|
||||||
|
filterCombo.setItems(filterStrings);
|
||||||
|
filterCombo.select(0);
|
||||||
|
filterCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
globber= new FileGlobber(filterCombo.getText());
|
||||||
|
tableViewer.setInput(selectedDir.listFiles());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sashForm.setWeights(new int[]{3, 3});
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SelectionAdapter getSelectionAdapter(final TableColumn column, final int index) {
|
||||||
|
SelectionAdapter selectionAdapter = new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
fileTableComparator.setColumn(index);
|
||||||
|
int dir = fileTableComparator.getDirection();
|
||||||
|
tableViewer.getTable().setSortDirection(dir);
|
||||||
|
tableViewer.getTable().setSortColumn(column);
|
||||||
|
tableViewer.refresh();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return selectionAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDirSelection(File f) {
|
||||||
|
ArrayList<File> fileTree = getParentDirList(f);
|
||||||
|
TreeSelection selection = new TreeSelection(new TreePath(fileTree.toArray()));
|
||||||
|
dirTreeViewer.setSelection(selection, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<File> getParentDirList(File actual){
|
||||||
|
if(actual==null)
|
||||||
|
return new ArrayList<>();
|
||||||
|
else {
|
||||||
|
ArrayList<File> l = getParentDirList(actual.getParentFile());
|
||||||
|
l.add(actual);
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isResizable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// save content of the Text fields because they get disposed
|
||||||
|
// as soon as the Dialog closes
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void saveInput() {
|
||||||
|
selectedFiles= tableViewer.getStructuredSelection().toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void okPressed() {
|
||||||
|
saveInput();
|
||||||
|
super.okPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileGlobber {
|
||||||
|
|
||||||
|
List<PathMatcher> matchers;
|
||||||
|
|
||||||
|
public FileGlobber() {
|
||||||
|
matchers = new ArrayList<>(); }
|
||||||
|
|
||||||
|
public FileGlobber(String expr) {
|
||||||
|
ArrayList<PathMatcher> m = new ArrayList<>();
|
||||||
|
if(expr.length()>0) {
|
||||||
|
String[] tok = expr.split(";");
|
||||||
|
for (String string : tok) {
|
||||||
|
m.add(FileSystems.getDefault().getPathMatcher("glob:**/"+string));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
matchers = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matches(Object f) {
|
||||||
|
assert(f instanceof File);
|
||||||
|
if(matchers.size()==0) return true;
|
||||||
|
for (PathMatcher m : matchers) {
|
||||||
|
if(m.matches(((File)f).toPath())) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileTreeContentProvider implements ITreeContentProvider {
|
||||||
|
public Object[] getChildren(Object arg0) {
|
||||||
|
File[] entries = ((File) arg0).listFiles();
|
||||||
|
if(entries != null) {
|
||||||
|
List<File> res = Arrays.stream(entries)
|
||||||
|
.filter(file -> !(file.isFile()||file.getName().startsWith(".") ||globber.matches(file)))
|
||||||
|
.sorted(new Comparator<File>(){
|
||||||
|
public int compare(File f1, File f2){return f1.getName().compareTo(f2.getName());}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList()); ;
|
||||||
|
return res.toArray();
|
||||||
|
} else
|
||||||
|
return new Object[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getParent(Object arg0) {
|
||||||
|
return ((File) arg0).getParentFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasChildren(Object arg0) {
|
||||||
|
Object[] obj = getChildren(arg0);
|
||||||
|
return obj == null ? false : obj.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[] getElements(Object arg0) {
|
||||||
|
return File.listRoots();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileTreeLabelProvider implements ILabelProvider {
|
||||||
|
private List<ILabelProviderListener> listeners;
|
||||||
|
|
||||||
|
private Image file;
|
||||||
|
|
||||||
|
private Image dir;
|
||||||
|
|
||||||
|
public FileTreeLabelProvider() {
|
||||||
|
listeners = new ArrayList<ILabelProviderListener>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Image getImage(Object arg0) {
|
||||||
|
return ((File) arg0).isDirectory() ? folderImage : file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText(Object arg0) {
|
||||||
|
File f = (File)arg0;
|
||||||
|
return f.getName().length() == 0? f.getPath() : f.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addListener(ILabelProviderListener arg0) {
|
||||||
|
listeners.add(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
// Dispose the images
|
||||||
|
if (dir != null)
|
||||||
|
dir.dispose();
|
||||||
|
if (file != null)
|
||||||
|
file.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLabelProperty(Object arg0, String arg1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeListener(ILabelProviderListener arg0) {
|
||||||
|
listeners.remove(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileTableFilter extends ViewerFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
|
File p = (File) element;
|
||||||
|
return !p.getName().startsWith(".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileTableComparator extends ViewerComparator {
|
||||||
|
private int propertyIndex = 0;
|
||||||
|
private boolean descending = false;
|
||||||
|
|
||||||
|
public FileTableComparator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDirection() {
|
||||||
|
return descending ? SWT.DOWN : SWT.UP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumn(int column) {
|
||||||
|
descending = column == this.propertyIndex?!descending : false;
|
||||||
|
this.propertyIndex = column;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||||
|
File p1 = (File) e1;
|
||||||
|
File p2 = (File) e2;
|
||||||
|
int rc = 0;
|
||||||
|
switch (propertyIndex) {
|
||||||
|
case 0:
|
||||||
|
rc = p1.getName().compareTo(p2.getName());
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
rc = Long.valueOf(p1.length()).compareTo(p2.length());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
// If descending order, flip the direction
|
||||||
|
return descending? -rc : rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileTableLabelProvider extends ColumnLabelProvider {
|
||||||
|
@Override
|
||||||
|
public Color getBackground(Object element) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getForeground(Object element) {
|
||||||
|
return globber.matches(element) || ((File)element).isDirectory()? null: ResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,6 @@ import java.util.List;
|
|||||||
import com.minres.scviewer.database.IHierNode;
|
import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class TransactionDetails {
|
|||||||
|
|
||||||
/** The attribute filter. */
|
/** The attribute filter. */
|
||||||
TxAttributeFilter attributeFilter;
|
TxAttributeFilter attributeFilter;
|
||||||
|
|
||||||
/** The view sorter. */
|
/** The view sorter. */
|
||||||
TxAttributeViewerSorter viewSorter;
|
TxAttributeViewerSorter viewSorter;
|
||||||
|
|
||||||
@ -124,12 +124,12 @@ public class TransactionDetails {
|
|||||||
treeViewer.expandAll(true);
|
treeViewer.expandAll(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
nameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
nameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
attributeFilter = new TxAttributeFilter();
|
attributeFilter = new TxAttributeFilter();
|
||||||
viewSorter = new TxAttributeViewerSorter();
|
viewSorter = new TxAttributeViewerSorter();
|
||||||
|
|
||||||
treeViewer = new TreeViewer(parent);
|
treeViewer = new TreeViewer(parent);
|
||||||
treeViewer.setContentProvider(new TransactionTreeContentProvider());
|
treeViewer.setContentProvider(new TransactionTreeContentProvider());
|
||||||
treeViewer.setLabelProvider(new TxPropertiesLabelProvider());
|
treeViewer.setLabelProvider(new TxPropertiesLabelProvider());
|
||||||
@ -148,7 +148,7 @@ public class TransactionDetails {
|
|||||||
public void treeExpanded(TreeExpansionEvent event) {
|
public void treeExpanded(TreeExpansionEvent event) {
|
||||||
treeViewer.getSelection();
|
treeViewer.getSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set up the table
|
// Set up the table
|
||||||
@ -188,14 +188,14 @@ 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);
|
||||||
tree.setLinesVisible(true);
|
tree.setLinesVisible(true);
|
||||||
|
|
||||||
treeViewer.addDoubleClickListener(new IDoubleClickListener(){
|
treeViewer.addDoubleClickListener(new IDoubleClickListener(){
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -213,7 +213,7 @@ public class TransactionDetails {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
parent.addControlListener(new ControlAdapter() {
|
parent.addControlListener(new ControlAdapter() {
|
||||||
public void controlResized(ControlEvent e) {
|
public void controlResized(ControlEvent e) {
|
||||||
@ -279,7 +279,7 @@ public class TransactionDetails {
|
|||||||
} else {
|
} else {
|
||||||
treeViewer.setInput(null);
|
treeViewer.setInput(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setExpandedState(TreeItem[] treeItems, ArrayList<Boolean> states) {
|
private void setExpandedState(TreeItem[] treeItems, ArrayList<Boolean> states) {
|
||||||
@ -294,7 +294,7 @@ public class TransactionDetails {
|
|||||||
ret.add(treeItem.getItemCount()>0?treeItem.getExpanded():true);
|
ret.add(treeItem.getItemCount()>0?treeItem.getExpanded():true);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getTopItemHier(ArrayList<String> names){
|
private int getTopItemHier(ArrayList<String> names){
|
||||||
int indexInParent=-1;
|
int indexInParent=-1;
|
||||||
TreeItem obj = treeViewer.getTree().getTopItem();
|
TreeItem obj = treeViewer.getTree().getTopItem();
|
||||||
@ -314,7 +314,7 @@ public class TransactionDetails {
|
|||||||
}
|
}
|
||||||
return indexInParent;
|
return indexInParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTopItemFromHier(ArrayList<String> names, int indexInParent) {
|
private void setTopItemFromHier(ArrayList<String> names, int indexInParent) {
|
||||||
if(indexInParent<0 || names.size()==0 ) return;
|
if(indexInParent<0 || names.size()==0 ) return;
|
||||||
TreeItem selItem=null;
|
TreeItem selItem=null;
|
||||||
@ -375,16 +375,16 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class TxAttributeViewerSorter.
|
* The Class TxAttributeViewerSorter.
|
||||||
*/
|
*/
|
||||||
class TxAttributeViewerSorter extends ViewerComparator {
|
class TxAttributeViewerSorter extends ViewerComparator {
|
||||||
|
|
||||||
/** The Constant ASCENDING. */
|
/** The Constant ASCENDING. */
|
||||||
private static final int ASCENDING = 0;
|
private static final int ASCENDING = 0;
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ public class TransactionDetails {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
|
|
||||||
if (searchString == null || searchString.length() == 0) {
|
if (searchString == null || searchString.length() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -482,7 +482,7 @@ public class TransactionDetails {
|
|||||||
if(element instanceof Object[]) {
|
if(element instanceof Object[]) {
|
||||||
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -491,19 +491,19 @@ 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.
|
||||||
*/
|
*/
|
||||||
class TreeNode{
|
class TreeNode{
|
||||||
|
|
||||||
/** The type. */
|
/** The type. */
|
||||||
public Type type;
|
public Type type;
|
||||||
|
|
||||||
/** The element. */
|
/** The element. */
|
||||||
public ITx element;
|
public ITx element;
|
||||||
|
|
||||||
@ -624,16 +624,16 @@ PROPS, /** The attrs. */
|
|||||||
* The Class AttributeLabelProvider.
|
* The Class AttributeLabelProvider.
|
||||||
*/
|
*/
|
||||||
class AttributeLabelProvider extends LabelProvider implements IStyledLabelProvider {
|
class AttributeLabelProvider extends LabelProvider implements IStyledLabelProvider {
|
||||||
|
|
||||||
/** The field. */
|
/** The field. */
|
||||||
final int field;
|
final int field;
|
||||||
|
|
||||||
/** The Constant NAME. */
|
/** The Constant NAME. */
|
||||||
public static final int NAME=0;
|
public static final int NAME=0;
|
||||||
|
|
||||||
/** The Constant TYPE. */
|
/** The Constant TYPE. */
|
||||||
public static final int TYPE=1;
|
public static final int TYPE=1;
|
||||||
|
|
||||||
/** The Constant VALUE. */
|
/** The Constant VALUE. */
|
||||||
public static final int VALUE=2;
|
public static final int VALUE=2;
|
||||||
|
|
||||||
@ -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,11 +42,10 @@ 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.IEclipsePreferences;
|
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||||
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.di.annotations.Optional;
|
import org.eclipse.e4.core.di.annotations.Optional;
|
||||||
import org.eclipse.e4.core.di.extensions.Preference;
|
|
||||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||||
import org.eclipse.e4.ui.di.Focus;
|
import org.eclipse.e4.ui.di.Focus;
|
||||||
import org.eclipse.e4.ui.di.PersistState;
|
import org.eclipse.e4.ui.di.PersistState;
|
||||||
@ -56,7 +56,9 @@ import org.eclipse.e4.ui.services.EMenuService;
|
|||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.resource.StringConverter;
|
import org.eclipse.jface.resource.StringConverter;
|
||||||
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
@ -65,18 +67,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.MouseEvent;
|
import org.eclipse.swt.events.FocusListener;
|
||||||
import org.eclipse.swt.events.MouseTrackListener;
|
import org.eclipse.swt.events.PaintEvent;
|
||||||
import org.eclipse.swt.events.MouseWheelListener;
|
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.MessageBox;
|
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;
|
||||||
@ -84,6 +96,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;
|
||||||
@ -97,8 +111,8 @@ import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl;
|
|||||||
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
||||||
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
|
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
|
||||||
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
||||||
import com.minres.scviewer.e4.application.preferences.DefaultValuesInitializer;
|
|
||||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||||
|
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class WaveformViewerPart.
|
* The Class WaveformViewerPart.
|
||||||
@ -180,11 +194,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
@Inject
|
@Inject
|
||||||
EPartService ePartService;
|
EPartService ePartService;
|
||||||
|
|
||||||
/** The prefs. */
|
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
@Inject
|
|
||||||
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE)
|
|
||||||
IEclipsePreferences prefs;
|
|
||||||
|
|
||||||
@Inject @Optional DesignBrowser designBrowser;
|
@Inject @Optional DesignBrowser designBrowser;
|
||||||
|
|
||||||
/** The database. */
|
/** The database. */
|
||||||
@ -230,7 +241,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory) {
|
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory) {
|
||||||
disposeListenerNumber += 1;
|
disposeListenerNumber += 1;
|
||||||
|
|
||||||
myPart = part;
|
myPart = part;
|
||||||
myParent = parent;
|
myParent = parent;
|
||||||
database = dbFactory.getDatabase();
|
database = dbFactory.getDatabase();
|
||||||
@ -281,51 +292,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
waveformPane.getWaveformControl().addMouseTrackListener(new MouseTrackListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseHover(MouseEvent e) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseExit(MouseEvent e) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseEnter(MouseEvent e) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
waveformPane.getWaveformControl().addMouseWheelListener(new MouseWheelListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseScrolled(MouseEvent e) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
waveformPane.getWaveformControl().addListener(SWT.KeyDown, new Listener() {
|
waveformPane.getWaveformControl().addListener(SWT.KeyDown, new Listener() {
|
||||||
|
|
||||||
@SuppressWarnings("null")
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event e) {
|
public void handleEvent(Event e) {
|
||||||
/*
|
|
||||||
String string = e.type == SWT.KeyDown ? "DOWN:" : "UP :";
|
|
||||||
string += " stateMask=0x" + Integer.toHexString (e.stateMask) + ","; // SWT.CTRL, SWT.ALT, SWT.SHIFT, SWT.COMMAND
|
|
||||||
string += " keyCode=0x" + Integer.toHexString (e.keyCode) + ",";
|
|
||||||
string += " character=0x" + Integer.toHexString (e.character) ;
|
|
||||||
if (e.keyLocation != 0) {
|
|
||||||
string += " location="+e.keyLocation;
|
|
||||||
}
|
|
||||||
System.out.println (string);
|
|
||||||
*/
|
|
||||||
if((e.stateMask&SWT.MOD3)!=0) { // Alt key
|
if((e.stateMask&SWT.MOD3)!=0) { // Alt key
|
||||||
} else if((e.stateMask&SWT.MOD1)!=0) { //Ctrl/Cmd
|
} else if((e.stateMask&SWT.MOD1)!=0) { //Ctrl/Cmd
|
||||||
int zoomlevel = waveformPane.getZoomLevel();
|
int zoomlevel = waveformPane.getZoomLevel();
|
||||||
@ -379,7 +349,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
|
|
||||||
zoomLevel = waveformPane.getZoomLevels();
|
zoomLevel = waveformPane.getZoomLevels();
|
||||||
setupColors();
|
setupColors();
|
||||||
checkForUpdates = prefs.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
checkForUpdates = store.getBoolean(PreferenceConstants.DATABASE_RELOAD);
|
||||||
filesToLoad = new ArrayList<File>();
|
filesToLoad = new ArrayList<File>();
|
||||||
persistedState = part.getPersistedState();
|
persistedState = part.getPersistedState();
|
||||||
Integer files = persistedState.containsKey(DATABASE_FILE + "S") //$NON-NLS-1$
|
Integer files = persistedState.containsKey(DATABASE_FILE + "S") //$NON-NLS-1$
|
||||||
@ -408,9 +378,117 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
prefs.addPreferenceChangeListener(this);
|
store.addPropertyChangeListener(new IPropertyChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) {
|
||||||
|
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getProperty())) {
|
||||||
|
checkForUpdates = (Boolean)event.getNewValue();
|
||||||
|
fileChecker = null;
|
||||||
|
if (checkForUpdates)
|
||||||
|
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
|
||||||
|
FILE_CHECK_INTERVAL);
|
||||||
|
else
|
||||||
|
fileMonitor.removeFileChangeListener(WaveformViewer.this);
|
||||||
|
} else if (!PreferenceConstants.SHOW_HOVER.equals(event.getProperty())){
|
||||||
|
setupColors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
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(!store.getBoolean(PreferenceConstants.SHOW_HOVER)) 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.SHADOW_IN);
|
||||||
|
label.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
label.setBackground(display.getSystemColor(SWT.COLOR_GRAY));
|
||||||
|
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);
|
||||||
|
label.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
label.setBackground(display.getSystemColor(SWT.COLOR_GRAY));
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
if(table.getHeaderVisible()) {
|
||||||
|
// add dummy row to get make last row visible
|
||||||
|
TableItem item = new TableItem(table, SWT.NONE);
|
||||||
|
item.setText(0, "");
|
||||||
|
item.setText(1, "");
|
||||||
|
}
|
||||||
|
nameCol.pack();
|
||||||
|
valueCol.pack();
|
||||||
|
table.setSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||||
|
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 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)
|
||||||
@ -418,28 +496,30 @@ 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) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup colors.
|
* Setup colors.
|
||||||
*/
|
*/
|
||||||
protected void setupColors() {
|
protected void setupColors() {
|
||||||
DefaultValuesInitializer initializer = new DefaultValuesInitializer();
|
|
||||||
HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
|
HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
String prefValue = prefs.get(c.name() + "_COLOR", //$NON-NLS-1$
|
String prefValue = store.getString(c.name() + "_COLOR"); //$NON-NLS-1$
|
||||||
StringConverter.asString(initializer.colors[c.ordinal()].getRGB()));
|
|
||||||
RGB rgb = StringConverter.asRGB(prefValue);
|
RGB rgb = StringConverter.asRGB(prefValue);
|
||||||
colorPref.put(c, rgb);
|
colorPref.put(c, rgb);
|
||||||
}
|
}
|
||||||
@ -552,38 +632,44 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
@Inject
|
@Inject
|
||||||
@Optional
|
@Optional
|
||||||
public void setPartInput(@Named("input") Object partInput, @Named("config") Object partConfig) {
|
public void setPartInput(@Named("input") Object partInput, @Named("config") Object partConfig) {
|
||||||
if (partInput instanceof File) {
|
if (partInput instanceof String) {
|
||||||
|
String name = (String)partInput;
|
||||||
filesToLoad = new ArrayList<File>();
|
filesToLoad = new ArrayList<File>();
|
||||||
File file = (File) partInput;
|
boolean explicit = name.contains(",");
|
||||||
if(file.isFile() && "CURRENT".equals(file.getName())){
|
for(String tok: name.split(",")) {
|
||||||
file=file.getParentFile();
|
File file = new File(tok);
|
||||||
}
|
if(file.isFile() && "CURRENT".equals(file.getName())){
|
||||||
if (file.exists()) {
|
file=file.getParentFile();
|
||||||
filesToLoad.add(file);
|
|
||||||
try {
|
|
||||||
String ext = getFileExtension(file.getName());
|
|
||||||
if (Messages.WaveformViewer_19.equals(ext.toLowerCase())) {
|
|
||||||
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)))) {
|
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)));
|
|
||||||
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)))) {
|
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)));
|
|
||||||
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_22)))) {
|
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_22)));
|
|
||||||
}
|
|
||||||
} else if (Messages.WaveformViewer_20.equals(ext.toLowerCase()) ||
|
|
||||||
Messages.WaveformViewer_21.equals(ext.toLowerCase()) ||
|
|
||||||
Messages.WaveformViewer_22.equals(ext.toLowerCase())
|
|
||||||
) {
|
|
||||||
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)))) {
|
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) { // silently ignore any error
|
|
||||||
}
|
}
|
||||||
|
if (file.exists()) {
|
||||||
|
filesToLoad.add(file);
|
||||||
|
}
|
||||||
|
if(!explicit)
|
||||||
|
try {
|
||||||
|
String ext = getFileExtension(file.getName());
|
||||||
|
if (Messages.WaveformViewer_19.equals(ext.toLowerCase())) {
|
||||||
|
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)))) {
|
||||||
|
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)));
|
||||||
|
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)))) {
|
||||||
|
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)));
|
||||||
|
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_22)))) {
|
||||||
|
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_22)));
|
||||||
|
}
|
||||||
|
} else if (Messages.WaveformViewer_20.equals(ext.toLowerCase()) ||
|
||||||
|
Messages.WaveformViewer_21.equals(ext.toLowerCase()) ||
|
||||||
|
Messages.WaveformViewer_22.equals(ext.toLowerCase())
|
||||||
|
) {
|
||||||
|
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)))) {
|
||||||
|
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) { // silently ignore any error
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (filesToLoad.size() > 0)
|
if (filesToLoad.size() > 0)
|
||||||
loadDatabase(persistedState);
|
loadDatabase(persistedState);
|
||||||
if(partConfig instanceof String) {
|
if(partConfig instanceof String && ((String)partConfig).length()>0) {
|
||||||
loadState((String) partConfig);
|
loadState((String) partConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -616,8 +702,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void saveState(String fileName){
|
public void saveState(String fileName){
|
||||||
|
|
||||||
|
|
||||||
Map<String, String> persistedState = new HashMap<>();
|
Map<String, String> persistedState = new HashMap<>();
|
||||||
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size())); //$NON-NLS-1$
|
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size())); //$NON-NLS-1$
|
||||||
Integer index = 0;
|
Integer index = 0;
|
||||||
@ -634,8 +718,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
FileOutputStream out = new FileOutputStream(fileName);
|
FileOutputStream out = new FileOutputStream(fileName);
|
||||||
props.store(out, "Written by SCViewer"); //$NON-NLS-1$
|
props.store(out, "Written by SCViewer"); //$NON-NLS-1$
|
||||||
out.close();
|
out.close();
|
||||||
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -929,10 +1011,13 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
Object first = selection.getFirstElement();
|
Object first = selection.getFirstElement();
|
||||||
IWaveform stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform) first;
|
IWaveform stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform) first;
|
||||||
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
|
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
|
||||||
int index = waveformPane.getStreamList().indexOf(trackEntry);
|
if (insert) {
|
||||||
if (!insert)
|
int index = waveformPane.getStreamList().indexOf(trackEntry);
|
||||||
index++;
|
waveformPane.getStreamList().addAll(index, streams);
|
||||||
waveformPane.getStreamList().addAll(index, streams);
|
} else {
|
||||||
|
waveformPane.getStreamList().addAll(streams);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
@ -1043,7 +1128,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
* Sets the zoom fit.
|
* Sets the zoom fit.
|
||||||
*/
|
*/
|
||||||
public void setZoomFit() {
|
public void setZoomFit() {
|
||||||
|
|
||||||
//actual max time of signal
|
//actual max time of signal
|
||||||
long maxTime = waveformPane.getMaxTime();
|
long maxTime = waveformPane.getMaxTime();
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
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.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.resource.StringConverter;
|
import org.eclipse.jface.resource.StringConverter;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
@ -64,9 +64,19 @@ 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)
|
||||||
|
// {
|
||||||
|
// node.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
|
// 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(DefaultScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
|
|
||||||
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
|
store.setDefault(PreferenceConstants.SHOW_HOVER, true);
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
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.1.6-SNAPSHOT</version>
|
<version>2.5.0-SNAPSHOT</version>
|
||||||
<packaging>eclipse-repository</packaging>
|
<packaging>eclipse-repository</packaging>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<build>
|
<build>
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
<?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.1.6.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.5.0.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
|
||||||
|
-Dosgi.instance.area=@user.home/.scviewer
|
||||||
|
-Dosgi.instance.area.default=@user.home/.scviewer
|
||||||
</vmArgs>
|
</vmArgs>
|
||||||
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
|
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
|
||||||
</vmArgsMac>
|
</vmArgsMac>
|
||||||
@ -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"/>
|
||||||
@ -141,4 +142,11 @@
|
|||||||
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
|
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
|
||||||
</configurations>
|
</configurations>
|
||||||
|
|
||||||
|
<preferencesInfo>
|
||||||
|
<targetfile overwrite="false"/>
|
||||||
|
</preferencesInfo>
|
||||||
|
|
||||||
|
<cssInfo>
|
||||||
|
</cssInfo>
|
||||||
|
|
||||||
</product>
|
</product>
|
||||||
|
@ -12,11 +12,9 @@
|
|||||||
<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.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>
|
||||||
<module>../com.opcoach.e4.preferences</module>
|
|
||||||
<module>../com.minres.scviewer.e4.application</module>
|
<module>../com.minres.scviewer.e4.application</module>
|
||||||
<module>../com.minres.scviewer.ui</module>
|
<module>../com.minres.scviewer.ui</module>
|
||||||
<module>../com.minres.scviewer.feature</module>
|
<module>../com.minres.scviewer.feature</module>
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
<repository location="http://dist.springsource.org/snapshot/GRECLIPSE/e4.8/"/>
|
<repository location="http://dist.springsource.org/snapshot/GRECLIPSE/e4.8/"/>
|
||||||
<unit id="org.codehaus.groovy25.feature.feature.group" version="3.5.1.v201909291550-e48"/>
|
<unit id="org.codehaus.groovy25.feature.feature.group" version="3.5.1.v201909291550-e48"/>
|
||||||
</location>
|
</location>
|
||||||
|
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||||
|
<repository location="https://www.opcoach.com/repository/2018-12"/>
|
||||||
|
<unit id="com.opcoach.e4.preferences.feature.feature.group" version="1.3.0.201903181741"/>
|
||||||
|
</location>
|
||||||
</locations>
|
</locations>
|
||||||
<environment>
|
<environment>
|
||||||
<arch>x86_64</arch>
|
<arch>x86_64</arch>
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<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.8"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
2
com.opcoach.e4.preferences/.gitignore
vendored
2
com.opcoach.e4.preferences/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
/target/
|
|
||||||
/bin/
|
|
@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>com.opcoach.e4.preferences</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
@ -1,12 +0,0 @@
|
|||||||
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.8
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
|
||||||
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.8
|
|
@ -1,19 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
Bundle-ManifestVersion: 2
|
|
||||||
Bundle-Name: Preferences
|
|
||||||
Bundle-SymbolicName: com.opcoach.e4.preferences;singleton:=true
|
|
||||||
Bundle-Version: 1.0.0.qualifier
|
|
||||||
Bundle-Vendor: OPCOACH
|
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
|
||||||
Require-Bundle: javax.inject,
|
|
||||||
org.eclipse.core.runtime;bundle-version="3.9.0",
|
|
||||||
org.eclipse.jface;bundle-version="3.9.0",
|
|
||||||
org.eclipse.e4.core.di;bundle-version="1.3.0",
|
|
||||||
org.eclipse.e4.ui.model.workbench;bundle-version="1.0.0",
|
|
||||||
org.eclipse.e4.core.services;bundle-version="1.1.0",
|
|
||||||
org.eclipse.e4.core.contexts;bundle-version="1.3.0",
|
|
||||||
org.eclipse.e4.ui.services;bundle-version="1.0.0"
|
|
||||||
Export-Package: com.opcoach.e4.preferences,
|
|
||||||
com.opcoach.e4.preferences.handlers
|
|
||||||
Bundle-ActivationPolicy: lazy
|
|
||||||
Automatic-Module-Name: com.opcoach.e4.preferences
|
|
@ -1,5 +0,0 @@
|
|||||||
source.. = src/
|
|
||||||
output.. = bin/
|
|
||||||
bin.includes = META-INF/,\
|
|
||||||
.,\
|
|
||||||
plugin.xml
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<?eclipse version="3.4"?>
|
|
||||||
<plugin>
|
|
||||||
<extension-point id="e4PreferencePages" name="e4PreferencePages" schema="schema/e4PreferencePages.exsd"/>
|
|
||||||
<extension-point id="e4PreferenceStoreProvider" name="e4PreferenceStoreProvider" schema="schema/e4PreferenceStoreProvider.exsd"/>
|
|
||||||
</plugin>
|
|
@ -1,13 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>com.opcoach.e4.preferences</artifactId>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.minres.scviewer</groupId>
|
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
|
||||||
</parent>
|
|
||||||
<packaging>eclipse-plugin</packaging>
|
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
|
||||||
<groupId>com.minres.scviewer</groupId>
|
|
||||||
</project>
|
|
@ -1,163 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<!-- Schema file written by PDE -->
|
|
||||||
<schema targetNamespace="com.opcoach.e4.preferences" xmlns="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.schema plugin="com.opcoach.e4.preferences" id="e4PreferencePages" name="e4PreferencePages"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter description of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<element name="extension">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.element />
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
<complexType>
|
|
||||||
<sequence>
|
|
||||||
<element ref="page" minOccurs="0" maxOccurs="unbounded"/>
|
|
||||||
</sequence>
|
|
||||||
<attribute name="point" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
a fully qualified identifier of the target extension point
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="id" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
an optional identifier of the extension instance
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
an optional name of the extension instance
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute translatable="true"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<element name="page">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.element labelAttribute="name"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
<complexType>
|
|
||||||
<sequence>
|
|
||||||
<element ref="keywordReference" minOccurs="0" maxOccurs="unbounded"/>
|
|
||||||
</sequence>
|
|
||||||
<attribute name="id" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
a unique name that will be used to identify this page.
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
a translatable name that will be used in the UI for this page.
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute translatable="true"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="class" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
a name of the fully qualified class that implements
|
|
||||||
<samp>org.eclipse.jface.preference.IPreferencePage</samp>.
|
|
||||||
|
|
||||||
IT IS EASYER to extend FieldEditorPreferencePage
|
|
||||||
|
|
||||||
If this class extends directly org.eclipse.jface.preference.FieldEditorPreferencePage preferenceStore is automatically set on it.
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute kind="java" basedOn="org.eclipse.jface.preference.FieldEditorPreferencePage:"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="category" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
a path indicating the location of the page in the preference tree. The path may either be a parent node ID or a sequence
|
|
||||||
of IDs separated by '/', representing the full path from the root node.
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute kind="identifier" basedOn="com.opcoach.e4.preferences.e4PreferencePages/page/@id"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<element name="keywordReference">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
A reference by a preference page to a keyword. See the keywords extension point.
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
<complexType>
|
|
||||||
<attribute name="id" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
The id of the keyword being referred to.
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute kind="identifier" basedOn="org.eclipse.ui.keywords/keyword/@id"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="since"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter the first release in which this extension point appears.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="examples"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter extension point usage example here.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="apiinfo"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter API information here.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="implementation"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter information about supplied implementation of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
|
|
||||||
</schema>
|
|
@ -1,149 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<!-- Schema file written by PDE -->
|
|
||||||
<schema targetNamespace="com.opcoach.e4.preferences" xmlns="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.schema plugin="com.opcoach.e4.preferences" id="e4PreferenceStoreProvider" name="e4PreferenceStoreProvider"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
This extension point is used to associate a preference store to a plugin.
|
|
||||||
You can choose either to implement the IPreferenceStoreProvider interface or to give the ID of the IPreferenceStore to use (stored in the workbench context of your E4 application).
|
|
||||||
If this extension point is not used, a default ScopedPreferenceStore will be used for the preference page.
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<element name="extension">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.element />
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
<complexType>
|
|
||||||
<sequence>
|
|
||||||
<element ref="preferenceStoreProvider" minOccurs="1" maxOccurs="unbounded"/>
|
|
||||||
</sequence>
|
|
||||||
<attribute name="point" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="id" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute translatable="true"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<element name="preferenceStoreProvider">
|
|
||||||
<complexType>
|
|
||||||
<attribute name="pluginId" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
Set here the plugin Id concerned by this extension.
|
|
||||||
Must be a valid plugin ID (control will be done at runtime)
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="class" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
Set a class to get the IPreferenceStore for the defined pluginID.
|
|
||||||
This parameter is optional if you use the contextId attribute.
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute kind="java" basedOn=":com.opcoach.e4.preferences.IPreferenceStoreProvider"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="idInWorkbenchContext" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
If no class is defined, you can set here the ID of the IPreferenceStore available in the context.
|
|
||||||
This object must be set in the workbenchContext using an Addon for instance, with the following code (in addon):
|
|
||||||
|
|
||||||
@PostContextCreate
|
|
||||||
public void initMyAddon(IEclipseContext ctx)
|
|
||||||
{
|
|
||||||
IPreferenceStore ps = new ... . // The code to create your pref store
|
|
||||||
ctx.set(ID set in this extension, ps);
|
|
||||||
}
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="since"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter the first release in which this extension point appears.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="examples"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
The definition could be like the following :
|
|
||||||
|
|
||||||
pluginId="yourPluginID"
|
|
||||||
provider="a class implementing IPreferenceStoreProvider"
|
|
||||||
|
|
||||||
|
|
||||||
Or using the key in context (usefull to share the same preference store between plugins) :
|
|
||||||
|
|
||||||
pluginId="yourPluginID"
|
|
||||||
keyInContext="the key of the IPreferenceStore stored in context"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="apiinfo"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter API information here.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="implementation"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter information about supplied implementation of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="copyright"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
@OPCoach 2014
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
</schema>
|
|
@ -1,25 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2014 OPCoach.
|
|
||||||
* 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:
|
|
||||||
* OPCoach - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package com.opcoach.e4.preferences;
|
|
||||||
|
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
|
||||||
|
|
||||||
/** This interface can be implemented to provide a PreferenceStore for a given plugin.
|
|
||||||
* This associatino must be done in the e4PreferenceStoreProvider extension point.
|
|
||||||
* @author olivier
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IPreferenceStoreProvider
|
|
||||||
{
|
|
||||||
/** Must be implemented to return a preference store */
|
|
||||||
public IPreferenceStore getPreferenceStore();
|
|
||||||
|
|
||||||
}
|
|
@ -1,861 +0,0 @@
|
|||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2014 OPCoach.
|
|
||||||
* 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:
|
|
||||||
* Eclipse - copy of the implementation coming from jface
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
package com.opcoach.e4.preferences;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.eclipse.core.commands.common.EventManager;
|
|
||||||
import org.eclipse.core.runtime.Assert;
|
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.eclipse.core.runtime.Plugin;
|
|
||||||
import org.eclipse.core.runtime.SafeRunner;
|
|
||||||
import org.eclipse.core.runtime.preferences.DefaultScope;
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
|
||||||
import org.eclipse.core.runtime.preferences.IScopeContext;
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener;
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent;
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
|
||||||
import org.eclipse.jface.preference.IPersistentPreferenceStore;
|
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
|
||||||
import org.eclipse.jface.resource.JFaceResources;
|
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
|
||||||
import org.eclipse.jface.util.SafeRunnable;
|
|
||||||
import org.osgi.service.prefs.BackingStoreException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ScopedPreferenceStore is an IPreferenceStore that uses the scopes
|
|
||||||
* provided in org.eclipse.core.runtime.preferences.
|
|
||||||
* <p>
|
|
||||||
* A ScopedPreferenceStore does the lookup of a preference based on it's search
|
|
||||||
* scopes and sets the value of the preference based on its store scope.
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* The default scope is always included in the search scopes when searching for
|
|
||||||
* preference values.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @see org.eclipse.core.runtime.preferences
|
|
||||||
* @since 3.1
|
|
||||||
*/
|
|
||||||
public class ScopedPreferenceStore extends EventManager implements
|
|
||||||
IPreferenceStore, IPersistentPreferenceStore {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The storeContext is the context where values will stored with the
|
|
||||||
* setValue methods. If there are no searchContexts this will be the search
|
|
||||||
* context. (along with the "default" context)
|
|
||||||
*/
|
|
||||||
private IScopeContext storeContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The searchContext is the array of contexts that will be used by the get
|
|
||||||
* methods for searching for values.
|
|
||||||
*/
|
|
||||||
private IScopeContext[] searchContexts;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A boolean to indicate the property changes should not be propagated.
|
|
||||||
*/
|
|
||||||
protected boolean silentRunning = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The listener on the IEclipsePreferences. This is used to forward updates
|
|
||||||
* to the property change listeners on the preference store.
|
|
||||||
*/
|
|
||||||
IEclipsePreferences.IPreferenceChangeListener preferencesListener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default context is the context where getDefault and setDefault
|
|
||||||
* methods will search. This context is also used in the search.
|
|
||||||
*/
|
|
||||||
private IScopeContext defaultContext = DefaultScope.INSTANCE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The nodeQualifer is the string used to look up the node in the contexts.
|
|
||||||
*/
|
|
||||||
String nodeQualifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The defaultQualifier is the string used to look up the default node.
|
|
||||||
*/
|
|
||||||
String defaultQualifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Boolean value indicating whether or not this store has changes to be
|
|
||||||
* saved.
|
|
||||||
*/
|
|
||||||
private boolean dirty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new instance of the receiver. Store the values in context in the
|
|
||||||
* node looked up by qualifier. <strong>NOTE:</strong> Any instance of
|
|
||||||
* ScopedPreferenceStore should call
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* the scope to store to
|
|
||||||
* @param qualifier
|
|
||||||
* the qualifier used to look up the preference node
|
|
||||||
* @param defaultQualifierPath
|
|
||||||
* the qualifier used when looking up the defaults
|
|
||||||
*/
|
|
||||||
public ScopedPreferenceStore(IScopeContext context, String qualifier,
|
|
||||||
String defaultQualifierPath) {
|
|
||||||
this(context, qualifier);
|
|
||||||
this.defaultQualifier = defaultQualifierPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new instance of the receiver. Store the values in context in the
|
|
||||||
* node looked up by qualifier.
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* the scope to store to
|
|
||||||
* @param qualifier
|
|
||||||
* the qualifer used to look up the preference node
|
|
||||||
*/
|
|
||||||
public ScopedPreferenceStore(IScopeContext context, String qualifier) {
|
|
||||||
storeContext = context;
|
|
||||||
this.nodeQualifier = qualifier;
|
|
||||||
this.defaultQualifier = qualifier;
|
|
||||||
|
|
||||||
((IEclipsePreferences) getStorePreferences().parent())
|
|
||||||
.addNodeChangeListener(getNodeChangeListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a node change listener that adds a removes the receiver when nodes
|
|
||||||
* change.
|
|
||||||
*
|
|
||||||
* @return INodeChangeListener
|
|
||||||
*/
|
|
||||||
private INodeChangeListener getNodeChangeListener() {
|
|
||||||
return new IEclipsePreferences.INodeChangeListener() {
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
|
|
||||||
*/
|
|
||||||
public void added(NodeChangeEvent event) {
|
|
||||||
if (nodeQualifier.equals(event.getChild().name())
|
|
||||||
&& isListenerAttached()) {
|
|
||||||
getStorePreferences().addPreferenceChangeListener(
|
|
||||||
preferencesListener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#removed(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
|
|
||||||
*/
|
|
||||||
public void removed(NodeChangeEvent event) {
|
|
||||||
// Do nothing as there are no events from removed node
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the preferences listener.
|
|
||||||
*/
|
|
||||||
private void initializePreferencesListener() {
|
|
||||||
if (preferencesListener == null) {
|
|
||||||
preferencesListener = new IEclipsePreferences.IPreferenceChangeListener() {
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
|
|
||||||
*/
|
|
||||||
public void preferenceChange(PreferenceChangeEvent event) {
|
|
||||||
|
|
||||||
if (silentRunning) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object oldValue = event.getOldValue();
|
|
||||||
Object newValue = event.getNewValue();
|
|
||||||
String key = event.getKey();
|
|
||||||
if (newValue == null) {
|
|
||||||
newValue = getDefault(key, oldValue);
|
|
||||||
} else if (oldValue == null) {
|
|
||||||
oldValue = getDefault(key, newValue);
|
|
||||||
}
|
|
||||||
firePropertyChangeEvent(event.getKey(), oldValue, newValue);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
getStorePreferences().addPreferenceChangeListener(
|
|
||||||
preferencesListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Does its best at determining the default value for the given key. Checks
|
|
||||||
* the given object's type and then looks in the list of defaults to see if
|
|
||||||
* a value exists. If not or if there is a problem converting the value, the
|
|
||||||
* default default value for that type is returned.
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* the key to search
|
|
||||||
* @param obj
|
|
||||||
* the object who default we are looking for
|
|
||||||
* @return Object or <code>null</code>
|
|
||||||
*/
|
|
||||||
Object getDefault(String key, Object obj) {
|
|
||||||
IEclipsePreferences defaults = getDefaultPreferences();
|
|
||||||
if (obj instanceof String) {
|
|
||||||
return defaults.get(key, STRING_DEFAULT_DEFAULT);
|
|
||||||
} else if (obj instanceof Integer) {
|
|
||||||
return new Integer(defaults.getInt(key, INT_DEFAULT_DEFAULT));
|
|
||||||
} else if (obj instanceof Double) {
|
|
||||||
return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT));
|
|
||||||
} else if (obj instanceof Float) {
|
|
||||||
return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
|
|
||||||
} else if (obj instanceof Long) {
|
|
||||||
return new Long(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
|
|
||||||
} else if (obj instanceof Boolean) {
|
|
||||||
return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE
|
|
||||||
: Boolean.FALSE;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the IEclipsePreferences node associated with this store.
|
|
||||||
*
|
|
||||||
* @return the preference node for this store
|
|
||||||
*/
|
|
||||||
IEclipsePreferences getStorePreferences() {
|
|
||||||
return storeContext.getNode(nodeQualifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the default IEclipsePreferences for this store.
|
|
||||||
*
|
|
||||||
* @return this store's default preference node
|
|
||||||
*/
|
|
||||||
private IEclipsePreferences getDefaultPreferences() {
|
|
||||||
return defaultContext.getNode(defaultQualifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
|
|
||||||
*/
|
|
||||||
public void addPropertyChangeListener(IPropertyChangeListener listener) {
|
|
||||||
initializePreferencesListener();// Create the preferences listener if it
|
|
||||||
// does not exist
|
|
||||||
addListenerObject(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the preference path to search preferences on. This is the list of
|
|
||||||
* preference nodes based on the scope contexts for this store. If there are
|
|
||||||
* no search contexts set, then return this store's context.
|
|
||||||
* <p>
|
|
||||||
* Whether or not the default context should be included in the resulting
|
|
||||||
* list is specified by the <code>includeDefault</code> parameter.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param includeDefault
|
|
||||||
* <code>true</code> if the default context should be included
|
|
||||||
* and <code>false</code> otherwise
|
|
||||||
* @return IEclipsePreferences[]
|
|
||||||
* @since 3.4 public, was added in 3.1 as private method
|
|
||||||
*/
|
|
||||||
public IEclipsePreferences[] getPreferenceNodes(boolean includeDefault) {
|
|
||||||
// if the user didn't specify a search order, then return the scope that
|
|
||||||
// this store was created on. (and optionally the default)
|
|
||||||
if (searchContexts == null) {
|
|
||||||
if (includeDefault) {
|
|
||||||
return new IEclipsePreferences[] { getStorePreferences(),
|
|
||||||
getDefaultPreferences() };
|
|
||||||
}
|
|
||||||
return new IEclipsePreferences[] { getStorePreferences() };
|
|
||||||
}
|
|
||||||
// otherwise the user specified a search order so return the appropriate
|
|
||||||
// nodes based on it
|
|
||||||
int length = searchContexts.length;
|
|
||||||
if (includeDefault) {
|
|
||||||
length++;
|
|
||||||
}
|
|
||||||
IEclipsePreferences[] preferences = new IEclipsePreferences[length];
|
|
||||||
for (int i = 0; i < searchContexts.length; i++) {
|
|
||||||
preferences[i] = searchContexts[i].getNode(nodeQualifier);
|
|
||||||
}
|
|
||||||
if (includeDefault) {
|
|
||||||
preferences[length - 1] = getDefaultPreferences();
|
|
||||||
}
|
|
||||||
return preferences;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the search contexts to scopes. When searching for a value the seach
|
|
||||||
* will be done in the order of scope contexts and will not search the
|
|
||||||
* storeContext unless it is in this list.
|
|
||||||
* <p>
|
|
||||||
* If the given list is <code>null</code>, then clear this store's search
|
|
||||||
* contexts. This means that only this store's scope context and default
|
|
||||||
* scope will be used during preference value searching.
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* The defaultContext will be added to the end of this list automatically
|
|
||||||
* and <em>MUST NOT</em> be included by the user.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param scopes
|
|
||||||
* a list of scope contexts to use when searching, or
|
|
||||||
* <code>null</code>
|
|
||||||
*/
|
|
||||||
public void setSearchContexts(IScopeContext[] scopes) {
|
|
||||||
this.searchContexts = scopes;
|
|
||||||
if (scopes == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assert that the default was not included (we automatically add it to
|
|
||||||
// the end)
|
|
||||||
for (int i = 0; i < scopes.length; i++) {
|
|
||||||
if (scopes[i].equals(defaultContext)) {
|
|
||||||
Assert
|
|
||||||
.isTrue(
|
|
||||||
false,
|
|
||||||
"Do not add the default to the search contexts");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
|
|
||||||
*/
|
|
||||||
public boolean contains(String name) {
|
|
||||||
if (name == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (Platform.getPreferencesService().get(name, null,
|
|
||||||
getPreferenceNodes(true))) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String,
|
|
||||||
* java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
public void firePropertyChangeEvent(String name, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
// important: create intermediate array to protect against listeners
|
|
||||||
// being added/removed during the notification
|
|
||||||
final Object[] list = getListeners();
|
|
||||||
if (list.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final PropertyChangeEvent event = new PropertyChangeEvent(this, name,
|
|
||||||
oldValue, newValue);
|
|
||||||
for (int i = 0; i < list.length; i++) {
|
|
||||||
final IPropertyChangeListener listener = (IPropertyChangeListener) list[i];
|
|
||||||
SafeRunner.run(new SafeRunnable(JFaceResources
|
|
||||||
.getString("PreferenceStore.changeError")) { //$NON-NLS-1$
|
|
||||||
public void run() {
|
|
||||||
listener.propertyChange(event);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
|
|
||||||
*/
|
|
||||||
public boolean getBoolean(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
return value == null ? BOOLEAN_DEFAULT_DEFAULT : Boolean.valueOf(value)
|
|
||||||
.booleanValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
|
|
||||||
*/
|
|
||||||
public boolean getDefaultBoolean(String name) {
|
|
||||||
return getDefaultPreferences()
|
|
||||||
.getBoolean(name, BOOLEAN_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String)
|
|
||||||
*/
|
|
||||||
public double getDefaultDouble(String name) {
|
|
||||||
return getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String)
|
|
||||||
*/
|
|
||||||
public float getDefaultFloat(String name) {
|
|
||||||
return getDefaultPreferences().getFloat(name, FLOAT_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String)
|
|
||||||
*/
|
|
||||||
public int getDefaultInt(String name) {
|
|
||||||
return getDefaultPreferences().getInt(name, INT_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String)
|
|
||||||
*/
|
|
||||||
public long getDefaultLong(String name) {
|
|
||||||
return getDefaultPreferences().getLong(name, LONG_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String)
|
|
||||||
*/
|
|
||||||
public String getDefaultString(String name) {
|
|
||||||
return getDefaultPreferences().get(name, STRING_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String)
|
|
||||||
*/
|
|
||||||
public double getDouble(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
if (value == null) {
|
|
||||||
return DOUBLE_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return Double.parseDouble(value);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return DOUBLE_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the string value for the specified key. Look in the nodes which
|
|
||||||
* are specified by this object's list of search scopes. If the value does
|
|
||||||
* not exist then return <code>null</code>.
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* the key to search with
|
|
||||||
* @return String or <code>null</code> if the value does not exist.
|
|
||||||
*/
|
|
||||||
private String internalGet(String key) {
|
|
||||||
return Platform.getPreferencesService().get(key, null,
|
|
||||||
getPreferenceNodes(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String)
|
|
||||||
*/
|
|
||||||
public float getFloat(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
if (value == null) {
|
|
||||||
return FLOAT_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return Float.parseFloat(value);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return FLOAT_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String)
|
|
||||||
*/
|
|
||||||
public int getInt(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
if (value == null) {
|
|
||||||
return INT_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return Integer.parseInt(value);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return INT_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
|
|
||||||
*/
|
|
||||||
public long getLong(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
if (value == null) {
|
|
||||||
return LONG_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return Long.parseLong(value);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return LONG_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
|
|
||||||
*/
|
|
||||||
public String getString(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
return value == null ? STRING_DEFAULT_DEFAULT : value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
|
|
||||||
*/
|
|
||||||
public boolean isDefault(String name) {
|
|
||||||
if (name == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (Platform.getPreferencesService().get(name, null,
|
|
||||||
getPreferenceNodes(false))) == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#needsSaving()
|
|
||||||
*/
|
|
||||||
public boolean needsSaving() {
|
|
||||||
return dirty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String,
|
|
||||||
* java.lang.String)
|
|
||||||
*/
|
|
||||||
public void putValue(String name, String value) {
|
|
||||||
try {
|
|
||||||
// Do not notify listeners
|
|
||||||
silentRunning = true;
|
|
||||||
getStorePreferences().put(name, value);
|
|
||||||
} finally {
|
|
||||||
// Be sure that an exception does not stop property updates
|
|
||||||
silentRunning = false;
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
|
|
||||||
*/
|
|
||||||
public void removePropertyChangeListener(IPropertyChangeListener listener) {
|
|
||||||
removeListenerObject(listener);
|
|
||||||
if (!isListenerAttached()) {
|
|
||||||
disposePreferenceStoreListener();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* double)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, double value) {
|
|
||||||
getDefaultPreferences().putDouble(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* float)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, float value) {
|
|
||||||
getDefaultPreferences().putFloat(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* int)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, int value) {
|
|
||||||
getDefaultPreferences().putInt(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* long)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, long value) {
|
|
||||||
getDefaultPreferences().putLong(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, String defaultObject) {
|
|
||||||
getDefaultPreferences().put(name, defaultObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* boolean)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, boolean value) {
|
|
||||||
getDefaultPreferences().putBoolean(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setToDefault(String name) {
|
|
||||||
|
|
||||||
String oldValue = getString(name);
|
|
||||||
String defaultValue = getDefaultString(name);
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
// removing a non-existing preference is a no-op so call the Core
|
|
||||||
// API directly
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
if (oldValue != defaultValue){
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, oldValue, defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* double)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, double value) {
|
|
||||||
double oldValue = getDouble(name);
|
|
||||||
if (oldValue == value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
if (getDefaultDouble(name) == value) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().putDouble(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, new Double(oldValue), new Double(
|
|
||||||
value));
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* float)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, float value) {
|
|
||||||
float oldValue = getFloat(name);
|
|
||||||
if (oldValue == value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
if (getDefaultFloat(name) == value) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().putFloat(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, new Float(oldValue), new Float(value));
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* int)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, int value) {
|
|
||||||
int oldValue = getInt(name);
|
|
||||||
if (oldValue == value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
if (getDefaultInt(name) == value) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().putInt(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, new Integer(oldValue), new Integer(
|
|
||||||
value));
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* long)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, long value) {
|
|
||||||
long oldValue = getLong(name);
|
|
||||||
if (oldValue == value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
if (getDefaultLong(name) == value) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().putLong(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, new Long(oldValue), new Long(value));
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, String value) {
|
|
||||||
// Do not turn on silent running here as Strings are propagated
|
|
||||||
if (getDefaultString(name).equals(value)) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().put(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* boolean)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, boolean value) {
|
|
||||||
boolean oldValue = getBoolean(name);
|
|
||||||
if (oldValue == value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
if (getDefaultBoolean(name) == value) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().putBoolean(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, oldValue ? Boolean.TRUE
|
|
||||||
: Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE);
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPersistentPreferenceStore#save()
|
|
||||||
*/
|
|
||||||
public void save() throws IOException {
|
|
||||||
try {
|
|
||||||
getStorePreferences().flush();
|
|
||||||
dirty = false;
|
|
||||||
} catch (BackingStoreException e) {
|
|
||||||
throw new IOException(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispose the receiver.
|
|
||||||
*/
|
|
||||||
private void disposePreferenceStoreListener() {
|
|
||||||
|
|
||||||
IEclipsePreferences root = (IEclipsePreferences) Platform
|
|
||||||
.getPreferencesService().getRootNode().node(
|
|
||||||
Plugin.PLUGIN_PREFERENCE_SCOPE);
|
|
||||||
try {
|
|
||||||
if (!(root.nodeExists(nodeQualifier))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (BackingStoreException e) {
|
|
||||||
return;// No need to report here as the node won't have the
|
|
||||||
// listener
|
|
||||||
}
|
|
||||||
|
|
||||||
IEclipsePreferences preferences = getStorePreferences();
|
|
||||||
if (preferences == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (preferencesListener != null) {
|
|
||||||
preferences.removePreferenceChangeListener(preferencesListener);
|
|
||||||
preferencesListener = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2014 OPCoach.
|
|
||||||
* 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:
|
|
||||||
* Manumitting Technologies : Brian de Alwis for initial API and implementation
|
|
||||||
* OPCoach : O.Prouvost fix bugs on hierarchy
|
|
||||||
*******************************************************************************//*
|
|
||||||
* Handler to open up a configured preferences dialog.
|
|
||||||
* Written by Brian de Alwis, Manumitting Technologies.
|
|
||||||
* Placed in the public domain.
|
|
||||||
* This code comes from : http://www.eclipse.org/forums/index.php/fa/4347/
|
|
||||||
* and was referenced in the thread : http://www.eclipse.org/forums/index.php/m/750139/
|
|
||||||
*/
|
|
||||||
package com.opcoach.e4.preferences.handlers;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
|
|
||||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
|
||||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
|
||||||
import org.eclipse.jface.preference.PreferenceDialog;
|
|
||||||
import org.eclipse.jface.preference.PreferenceManager;
|
|
||||||
import org.eclipse.jface.viewers.ViewerComparator;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
import com.opcoach.e4.preferences.internal.E4PreferenceRegistry;
|
|
||||||
|
|
||||||
|
|
||||||
public class E4PreferencesHandler
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
@CanExecute
|
|
||||||
public boolean canExecute()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Execute
|
|
||||||
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, E4PreferenceRegistry prefReg)
|
|
||||||
{
|
|
||||||
PreferenceManager pm = prefReg.getPreferenceManager();
|
|
||||||
PreferenceDialog dialog = new PreferenceDialog(shell, pm);
|
|
||||||
dialog.create();
|
|
||||||
dialog.getTreeViewer().setComparator(new ViewerComparator());
|
|
||||||
dialog.getTreeViewer().expandAll();
|
|
||||||
dialog.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user