if (selection instanceof ITreeSelection) {
ITreeSelection treeSelection = (ITreeSelection) selection;
Object firstElement = treeSelection.getFirstElement();
if (firstElement instanceof IJavaScriptElement) {
// it's JS element, follow opening JS editor
ScriptExplorerPart part = getPart();
IViewSite viewSite = part.getViewSite();
OpenAction openAction = new OpenAction(viewSite);
if (openAction != null && openAction.isEnabled()) {
openAction.run();
return;
}