diff options
author | kalyan prasad | 2018-05-22 11:01:27 +0000 |
---|---|---|
committer | Kalyan Prasad Tatavarthi | 2018-05-22 11:02:04 +0000 |
commit | 7a5bfc8d9459112f13925bc55208003316077ad4 (patch) | |
tree | bd3b2f98c68ab49750ac7b32ed764e147251ccf0 | |
parent | 07b4730155f49ad78ca1de5107b1b839e2146c66 (diff) | |
download | eclipse.platform.ui-7a5bfc8d9459112f13925bc55208003316077ad4.tar.gz eclipse.platform.ui-7a5bfc8d9459112f13925bc55208003316077ad4.tar.xz eclipse.platform.ui-7a5bfc8d9459112f13925bc55208003316077ad4.zip |
Bug 521264 - GVT47: Perspective descriptions are truncated since they
are displayed as single line
Change-Id: I530c647bb2efe2f6143d80b54dc579c2cbe724d2
Signed-off-by: kalyan prasad <kalyan_prasad@in.ibm.com>
-rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java index 9b4a7c935f2..9803da39807 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java @@ -30,6 +30,7 @@ import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; @@ -308,6 +309,7 @@ public class SelectPerspectiveDialog extends Dialog implements ISelectionChanged private void popUp(final String description) { perspDescPopupDialog = new PopupDialog(getShell(), PopupDialog.HOVER_SHELLSTYLE, true, false, false, false, false, null, null) { private static final int CURSOR_SIZE = 15; + private Label label = null; @Override protected Point getInitialLocation(Point initialSize) { @@ -320,8 +322,27 @@ public class SelectPerspectiveDialog extends Dialog implements ISelectionChanged } @Override + protected void adjustBounds() { + // grow/shrink a wrappable Label's height to show its content as it changes + Display display = getShell().getDisplay(); + if (display != null && label != null) { + Rectangle clientArea = display.getClientArea(); + if (clientArea != null && clientArea.width > 0) { + int workbenchWidth = clientArea.width; + int currentHeight = label.getSize().y; + int preferredHeight = label.computeSize(workbenchWidth, SWT.DEFAULT).y; + if (currentHeight != preferredHeight) { + GridData data = (GridData) label.getLayoutData(); + data.heightHint = preferredHeight; + getShell().pack(); + } + } + } + } + + @Override protected Control createDialogArea(Composite parent) { - Label label = new Label(parent, SWT.WRAP); + label = new Label(parent, SWT.WRAP); label.setText(description); label.addFocusListener(new FocusAdapter() { @Override |