fixes removing traces
This commit is contained in:
parent
0e705ce0e9
commit
b809042189
|
@ -316,30 +316,25 @@
|
||||||
id="com.minres.scviewer.ui.oneWaveSeleted">
|
id="com.minres.scviewer.ui.oneWaveSeleted">
|
||||||
<with
|
<with
|
||||||
variable="selection">
|
variable="selection">
|
||||||
<and>
|
|
||||||
<count
|
|
||||||
value="1">
|
|
||||||
</count>
|
|
||||||
<iterate
|
<iterate
|
||||||
|
ifEmpty="false"
|
||||||
operator="or">
|
operator="or">
|
||||||
<instanceof value="com.minres.scviewer.database.IWaveform"/>
|
<instanceof
|
||||||
|
value="com.minres.scviewer.database.ui.TrackEntry">
|
||||||
|
</instanceof>
|
||||||
</iterate>
|
</iterate>
|
||||||
</and>
|
|
||||||
</with>
|
</with>
|
||||||
</definition>
|
</definition>
|
||||||
<definition
|
<definition
|
||||||
id="com.minres.scviewer.ui.oneTxSeleted">
|
id="com.minres.scviewer.ui.oneTxSeleted">
|
||||||
<with
|
<with
|
||||||
variable="selection">
|
variable="selection">
|
||||||
<and>
|
|
||||||
<count
|
|
||||||
value="1">
|
|
||||||
</count>
|
|
||||||
<iterate
|
<iterate
|
||||||
operator="or">
|
operator="or">
|
||||||
<instanceof value="com.minres.scviewer.database.tx.ITx"/>
|
<instanceof
|
||||||
|
value="com.minres.scviewer.database.tx.ITx">
|
||||||
|
</instanceof>
|
||||||
</iterate>
|
</iterate>
|
||||||
</and>
|
|
||||||
</with>
|
</with>
|
||||||
</definition>
|
</definition>
|
||||||
<definition
|
<definition
|
||||||
|
|
|
@ -333,6 +333,10 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||||
addStreamToList(stream);
|
addStreamToList(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeStreamFromList(TrackEntry entry){
|
||||||
|
waveformView.getStreamList().remove(entry);
|
||||||
|
}
|
||||||
|
|
||||||
public void removeStreamFromList(IWaveform waveform){
|
public void removeStreamFromList(IWaveform waveform){
|
||||||
if(getEditorInput() instanceof TxEditorInput && ((TxEditorInput) getEditorInput()).getStreamNames().contains(waveform.getFullName())){
|
if(getEditorInput() instanceof TxEditorInput && ((TxEditorInput) getEditorInput()).getStreamNames().contains(waveform.getFullName())){
|
||||||
((TxEditorInput) getEditorInput()).getStreamNames().remove(waveform.getFullName());
|
((TxEditorInput) getEditorInput()).getStreamNames().remove(waveform.getFullName());
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.ui.IEditorPart;
|
import org.eclipse.ui.IEditorPart;
|
||||||
import org.eclipse.ui.handlers.HandlerUtil;
|
import org.eclipse.ui.handlers.HandlerUtil;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.ui.TxEditorPart;
|
import com.minres.scviewer.ui.TxEditorPart;
|
||||||
|
|
||||||
public class RemoveHandler extends AbstractHandler {
|
public class RemoveHandler extends AbstractHandler {
|
||||||
|
@ -29,8 +29,12 @@ public class RemoveHandler extends AbstractHandler {
|
||||||
if(editor instanceof TxEditorPart){
|
if(editor instanceof TxEditorPart){
|
||||||
TxEditorPart editorPart = (TxEditorPart) editor;
|
TxEditorPart editorPart = (TxEditorPart) editor;
|
||||||
ISelection selection =editorPart.getSelection();
|
ISelection selection =editorPart.getSelection();
|
||||||
if(selection instanceof StructuredSelection && ((StructuredSelection)selection).getFirstElement() instanceof IWaveform){
|
if(selection instanceof StructuredSelection) {
|
||||||
editorPart.removeStreamFromList((IWaveform) ((StructuredSelection)selection).getFirstElement());
|
for(Object elem:((StructuredSelection) selection).toList()) {
|
||||||
|
if(elem instanceof TrackEntry){
|
||||||
|
editorPart.removeStreamFromList((TrackEntry) elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
editorPart.setSelection(new StructuredSelection());
|
editorPart.setSelection(new StructuredSelection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue