I'm not quite sure what you mean by "show popup dialog at this point", but do something like this:
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); if (editor instanceof ITextEditor) { ISelectionProvider selectionProvider = ((ITextEditor)editor).getSelectionProvider(); ISelection selection = selectionProvider.getSelection(); if (selection instanceof ITextSelection) { ITextSelection textSelection = (ITextSelection)selection; int offset = textSelection.getOffset();
Of course, in production code, zero checks, etc.
source share