Merge branch 'hotfix/#29_cannot_delete_signals'

This commit is contained in:
Eyck Jentzsch 2020-03-13 16:01:29 +01:00
commit b398a07fd7
4 changed files with 15 additions and 17 deletions

View File

@ -193,7 +193,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
@Override @Override
public Boolean equals(IWaveform other) { public Boolean equals(IWaveform other) {
return(other instanceof TxStream && this.getId()==other.getId()); return(other instanceof TxStream && this.getId().equals(other.getId()));
} }
} }

View File

@ -117,7 +117,7 @@ public class VCDSignal<T> extends HierNode implements ISignal<T> {
@Override @Override
public Boolean equals(IWaveform other) { public Boolean equals(IWaveform other) {
return(other instanceof VCDSignal<?> && this.getId()==other.getId()); return( other instanceof VCDSignal<?> && this.getId().equals(other.getId()));
} }
@Override @Override

View File

@ -140,7 +140,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
break; break;
} }
} }
if(name == hier[hier.length-1]){ //leaf if(name.equals(hier[hier.length-1])){ //leaf
if(n1!=null) { if(n1!=null) {
if(n1 instanceof HierNode){ if(n1 instanceof HierNode){
node.getChildNodes().remove(n1); node.getChildNodes().remove(n1);

View File

@ -669,12 +669,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
* @param persistedState the persisted state * @param persistedState the persisted state
*/ */
protected void saveWaveformViewerState(Map<String, String> persistedState) { protected void saveWaveformViewerState(Map<String, String> persistedState) {
Integer index;
boolean isStream = false;
persistedState.put(SHOWN_WAVEFORM + "S", Integer.toString(waveformPane.getStreamList().size())); //$NON-NLS-1$ persistedState.put(SHOWN_WAVEFORM + "S", Integer.toString(waveformPane.getStreamList().size())); //$NON-NLS-1$
index = 0; Integer index = 0;
for (TrackEntry trackEntry : waveformPane.getStreamList()) { for (TrackEntry trackEntry : waveformPane.getStreamList()) {
if(trackEntry.isStream()) { isStream=true; }
persistedState.put(SHOWN_WAVEFORM + index, trackEntry.waveform.getFullName()); persistedState.put(SHOWN_WAVEFORM + index, trackEntry.waveform.getFullName());
persistedState.put(SHOWN_WAVEFORM + index + VALUE_DISPLAY, trackEntry.valueDisplay.toString()); persistedState.put(SHOWN_WAVEFORM + index + VALUE_DISPLAY, trackEntry.valueDisplay.toString());
persistedState.put(SHOWN_WAVEFORM + index + WAVE_DISPLAY, trackEntry.waveDisplay.toString()); persistedState.put(SHOWN_WAVEFORM + index + WAVE_DISPLAY, trackEntry.waveDisplay.toString());
@ -693,23 +690,24 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
// get selected transaction of a stream // get selected transaction of a stream
ISelection selection = waveformPane.getSelection(); ISelection selection = waveformPane.getSelection();
if (!selection.isEmpty() && isStream) { if (!selection.isEmpty()) {
List<Object> t = getISelection(selection); List<Object> t = getISelection(selection);
ITx tx = (ITx) t.get(0); if(t.get(0) instanceof ITx) {
TrackEntry te = (TrackEntry) t.get(1); ITx tx = (ITx) t.get(0);
// get transaction id TrackEntry te = (TrackEntry) t.get(1);
persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId())); // get transaction id
//get TrackEntry name persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId()));
String name = te.getStream().getFullName(); //get TrackEntry name
persistedState.put(SELECTED_TRACKENTRY_NAME, name); String name = te.getStream().getFullName();
persistedState.put(SELECTED_TRACKENTRY_NAME, name);
}
} }
} }
protected List<Object> getISelection(ISelection selection){ protected List<Object> getISelection(ISelection selection){
List<Object> result = new LinkedList<Object> (); List<Object> result = new LinkedList<Object> ();
if ( selection instanceof IStructuredSelection ) if ( selection instanceof IStructuredSelection ) {
{
Iterator<?> i = ((IStructuredSelection)selection).iterator(); Iterator<?> i = ((IStructuredSelection)selection).iterator();
while (i.hasNext()){ while (i.hasNext()){
Object o = i.next (); Object o = i.next ();