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 132520 Details for
Bug 272794
[DataBinding] TitleAreaDialogSupport should use TitleAreaDialog.setDialogComplete (new in 3.6)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fixes all issues.
TitleAreaDialogAndSupport.patch (text/plain), 9.01 KB, created by
Kai Schlamp
on 2009-04-20 18:54:31 EDT
(
hide
)
Description:
Fixes all issues.
Filename:
MIME Type:
Creator:
Kai Schlamp
Created:
2009-04-20 18:54:31 EDT
Size:
9.01 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.44 >diff -u -r1.44 TitleAreaDialog.java >--- src/org/eclipse/jface/dialogs/TitleAreaDialog.java 23 Oct 2008 18:51:06 -0000 1.44 >+++ src/org/eclipse/jface/dialogs/TitleAreaDialog.java 20 Apr 2009 22:48:01 -0000 >@@ -28,6 +28,7 @@ > import org.eclipse.swt.layout.FormLayout; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Display; >@@ -89,8 +90,12 @@ > private RGB titleAreaRGB; > > Color titleAreaColor; >+ >+ private String description = ""; //$NON-NLS-1$ > >- private String message = ""; //$NON-NLS-1$ >+ private String message; >+ >+ private int messageType = IMessageProvider.NONE; > > private String errorMessage; > >@@ -103,8 +108,12 @@ > private Image messageImage; > > private boolean showingError = false; >+ >+ private boolean showingMessage = false; > > private boolean titleImageLargest = true; >+ >+ private boolean dialogComplete = true; > > private int messageLabelHeight; > >@@ -372,16 +381,20 @@ > // we were previously showing an error > showingError = false; > } >- // show the message >- // avoid calling setMessage in case it is overridden to call >+ // show the description or message >+ // avoid calling setDescription or setMessage in case it is overridden to call > // setErrorMessage, > // which would result in a recursive infinite loop >- if (message == null) // this should probably never happen since >- // setMessage does this conversion.... >- message = ""; //$NON-NLS-1$ >- updateMessage(message); >- messageImageLabel.setImage(messageImage); >- setImageLabelVisible(messageImage != null); >+ if (showingMessage) { >+ updateMessage(message); >+ messageImageLabel.setImage(messageImage); >+ setImageLabelVisible(messageImage != null); >+ } >+ else { >+ updateMessage(description); >+ messageImageLabel.setImage(null); >+ setImageLabelVisible(false); >+ } > } else { > // Add in a space for layout purposes but do not > // change the instance variable >@@ -492,6 +505,7 @@ > */ > public void setMessage(String newMessage, int newType) { > Image newImage = null; >+ messageType = newType; > if (newMessage != null) { > switch (newType) { > case IMessageProvider.NONE: >@@ -518,23 +532,34 @@ > */ > private void showMessage(String newMessage, Image newImage) { > // Any change? >- if (message.equals(newMessage) && messageImage == newImage) { >+ if ((message == null ? newMessage == null : message >+ .equals(newMessage)) && messageImage == newImage) { > return; > } > message = newMessage; >- if (message == null) >- message = "";//$NON-NLS-1$ >- // Message string to be shown - if there is an image then add in >- // a space to the message for layout purposes >- String shownMessage = (newImage == null) ? message : " " + message; //$NON-NLS-1$ > messageImage = newImage; >- if (!showingError) { >- // we are not showing an error >- updateMessage(shownMessage); >- messageImageLabel.setImage(messageImage); >- setImageLabelVisible(messageImage != null); >- layoutForNewMessage(); >+ >+ if (message == null) { >+ if (showingMessage) >+ showingMessage = false; >+ if (!showingError) { >+ updateMessage(description); >+ } > } >+ else { >+ if (!showingMessage) >+ showingMessage = true; >+ // Message string to be shown - if there is an image then add in >+ // a space to the message for layout purposes >+ String shownMessage = (newImage == null) ? message : " " + message; //$NON-NLS-1$ >+ if (!showingError) { >+ // we are not showing an error >+ updateMessage(shownMessage); >+ } >+ } >+ messageImageLabel.setImage(messageImage); >+ setImageLabelVisible(messageImage != null); >+ layoutForNewMessage(); > } > > /** >@@ -621,4 +646,95 @@ > childData.bottom = new FormAttachment(100, 0); > workArea.setLayoutData(childData); > } >+ >+ protected Control createButtonBar(Composite parent) { >+ Control control = super.createButtonBar(parent); >+ Button okButton = getButton(IDialogConstants.OK_ID); >+ if (okButton != null) { >+ okButton.setEnabled(dialogComplete); >+ } >+ return control; >+ } >+ >+ /** >+ * Sets whether this dialog is complete. >+ * @param complete >+ * true if this dialog is complete, and and false otherwise >+ */ >+ public void setDialogComplete(boolean complete) { >+ Button okButton = getButton(IDialogConstants.OK_ID); >+ if (okButton != null) >+ okButton.setEnabled(complete); >+ dialogComplete = complete; >+ } >+ >+ /** >+ * Returns the value of an internal state variable set by setPageComplete. >+ * @return true if this dialog is complete, and false otherwise >+ */ >+ public boolean isDialogComplete() { >+ return dialogComplete; >+ } >+ >+ /** >+ * Sets this dialog description text. >+ * @param description >+ * the description text for this dialog page, or null if none >+ */ >+ public void setDescription(String description) { >+ showDescription(description); >+ } >+ >+ private void showDescription(String newDescription) { >+ // Any change? >+ if (description.equals(newDescription)) { >+ return; >+ } >+ description = newDescription; >+ if (description == null) { >+ description = ""; //$NON-NLS-1$ >+ } >+ >+ if (!showingError && !showingMessage) { >+ updateMessage(description); >+ messageImageLabel.setImage(null); >+ setImageLabelVisible(false); >+ layoutForNewMessage(); >+ } >+ } >+ >+ /** >+ * Returns this dialog description text. >+ * @return the description text for this dialog, or null if none >+ */ >+ public String getDescription() { >+ return description; >+ } >+ >+ /** >+ * Returns the current message for this dialog. >+ * A message provides instruction or information to the user, as opposed to an error message which should describe some error state. >+ * @return the message, or null if none >+ */ >+ public String getMessage() { >+ return message; >+ } >+ >+ /** >+ * Returns a value indicating if the message is a an information message, a warning message, or an error message. >+ * Returns one of NONE,INFORMATION, WARNING, or ERROR. >+ * @return the message type >+ */ >+ public int getMessageType() { >+ return messageType; >+ } >+ >+ /** >+ * Returns the current error message for this dialog. May be null to indicate no error message. >+ * An error message should describe some error state, as opposed to a message which may simply provide instruction or information to the user. >+ * @return the error message, or null if none >+ */ >+ public String getErrorMessage() { >+ return errorMessage; >+ } > } >#P org.eclipse.jface.databinding >Index: src/org/eclipse/jface/databinding/dialog/TitleAreaDialogSupport.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/dialog/TitleAreaDialogSupport.java,v >retrieving revision 1.2 >diff -u -r1.2 TitleAreaDialogSupport.java >--- src/org/eclipse/jface/databinding/dialog/TitleAreaDialogSupport.java 3 Feb 2009 03:04:19 -0000 1.2 >+++ src/org/eclipse/jface/databinding/dialog/TitleAreaDialogSupport.java 20 Apr 2009 22:48:02 -0000 >@@ -37,6 +37,8 @@ > import org.eclipse.core.runtime.Status; > import org.eclipse.jface.dialogs.IMessageProvider; > import org.eclipse.jface.dialogs.TitleAreaDialog; >+import org.eclipse.swt.events.DisposeEvent; >+import org.eclipse.swt.events.DisposeListener; > > /** > * Connects the validation result from the given data binding context to the >@@ -116,9 +118,9 @@ > }; > private IStatus currentStatus; > >- private TitleAreaDialogSupport(TitleAreaDialog dialogPage, >+ private TitleAreaDialogSupport(TitleAreaDialog dialog, > DataBindingContext dbc) { >- this.dialog = dialogPage; >+ this.dialog = dialog; > this.dbc = dbc; > init(); > } >@@ -127,12 +129,18 @@ > aggregateStatus = new AggregateValidationStatus(dbc > .getValidationStatusProviders(), > AggregateValidationStatus.MAX_SEVERITY); >- aggregateStatus.addValueChangeListener(new IValueChangeListener() { >+ final IValueChangeListener changeListener = new IValueChangeListener() { > public void handleValueChange(ValueChangeEvent event) { > > currentStatus = (IStatus) event.diff.getNewValue(); > handleStatusChanged(); > } >+ }; >+ aggregateStatus.addValueChangeListener(changeListener); >+ dialog.getShell().addDisposeListener(new DisposeListener() { >+ public void widgetDisposed(DisposeEvent e) { >+ aggregateStatus.removeValueChangeListener(changeListener); >+ } > }); > currentStatus = (IStatus) aggregateStatus.getValue(); > handleStatusChanged(); >@@ -213,6 +221,13 @@ > dialog.setMessage(null); > dialog.setErrorMessage(null); > } >+ >+ boolean pageComplete = true; >+ if (currentStatus != null) { >+ pageComplete = !currentStatus.matches(IStatus.ERROR >+ | IStatus.CANCEL); >+ } >+ dialog.setDialogComplete(pageComplete); > } > > private boolean currentStatusHasException() {
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 272794
:
132324
|
132326
|
132327
|
132339
|
132407
| 132520