This could not get weirder I was trying to run this snippet when it gives an error at following line
IStructuredSelection selection = viewer.getStructuredSelection();
gives suggestion to change but does not help anyone knows how to resolve this issue.
Any help is greatly appreciated.