From 8f0f7650e37f27c3a8a200ac6910466a2ca48d13 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 15 Nov 2026 16:30:23 +0100 Subject: [PATCH] reworks some keybindings to show them in menus --- README.md | 20 +++++++ .../Application.e4xmi | 46 ++++++++------- .../META-INF/MANIFEST.MF | 3 +- .../handlers/WaveformBindingsTest.java | 58 +++++++++++++++++++ 4 files changed, 105 insertions(+), 22 deletions(-) create mode 100644 tests/com.minres.scviewer.e4.application.test/src/com/minres/scviewer/e4/application/handlers/WaveformBindingsTest.java diff --git a/README.md b/README.md index d6c7279b..44f7a0ea 100644 --- a/README.md +++ b/README.md @@ -80,3 +80,23 @@ to collapse or expand it. Select a group and press Ctrl+Shift+G Settings files and persisted viewer state preserve group names, membership, nesting, and expansion state, including tracks inside collapsed groups. Older settings files continue to load as an ordinary list of tracks. + +Embedded Help +============= + +The legacy Jasper JSP loader uses `File.toURL()` for its generated-class directory. +A PDE configuration directory containing a literal percent escape (such as +`scviewer.product%20issue3`) can therefore produce HTTP 500 / `PWC6034` / +`ClassNotFoundException: org.apache.jsp.index_jsp` even when the class was compiled. +`-clearPersistedState` clears the application model; it does not correct that path. + +In **Run/Debug Configurations > Configuration**, disable the default configuration +area and choose an explicit path without spaces or percent escapes, for example: + +``` +${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/scviewer-product +``` + +Use a distinct safe configuration directory for each launch. Stop and relaunch +the application after changing it; the new area will have a fresh JSP cache. +Graphics warnings about EGL/DRI3 are separate from JSP class loading. diff --git a/plugins/com.minres.scviewer.e4.application/Application.e4xmi b/plugins/com.minres.scviewer.e4.application/Application.e4xmi index 30bc096c..82a3a223 100644 --- a/plugins/com.minres.scviewer.e4.application/Application.e4xmi +++ b/plugins/com.minres.scviewer.e4.application/Application.e4xmi @@ -111,22 +111,22 @@ - - - - - + + + + + - - + + - - + + - + - + type:user @@ -158,6 +158,8 @@ + + type:user @@ -169,23 +171,25 @@ - + + + - + categoryTag:General - - - - - + + + + + - + - + @@ -300,7 +304,7 @@ - + diff --git a/tests/com.minres.scviewer.e4.application.test/META-INF/MANIFEST.MF b/tests/com.minres.scviewer.e4.application.test/META-INF/MANIFEST.MF index 536e04bf..863c5b42 100644 --- a/tests/com.minres.scviewer.e4.application.test/META-INF/MANIFEST.MF +++ b/tests/com.minres.scviewer.e4.application.test/META-INF/MANIFEST.MF @@ -5,7 +5,8 @@ Bundle-SymbolicName: com.minres.scviewer.e4.application.test Bundle-Version: 2.20.0 Fragment-Host: com.minres.scviewer.e4.application Bundle-RequiredExecutionEnvironment: JavaSE-17 -Require-Bundle: org.eclipse.equinox.http.jetty, +Require-Bundle: org.eclipse.e4.ui.bindings, + org.eclipse.equinox.http.jetty, org.eclipse.equinox.http.registry, org.eclipse.equinox.jsp.jasper.registry, org.eclipse.jdt.core, diff --git a/tests/com.minres.scviewer.e4.application.test/src/com/minres/scviewer/e4/application/handlers/WaveformBindingsTest.java b/tests/com.minres.scviewer.e4.application.test/src/com/minres/scviewer/e4/application/handlers/WaveformBindingsTest.java new file mode 100644 index 00000000..90031946 --- /dev/null +++ b/tests/com.minres.scviewer.e4.application.test/src/com/minres/scviewer/e4/application/handlers/WaveformBindingsTest.java @@ -0,0 +1,58 @@ +package com.minres.scviewer.e4.application.handlers; + +import static org.junit.Assert.*; +import java.util.List; +import org.junit.Test; +import org.eclipse.core.commands.CommandManager; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.commands.contexts.ContextManager; +import org.eclipse.e4.core.contexts.ContextInjectionFactory; +import org.eclipse.e4.core.contexts.EclipseContextFactory; +import org.eclipse.e4.ui.bindings.internal.BindingTable; +import org.eclipse.e4.ui.bindings.internal.BindingTableManager; +import org.eclipse.e4.ui.bindings.internal.ContextSet; +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.bindings.keys.KeyBinding; +import org.eclipse.jface.bindings.keys.KeySequence; + +@SuppressWarnings("restriction") +public class WaveformBindingsTest { + @Test + public void childContextResolvesDeleteConflictAndRetainsMenuShortcutLookup() throws Exception { + var contexts = new ContextManager(); + var window = contexts.getContext("org.eclipse.ui.contexts.window"); + window.define("Window", "", null); + var waveform = contexts.getContext("com.minres.scviewer.e4.application.context.waveform"); + waveform.define("Waveform", "", window.getId()); + ContextSet.setComparator(new ContextSet.CComp(contexts)); + var context = EclipseContextFactory.create(); + try { + var manager = ContextInjectionFactory.make(BindingTableManager.class, context); + var windowTable = new BindingTable(window); + var waveformTable = new BindingTable(waveform); + manager.addTable(windowTable); manager.addTable(waveformTable); + var commands = new CommandManager(); + var category = commands.getCategory("test"); category.define("test", ""); + var standardCommand = commands.getCommand("org.eclipse.ui.edit.delete"); + standardCommand.define("Delete", "", category); + var viewerCommand = commands.getCommand("com.minres.scviewer.e4.application.command.deleteWaveform"); + viewerCommand.define("Delete waveform", "", category); + var standard = new ParameterizedCommand(standardCommand, null); + var viewer = new ParameterizedCommand(viewerCommand, null); + var key = KeySequence.getInstance("DEL"); + String scheme = "org.eclipse.ui.defaultAcceleratorConfiguration"; + var normal = new KeyBinding(key, standard, scheme, window.getId(), null, null, null, Binding.SYSTEM); + var conflicting = new KeyBinding(key, viewer, scheme, window.getId(), null, null, null, Binding.USER); + windowTable.addBinding(normal); windowTable.addBinding(conflicting); + assertEquals(2, windowTable.getConflictsFor(key).size()); + assertNull(windowTable.getBestSequenceFor(viewer)); + windowTable.removeBinding(conflicting); + var scoped = new KeyBinding(key, viewer, scheme, waveform.getId(), null, null, null, Binding.USER); + waveformTable.addBinding(scoped); + var active = manager.createContextSet(List.of(window, waveform)); + assertSame(scoped, manager.getPerfectMatch(active, key)); + assertSame(scoped, manager.getBestSequenceFor(active, viewer)); + assertSame(normal, manager.getPerfectMatch(manager.createContextSet(List.of(window)), key)); + } finally { context.dispose(); } + } +}