diff options
author | Dani Megert | 2004-02-24 16:39:03 +0000 |
---|---|---|
committer | Dani Megert | 2004-02-24 16:39:03 +0000 |
commit | a8eb53b3d7830497ca0450fd23764b3c691d1277 (patch) | |
tree | c9ffe1784c4091ccb87ccc41280ea3cad1952bb6 | |
parent | 38572fbab6d4a831c3affe02254310d1d932ca96 (diff) | |
download | eclipse.platform.text-R2_1_maintenance.tar.gz eclipse.platform.text-R2_1_maintenance.tar.xz eclipse.platform.text-R2_1_maintenance.zip |
Fixed bug 48275: [navigation] abnormal lineup/linedown refresh when using ctrl related key mappingsv20040224_R2_1_3R2_1_maintenance
-rw-r--r-- | org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextNavigationAction.java | 47 |
1 files changed, 45 insertions, 2 deletions
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 daa0cb62a..1db2b5bd4 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 @@ public class TextNavigationAction implements IAction { 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 class TextNavigationAction implements IAction { public void removePropertyChangeListener(IPropertyChangeListener listener) { } - /* - * @see IAction#setAccelerator(int) + /** + * @deprecated */ public void setAccelerator(int keycode) { } |