Merge branch 'release/2.14.1'
This commit is contained in:
commit
037c645075
|
@ -27,12 +27,12 @@ http://www.eclipse.org/legal/epl-v10.html
|
|||
</url>
|
||||
|
||||
<requires>
|
||||
<import plugin="org.codehaus.groovy" version="2.5.8" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.osgi.services" version="3.4.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.google.guava" version="15.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.osgi"/>
|
||||
<import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.core.runtime"/>
|
||||
<import feature="org.eclipse.collections.feature" version="10.4.0.v20200820-2049"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.minres.scviewer.database.ui.swt;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static final String[] UNIT_STRING={"fs", "ps", "ns", "us", "ms"};//, "s"};
|
||||
|
@ -9,6 +11,20 @@ public class Constants {
|
|||
public static final String CONTENT_PROVIDER_TAG = "TOOLTIP_CONTENT_PROVIDER";
|
||||
public static final String HELP_PROVIDER_TAG = "TOOLTIP_HELP_PROVIDER";
|
||||
|
||||
public static final DecimalFormat TIME_FORMAT_FS = new DecimalFormat("#");
|
||||
public static final DecimalFormat TIME_FORMAT_PS = new DecimalFormat("#");
|
||||
public static final DecimalFormat TIME_FORMAT_NS = new DecimalFormat("#.0##");
|
||||
public static final DecimalFormat TIME_FORMAT_US = new DecimalFormat("#.0#####");
|
||||
public static final DecimalFormat TIME_FORMAT_MS = new DecimalFormat("#.0#####");
|
||||
|
||||
public static final DecimalFormat[] TIME_FORMAT = {
|
||||
TIME_FORMAT_FS, TIME_FORMAT_FS, TIME_FORMAT_FS, TIME_FORMAT_FS, TIME_FORMAT_FS, TIME_FORMAT_FS,
|
||||
TIME_FORMAT_PS, TIME_FORMAT_PS, TIME_FORMAT_PS, TIME_FORMAT_PS, TIME_FORMAT_PS, TIME_FORMAT_PS,
|
||||
TIME_FORMAT_NS, TIME_FORMAT_NS, TIME_FORMAT_NS, TIME_FORMAT_NS, TIME_FORMAT_NS, TIME_FORMAT_NS,
|
||||
TIME_FORMAT_US, TIME_FORMAT_US, TIME_FORMAT_US, TIME_FORMAT_US, TIME_FORMAT_US, TIME_FORMAT_US,
|
||||
TIME_FORMAT_MS, TIME_FORMAT_MS, TIME_FORMAT_MS, TIME_FORMAT_MS, TIME_FORMAT_MS, TIME_FORMAT_MS,
|
||||
};
|
||||
|
||||
private Constants() {}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.swt.graphics.Rectangle;
|
|||
|
||||
import com.minres.scviewer.database.ui.ICursor;
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
import com.minres.scviewer.database.ui.swt.Constants;
|
||||
|
||||
public class CursorPainter implements IPainter, ICursor {
|
||||
|
||||
|
@ -84,7 +85,7 @@ public class CursorPainter implements IPainter, ICursor {
|
|||
proj.setBackground(drawColor);
|
||||
proj.setForeground(textColor);
|
||||
double dTime=time;
|
||||
proj.drawText((dTime/waveCanvas.getScaleFactorPow10())+waveCanvas.getUnitStr(), x+1, top);
|
||||
proj.drawText(Constants.TIME_FORMAT[waveCanvas.getZoomLevel()].format(dTime/waveCanvas.getScaleFactorPow10())+waveCanvas.getUnitStr(), x+1, top);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@ import org.eclipse.swt.graphics.GC;
|
|||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
|
||||
import com.minres.scviewer.database.ui.swt.Constants;
|
||||
|
||||
public class RulerPainter implements IPainter {
|
||||
protected final WaveformCanvas waveCanvas;
|
||||
|
||||
static final int RULER_TICK_MINOR = 10;
|
||||
static final int RULER_TICK_MAJOR = 100;
|
||||
|
||||
static final DecimalFormat df = new DecimalFormat("#.00####");
|
||||
|
||||
public RulerPainter(WaveformCanvas waveCanvas) {
|
||||
this.waveCanvas=waveCanvas;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class RulerPainter implements IPainter {
|
|||
|
||||
int minorTickY = waveCanvas.rulerHeight-5;
|
||||
int majorTickY = waveCanvas.rulerHeight-15;
|
||||
int textY=waveCanvas.rulerHeight-20;
|
||||
int textY=waveCanvas.rulerHeight-30;
|
||||
int baselineY=waveCanvas.rulerHeight - 1;
|
||||
int bottom=waveCanvas.rulerHeight - 2;
|
||||
|
||||
|
@ -66,13 +66,22 @@ public class RulerPainter implements IPainter {
|
|||
gc.fillRectangle(new Rectangle(area.x, area.y, area.width, baselineY));
|
||||
gc.setForeground(headerFgColor);
|
||||
gc.drawLine(area.x, area.y+bottom, area.x+area.width, area.y+bottom);
|
||||
|
||||
boolean allMarker=true;
|
||||
for (long pos = startMinorIncrPos, tick = startMinorIncrVal; pos < endPos; pos+= rulerTickMinor, tick += rulerTickMinor) {
|
||||
if ((tick % rulerTickMajor) == 0) {
|
||||
String text = Constants.TIME_FORMAT[waveCanvas.getZoomLevel()].format(tick/scaleFactor*unitMultiplier);
|
||||
if(text.length()>8) allMarker=false;
|
||||
}
|
||||
}
|
||||
boolean drawText = true;
|
||||
for (long pos = startMinorIncrPos, tick = startMinorIncrVal; pos < endPos; pos+= rulerTickMinor, tick += rulerTickMinor) {
|
||||
int x0Pos = (int) (pos/scaleFactor);
|
||||
long x0Val = tick/scaleFactor;
|
||||
if ((tick % rulerTickMajor) == 0) {
|
||||
gc.drawText(df.format(x0Val*unitMultiplier)+unit, x0Pos, area.y+textY);
|
||||
if(allMarker || drawText)
|
||||
gc.drawText(Constants.TIME_FORMAT[waveCanvas.getZoomLevel()].format(x0Val*unitMultiplier)+unit, x0Pos, area.y+textY);
|
||||
gc.drawLine(x0Pos, area.y+majorTickY, x0Pos,area.y+ bottom);
|
||||
drawText=!drawText;
|
||||
} else {
|
||||
gc.drawLine(x0Pos, area.y+minorTickY, x0Pos, area.y+bottom);
|
||||
}
|
||||
|
|
|
@ -190,7 +190,6 @@ public class WaveformCanvas extends Canvas {
|
|||
if(level<0) level = 0;
|
||||
}
|
||||
//FIXME: keep center if zoom-out and cursor is not in view
|
||||
long xc=centerTime/this.scaleFactor; // cursor total x-offset
|
||||
if(level<Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length){
|
||||
this.scaleFactor = (long) Math.pow(10, level>>1);
|
||||
if(level%2==1) this.scaleFactor*=3;
|
||||
|
@ -202,7 +201,9 @@ public class WaveformCanvas extends Canvas {
|
|||
* xcn = tc/newScaleFactor
|
||||
* t0n = (xcn-xoffs)*scaleFactor
|
||||
*/
|
||||
long xoffs=xc+origin.x; // cursor offset relative to left border
|
||||
Rectangle clientArea = getClientArea();
|
||||
long clientAreaWidth = clientArea.width;
|
||||
long xoffs = clientAreaWidth/2;
|
||||
long xcn=centerTime/scaleFactor; // new total x-offset
|
||||
long originX=xcn-xoffs;
|
||||
if(originX>0) {
|
||||
|
@ -217,20 +218,20 @@ public class WaveformCanvas extends Canvas {
|
|||
}
|
||||
}
|
||||
|
||||
private int findFitZoomLevel(long timeRange) {
|
||||
private int findFitZoomLevel(long duration) {
|
||||
//get area actually capable of displaying data, i.e. area of the receiver which is capable of displaying data
|
||||
Rectangle clientArea = getClientArea();
|
||||
long clientAreaWidth = clientArea.width;
|
||||
//try to find existing zoomlevel where scaleFactor*clientAreaWidth >= maxTime, if one is found set it as new zoomlevel
|
||||
int magnitude_factor=1;
|
||||
final long[] UNIT_STRING_MULT={1, 1000, 1000*1000, 1000*1000*1000, 1000*1000*1000*1000, 1000*1000*1000*1000*1000 };
|
||||
for(int magnitude=0; magnitude<Constants.UNIT_STRING.length; magnitude++) {
|
||||
long magnitudeMultiplier = UNIT_STRING_MULT[magnitude];
|
||||
for (int multiplier=0; multiplier<Constants.UNIT_MULTIPLIER.length; multiplier++){
|
||||
int tempLevel = magnitude*Constants.UNIT_MULTIPLIER.length+multiplier;
|
||||
long scaleFactor = Constants.UNIT_MULTIPLIER[multiplier]*magnitude_factor;
|
||||
if(scaleFactor*clientAreaWidth >= timeRange)
|
||||
return tempLevel;
|
||||
long scaleFactor = magnitudeMultiplier * Constants.UNIT_MULTIPLIER[multiplier];
|
||||
long range = scaleFactor*clientAreaWidth;
|
||||
if( range >= duration)
|
||||
return magnitude*Constants.UNIT_MULTIPLIER.length+multiplier;
|
||||
}
|
||||
magnitude_factor*=1000;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -99,8 +99,6 @@ public class WaveformView implements IWaveformView {
|
|||
|
||||
private PropertyChangeSupport pcs;
|
||||
|
||||
static final DecimalFormat df = new DecimalFormat("#0.00####");
|
||||
|
||||
private ITx currentTxSelection;
|
||||
|
||||
private ArrayList<TrackEntry> currentWaveformSelection = new ArrayList<>();
|
||||
|
@ -1477,7 +1475,7 @@ public class WaveformView implements IWaveformView {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
double dTime = time;
|
||||
double scaledTime = dTime / waveformCanvas.getScaleFactorPow10();
|
||||
return sb.append(df.format(scaledTime)).append(waveformCanvas.getUnitStr()).toString();
|
||||
return sb.append(Constants.TIME_FORMAT[waveformCanvas.getZoomLevel()].format(scaledTime)).append(waveformCanvas.getUnitStr()).toString();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?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">
|
||||
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="1280" height="700">
|
||||
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.trimmedwindow.main" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="1280" height="700">
|
||||
<children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
|
||||
|
@ -134,6 +134,9 @@
|
|||
</children>
|
||||
</trimBars>
|
||||
</children>
|
||||
<children xsi:type="basic:Window" xmi:id="_Gm0qAEamEeyPDuc8x6Ggxw" elementId="com.minres.scviewer.e4.application.window.help" toBeRendered="false" selectedElement="_M5eT0EamEeyPDuc8x6Ggxw" label="SC Viewer Help" width="800" height="600">
|
||||
<children xsi:type="basic:Part" xmi:id="_M5eT0EamEeyPDuc8x6Ggxw" elementId="com.minres.scviewer.e4.application.part.container" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.help.HelpBrowser"/>
|
||||
</children>
|
||||
<handlers xmi:id="_95PfvXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.quitCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.QuitHandler" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||
<handlers xmi:id="_95PfwXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.openCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.OpenHandler" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<handlers xmi:id="_95PfxHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.saveCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SaveHandler" command="_95Pfw3NmEeWBq8z1Dv39LA"/>
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
||||
Bundle-Version: 2.14.0
|
||||
Bundle-Version: 2.14.1
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||
|
@ -38,5 +38,6 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
|||
org.eclipse.equinox.p2.metadata.repository;bundle-version="1.3.400"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Import-Package: com.minres.scviewer.database,
|
||||
javax.annotation;version="1.0.0";resolution:=optional,
|
||||
javax.inject;version="1.0.0"
|
||||
Automatic-Module-Name: com.minres.scviewer.e4.application
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 781 B |
Binary file not shown.
After Width: | Height: | Size: 625 B |
Binary file not shown.
After Width: | Height: | Size: 685 B |
Binary file not shown.
After Width: | Height: | Size: 631 B |
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -83,6 +83,8 @@ public class Messages extends NLS {
|
|||
public static String cursor;
|
||||
public static String cursor_drag;
|
||||
public static String cursor_text;
|
||||
public static String HelpBrowser_7;
|
||||
public static String HelpBrowser_8;
|
||||
public static String HelpDialog_0;
|
||||
public static String HelpDialog_1;
|
||||
public static String HelpDialog_2;
|
||||
|
|
|
@ -12,20 +12,21 @@ package com.minres.scviewer.e4.application.handlers;
|
|||
|
||||
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.MUIElement;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
public class HelpHandler {
|
||||
|
||||
static final String DIALOG_ID="com.minres.scviewer.e4.application.dialog.onlinehelp";
|
||||
static final String DIALOG_ID="com.minres.scviewer.e4.application.dialog.onlinehelp"; //$NON-NLS-1$
|
||||
static final String WINDOW_ID="com.minres.scviewer.e4.application.window.help"; //$NON-NLS-1$
|
||||
|
||||
@Execute
|
||||
public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
||||
MPart mel = (MPart) ms.find(DIALOG_ID, app); //$NON-NLS-1$
|
||||
mel.setToBeRendered(true);
|
||||
mel.setToBeRendered(false);
|
||||
public void execute(MApplication app, /*MWindow window,*/ EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
||||
// MPart mel = (MPart) ms.find(DIALOG_ID, app); //$NON-NLS-1$
|
||||
// mel.setToBeRendered(true);
|
||||
// mel.setToBeRendered(false);
|
||||
MUIElement w = ms.find(WINDOW_ID, app);
|
||||
if(w!=null) w.setToBeRendered(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,6 +77,8 @@ signal_nan=Signal NaN Value
|
|||
cursor=Cursor
|
||||
cursor_drag=dragged Cursor
|
||||
cursor_text=Cursor Text
|
||||
HelpBrowser_7=Error initializing help browser
|
||||
HelpBrowser_8=An error occurred while initializing the help browser:
|
||||
HelpDialog_0=Back
|
||||
HelpDialog_1=Forward
|
||||
HelpDialog_2=Stop
|
||||
|
|
|
@ -241,9 +241,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||
|
||||
private boolean showHover;
|
||||
|
||||
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE, value = PreferenceConstants.SHOW_TX_DETAILS) Boolean blah;
|
||||
|
||||
private SashForm topSash = null;
|
||||
|
||||
private SashForm middleSash = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
package com.minres.scviewer.e4.application.parts.help;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.resource.ResourceLocator;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.SWTError;
|
||||
import org.eclipse.swt.browser.Browser;
|
||||
import org.eclipse.swt.browser.LocationListener;
|
||||
import org.eclipse.swt.browser.ProgressEvent;
|
||||
import org.eclipse.swt.browser.ProgressListener;
|
||||
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.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.ProgressBar;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
public class HelpBrowser {
|
||||
|
||||
private static void decorateItem(ToolItem item, String label, String imageName) {
|
||||
String fullpath = File.separator+"icons"+File.separator+imageName; //$NON-NLS-1$
|
||||
ImageDescriptor descr = ResourceLocator.imageDescriptorFromBundle("com.minres.scviewer.e4.application", fullpath).orElse(null); //$NON-NLS-1$
|
||||
if(descr == null) {
|
||||
item.setText(label);
|
||||
} else {
|
||||
item.setImage(descr.createImage());
|
||||
item.setToolTipText(label);
|
||||
}
|
||||
item.setData(label);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public HelpBrowser() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
protected Control createComposite(Composite container) {
|
||||
GridLayout gridLayout = new GridLayout();
|
||||
gridLayout.numColumns = 3;
|
||||
container.setLayout(gridLayout);
|
||||
ToolBar toolbar = new ToolBar(container, SWT.NONE);
|
||||
ToolItem itemBack = new ToolItem(toolbar, SWT.PUSH);
|
||||
decorateItem(itemBack, Messages.HelpDialog_0, "arrow_undo.png"); //$NON-NLS-1$
|
||||
ToolItem itemForward = new ToolItem(toolbar, SWT.PUSH);
|
||||
decorateItem(itemForward, Messages.HelpDialog_1, "arrow_redo.png"); //$NON-NLS-1$
|
||||
ToolItem itemStop = new ToolItem(toolbar, SWT.PUSH);
|
||||
decorateItem(itemStop, Messages.HelpDialog_2, "cross.png"); //$NON-NLS-1$
|
||||
ToolItem itemRefresh = new ToolItem(toolbar, SWT.PUSH);
|
||||
decorateItem(itemRefresh, Messages.HelpDialog_3, "arrow_refresh.png"); //$NON-NLS-1$
|
||||
ToolItem itemGo = new ToolItem(toolbar, SWT.PUSH);
|
||||
decorateItem(itemGo, Messages.HelpDialog_4, "accept.png"); //$NON-NLS-1$
|
||||
|
||||
GridData data = new GridData();
|
||||
data.horizontalSpan = 3;
|
||||
toolbar.setLayoutData(data);
|
||||
|
||||
Label labelAddress = new Label(container, SWT.NONE);
|
||||
labelAddress.setText(Messages.HelpDialog_5);
|
||||
|
||||
final Text location = new Text(container, SWT.BORDER);
|
||||
data = new GridData();
|
||||
data.horizontalAlignment = GridData.FILL;
|
||||
data.horizontalSpan = 2;
|
||||
data.grabExcessHorizontalSpace = true;
|
||||
location.setLayoutData(data);
|
||||
|
||||
final Browser browser;
|
||||
try {
|
||||
browser = new Browser(container, SWT.NONE);
|
||||
data = new GridData();
|
||||
// data.widthHint = 800;
|
||||
// data.heightHint =600;
|
||||
data.horizontalAlignment = GridData.FILL;
|
||||
data.verticalAlignment = GridData.FILL;
|
||||
data.horizontalSpan = 3;
|
||||
data.grabExcessHorizontalSpace = true;
|
||||
data.grabExcessVerticalSpace = true;
|
||||
browser.setLayoutData(data);
|
||||
|
||||
final Label status = new Label(container, SWT.NONE);
|
||||
data = new GridData(GridData.FILL_HORIZONTAL);
|
||||
data.horizontalSpan = 2;
|
||||
status.setLayoutData(data);
|
||||
|
||||
final ProgressBar progressBar = new ProgressBar(container, SWT.NONE);
|
||||
data = new GridData();
|
||||
data.horizontalAlignment = GridData.END;
|
||||
progressBar.setLayoutData(data);
|
||||
|
||||
/* event handling */
|
||||
Listener listener = event -> {
|
||||
ToolItem item = (ToolItem) event.widget;
|
||||
String string = (String) item.getData();
|
||||
if (string.equals(Messages.HelpDialog_0))
|
||||
browser.back();
|
||||
else if (string.equals(Messages.HelpDialog_1))
|
||||
browser.forward();
|
||||
else if (string.equals(Messages.HelpDialog_2))
|
||||
browser.stop();
|
||||
else if (string.equals(Messages.HelpDialog_3))
|
||||
browser.refresh();
|
||||
else if (string.equals(Messages.HelpDialog_4))
|
||||
browser.setUrl(location.getText());
|
||||
};
|
||||
browser.addProgressListener(new ProgressListener() {
|
||||
@Override
|
||||
public void changed(ProgressEvent event) {
|
||||
if (event.total == 0) return;
|
||||
int ratio = event.current * 100 / event.total;
|
||||
progressBar.setSelection(ratio);
|
||||
}
|
||||
@Override
|
||||
public void completed(ProgressEvent event) {
|
||||
progressBar.setSelection(0);
|
||||
}
|
||||
});
|
||||
browser.addStatusTextListener(event -> status.setText(event.text));
|
||||
browser.addLocationListener(LocationListener.changedAdapter(event -> { if (event.top) location.setText(event.location); }));
|
||||
itemBack.addListener(SWT.Selection, listener);
|
||||
itemForward.addListener(SWT.Selection, listener);
|
||||
itemStop.addListener(SWT.Selection, listener);
|
||||
itemRefresh.addListener(SWT.Selection, listener);
|
||||
itemGo.addListener(SWT.Selection, listener);
|
||||
location.addListener(SWT.DefaultSelection, e -> browser.setUrl(location.getText()));
|
||||
browser.setUrl(Messages.HelpDialog_6);
|
||||
} catch (SWTError e) {
|
||||
MessageDialog.openWarning(container.getDisplay().getActiveShell(), Messages.HelpBrowser_7,Messages.HelpBrowser_8+e.getMessage());
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<packaging>eclipse-repository</packaging>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<build>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?pde version="3.5"?>
|
||||
|
||||
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.14.0" useFeatures="true" includeLaunchers="true">
|
||||
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.14.1" useFeatures="true" includeLaunchers="true">
|
||||
|
||||
<configIni use="default">
|
||||
</configIni>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<build>
|
||||
|
|
|
@ -10,3 +10,4 @@
|
|||
/hw_cfg_2_nc.vcd
|
||||
/test_05.txlog
|
||||
/test_05.vcd
|
||||
/tgc/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<version>2.14.1</version>
|
||||
<relativePath>../../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
|
|
Loading…
Reference in New Issue