diff --git a/features/com.minres.scviewer.database.feature/feature.xml b/features/com.minres.scviewer.database.feature/feature.xml index 0220ea3..2f9f01a 100644 --- a/features/com.minres.scviewer.database.feature/feature.xml +++ b/features/com.minres.scviewer.database.feature/feature.xml @@ -27,12 +27,12 @@ http://www.eclipse.org/legal/epl-v10.html - + com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. 3.0.0-SNAPSHOT diff --git a/features/com.minres.scviewer.e4.feature/pom.xml b/features/com.minres.scviewer.e4.feature/pom.xml index 0d5d210..e6e6e5c 100644 --- a/features/com.minres.scviewer.e4.feature/pom.xml +++ b/features/com.minres.scviewer.e4.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. 1.1.0-SNAPSHOT diff --git a/features/com.minres.scviewer.e4.platform.feature/pom.xml b/features/com.minres.scviewer.e4.platform.feature/pom.xml index a58ba0a..7e87863 100644 --- a/features/com.minres.scviewer.e4.platform.feature/pom.xml +++ b/features/com.minres.scviewer.e4.platform.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. 1.0.0-SNAPSHOT diff --git a/features/com.minres.scviewer.feature/pom.xml b/features/com.minres.scviewer.feature/pom.xml index 06aabf5..ecd2f69 100644 --- a/features/com.minres.scviewer.feature/pom.xml +++ b/features/com.minres.scviewer.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. 1.1.0-SNAPSHOT diff --git a/features/com.minres.scviewer.ui.feature/pom.xml b/features/com.minres.scviewer.ui.feature/pom.xml index a15a59f..d1c2f79 100644 --- a/features/com.minres.scviewer.ui.feature/pom.xml +++ b/features/com.minres.scviewer.ui.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. 1.1.0-SNAPSHOT diff --git a/plugins/com.minres.scviewer.database.sqlite/pom.xml b/plugins/com.minres.scviewer.database.sqlite/pom.xml index 87129d8..a7e1e06 100644 --- a/plugins/com.minres.scviewer.database.sqlite/pom.xml +++ b/plugins/com.minres.scviewer.database.sqlite/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database.text/pom.xml b/plugins/com.minres.scviewer.database.text/pom.xml index 98547d3..82270ef 100644 --- a/plugins/com.minres.scviewer.database.text/pom.xml +++ b/plugins/com.minres.scviewer.database.text/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database.ui.swt/pom.xml b/plugins/com.minres.scviewer.database.ui.swt/pom.xml index 62d3e25..6196778 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/pom.xml +++ b/plugins/com.minres.scviewer.database.ui.swt/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. 4.0.0-SNAPSHOT diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/Constants.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/Constants.java index 7e8563f..38cd838 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/Constants.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/Constants.java @@ -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() {} } diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/CursorPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/CursorPainter.java index 09e0777..9ae501a 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/CursorPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/CursorPainter.java @@ -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); } } } diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/RulerPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/RulerPainter.java index 275ed94..98a11b6 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/RulerPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/RulerPainter.java @@ -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); } diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java index 05bf89e..1149019 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java @@ -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>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= 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; } diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java index d4cf7cd..e9d563f 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java @@ -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 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(); } /* diff --git a/plugins/com.minres.scviewer.database.vcd/pom.xml b/plugins/com.minres.scviewer.database.vcd/pom.xml index 36e05fb..d010037 100644 --- a/plugins/com.minres.scviewer.database.vcd/pom.xml +++ b/plugins/com.minres.scviewer.database.vcd/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database/pom.xml b/plugins/com.minres.scviewer.database/pom.xml index ea264f2..9324a69 100644 --- a/plugins/com.minres.scviewer.database/pom.xml +++ b/plugins/com.minres.scviewer.database/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.e4.application/Application.e4xmi b/plugins/com.minres.scviewer.e4.application/Application.e4xmi index 90b71f5..c289e0d 100644 --- a/plugins/com.minres.scviewer.e4.application/Application.e4xmi +++ b/plugins/com.minres.scviewer.e4.application/Application.e4xmi @@ -1,6 +1,6 @@ - + @@ -134,6 +134,9 @@ + + + diff --git a/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF index aa8d0d8..605f1e0 100644 --- a/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF @@ -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 diff --git a/plugins/com.minres.scviewer.e4.application/icons/accept.png b/plugins/com.minres.scviewer.e4.application/icons/accept.png new file mode 100644 index 0000000..89c8129 Binary files /dev/null and b/plugins/com.minres.scviewer.e4.application/icons/accept.png differ diff --git a/plugins/com.minres.scviewer.e4.application/icons/arrow_redo.png b/plugins/com.minres.scviewer.e4.application/icons/arrow_redo.png new file mode 100644 index 0000000..fdc394c Binary files /dev/null and b/plugins/com.minres.scviewer.e4.application/icons/arrow_redo.png differ diff --git a/plugins/com.minres.scviewer.e4.application/icons/arrow_refresh.png b/plugins/com.minres.scviewer.e4.application/icons/arrow_refresh.png new file mode 100644 index 0000000..0de2656 Binary files /dev/null and b/plugins/com.minres.scviewer.e4.application/icons/arrow_refresh.png differ diff --git a/plugins/com.minres.scviewer.e4.application/icons/arrow_undo.png b/plugins/com.minres.scviewer.e4.application/icons/arrow_undo.png new file mode 100644 index 0000000..6972c5e Binary files /dev/null and b/plugins/com.minres.scviewer.e4.application/icons/arrow_undo.png differ diff --git a/plugins/com.minres.scviewer.e4.application/pom.xml b/plugins/com.minres.scviewer.e4.application/pom.xml index c6aa376..98524f3 100644 --- a/plugins/com.minres.scviewer.e4.application/pom.xml +++ b/plugins/com.minres.scviewer.e4.application/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/Messages.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/Messages.java index 3ca4467..3d88974 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/Messages.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/Messages.java @@ -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; diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/HelpHandler.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/HelpHandler.java index 8602148..55e6a9f 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/HelpHandler.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/HelpHandler.java @@ -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); } } diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties index a8fff7f..9651d86 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties @@ -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 diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java index 076f682..c35fc5b 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java @@ -240,10 +240,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis @Inject Composite parent; private boolean showHover; - - @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE, value = PreferenceConstants.SHOW_TX_DETAILS) Boolean blah; private SashForm topSash = null; + private SashForm middleSash = null; /** diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/help/HelpBrowser.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/help/HelpBrowser.java new file mode 100644 index 0000000..1ed125f --- /dev/null +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/help/HelpBrowser.java @@ -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; + } + + +} \ No newline at end of file diff --git a/plugins/com.minres.scviewer.ui/pom.xml b/plugins/com.minres.scviewer.ui/pom.xml index bc45599..b382c0d 100644 --- a/plugins/com.minres.scviewer.ui/pom.xml +++ b/plugins/com.minres.scviewer.ui/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. eclipse-plugin diff --git a/products/com.minres.scviewer.e4.product/pom.xml b/products/com.minres.scviewer.e4.product/pom.xml index 9f9a4ed..bce6d5b 100644 --- a/products/com.minres.scviewer.e4.product/pom.xml +++ b/products/com.minres.scviewer.e4.product/pom.xml @@ -6,11 +6,11 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. com.minres.scviewer.e4.product - 2.14.0 + 2.14.1 eclipse-repository com.minres.scviewer diff --git a/products/com.minres.scviewer.e4.product/scviewer.product b/products/com.minres.scviewer.e4.product/scviewer.product index 66261a3..c73fa9b 100644 --- a/products/com.minres.scviewer.e4.product/scviewer.product +++ b/products/com.minres.scviewer.e4.product/scviewer.product @@ -1,7 +1,7 @@ - + diff --git a/releng/com.minres.scviewer.target/pom.xml b/releng/com.minres.scviewer.target/pom.xml index 83cbad8..5248446 100644 --- a/releng/com.minres.scviewer.target/pom.xml +++ b/releng/com.minres.scviewer.target/pom.xml @@ -12,7 +12,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. diff --git a/releng/com.minres.scviewer.updateSite/pom.xml b/releng/com.minres.scviewer.updateSite/pom.xml index 5a5c991..0fc8abd 100644 --- a/releng/com.minres.scviewer.updateSite/pom.xml +++ b/releng/com.minres.scviewer.updateSite/pom.xml @@ -7,7 +7,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. diff --git a/tests/com.minres.scviewer.database.test/inputs/.gitignore b/tests/com.minres.scviewer.database.test/inputs/.gitignore index b60cf0f..358f155 100644 --- a/tests/com.minres.scviewer.database.test/inputs/.gitignore +++ b/tests/com.minres.scviewer.database.test/inputs/.gitignore @@ -10,3 +10,4 @@ /hw_cfg_2_nc.vcd /test_05.txlog /test_05.vcd +/tgc/ diff --git a/tests/com.minres.scviewer.database.test/pom.xml b/tests/com.minres.scviewer.database.test/pom.xml index 268b568..ffa4f34 100644 --- a/tests/com.minres.scviewer.database.test/pom.xml +++ b/tests/com.minres.scviewer.database.test/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.14.0 + 2.14.1 ../../.. eclipse-test-plugin