Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 168074 Details for
Bug 16552
[Dialogs] Title Area dialog should support > 2 lines text
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
patch that grows the title area but ensures separator never disappears
patch16552sep.txt (text/plain), 5.74 KB, created by
Susan McCourt
on 2010-05-11 22:16:11 EDT
(
hide
)
Description:
patch that grows the title area but ensures separator never disappears
Filename:
MIME Type:
Creator:
Susan McCourt
Created:
2010-05-11 22:16:11 EDT
Size:
5.74 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface >Index: src/org/eclipse/jface/dialogs/TitleAreaDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/dialogs/TitleAreaDialog.java,v >retrieving revision 1.47 >diff -u -r1.47 TitleAreaDialog.java >--- src/org/eclipse/jface/dialogs/TitleAreaDialog.java 3 Mar 2010 22:39:32 -0000 1.47 >+++ src/org/eclipse/jface/dialogs/TitleAreaDialog.java 12 May 2010 01:46:48 -0000 >@@ -23,6 +23,7 @@ > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.graphics.RGB; >+import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.layout.FormLayout; >@@ -31,7 +32,9 @@ > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Listener; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.swt.widgets.Text; > >@@ -85,6 +88,8 @@ > private Label bottomFillerLabel; > > private Label leftFillerLabel; >+ >+ private Label separator; > > private RGB titleAreaRGB; > >@@ -110,6 +115,8 @@ > > private Image titleAreaImage; > >+ private int xTrim; >+ > /** > * Instantiate a new title area dialog. > * >@@ -138,14 +145,26 @@ > childLayout.marginWidth = 0; > childLayout.verticalSpacing = 0; > workArea.setLayout(childLayout); >- Control top = createTitleArea(contents); >- resetWorkAreaAttachments(top); >+ createTitleArea(contents); >+ resetWorkAreaAttachments(); > workArea.setFont(JFaceResources.getDialogFont()); > // initialize the dialog units > initializeDialogUnits(workArea); > // create the dialog area and button bar > dialogArea = createDialogArea(workArea); > buttonBar = createButtonBar(workArea); >+ >+ // computing trim for later >+ Rectangle rect = messageLabel.computeTrim(0, 0, 100, 100); >+ xTrim = rect.width - 100; >+ >+ // need to know whether to relayout >+ getShell().addListener(SWT.Resize, new Listener() { >+ >+ public void handleEvent(Event event) { >+ layoutForNewMessage(); >+ } >+ }); > return contents; > } > >@@ -173,10 +192,6 @@ > composite.setLayout(layout); > composite.setLayoutData(new GridData(GridData.FILL_BOTH)); > composite.setFont(parent.getFont()); >- // Build the separator line >- Label titleBarSeparator = new Label(composite, SWT.HORIZONTAL >- | SWT.SEPARATOR); >- titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); > return composite; > } > >@@ -185,9 +200,8 @@ > * > * @param parent > * the SWT parent for the title area widgets >- * @return Control with the highest x axis value. > */ >- private Control createTitleArea(Composite parent) { >+ private void createTitleArea(Composite parent) { > > // add a dispose listener > parent.addDisposeListener(new DisposeListener() { >@@ -255,11 +269,17 @@ > leftFillerLabel.setBackground(background); > bottomFillerLabel = new Label(parent, SWT.CENTER); > bottomFillerLabel.setBackground(background); >+ // Build the separator line >+ separator = new Label(parent, SWT.HORIZONTAL >+ | SWT.SEPARATOR); >+ FormData sepData = new FormData(); >+ sepData.top = new FormAttachment(messageLabel); >+ sepData.right = new FormAttachment(100, 0); >+ sepData.left = new FormAttachment(0, 0); >+ separator.setLayoutData(sepData); > setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing); > determineTitleImageLargest(); >- if (titleImageLargest) >- return titleImageLabel; >- return messageLabel; >+ > } > > /** >@@ -404,6 +424,9 @@ > private void layoutForNewMessage() { > int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); > int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); >+ messageLabelHeight = messageLabel.computeSize(messageLabel.getSize().x - xTrim, SWT.DEFAULT).y; >+ determineTitleImageLargest(); >+ resetWorkAreaAttachments(); > // If there are no images then layout as normal > if (errorMessage == null && messageImage == null) { > setImageLabelVisible(false); >@@ -416,7 +439,7 @@ > * Note that we do not use horizontalSpacing here as when the > * background of the messages changes there will be gaps between the > * icon label and the message that are the background color of the >- * shell. We add a leading space elsewhere to compendate for this. >+ * shell. We add a leading space elsewhere to compensate for this. > */ > FormData data = new FormData(); > data.left = new FormAttachment(0, H_GAP_IMAGE); >@@ -447,8 +470,9 @@ > } > // Do not layout before the dialog area has been created > // to avoid incomplete calculations. >- if (dialogArea != null) >+ if (dialogArea != null) { > workArea.getParent().layout(true); >+ } > } > > /** >@@ -587,12 +611,7 @@ > if (titleImageLabel != null) { > titleImageLabel.setImage(newTitleImage); > determineTitleImageLargest(); >- Control top; >- if (titleImageLargest) >- top = titleImageLabel; >- else >- top = messageLabel; >- resetWorkAreaAttachments(top); >+ resetWorkAreaAttachments(); > } > } > >@@ -616,9 +635,9 @@ > * > * @param top > */ >- private void resetWorkAreaAttachments(Control top) { >+ private void resetWorkAreaAttachments() { > FormData childData = new FormData(); >- childData.top = new FormAttachment(top); >+ childData.top = new FormAttachment(separator); > childData.right = new FormAttachment(100, 0); > childData.left = new FormAttachment(0, 0); > childData.bottom = new FormAttachment(100, 0);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 16552
:
164664
|
164665
|
165695
|
165979
|
165980
|
166041
|
167724
| 168074 |
168154
|
168272