Fixed bug 48275: [navigation] abnormal lineup/linedown refresh when using ctrl related key mappings
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextNavigationAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextNavigationAction.java index daa0cb6..1db2b5b 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextNavigationAction.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextNavigationAction.java
@@ -13,8 +13,10 @@ package org.eclipse.ui.texteditor; +import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.events.HelpListener; +import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Event; import org.eclipse.jface.action.IAction; @@ -49,11 +51,52 @@ fAction= action; } + /** + * Returns the text widget this actions is bound to. + * + * @return returns the text widget this actions is bound to + */ + protected StyledText getTextWidget() { + return fTextWidget; + } + /* * @see IAction#run() */ public void run() { + Point selection= fTextWidget.getSelection(); fTextWidget.invokeAction(fAction); + fireSelectionChanged(selection); + } + + private void doFireSelectionChanged(Point selection) { + Event event= new Event(); + event.x= selection.x; + event.y= selection.y; + fTextWidget.notifyListeners(SWT.Selection, event); + } + + /** + * Sends a selection event with the current selection to all + * selection listeners of the action's text widget + * + * @since 3.0 + */ + protected void fireSelectionChanged() { + fireSelectionChanged(fTextWidget.getSelection()); + } + + /** + * Fires a selection event to all selection listener of the action's + * text widget if the current selection differs from the given selection. + * + * @param oldSelection the old selection + * @since 3.0 + */ + protected void fireSelectionChanged(Point oldSelection) { + Point selection= fTextWidget.getSelection(); + if (oldSelection == null || !selection.equals(oldSelection)) + doFireSelectionChanged(selection); } /* @@ -191,8 +234,8 @@ public void removePropertyChangeListener(IPropertyChangeListener listener) { } - /* - * @see IAction#setAccelerator(int) + /** + * @deprecated */ public void setAccelerator(int keycode) { }