Author: snjeza
Date: 2012-03-26 12:49:51 -0400 (Mon, 26 Mar 2012)
New Revision: 39833
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
Log:
JBIDE-10429 Narrow editor area causes broken layout
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2012-03-26
15:44:17 UTC (rev 39832)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2012-03-26
16:49:51 UTC (rev 39833)
@@ -25,11 +25,14 @@
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -160,12 +163,35 @@
@Override
protected void createHeaderContents(IManagedForm headerForm) {
- ScrolledForm form = headerForm.getForm();
+ final ScrolledForm form = headerForm.getForm();
form.setText(JBOSS_CENTRAL);
form.setToolTipText(JBOSS_CENTRAL);
form.setImage(getHeaderImage());
getToolkit().decorateFormHeading(form.getForm());
+ form.addControlListener(new ControlAdapter() {
+
+ boolean resize;
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ if (resize) {
+ return;
+ }
+ resize = true;
+ try {
+ Point size = form.getSize();
+ if (size.x < 500) {
+ form.setSize(500, size.y);
+ form.layout(true, true);
+ }
+ } finally {
+ resize = false;
+ }
+ }
+
+ });
+
IToolBarManager toolbar = form.getToolBarManager();
ControlContribution searchControl = new ControlContribution("Search") {
@Override