From 6dfe6c8e2b2df8f0b7e51ced6c4e426a6fa67788 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 28 Feb 2023 07:50:10 +0100 Subject: [PATCH] adds blank entry for waveform viewer --- .../scviewer/database/fst/FstLibrary.java | 1 - .../scviewer/database/ftr/FtrDbLoader.java | 1 - .../scviewer/database/text/TextDbLoader.java | 1 - .../scviewer/database/vcd/VCDDbLoader.java | 1 - .../scviewer/database/BlankWaveform.java | 104 ++++++++++++++++++ .../scviewer/database/WaveformType.java | 4 +- .../Application.e4xmi | 7 ++ .../handlers/AddBlankWaveformHandler.java | 51 +++++++++ 8 files changed, 165 insertions(+), 5 deletions(-) create mode 100644 plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BlankWaveform.java create mode 100644 plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AddBlankWaveformHandler.java diff --git a/plugins/com.minres.scviewer.database.fst/src/com/minres/scviewer/database/fst/FstLibrary.java b/plugins/com.minres.scviewer.database.fst/src/com/minres/scviewer/database/fst/FstLibrary.java index 5b6871b..5654025 100644 --- a/plugins/com.minres.scviewer.database.fst/src/com/minres/scviewer/database/fst/FstLibrary.java +++ b/plugins/com.minres.scviewer.database.fst/src/com/minres/scviewer/database/fst/FstLibrary.java @@ -1,7 +1,6 @@ package com.minres.scviewer.database.fst; import com.sun.jna.Native; -import com.sun.jna.Platform; import com.sun.jna.Pointer; import com.sun.jna.Structure; import com.sun.jna.Structure.FieldOrder; diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java index d84610d..53a1736 100644 --- a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java @@ -33,7 +33,6 @@ import com.minres.scviewer.database.AssociationType; import com.minres.scviewer.database.DataType; import com.minres.scviewer.database.EventKind; import com.minres.scviewer.database.IWaveform; -import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDbLoader; import com.minres.scviewer.database.InputFormatException; import com.minres.scviewer.database.RelationType; diff --git a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.java b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.java index 563af11..31c7b96 100644 --- a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.java +++ b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.java @@ -46,7 +46,6 @@ import com.minres.scviewer.database.AssociationType; import com.minres.scviewer.database.DataType; import com.minres.scviewer.database.EventKind; import com.minres.scviewer.database.IWaveform; -import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDbLoader; import com.minres.scviewer.database.InputFormatException; import com.minres.scviewer.database.RelationType; diff --git a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java index 1801a50..853f87b 100644 --- a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java +++ b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java @@ -28,7 +28,6 @@ import com.minres.scviewer.database.BitVector; import com.minres.scviewer.database.DoubleVal; import com.minres.scviewer.database.IEventList; import com.minres.scviewer.database.IWaveform; -import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDbLoader; import com.minres.scviewer.database.InputFormatException; import com.minres.scviewer.database.RelationType; diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BlankWaveform.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BlankWaveform.java new file mode 100644 index 0000000..c4c0752 --- /dev/null +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BlankWaveform.java @@ -0,0 +1,104 @@ +package com.minres.scviewer.database; + +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.List; + +public class BlankWaveform implements IWaveform { + + @Override + public void addPropertyChangeListener(PropertyChangeListener l) { + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener l) { + } + + @Override + public String getFullName() { + return ""; + } + + @Override + public String getName() { + return ""; + } + + @Override + public void setName(String name) { + } + + @Override + public void setParent(IHierNode parent) { + } + + @Override + public IHierNode getParent() { + return null; + } + + @Override + public List getChildNodes() { + return new ArrayList<>(); + } + + @Override + public void addChild(IHierNode child) { + } + + @Override + public IDerivedWaveform deriveWaveform() { + return null; + } + + @Override + public int compareTo(IHierNode o) { + return 1; + } + + @Override + public long getId() { + return 0; + } + + @Override + public boolean isSame(IWaveform other) { + return false; + } + + @Override + public IEventList getEvents() { + return new EventList(); + } + + @Override + public IEvent[] getEventsAtTime(long time) { + return new IEvent[0]; + } + + @Override + public IEvent[] getEventsBeforeTime(long time) { + return new IEvent[0]; + } + + @Override + public WaveformType getType() { + return WaveformType.BLANK; + } + + @Override + public String getKind() { + return "BLANK"; + } + + @Override + public int getRowCount() { + return 1; + } + + @Override + public int getWidth() { + return 0; + } + +} diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/WaveformType.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/WaveformType.java index 209f3c9..6da5ed6 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/WaveformType.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/WaveformType.java @@ -20,5 +20,7 @@ public enum WaveformType { /** The transaction. */ TRANSACTION, /** The filter. */ - FILTER + FILTER, + /** The blank line. */ + BLANK } diff --git a/plugins/com.minres.scviewer.e4.application/Application.e4xmi b/plugins/com.minres.scviewer.e4.application/Application.e4xmi index f896b0f..ac1f5d3 100644 --- a/plugins/com.minres.scviewer.e4.application/Application.e4xmi +++ b/plugins/com.minres.scviewer.e4.application/Application.e4xmi @@ -117,6 +117,7 @@ + type:user @@ -208,6 +209,9 @@ + + + @@ -278,6 +282,9 @@ + + + diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AddBlankWaveformHandler.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AddBlankWaveformHandler.java new file mode 100644 index 0000000..aa3679b --- /dev/null +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AddBlankWaveformHandler.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2023 MINRES Technologies GmbH and others. + * 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: + * MINRES Technologies GmbH - initial API and implementation + *******************************************************************************/ + +package com.minres.scviewer.e4.application.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.workbench.modeling.EPartService; +import org.eclipse.e4.ui.workbench.modeling.ESelectionService; +import org.eclipse.jface.viewers.IStructuredSelection; + +import com.minres.scviewer.database.BlankWaveform; +import com.minres.scviewer.database.IWaveform; +import com.minres.scviewer.database.tx.ITx; +import com.minres.scviewer.database.ui.TrackEntry; +import com.minres.scviewer.e4.application.parts.WaveformViewer; + +public class AddBlankWaveformHandler { + + public static final String PARAM_WHERE_ID="com.minres.scviewer.e4.application.commandparameter.add_blank"; //$NON-NLS-1$ + + @CanExecute + public Boolean canExecute(ESelectionService selectionService){ + Object sel = selectionService.getSelection(); + if( sel instanceof IStructuredSelection) { + Object o= ((IStructuredSelection)sel).getFirstElement(); + return o instanceof IWaveform || o instanceof ITx | o instanceof TrackEntry; + } + return false; + } + + @Execute + public void execute(@Named(PARAM_WHERE_ID) String where, EPartService partService) { + Object obj = partService.getActivePart().getObject(); + if(obj instanceof WaveformViewer){ + ((WaveformViewer)obj).addStreamsToList( + new IWaveform[]{new BlankWaveform()}, "before".equalsIgnoreCase(where)); //$NON-NLS-1$ + } + } + +}