private IStructuredSelection evaluateCurrentSelection() { IWorkbenchWindow window = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow(); if (window != null) { ISelection selection = window.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; } } return StructuredSelection.EMPTY; }
/** * We will cache window object in order to be able to provide parent shell for the message dialog. * * @see IWorkbenchWindowActionDelegate#init */ public void init(IWorkbenchWindow window) { this.window = window; setText("&New PHP Class"); setToolTipText("&Create New PHP Class."); setImageDescriptor(Activator.getImageDescriptor("icons/newclass_wiz.gif")); }