Omaha #4871 Fix error when procedure is called with varDict=None, fix issues when calling tools/procedures with dialogs

Change-Id: I8a43c13560da9e1434c24c5b6ff1ef3e1fed8602

Former-commit-id: bc377691615626b51c7b745e3e6647116b13093e
This commit is contained in:
Ron Anderson 2015-09-22 16:38:42 -05:00
parent 81172cf692
commit 74f5f1e46b
8 changed files with 145 additions and 236 deletions

View file

@ -1044,6 +1044,8 @@ class SmartScript(BaseTool.BaseTool):
emptyEditAreaFlag = True emptyEditAreaFlag = True
else: else:
emptyEditAreaFlag = False emptyEditAreaFlag = False
javaDict = None
if varDict is not None: if varDict is not None:
javaDict = JUtil.pyValToJavaObj(varDict) javaDict = JUtil.pyValToJavaObj(varDict)
@ -1055,13 +1057,12 @@ class SmartScript(BaseTool.BaseTool):
timeRange = timeRange.toJavaObj() timeRange = timeRange.toJavaObj()
from com.raytheon.viz.gfe.smarttool import SmartUtil from com.raytheon.viz.gfe.smarttool import SmartUtil
result, returnedDict = SmartUtil.callFromSmartScript(self.__dataMgr, toolName, elementName, editArea, result, returnedDict = SmartUtil.callFromSmartScript(self.__dataMgr, toolName, elementName, editArea,
timeRange, javaDict, emptyEditAreaFlag, timeRange, javaDict, emptyEditAreaFlag,
JUtil.pylistToJavaStringList(passErrors), JUtil.pylistToJavaStringList(passErrors),
missingDataMode, parm) missingDataMode, parm)
if returnedDict: if varDict is not None and returnedDict:
returnedDict = JUtil.javaObjToPyVal(returnedDict) returnedDict = JUtil.javaObjToPyVal(returnedDict)
varDict.clear() varDict.clear()
varDict.update(returnedDict) varDict.update(returnedDict)
@ -1082,13 +1083,14 @@ class SmartScript(BaseTool.BaseTool):
else: else:
timeRange = timeRange.toJavaObj() timeRange = timeRange.toJavaObj()
from com.raytheon.viz.gfe.procedures import ProcedureUtil javaDict=None
if varDict is not None: if varDict is not None:
javaDict = JUtil.pyValToJavaObj(varDict) javaDict = JUtil.pyValToJavaObj(varDict)
from com.raytheon.viz.gfe.procedures import ProcedureUtil
result, returnedDict = ProcedureUtil.callFromSmartScript(self.__dataMgr, name, editArea, timeRange, javaDict) result, returnedDict = ProcedureUtil.callFromSmartScript(self.__dataMgr, name, editArea, timeRange, javaDict)
if returnedDict: if varDict is not None and returnedDict:
returnedDict = JUtil.javaObjToPyVal(returnedDict) returnedDict = JUtil.javaObjToPyVal(returnedDict)
varDict.clear() varDict.clear()
varDict.update(returnedDict) varDict.update(returnedDict)

View file

@ -1,74 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.gfe.procedures;
import java.util.List;
import java.util.Map;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.smartscript.FieldDefinition;
import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 25, 2010 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class ProcedureSelectionBlockingDlg extends SelectionDlg {
private boolean run = false;
public ProcedureSelectionBlockingDlg(Shell parent, String title,
DataManager dataMgr, List<FieldDefinition> varList) {
super(parent, title, dataMgr, varList);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg#run()
*/
@Override
public void run() {
run = true;
}
public Map<String, Object> getVarDictResult() {
Map<String, Object> varDictResult = null;
if (run) {
varDictResult = this.getValues();
}
return varDictResult;
}
}

View file

@ -40,6 +40,7 @@ import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
* Feb 09, 2010 njensen Initial creation * Feb 09, 2010 njensen Initial creation
* Dec 09, 2013 #2367 dgilling Use new ProcedureJobPool. * Dec 09, 2013 #2367 dgilling Use new ProcedureJobPool.
* Jul 17, 2015 4575 njensen Changed varDict from String to Map * Jul 17, 2015 4575 njensen Changed varDict from String to Map
* Sep 23, 2015 4871 randerso Code clean up
* *
* </pre> * </pre>
* *
@ -49,18 +50,25 @@ import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
public class ProcedureSelectionDlg extends SelectionDlg { public class ProcedureSelectionDlg extends SelectionDlg {
public ProcedureSelectionDlg(Shell parent, String title, /**
DataManager dataMgr, List<FieldDefinition> varList) { * Constructor
super(parent, title, dataMgr, varList); *
* @param parent
* parent shell
* @param name
* name of smartTool/procedure
* @param dataMgr
* DataManager instance to use
* @param fieldDefs
* field definitions for dialog
*/
public ProcedureSelectionDlg(Shell parent, String name,
DataManager dataMgr, List<FieldDefinition> fieldDefs) {
super(parent, name, dataMgr, fieldDefs, false);
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg#run()
*/
@Override @Override
public void run() { protected void run() {
PreviewInfo pi = ProcedureUtil.checkAndBuildPreview(dataMgr, name); PreviewInfo pi = ProcedureUtil.checkAndBuildPreview(dataMgr, name);
if (pi != null) { if (pi != null) {
ProcedureRequest req = ProcedureUtil.buildProcedureRequest(name, ProcedureRequest req = ProcedureUtil.buildProcedureRequest(name,

View file

@ -1,19 +1,19 @@
/** /**
* This software was developed and / or modified by Raytheon Company, * This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government. * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
* *
* U.S. EXPORT CONTROLLED TECHNICAL DATA * U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose * This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination * export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires * to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization. * an export license or other authorization.
* *
* Contractor Name: Raytheon Company * Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340 * Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8 * Mail Stop B8
* Omaha, NE 68106 * Omaha, NE 68106
* 402.291.0100 * 402.291.0100
* *
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
@ -22,6 +22,7 @@ package com.raytheon.viz.gfe.procedures;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData; import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData;
@ -30,6 +31,7 @@ import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.smartscript.FieldDefinition; import com.raytheon.viz.gfe.smartscript.FieldDefinition;
import com.raytheon.viz.gfe.smarttool.PreviewInfo; import com.raytheon.viz.gfe.smarttool.PreviewInfo;
import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
/** /**
* Utilities for GFE procedures * Utilities for GFE procedures
@ -85,8 +87,10 @@ public class ProcedureUtil {
req.setRefSet(pi.getEditAction().getRefSet()); req.setRefSet(pi.getEditAction().getRefSet());
req.setTimeRange(pi.getEditAction().getTimeRange()); req.setTimeRange(pi.getEditAction().getTimeRange());
final int[] returnCode = new int[1];
if (varDict != null) { if (varDict != null) {
req.setVarDict(varDict); req.setVarDict(varDict);
returnCode[0] = IDialogConstants.OK_ID;
} else { } else {
VizApp.runSync(new Runnable() { VizApp.runSync(new Runnable() {
@Override @Override
@ -94,24 +98,32 @@ public class ProcedureUtil {
List<FieldDefinition> varList = dm.getProcedureInterface() List<FieldDefinition> varList = dm.getProcedureInterface()
.getVarDictWidgets(procName); .getVarDictWidgets(procName);
if ((varList != null) && (varList.size() > 0)) { if ((varList != null) && (varList.size() > 0)) {
// make the gui, let it handle running the procedure /*
ProcedureSelectionBlockingDlg sd = new ProcedureSelectionBlockingDlg( * The SelectionDlg changes based on the procedure.
PlatformUI.getWorkbench() * Since it is non-modal several dialogs may be
.getActiveWorkbenchWindow().getShell(), * displayed. This mimics the AWIPS 1 behavior.
procName, dm, varList); */
SelectionDlg sd = new SelectionDlg(PlatformUI
.getWorkbench().getActiveWorkbenchWindow()
.getShell(), procName, dm, varList, true);
/*
* must block because this method needs the results to
* determine what to return.
*/
sd.setBlockOnOpen(true);
sd.open(); sd.open();
Map<String, Object> resultMap = sd.getVarDictResult(); returnCode[0] = sd.getReturnCode();
if (resultMap != null) { req.setVarDict(sd.getValues());
req.setVarDict(resultMap);
}
} else {
req.setVarDict(null);
} }
} }
}); });
} }
dm.getProcedureJobPool().schedule(req); if (returnCode[0] == IDialogConstants.OK_ID) {
return new Object[] { req.getResult(), req.getVarDict() }; dm.getProcedureJobPool().schedule(req);
return new Object[] { req.getResult(), req.getVarDict() };
}
return new Object[] { null, null };
} }
} }

View file

@ -19,10 +19,10 @@
**/ **/
package com.raytheon.viz.gfe.smarttool; package com.raytheon.viz.gfe.smarttool;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData; import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData;
@ -32,7 +32,6 @@ import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory; import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.parm.Parm; import com.raytheon.viz.gfe.core.parm.Parm;
import com.raytheon.viz.gfe.smartscript.FieldDefinition; import com.raytheon.viz.gfe.smartscript.FieldDefinition;
import com.raytheon.viz.gfe.smarttool.script.SmartToolBlockingSelectionDlg;
import com.raytheon.viz.gfe.smarttool.script.SmartToolRequest; import com.raytheon.viz.gfe.smarttool.script.SmartToolRequest;
import com.raytheon.viz.gfe.smarttool.script.SmartToolSelectionDlg; import com.raytheon.viz.gfe.smarttool.script.SmartToolSelectionDlg;
import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg; import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
@ -46,7 +45,7 @@ import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 21, 2008 njensen Initial creation * Feb 21, 2008 njensen Initial creation
* Dec 1, 2009 1426 ryu Add time range warning * Dec 1, 2009 1426 ryu Add time range warning
* Nov 15, 2012 1298 rferrel Changes for non-blocking prcedures. * Nov 15, 2012 1298 rferrel Changes for non-blocking procedures.
* Jun 25, 2013 16065 ryu Passing outerLevel to smart tool job. * Jun 25, 2013 16065 ryu Passing outerLevel to smart tool job.
* Dec 10, 2013 2367 dgilling Use new SmartToolJobPool. * Dec 10, 2013 2367 dgilling Use new SmartToolJobPool.
* Jun 05, 2015 4259 njensen Removed LD_PRELOAD check * Jun 05, 2015 4259 njensen Removed LD_PRELOAD check
@ -113,7 +112,7 @@ public class SmartUtil {
return pi; return pi;
} }
public static Object[] callFromSmartScript(final DataManager dm, public static Object[] callFromSmartScript(final DataManager dataMgr,
final String toolName, final String elementName, final String toolName, final String elementName,
ReferenceData editArea, TimeRange timeRange, ReferenceData editArea, TimeRange timeRange,
Map<String, Object> varDict, boolean emptyEditAreaFlag, Map<String, Object> varDict, boolean emptyEditAreaFlag,
@ -122,47 +121,47 @@ public class SmartUtil {
timeRange, editArea, emptyEditAreaFlag, timeRange, editArea, emptyEditAreaFlag,
MissingDataMode.valueFrom(missingDataMode)); MissingDataMode.valueFrom(missingDataMode));
PreviewInfo pi = new PreviewInfo(editAction, passErrors, parm); PreviewInfo pi = new PreviewInfo(editAction, passErrors, parm);
final SmartToolRequest req = SmartUtil.buildSmartToolRequest(dm, pi, final SmartToolRequest req = SmartUtil.buildSmartToolRequest(dataMgr,
false); pi, false);
final int[] returnCode = new int[1];
if (varDict != null) { if (varDict != null) {
req.setVarDict(varDict); req.setVarDict(varDict);
returnCode[0] = IDialogConstants.OK_ID;
} else { } else {
VizApp.runSync(new Runnable() { VizApp.runSync(new Runnable() {
@Override @Override
public void run() { public void run() {
List<FieldDefinition> varList = dm.getSmartToolInterface() List<FieldDefinition> varList = dataMgr
.getSmartToolInterface()
.getVarDictWidgets(toolName); .getVarDictWidgets(toolName);
if ((varList != null) && (varList.size() > 0)) { if ((varList != null) && (varList.size() > 0)) {
// The SmartToolBlockingSelectionDlg changes based /*
// on the procedure. Since it is non-modal several * The SelectionDlg changes based on the procedure.
// dialogs may be displayed. This mimics the AWIPS 1 * Since it is non-modal several dialogs may be
// behavior. * displayed. This mimics the AWIPS 1 behavior.
*/
SelectionDlg sd = new SelectionDlg(PlatformUI
.getWorkbench().getActiveWorkbenchWindow()
.getShell(), toolName, dataMgr, varList, true);
// make the gui, let it handle running the procedure /*
SmartToolBlockingSelectionDlg sd = new SmartToolBlockingSelectionDlg( * must block because this method needs the results to
PlatformUI.getWorkbench() * determine what to return.
.getActiveWorkbenchWindow().getShell(), */
toolName, dm, varList);
// must block because this method needs the results
// to determine what to return.
sd.setBlockOnOpen(true); sd.setBlockOnOpen(true);
sd.open(); sd.open();
Map<String, Object> resultMap = sd.getVarDictResult(); returnCode[0] = sd.getReturnCode();
if (resultMap != null) { req.setVarDict(sd.getValues());
req.setVarDict(resultMap);
}
} else {
// set it to something so we don't trigger the null
// == user cancelled below
req.setVarDict(Collections.<String, Object> emptyMap());
} }
} }
}); });
} }
dm.getSmartToolJobPool().schedule(req); if (returnCode[0] == IDialogConstants.OK_ID) {
return new Object[] { req.getResult(), req.getVarDict() }; dataMgr.getSmartToolJobPool().schedule(req);
return new Object[] { req.getResult(), req.getVarDict() };
}
return new Object[] { null, null };
} }
} }

View file

@ -1,81 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.gfe.smarttool.script;
import java.util.List;
import java.util.Map;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.smartscript.FieldDefinition;
import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 8, 2010 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public class SmartToolBlockingSelectionDlg extends SelectionDlg {
private boolean run = false;
/**
* @param parent
* @param title
* @param dataMgr
* @param fieldDefs
*/
public SmartToolBlockingSelectionDlg(Shell parent, String title,
DataManager dataMgr, List<FieldDefinition> fieldDefs) {
super(parent, title, dataMgr, fieldDefs);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg#run()
*/
@Override
public void run() {
run = true;
}
public Map<String, Object> getVarDictResult() {
Map<String, Object> varDictResult = null;
if (run) {
varDictResult = this.getValues();
}
return varDictResult;
}
}

View file

@ -42,6 +42,7 @@ import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
* Jun 25, 2013 16065 ryu Passing outerLevel to tool job * Jun 25, 2013 16065 ryu Passing outerLevel to tool job
* Dec 10, 2013 #2367 dgilling Use new SmartToolJobPool. * Dec 10, 2013 #2367 dgilling Use new SmartToolJobPool.
* Jul 17, 2015 4575 njensen Changed varDict from String to Map * Jul 17, 2015 4575 njensen Changed varDict from String to Map
* Sep 23, 2015 4871 randerso Code clean up
* *
* </pre> * </pre>
* *
@ -51,18 +52,25 @@ import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
public class SmartToolSelectionDlg extends SelectionDlg { public class SmartToolSelectionDlg extends SelectionDlg {
public SmartToolSelectionDlg(Shell parent, String title, /**
DataManager dataMgr, List<FieldDefinition> varList) { * Constructor
super(parent, title, dataMgr, varList); *
* @param parent
* parent shell
* @param name
* name of smartTool/procedure
* @param dataMgr
* DataManager instance to use
* @param fieldDefs
* field definitions for dialog
*/
public SmartToolSelectionDlg(Shell parent, String name,
DataManager dataMgr, List<FieldDefinition> fieldDefs) {
super(parent, name, dataMgr, fieldDefs, false);
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg#run()
*/
@Override @Override
public void run() { protected void run() {
PreviewInfo pi = SmartUtil.checkAndBuildPreview(dataMgr, name); PreviewInfo pi = SmartUtil.checkAndBuildPreview(dataMgr, name);
if (pi != null) { if (pi != null) {
SmartToolRequest req = SmartUtil.buildSmartToolRequest(dataMgr, pi, SmartToolRequest req = SmartUtil.buildSmartToolRequest(dataMgr, pi,

View file

@ -44,16 +44,18 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 9, 2010 3353 njensen Initial creation * Feb 9, 2010 3353 njensen Initial creation
* Jul 13,2011 9291 rferrel Convert to subclass of CaveJFACEDialog. * Jul 13, 2011 9291 rferrel Convert to subclass of CaveJFACEDialog.
* Nov 15,2012 1298 rferrel Code cleanup for non-blocking dialogs. * Nov 15, 2012 1298 rferrel Code cleanup for non-blocking dialogs.
* Sep 23, 2015 4871 randerso Changed to concrete class with do nothing run method
* Added flag to change buttons when called from procedure
* *
* </pre> * </pre>
* *
* @version 1.0 * @version 1.0
*/ */
public abstract class SelectionDlg extends CaveJFACEDialog { public class SelectionDlg extends CaveJFACEDialog {
/** /**
* The top composite. * The top composite.
*/ */
@ -65,6 +67,8 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
private List<FieldDefinition> fieldDefs; private List<FieldDefinition> fieldDefs;
private boolean fromProcedure;
@Override @Override
protected void buttonPressed(int buttonId) { protected void buttonPressed(int buttonId) {
setReturnCode(buttonId); setReturnCode(buttonId);
@ -73,6 +77,7 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
case RUN: case RUN:
run(); run();
break; break;
case OK:
case RUN_DISMISS: case RUN_DISMISS:
run(); run();
close(); close();
@ -83,14 +88,34 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
} }
} }
public abstract void run(); /**
* Method called when the Run, Run/Dismiss, or OK buttons are pressed.
*/
protected void run() {
// Base dialog does nothing for case when called from procedure.
}
public SelectionDlg(Shell parent, String title, DataManager dataMgr, /**
List<FieldDefinition> fieldDefs) { * Constructor
*
* @param parent
* parent shell
* @param name
* name of smartTool/procedure
* @param dataMgr
* DataManager instance to use
* @param fieldDefs
* field definitions for dialog
* @param fromProcedure
* true if being called from procedure
*/
public SelectionDlg(Shell parent, String name, DataManager dataMgr,
List<FieldDefinition> fieldDefs, boolean fromProcedure) {
super(parent); super(parent);
this.name = title; this.name = name;
this.dataMgr = dataMgr; this.dataMgr = dataMgr;
this.fieldDefs = fieldDefs; this.fieldDefs = fieldDefs;
this.fromProcedure = fromProcedure;
this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE); this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE);
} }
@ -104,7 +129,7 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
@Override @Override
protected void configureShell(Shell newShell) { protected void configureShell(Shell newShell) {
super.configureShell(newShell); super.configureShell(newShell);
newShell.setText(this.name); newShell.setText(this.name + " Values");
} }
/* /*
@ -132,10 +157,15 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
@Override @Override
protected void createButtonsForButtonBar(Composite parent) { protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, ButtonConstant.RUN.id, ButtonConstant.RUN.label, if (fromProcedure) {
false); createButton(parent, ButtonConstant.OK.id, ButtonConstant.OK.label,
createButton(parent, ButtonConstant.RUN_DISMISS.id, false);
ButtonConstant.RUN_DISMISS.label, false); } else {
createButton(parent, ButtonConstant.RUN.id,
ButtonConstant.RUN.label, false);
createButton(parent, ButtonConstant.RUN_DISMISS.id,
ButtonConstant.RUN_DISMISS.label, false);
}
createButton(parent, ButtonConstant.CANCEL.id, createButton(parent, ButtonConstant.CANCEL.id,
ButtonConstant.CANCEL.label, false); ButtonConstant.CANCEL.label, false);
@ -145,7 +175,12 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
parent.getSize().y + 20); parent.getSize().y + 20);
} }
protected Map<String, Object> getValues() { /**
* Get values from dialog
*
* @return map of field labels to values
*/
public Map<String, Object> getValues() {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
for (Widget w : this.comp.getWidgetList()) { for (Widget w : this.comp.getWidgetList()) {
if (!(w instanceof LabelWidget)) { if (!(w instanceof LabelWidget)) {