Merge "Issue #1229 Changes for non-blocking SaveColorMapDialog." into development

Former-commit-id: 191537fbfc3e1933121cf133f7b906a9f59cab3d
This commit is contained in:
Lee Venable 2012-10-17 08:26:53 -05:00 committed by Gerrit Code Review
commit 526085140a
2 changed files with 44 additions and 17 deletions

View file

@ -63,6 +63,7 @@ import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.UiPlugin;
import com.raytheon.viz.ui.VizWorkbenchManager;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
import com.raytheon.viz.ui.editor.ISelectedPanesChangedListener;
@ -75,6 +76,7 @@ import com.raytheon.viz.ui.editor.ISelectedPanesChangedListener;
* ------------ ---------- ----------- --------------------------
* lvenable Initial Creation.
* Jul 24, 2007 njensen Hooked into backend.
* Oct 17, 2012 1229 rferrel Changes for non-blocking SaveColorMapDialog.
*
* </pre>
*
@ -85,10 +87,10 @@ public class ColorEditDialog extends CaveSWTDialog implements
IVizEditorChangedListener, IRenderableDisplayChangedListener,
RemoveListener, AddListener, IResourceDataChanged,
ISelectedPanesChangedListener, IColorEditCompCallback {
private static final transient IUFStatusHandler statusHandler = UFStatus
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ColorEditDialog.class);
private static final String NO_COLOR_TABLE = "No color table is being edited";
private final String NO_COLOR_TABLE = "No color table is being edited";
private String currentColormapName;
@ -144,6 +146,10 @@ public class ColorEditDialog extends CaveSWTDialog implements
private static ColorEditDialog instance = null;
private SaveColorMapDialog officeSaveAsDialog;
private SaveColorMapDialog saveAsDialog;
public static void openDialog(Shell parent,
IDisplayPaneContainer container,
AbstractVizResource<?, ?> singleRscToEdit, boolean rightImages,
@ -831,24 +837,44 @@ public class ColorEditDialog extends CaveSWTDialog implements
}
private void officeSaveAs() {
SaveColorMapDialog saveDialog = new SaveColorMapDialog(shell,
(ColorMap) cap.getColorMapParameters().getColorMap(), true,
currentColormapName);
String newName = (String) saveDialog.open();
if (newName != null) {
currentColormapName = newName;
completeSave();
if (mustCreate(officeSaveAsDialog)) {
officeSaveAsDialog = new SaveColorMapDialog(shell, (ColorMap) cap
.getColorMapParameters().getColorMap(), true,
currentColormapName);
officeSaveAsDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof String) {
currentColormapName = (String) returnValue;
completeSave();
}
}
});
officeSaveAsDialog.open();
} else {
officeSaveAsDialog.bringToTop();
}
}
private void saveAs() {
SaveColorMapDialog saveDialog = new SaveColorMapDialog(shell,
(ColorMap) cap.getColorMapParameters().getColorMap(), false,
currentColormapName);
String newName = (String) saveDialog.open();
if (newName != null) {
currentColormapName = newName;
completeSave();
if (mustCreate(saveAsDialog)) {
saveAsDialog = new SaveColorMapDialog(shell, (ColorMap) cap
.getColorMapParameters().getColorMap(), false,
currentColormapName);
saveAsDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof String) {
currentColormapName = (String) returnValue;
completeSave();
}
}
});
saveAsDialog.open();
} else {
saveAsDialog.bringToTop();
}
}

View file

@ -55,6 +55,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 24, 2007 njensen Initial creation
* Oct 17, 2012 1229 rferrel Dialog is non-blocking.
*
* </pre>
*
@ -85,7 +86,7 @@ public class SaveColorMapDialog extends CaveSWTDialog {
*/
public SaveColorMapDialog(Shell parent, ColorMap aColorMap,
boolean aSiteContext, String aCurrentColormapName) {
super(parent);
super(parent, SWT.NONE, CAVE.DO_NOT_BLOCK);
colorMapToSave = aColorMap;
siteContext = aSiteContext;
currentColormapName = new String(aCurrentColormapName == null ? ""