public void swapMarkAndCursor() {
if (!(fViewer instanceof ITextViewerExtension))
return;
ITextViewerExtension viewerExtension= ((ITextViewerExtension) fViewer);
int markPosition= viewerExtension.getMark();
if (markPosition == -1) {
fStatusLine.setErrorMessage(EditorMessages.MarkRegionTarget_markNotSet);
fStatusLine.setMessage(""); //$NON-NLS-1$
return;
}
if (!isVisible(fViewer, markPosition)) {
fStatusLine.setErrorMessage(EditorMessages.MarkRegionTarget_markNotVisible);
fStatusLine.setMessage(""); //$NON-NLS-1$
return;
}
Point selection= fViewer.getSelectedRange();
viewerExtension.setMark(selection.x);
fViewer.setSelectedRange(markPosition, 0);
fViewer.revealRange(markPosition, 0);
fStatusLine.setErrorMessage(""); //$NON-NLS-1$