Merge "Issue #1298 Changes for non-blocking WrapLengthDialog. Changes from reviewer's comments. Fix merge conflict." into development

Former-commit-id: d4276e6474 [formerly 46fbeba87efbee0b558fdd2c8f7e8c5abf004ac5]
Former-commit-id: a576274c3c
This commit is contained in:
Lee Venable 2012-11-12 16:58:17 -06:00 committed by Gerrit Code Review
commit e62c2fb732
2 changed files with 24 additions and 13 deletions

View file

@ -142,6 +142,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 07 Nov 2012 1298 rferrel Changes for non-blocking CallToActionsDlg.
* Changes for non-blocking FindReplaceDlg.
* Changes for non-blocking StoreTransmitDlg.
* Changes for non-blocking WrapLengthDialog.
*
* </pre>
*
@ -866,14 +867,27 @@ public class ProductEditorComp extends Composite implements
wrapLengthMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
WrapLengthDialog wrapLengthDialog = new WrapLengthDialog(
// The dialog being opened is modal to the parent dialog. This
// will prevent the launching of another dialog until the modal
// dialog is closed.
final WrapLengthDialog wrapLengthDialog = new WrapLengthDialog(
getShell());
wrapLengthDialog.setWrapLength(wrapColumn);
int result = wrapLengthDialog.open();
if (result == Window.OK) {
wrapColumn = wrapLengthDialog.getWrapLength();
textComp.setWrapColumn(wrapColumn);
}
wrapLengthDialog.setBlockOnOpen(false);
wrapLengthDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof Integer) {
int result = (Integer) returnValue;
if (result == Window.OK) {
wrapColumn = wrapLengthDialog.getWrapLength();
textComp.setWrapColumn(wrapColumn);
}
}
}
});
wrapLengthDialog.open();
}
});
}

View file

@ -41,6 +41,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 27, 2010 wldougher Initial creation
* Nov 09, 2012 1298 rferrel Code clean up for non-blocking dialog.
*
* </pre>
*
@ -49,11 +50,11 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
*/
public class WrapLengthDialog extends CaveJFACEDialog {
private static final int MAX_COLUMNS = 255;
private final int MAX_COLUMNS = 255;
private static final int MIN_COLUMNS = 15;
private final int MIN_COLUMNS = 15;
private static final String MESSAGE = "Current Wrap Length: %d\n"
private final String MESSAGE = "Current Wrap Length: %d\n"
+ "Enter new Wrap Length";
protected Label notice;
@ -66,10 +67,6 @@ public class WrapLengthDialog extends CaveJFACEDialog {
super(parentShell);
}
protected WrapLengthDialog(Shell parentShell, boolean perspectiveSpecific) {
super(parentShell, perspectiveSpecific);
}
/**
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets
* .Composite)