diff options
author | Markus Keller | 2010-11-01 14:37:36 +0000 |
---|---|---|
committer | Markus Keller | 2010-11-01 14:37:36 +0000 |
commit | c6059df530c4510566912b93c3e3deb7acc99a9a (patch) | |
tree | f6e6e2d4d691bc62439bc07f4e21d6c2b3600c06 /org.eclipse.ui.workbench.texteditor/src/org/eclipse | |
parent | d4c07ae5b0ae6c242e4d12c187b37229744c78fc (diff) | |
download | eclipse.platform.text-c6059df530c4510566912b93c3e3deb7acc99a9a.tar.gz eclipse.platform.text-c6059df530c4510566912b93c3e3deb7acc99a9a.tar.xz eclipse.platform.text-c6059df530c4510566912b93c3e3deb7acc99a9a.zip |
Bug 327842: Key bindings broken in editor when showing statusv20101102-0800
Diffstat (limited to 'org.eclipse.ui.workbench.texteditor/src/org/eclipse')
-rw-r--r-- | org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java | 9 | ||||
-rw-r--r-- | org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java | 19 |
2 files changed, 18 insertions, 10 deletions
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java index fb07bd01521..3b1310ba556 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java @@ -15,6 +15,7 @@ package org.eclipse.ui.texteditor; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.graphics.Color; @@ -24,7 +25,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.util.IPropertyChangeListener; @@ -53,7 +53,7 @@ public class InfoForm { /** The form banner */ private Label fBanner; /** The form text */ - private Text fText; + private StyledText fText; /** The preference change listener */ private IPropertyChangeListener fPropertyChangeListener; @@ -207,8 +207,8 @@ public class InfoForm { return label; } - private Text createText(Composite parent, String text) { - Text widget = new Text(parent, SWT.READ_ONLY | SWT.MULTI); + private StyledText createText(Composite parent, String text) { + StyledText widget = new StyledText(parent, SWT.READ_ONLY | SWT.MULTI); GridData data= new GridData(GridData.FILL_HORIZONTAL); widget.setLayoutData(data); @@ -216,6 +216,7 @@ public class InfoForm { widget.setText(text); widget.setBackground(fBackgroundColor); widget.setForeground(fForegroundColor); + widget.setCaret(null); return widget; } diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java index 5a7706aea07..dd3c3f5381b 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java @@ -67,11 +67,7 @@ public class StatusTextEditor extends AbstractTextEditor { if (fStatusControl != null) { if (!fStatusControl.isDisposed()) { - Control focusControl= fStatusControl.getDisplay().getFocusControl(); - while (focusControl != fParent && focusControl != null && !(focusControl instanceof Shell)) { - focusControl= focusControl.getParent(); - } - restoreFocus= focusControl == fParent; + restoreFocus= containsFocus(fStatusControl); } fStatusControl.dispose(); fStatusControl= null; @@ -97,10 +93,21 @@ public class StatusTextEditor extends AbstractTextEditor { updateStatusFields(); } - if (restoreFocus) { + if (restoreFocus && fStatusControl != null && !containsFocus(fStatusControl)) { fParent.setFocus(); } } + + private boolean containsFocus(Control control) { + Control focusControl= control.getDisplay().getFocusControl(); + if (focusControl != null) { + focusControl= focusControl.getParent(); + while (focusControl != fParent && focusControl != null && !(focusControl instanceof Shell)) { + focusControl= focusControl.getParent(); + } + } + return focusControl == fParent; + } /* * @see org.eclipse.ui.texteditor.AbstractTextEditor#setFocus() |