diff options
| author | cdaniel | 2011-12-30 19:07:11 +0000 |
|---|---|---|
| committer | Krzysztof Daniel | 2012-01-08 20:18:41 +0000 |
| commit | 469e4cf27c641ca2238a746f39939cfe26eb5307 (patch) | |
| tree | 83dfdbb56d6ed93883c206a3a30c5e4488d1500d | |
| parent | cc2e43468394c78b64c49047cbb05b51fae354b7 (diff) | |
| download | eclipse.platform.ui-469e4cf27c641ca2238a746f39939cfe26eb5307.tar.gz eclipse.platform.ui-469e4cf27c641ca2238a746f39939cfe26eb5307.tar.xz eclipse.platform.ui-469e4cf27c641ca2238a746f39939cfe26eb5307.zip | |
Bug 96373: [ErrorHandling] ErrorDialog details area becomesv20120108-2018
huge with multi-line strings
https://bugs.eclipse.org/bugs/show_bug.cgi?id=96373
The size of the details is no longer computed relatively to the item
height.
| -rw-r--r-- | bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java index e42eef7fbe9..d986f37fa0d 100644 --- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java +++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -9,6 +9,8 @@ * IBM Corporation - initial API and implementation * Sebastian Davids <sdavids@gmx.de> - Fix for bug 19346 - Dialog font should * be activated and used by other components. + * Krzysztof Daniel <krzysztof.daniel@gmail.com> Bug 96373 - [ErrorHandling] + * ErrorDialog details area becomes huge with multi-line strings *******************************************************************************/ package org.eclipse.jface.dialogs; @@ -59,11 +61,6 @@ public class ErrorDialog extends IconAndMessageDialog { public static boolean AUTOMATED_MODE = false; /** - * Reserve room for this many list items. - */ - private static final int LIST_ITEM_COUNT = 7; - - /** * The nesting indent. */ private static final String NESTING_INDENT = " "; //$NON-NLS-1$ @@ -319,7 +316,7 @@ public class ErrorDialog extends IconAndMessageDialog { GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL); - data.heightHint = list.getItemHeight() * LIST_ITEM_COUNT; + data.heightHint = 150; data.horizontalSpan = 2; list.setLayoutData(data); list.setFont(parent.getFont()); @@ -609,22 +606,26 @@ public class ErrorDialog extends IconAndMessageDialog { * pressing the details button. */ private void toggleDetailsArea() { + boolean opened = false; Point windowSize = getShell().getSize(); - Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); if (listCreated) { list.dispose(); listCreated = false; detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); + opened = false; } else { list = createDropDownList((Composite) getContents()); detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); getContents().getShell().layout(); + opened = true; } Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); - getShell() - .setSize( - new Point(windowSize.x, windowSize.y - + (newSize.y - oldSize.y))); + int diffY = newSize.y - windowSize.y; + // increase the dialog height if details were opened and such increase is necessary + // decrease the dialog height if details were closed and empty space appeared + if ((opened && diffY > 0) || (!opened && diffY < 0)) { + getShell().setSize(new Point(windowSize.x, windowSize.y + (diffY))); + } } /** |
