I found a solution, not the best one, but an acceptable way.
I use the SelectionService in my ViewPart and register a new SelectionListener.
My solution only accepts a selection in the problem view, perhaps there is a better way to differ the events.
site.getWorkbenchWindow().getSelectionService().addSelectionListener(new ISelectionListener() {
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
IStructuredSelection s = (IStructuredSelection) selection;
if (s.getFirstElement() instanceof MarkerItem) {
MarkerItem marker = (MarkerItem) s.getFirstElement();
if (marker != null && marker.getMarker() != null) {
IMarker iMarker = marker.getMarker();
// More Code here ...
}
}
}
});