diff options
author | Markus Keller | 2010-10-29 16:25:51 +0000 |
---|---|---|
committer | Markus Keller | 2010-10-29 16:25:51 +0000 |
commit | e472b7e57a588f95e8e26a4e05fe97b3165ddab9 (patch) | |
tree | 09436e6cca950a630e6adaa7807c474d7439d827 /org.eclipse.ui.workbench.texteditor/src | |
parent | 02abf37edf358849a1e2ece127964283e328f953 (diff) | |
download | eclipse.platform.text-e472b7e57a588f95e8e26a4e05fe97b3165ddab9.tar.gz eclipse.platform.text-e472b7e57a588f95e8e26a4e05fe97b3165ddab9.tar.xz eclipse.platform.text-e472b7e57a588f95e8e26a4e05fe97b3165ddab9.zip |
Bug 327842: Key bindings broken in editor when showing status
Diffstat (limited to 'org.eclipse.ui.workbench.texteditor/src')
-rw-r--r-- | org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java | 25 | ||||
-rw-r--r-- | org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java | 15 |
2 files changed, 33 insertions, 7 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 387de38590a..fb07bd01521 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,6 +24,7 @@ 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; @@ -31,8 +32,8 @@ import org.eclipse.jface.util.PropertyChangeEvent; /** - * A form consisting of a title, a banner, and a info text. Banner and info text are - * separated by a separator line. This form must be handled like a SWT widget. + * A form consisting of a title, a banner, and an info text. Banner and info text are + * separated by a separator line. This form must be handled like an SWT widget. * * @since 2.0 * @deprecated since 3.0. there is no replacement, use org.eclipse.ui.forms to define a component with a similar look and function. @@ -52,7 +53,7 @@ public class InfoForm { /** The form banner */ private Label fBanner; /** The form text */ - private Label fText; + private Text fText; /** The preference change listener */ private IPropertyChangeListener fPropertyChangeListener; @@ -104,7 +105,7 @@ public class InfoForm { data.heightHint= 2; separator.setLayoutData(data); - fText= createLabel(composite, null); + fText= createText(composite, null); createLabel(composite, null); fScrolledComposite.setContent(composite); @@ -186,7 +187,7 @@ public class InfoForm { * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createCompositeSeparator(Composite) */ private Composite createCompositeSeparator(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); + Composite composite = new Composite(parent, SWT.NO_FOCUS); composite.setBackground(fSeparatorColor); return composite; } @@ -205,6 +206,18 @@ public class InfoForm { label.setForeground(fForegroundColor); return label; } + + private Text createText(Composite parent, String text) { + Text widget = new Text(parent, SWT.READ_ONLY | SWT.MULTI); + GridData data= new GridData(GridData.FILL_HORIZONTAL); + widget.setLayoutData(data); + + if (text != null) + widget.setText(text); + widget.setBackground(fBackgroundColor); + widget.setForeground(fForegroundColor); + return widget; + } /* * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createHeader(Composite, String) 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 d26d2890db5..5a7706aea07 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 @@ -17,6 +17,7 @@ import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; @@ -62,8 +63,16 @@ public class StatusTextEditor extends AbstractTextEditor { * @param input the input whose status is checked */ public void updatePartControl(IEditorInput input) { - + boolean restoreFocus= false; + 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; + } fStatusControl.dispose(); fStatusControl= null; } @@ -87,6 +96,10 @@ public class StatusTextEditor extends AbstractTextEditor { fParent.layout(); updateStatusFields(); } + + if (restoreFocus) { + fParent.setFocus(); + } } /* |