implements visual improvements

This commit is contained in:
2023-03-19 13:43:22 +01:00
parent 3890a87a8c
commit dc4798b8ba
7 changed files with 72 additions and 64 deletions

View File

@@ -118,7 +118,7 @@
<handlers xmi:id="_TwU0IEYoEeyKK_icsY7Xjg" elementId="com.minres.scviewer.e4.application.handler.enabletxdetails" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.EnableTxDetails" command="_Fj1gQEYoEeyKK_icsY7Xjg"/>
<handlers xmi:id="_htyxgHCOEeyub8CfGE1sGA" elementId="com.minres.scviewer.e4.application.handler.helpContent" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.HelpContentsHandler" command="_RdUMoHCOEeyub8CfGE1sGA"/>
<handlers xmi:id="__Ozu4LcxEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handler.add_separator" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.AddSeparatorHandler" command="_vYAOQLcxEe294PIiYLxpfA"/>
<handlers xmi:id="_zpAa4LepEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handler.set_label_text" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SetLabelTextHandler" command="_wcqasLepEe294PIiYLxpfA"/>
<handlers xmi:id="_zpAa4LepEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handler.wave_double_click" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.WaveformDoubleClickTextHandler" command="_wcqasLepEe294PIiYLxpfA"/>
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.quit" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA">
<tags>type:user</tags>
@@ -218,7 +218,7 @@
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_Se1voBlEEeuiP60JNw0iiA" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SearchHandler"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_Wblk0LexEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handledmenuitem.edit_text" label="Edit Text" command="_wcqasLepEe294PIiYLxpfA">
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_fH08MLexEe294PIiYLxpfA" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SetLabelTextHandler"/>
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_fH08MLexEe294PIiYLxpfA" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.WaveformDoubleClickTextHandler"/>
</children>
</menus>
<toolbar xmi:id="_ReeeAE-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.toolbar.3">
@@ -319,7 +319,7 @@
<parameters xmi:id="_y2BUsU-HEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.command.pancommand.parameter.direction" name="direction" optional="false"/>
</commands>
<commands xmi:id="_RdUMoHCOEeyub8CfGE1sGA" elementId="org.eclipse.ui.help.helpContentCommand" commandName="Help Content Command" description=""/>
<commands xmi:id="_wcqasLepEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.command.set_label_text" commandName="Set Label Text"/>
<commands xmi:id="_wcqasLepEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.command.wave_double_click" commandName="Waveform Double Click"/>
<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="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>

View File

@@ -41,7 +41,7 @@ public class AppModelId {
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_PANCOMMAND = "com.minres.scviewer.e4.application.command.pancommand";
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_SELECTALLCOMMAND = "com.minres.scviewer.e4.application.command.selectallCommand";
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_SETRELATIONTYPE = "com.minres.scviewer.e4.application.command.setrelationtype";
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_SET_LABEL_TEXT = "com.minres.scviewer.e4.application.command.set_label_text";
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_WAVE_DOUBLE_CLICK = "com.minres.scviewer.e4.application.command.wave_double_click";
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_SET_THEM = "com.minres.scviewer.e4.application.command.set_them";
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_UPDATE = "com.minres.scviewer.e4.application.command.update";
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_ZOOMCOMMAND = "com.minres.scviewer.e4.application.command.zoomcommand";

View File

@@ -11,6 +11,8 @@
package com.minres.scviewer.e4.application.handlers;
import java.util.Optional;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.CanExecute;
@@ -34,12 +36,11 @@ public class AddSeparatorHandler {
if(part!=null && part.getObject() instanceof WaveformViewer){
Object sel = ((WaveformViewer)part.getObject()).getSelection();
if( sel instanceof IStructuredSelection) {
if(((IStructuredSelection)sel).isEmpty()) return false;
IStructuredSelection isel = (IStructuredSelection) sel;
if(isel.size()==1)
return isel.getFirstElement() instanceof TrackEntry;
else if(isel.size()==2) {
return isel.toArray()[1] instanceof TrackEntry;
if( sel instanceof IStructuredSelection) {
if(((IStructuredSelection)sel).isEmpty()) return false;
@SuppressWarnings("unchecked")
Optional<TrackEntry> o= ((IStructuredSelection)sel).toList().stream().filter(e -> e instanceof TrackEntry).findFirst();
return o.isPresent();
}
}
}

View File

@@ -11,6 +11,8 @@
package com.minres.scviewer.e4.application.handlers;
import java.util.Optional;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
@@ -25,13 +27,11 @@ public class DeleteWaveformHandler {
@SuppressWarnings("unchecked")
@CanExecute
public Boolean canExecute(ESelectionService selectionService){
Object o = selectionService.getSelection();
if(o instanceof IStructuredSelection) {
IStructuredSelection sel = (IStructuredSelection) o;
if(sel.size()>0)
return sel.toList().stream().allMatch(e-> e instanceof TrackEntry);
else
return false;
Object sel = selectionService.getSelection();
if(sel instanceof IStructuredSelection) {
if(((IStructuredSelection)sel).isEmpty()) return false;
Optional<TrackEntry> o= ((IStructuredSelection)sel).toList().stream().filter(e -> e instanceof TrackEntry).findFirst();
return o.isPresent();
} else
return false;
}

View File

@@ -11,6 +11,8 @@
package com.minres.scviewer.e4.application.handlers;
import java.util.Optional;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Evaluate;
import org.eclipse.e4.core.di.annotations.Execute;
@@ -22,10 +24,11 @@ import org.eclipse.swt.widgets.Shell;
import com.minres.scviewer.database.EmptyWaveform;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.TrackEntry.HierState;
import com.minres.scviewer.e4.application.parts.TextInputDialog;
import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class SetLabelTextHandler {
public class WaveformDoubleClickTextHandler {
@Execute
public void execute(Shell shell, EPartService partService) {
@@ -33,9 +36,10 @@ public class SetLabelTextHandler {
if(part!=null && part.getObject() instanceof WaveformViewer){
Object sel = ((WaveformViewer)part.getObject()).getSelection();
if( sel instanceof IStructuredSelection) {
Object o= ((IStructuredSelection)sel).getFirstElement();
if(o instanceof TrackEntry) {
TrackEntry te = (TrackEntry)o;
@SuppressWarnings("unchecked")
Optional<TrackEntry> o = ((IStructuredSelection)sel).toList().stream().filter(e -> e instanceof TrackEntry).findFirst();
if(o.isPresent()) {
TrackEntry te = o.get();
if(te.waveform instanceof EmptyWaveform) {
EmptyWaveform waveform= (EmptyWaveform)te.waveform;
TextInputDialog dialog = new TextInputDialog(shell);
@@ -45,6 +49,10 @@ public class SetLabelTextHandler {
if (dialog.open() == Window.OK) {
waveform.setName(dialog.getText());
}
} else if(te.hierState==HierState.CLOSED) {
te.hierState=HierState.OPENED;
} else if(te.hierState==HierState.OPENED) {
te.hierState=HierState.CLOSED;
}
}
}
@@ -59,10 +67,11 @@ public class SetLabelTextHandler {
Object sel = ((WaveformViewer)activePart.getObject()).getSelection();
if( sel instanceof IStructuredSelection) {
if(((IStructuredSelection)sel).isEmpty()) return false;
Object o= ((IStructuredSelection)sel).getFirstElement();
if(o instanceof TrackEntry) {
TrackEntry te = (TrackEntry)o;
return te.waveform instanceof EmptyWaveform;
@SuppressWarnings("unchecked")
Optional<TrackEntry> o = ((IStructuredSelection)sel).toList().stream().filter(e -> e instanceof TrackEntry).findFirst();
if(o.isPresent()) {
TrackEntry te = o.get();
return te.waveform instanceof EmptyWaveform || te.hierState!=HierState.NONE;
}
}
}

View File

@@ -418,7 +418,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
waveformPane.addEventListner(new IWaveformviewEventListener() {
@Override
public void onTrackEntryDoubleClickEvent(TrackEntry trackEntry) {
ParameterizedCommand command = commandService.createCommand(AppModelId.COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_SET_LABEL_TEXT);
ParameterizedCommand command = commandService.createCommand(AppModelId.COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_WAVE_DOUBLE_CLICK);
handlerService.executeHandler(command);
}
});
@@ -1000,9 +1000,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
for (IWaveform waveform : iWaveforms)
waveformPane.addWaveform(waveform, -1);
} else {
Object first = selection.getFirstElement();
if(first instanceof ITx) {
TrackEntry trackEntry = waveformPane.getEntryFor((ITx) first);
@SuppressWarnings("unchecked")
java.util.Optional<TrackEntry> o = selection.toList().stream().filter(e -> e instanceof TrackEntry).findFirst();
if(o.isPresent()) {
TrackEntry trackEntry = o.get();
if (insert) {
int index = waveformPane.getStreamList().indexOf(trackEntry);
for (IWaveform waveform : iWaveforms)
@@ -1011,18 +1012,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
for (IWaveform waveform : iWaveforms)
waveformPane.addWaveform(waveform, -1);
}
} else if(first instanceof TrackEntry) {
TrackEntry trackEntry = (TrackEntry) first;
if (insert) {
int index = waveformPane.getStreamList().indexOf(trackEntry);
for (IWaveform waveform : iWaveforms)
waveformPane.addWaveform(waveform, index++);
} else {
for (IWaveform waveform : iWaveforms)
waveformPane.addWaveform(waveform, -1);
}
}
}
}
showTxDetails(waveformPane.getStreamList().stream().filter(t -> t.waveform.getType() == WaveformType.TRANSACTION).findFirst().isPresent());
setFocus();
@@ -1033,10 +1024,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
showTxDetails(waveformPane.getStreamList().stream().filter(t -> t.waveform.getType() == WaveformType.TRANSACTION).findFirst().isPresent());
}
public void removeSelectedStreamFromList() {
waveformPane.deleteSelectedTracks();
showTxDetails(waveformPane.getStreamList().stream().filter(t -> t.waveform.getType() == WaveformType.TRANSACTION).findFirst().isPresent());
}
/**
* Move selected.
*