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:
parent
81172cf692
commit
74f5f1e46b
8 changed files with 145 additions and 236 deletions
|
@ -1044,6 +1044,8 @@ class SmartScript(BaseTool.BaseTool):
|
|||
emptyEditAreaFlag = True
|
||||
else:
|
||||
emptyEditAreaFlag = False
|
||||
|
||||
javaDict = None
|
||||
if varDict is not None:
|
||||
javaDict = JUtil.pyValToJavaObj(varDict)
|
||||
|
||||
|
@ -1055,13 +1057,12 @@ class SmartScript(BaseTool.BaseTool):
|
|||
timeRange = timeRange.toJavaObj()
|
||||
|
||||
from com.raytheon.viz.gfe.smarttool import SmartUtil
|
||||
|
||||
result, returnedDict = SmartUtil.callFromSmartScript(self.__dataMgr, toolName, elementName, editArea,
|
||||
timeRange, javaDict, emptyEditAreaFlag,
|
||||
JUtil.pylistToJavaStringList(passErrors),
|
||||
missingDataMode, parm)
|
||||
|
||||
if returnedDict:
|
||||
if varDict is not None and returnedDict:
|
||||
returnedDict = JUtil.javaObjToPyVal(returnedDict)
|
||||
varDict.clear()
|
||||
varDict.update(returnedDict)
|
||||
|
@ -1082,13 +1083,14 @@ class SmartScript(BaseTool.BaseTool):
|
|||
else:
|
||||
timeRange = timeRange.toJavaObj()
|
||||
|
||||
from com.raytheon.viz.gfe.procedures import ProcedureUtil
|
||||
javaDict=None
|
||||
if varDict is not None:
|
||||
javaDict = JUtil.pyValToJavaObj(varDict)
|
||||
|
||||
from com.raytheon.viz.gfe.procedures import ProcedureUtil
|
||||
result, returnedDict = ProcedureUtil.callFromSmartScript(self.__dataMgr, name, editArea, timeRange, javaDict)
|
||||
|
||||
if returnedDict:
|
||||
if varDict is not None and returnedDict:
|
||||
returnedDict = JUtil.javaObjToPyVal(returnedDict)
|
||||
varDict.clear()
|
||||
varDict.update(returnedDict)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -40,6 +40,7 @@ import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
|
|||
* Feb 09, 2010 njensen Initial creation
|
||||
* Dec 09, 2013 #2367 dgilling Use new ProcedureJobPool.
|
||||
* Jul 17, 2015 4575 njensen Changed varDict from String to Map
|
||||
* Sep 23, 2015 4871 randerso Code clean up
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -49,18 +50,25 @@ import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
|
|||
|
||||
public class ProcedureSelectionDlg extends SelectionDlg {
|
||||
|
||||
public ProcedureSelectionDlg(Shell parent, String title,
|
||||
DataManager dataMgr, List<FieldDefinition> varList) {
|
||||
super(parent, title, dataMgr, varList);
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @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
|
||||
public void run() {
|
||||
protected void run() {
|
||||
PreviewInfo pi = ProcedureUtil.checkAndBuildPreview(dataMgr, name);
|
||||
if (pi != null) {
|
||||
ProcedureRequest req = ProcedureUtil.buildProcedureRequest(name,
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
@ -22,6 +22,7 @@ package com.raytheon.viz.gfe.procedures;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
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.smartscript.FieldDefinition;
|
||||
import com.raytheon.viz.gfe.smarttool.PreviewInfo;
|
||||
import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
|
||||
|
||||
/**
|
||||
* Utilities for GFE procedures
|
||||
|
@ -85,8 +87,10 @@ public class ProcedureUtil {
|
|||
req.setRefSet(pi.getEditAction().getRefSet());
|
||||
req.setTimeRange(pi.getEditAction().getTimeRange());
|
||||
|
||||
final int[] returnCode = new int[1];
|
||||
if (varDict != null) {
|
||||
req.setVarDict(varDict);
|
||||
returnCode[0] = IDialogConstants.OK_ID;
|
||||
} else {
|
||||
VizApp.runSync(new Runnable() {
|
||||
@Override
|
||||
|
@ -94,24 +98,32 @@ public class ProcedureUtil {
|
|||
List<FieldDefinition> varList = dm.getProcedureInterface()
|
||||
.getVarDictWidgets(procName);
|
||||
if ((varList != null) && (varList.size() > 0)) {
|
||||
// make the gui, let it handle running the procedure
|
||||
ProcedureSelectionBlockingDlg sd = new ProcedureSelectionBlockingDlg(
|
||||
PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getShell(),
|
||||
procName, dm, varList);
|
||||
/*
|
||||
* The SelectionDlg changes based on the procedure.
|
||||
* Since it is non-modal several dialogs may be
|
||||
* displayed. This mimics the AWIPS 1 behavior.
|
||||
*/
|
||||
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();
|
||||
Map<String, Object> resultMap = sd.getVarDictResult();
|
||||
if (resultMap != null) {
|
||||
req.setVarDict(resultMap);
|
||||
}
|
||||
} else {
|
||||
req.setVarDict(null);
|
||||
returnCode[0] = sd.getReturnCode();
|
||||
req.setVarDict(sd.getValues());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dm.getProcedureJobPool().schedule(req);
|
||||
return new Object[] { req.getResult(), req.getVarDict() };
|
||||
if (returnCode[0] == IDialogConstants.OK_ID) {
|
||||
dm.getProcedureJobPool().schedule(req);
|
||||
return new Object[] { req.getResult(), req.getVarDict() };
|
||||
}
|
||||
return new Object[] { null, null };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
**/
|
||||
package com.raytheon.viz.gfe.smarttool;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
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.parm.Parm;
|
||||
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.SmartToolSelectionDlg;
|
||||
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
|
||||
* 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.
|
||||
* Dec 10, 2013 2367 dgilling Use new SmartToolJobPool.
|
||||
* Jun 05, 2015 4259 njensen Removed LD_PRELOAD check
|
||||
|
@ -113,7 +112,7 @@ public class SmartUtil {
|
|||
return pi;
|
||||
}
|
||||
|
||||
public static Object[] callFromSmartScript(final DataManager dm,
|
||||
public static Object[] callFromSmartScript(final DataManager dataMgr,
|
||||
final String toolName, final String elementName,
|
||||
ReferenceData editArea, TimeRange timeRange,
|
||||
Map<String, Object> varDict, boolean emptyEditAreaFlag,
|
||||
|
@ -122,47 +121,47 @@ public class SmartUtil {
|
|||
timeRange, editArea, emptyEditAreaFlag,
|
||||
MissingDataMode.valueFrom(missingDataMode));
|
||||
PreviewInfo pi = new PreviewInfo(editAction, passErrors, parm);
|
||||
final SmartToolRequest req = SmartUtil.buildSmartToolRequest(dm, pi,
|
||||
false);
|
||||
final SmartToolRequest req = SmartUtil.buildSmartToolRequest(dataMgr,
|
||||
pi, false);
|
||||
|
||||
final int[] returnCode = new int[1];
|
||||
if (varDict != null) {
|
||||
req.setVarDict(varDict);
|
||||
returnCode[0] = IDialogConstants.OK_ID;
|
||||
} else {
|
||||
VizApp.runSync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<FieldDefinition> varList = dm.getSmartToolInterface()
|
||||
List<FieldDefinition> varList = dataMgr
|
||||
.getSmartToolInterface()
|
||||
.getVarDictWidgets(toolName);
|
||||
if ((varList != null) && (varList.size() > 0)) {
|
||||
// The SmartToolBlockingSelectionDlg changes based
|
||||
// on the procedure. Since it is non-modal several
|
||||
// dialogs may be displayed. This mimics the AWIPS 1
|
||||
// behavior.
|
||||
/*
|
||||
* The SelectionDlg changes based on the procedure.
|
||||
* Since it is non-modal several dialogs may be
|
||||
* 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(
|
||||
PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getShell(),
|
||||
toolName, dm, varList);
|
||||
|
||||
// must block because this method needs the results
|
||||
// to determine what to return.
|
||||
/*
|
||||
* must block because this method needs the results to
|
||||
* determine what to return.
|
||||
*/
|
||||
sd.setBlockOnOpen(true);
|
||||
sd.open();
|
||||
Map<String, Object> resultMap = sd.getVarDictResult();
|
||||
if (resultMap != null) {
|
||||
req.setVarDict(resultMap);
|
||||
}
|
||||
} else {
|
||||
// set it to something so we don't trigger the null
|
||||
// == user cancelled below
|
||||
req.setVarDict(Collections.<String, Object> emptyMap());
|
||||
returnCode[0] = sd.getReturnCode();
|
||||
req.setVarDict(sd.getValues());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dm.getSmartToolJobPool().schedule(req);
|
||||
return new Object[] { req.getResult(), req.getVarDict() };
|
||||
if (returnCode[0] == IDialogConstants.OK_ID) {
|
||||
dataMgr.getSmartToolJobPool().schedule(req);
|
||||
return new Object[] { req.getResult(), req.getVarDict() };
|
||||
}
|
||||
return new Object[] { null, null };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -42,6 +42,7 @@ import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
|
|||
* Jun 25, 2013 16065 ryu Passing outerLevel to tool job
|
||||
* Dec 10, 2013 #2367 dgilling Use new SmartToolJobPool.
|
||||
* Jul 17, 2015 4575 njensen Changed varDict from String to Map
|
||||
* Sep 23, 2015 4871 randerso Code clean up
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,18 +52,25 @@ import com.raytheon.viz.gfe.ui.runtimeui.SelectionDlg;
|
|||
|
||||
public class SmartToolSelectionDlg extends SelectionDlg {
|
||||
|
||||
public SmartToolSelectionDlg(Shell parent, String title,
|
||||
DataManager dataMgr, List<FieldDefinition> varList) {
|
||||
super(parent, title, dataMgr, varList);
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @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
|
||||
public void run() {
|
||||
protected void run() {
|
||||
PreviewInfo pi = SmartUtil.checkAndBuildPreview(dataMgr, name);
|
||||
if (pi != null) {
|
||||
SmartToolRequest req = SmartUtil.buildSmartToolRequest(dataMgr, pi,
|
||||
|
|
|
@ -44,16 +44,18 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 9, 2010 3353 njensen Initial creation
|
||||
* Jul 13,2011 9291 rferrel Convert to subclass of CaveJFACEDialog.
|
||||
* Nov 15,2012 1298 rferrel Code cleanup for non-blocking dialogs.
|
||||
* Feb 9, 2010 3353 njensen Initial creation
|
||||
* Jul 13, 2011 9291 rferrel Convert to subclass of CaveJFACEDialog.
|
||||
* 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>
|
||||
*
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class SelectionDlg extends CaveJFACEDialog {
|
||||
public class SelectionDlg extends CaveJFACEDialog {
|
||||
/**
|
||||
* The top composite.
|
||||
*/
|
||||
|
@ -65,6 +67,8 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
|
|||
|
||||
private List<FieldDefinition> fieldDefs;
|
||||
|
||||
private boolean fromProcedure;
|
||||
|
||||
@Override
|
||||
protected void buttonPressed(int buttonId) {
|
||||
setReturnCode(buttonId);
|
||||
|
@ -73,6 +77,7 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
|
|||
case RUN:
|
||||
run();
|
||||
break;
|
||||
case OK:
|
||||
case RUN_DISMISS:
|
||||
run();
|
||||
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);
|
||||
this.name = title;
|
||||
this.name = name;
|
||||
this.dataMgr = dataMgr;
|
||||
this.fieldDefs = fieldDefs;
|
||||
this.fromProcedure = fromProcedure;
|
||||
this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE);
|
||||
}
|
||||
|
||||
|
@ -104,7 +129,7 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
|
|||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText(this.name);
|
||||
newShell.setText(this.name + " Values");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -132,10 +157,15 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
|
|||
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
createButton(parent, ButtonConstant.RUN.id, ButtonConstant.RUN.label,
|
||||
false);
|
||||
createButton(parent, ButtonConstant.RUN_DISMISS.id,
|
||||
ButtonConstant.RUN_DISMISS.label, false);
|
||||
if (fromProcedure) {
|
||||
createButton(parent, ButtonConstant.OK.id, ButtonConstant.OK.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,
|
||||
ButtonConstant.CANCEL.label, false);
|
||||
|
||||
|
@ -145,7 +175,12 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
|
|||
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>();
|
||||
for (Widget w : this.comp.getWidgetList()) {
|
||||
if (!(w instanceof LabelWidget)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue