IWorkbenchWindow window = plugin.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
IEditorPart activeEditorPart = page.getActiveEditor();
if (activeEditorPart != null) {
IEditorSite editorSite = page.getActiveEditor().getEditorSite();
ISelectionProvider selectionProvider = editorSite.getSelectionProvider();
if (selectionProvider != null) {
ISelection selection = selectionProvider.getSelection();
if (selection instanceof ITextSelection) {
this.lineNumber = String.valueOf(((ITextSelection) selection).getStartLine() + 1);
}