if (selection != null && selection instanceof ITextSelection) {
ITextSelection textSelection = (ITextSelection) selection;
IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
if (doc != null) {
if(textSelection.getLength()>0){
new LabelingDialog(editor.getEditorSite().getShell(), textSelection, doc).open();
}
}
}
}