Fixed NPE in case of detached waveform
This commit is contained in:
parent
f9425834a3
commit
b648dccfd8
|
@ -40,13 +40,16 @@ public class AddWaveformHandler {
|
||||||
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
|
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
|
||||||
if(designBrowser==null) designBrowser = getListPart( partService);
|
if(designBrowser==null) designBrowser = getListPart( partService);
|
||||||
if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false;
|
if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false;
|
||||||
Boolean before = "before".equalsIgnoreCase(where); //$NON-NLS-1$
|
boolean before = "before".equalsIgnoreCase(where); //$NON-NLS-1$
|
||||||
|
IStructuredSelection waveformSelection = null;
|
||||||
|
if(designBrowser.getActiveWaveformViewerPart()!=null)
|
||||||
|
waveformSelection = (IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection();
|
||||||
if("true".equalsIgnoreCase(all)) //$NON-NLS-1$
|
if("true".equalsIgnoreCase(all)) //$NON-NLS-1$
|
||||||
return designBrowser.getFilteredChildren().length>0 &&
|
return designBrowser.getFilteredChildren().length>0 &&
|
||||||
(!before || ((IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection()).size()>0);
|
(!before || (waveformSelection!=null && waveformSelection.size()>0));
|
||||||
else
|
else
|
||||||
return selection.size()>0 &&
|
return selection!=null && selection.size()>0 &&
|
||||||
(!before || ((IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection()).size()>0);
|
(!before || (waveformSelection!=null && waveformSelection.size()>0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
|
|
Loading…
Reference in New Issue