Issue #1936: Initialize TextProductManager with DataManager to remove delay when first launching Formatter Launcher.

Former-commit-id: 94efec9ec3 [formerly 12b144082433cbc6e54e80edf5a4ae4069e45b84]
Former-commit-id: 13940124bc
This commit is contained in:
David Gillingham 2013-04-24 15:15:13 -05:00
parent 3f682899e0
commit 8613c7e96d
4 changed files with 51 additions and 26 deletions

View file

@ -25,17 +25,23 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog; import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog;
/** /**
* TODO Add Description FormatterlauncherAction.java Apr 11, 2008 * Displays Formatter Launcher dialog.
* *
* <pre> * <pre>
*
* SOFTWARE HISTORY * SOFTWARE HISTORY
*
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 11, 2008 Eric Babin Initial Creation * Apr 11, 2008 ebabin Initial creation
* Oct 23, 2012 1287 rferrel Changes for non-blocking FormatterLauncherDialog. * Oct 23, 2012 1287 rferrel Changes for non-blocking FormatterLauncherDialog.
* Apr 24, 2013 1936 dgilling Pass DataManager to
* FormatterLauncherDialog via constructor.
* *
* </pre> * </pre>
* *
@ -60,7 +66,8 @@ public class FormatterlauncherAction extends AbstractHandler {
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell(); .getShell();
dialog = new FormatterLauncherDialog(shell); DataManager dm = DataManagerUIFactory.getCurrentInstance();
dialog = new FormatterLauncherDialog(shell, dm);
dialog.setBlockOnOpen(false); dialog.setBlockOnOpen(false);
dialog.open(); dialog.open();
} else { } else {

View file

@ -74,6 +74,7 @@ import com.raytheon.viz.gfe.smarttool.EditActionProcessor;
import com.raytheon.viz.gfe.smarttool.GridCycler; import com.raytheon.viz.gfe.smarttool.GridCycler;
import com.raytheon.viz.gfe.smarttool.script.SmartToolFactory; import com.raytheon.viz.gfe.smarttool.script.SmartToolFactory;
import com.raytheon.viz.gfe.smarttool.script.SmartToolUIController; import com.raytheon.viz.gfe.smarttool.script.SmartToolUIController;
import com.raytheon.viz.gfe.textformatter.TextProductManager;
/** /**
* DataManager is the central singleton in GFE upon which other managers are * DataManager is the central singleton in GFE upon which other managers are
@ -93,6 +94,8 @@ import com.raytheon.viz.gfe.smarttool.script.SmartToolUIController;
* 02/15/2013 1507 dgilling Force procedureInterface and * 02/15/2013 1507 dgilling Force procedureInterface and
* smartToolInterface to be * smartToolInterface to be
* initialized by constructor. * initialized by constructor.
* 04/24/2013 1936 dgilling Move initialization of TextProductMgr
* to GFE startup.
* *
* </pre> * </pre>
* *
@ -159,6 +162,8 @@ public class DataManager {
private ProcedureUIController procedureInterface; private ProcedureUIController procedureInterface;
private TextProductManager textProductMgr;
private IToolController itoolInterface; private IToolController itoolInterface;
private EditActionProcessor editActionProcessor; private EditActionProcessor editActionProcessor;
@ -507,6 +512,8 @@ public class DataManager {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error initializing smart tool interface", e); "Error initializing smart tool interface", e);
} }
DataManager.this.textProductMgr = new TextProductManager();
} }
}); });
} }
@ -685,4 +692,8 @@ public class DataManager {
return initStatus; return initStatus;
} }
public TextProductManager getTextProductMgr() {
return textProductMgr;
}
} }

View file

@ -92,6 +92,9 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Jul 26, 2012 15165 ryu Set default db source when formatter has no db defined. * Jul 26, 2012 15165 ryu Set default db source when formatter has no db defined.
* Oct 23, 2012 1287 rferrel Changes for non-blocking dialogs and code clean up. * Oct 23, 2012 1287 rferrel Changes for non-blocking dialogs and code clean up.
* Nov 08, 2012 1298 rferrel Changes for non-blocking IssuanceSiteIdDlg. * Nov 08, 2012 1298 rferrel Changes for non-blocking IssuanceSiteIdDlg.
* Apr 24, 2013 1936 dgilling Remove initialization of
* TextProductManager from this class, clean
* up warnings.
* *
* </pre> * </pre>
* *
@ -205,6 +208,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
private TextProductManager textProductMgr; private TextProductManager textProductMgr;
private DataManager dataMgr;
private String selectedDataSource = null; private String selectedDataSource = null;
private boolean doClose = false; private boolean doClose = false;
@ -214,12 +219,14 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
* *
* @param parent * @param parent
* Parent Shell. * Parent Shell.
* @param dataMgr
* DataManager instance.
*/ */
public FormatterLauncherDialog(Shell parent) { public FormatterLauncherDialog(Shell parent, DataManager dataMgr) {
super(parent); super(parent);
setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE | SWT.RESIZE); setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE | SWT.RESIZE);
this.dataMgr = dataMgr;
textProductMgr = new TextProductManager(); this.textProductMgr = this.dataMgr.getTextProductMgr();
} }
@Override @Override
@ -326,10 +333,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
// Create all the items in the Data Source dropdown menu // Create all the items in the Data Source dropdown menu
// ------------------------------------------------------ // ------------------------------------------------------
DataManager dm = DataManager.getCurrentInstance();
// Get the CAVE operating mode // Get the CAVE operating mode
CAVEMode mode = dm.getOpMode(); CAVEMode mode = dataMgr.getOpMode();
// Forecast menu item, set text based on operating mode // Forecast menu item, set text based on operating mode
fcstMI = new MenuItem(dataSourceMenu, SWT.RADIO); fcstMI = new MenuItem(dataSourceMenu, SWT.RADIO);
@ -345,8 +350,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
fcstMI.addSelectionListener(new SelectionAdapter() { fcstMI.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
selectedDataSource = DataManager.getCurrentInstance() selectedDataSource = dataMgr.getParmManager()
.getParmManager().getMutableDatabase().toString(); .getMutableDatabase().toString();
} }
}); });
@ -382,8 +387,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
} }
}); });
} else { } else {
selectedDataSource = DataManager.getCurrentInstance() selectedDataSource = dataMgr.getParmManager().getMutableDatabase()
.getParmManager().getMutableDatabase().toString(); .toString();
} }
} }
@ -735,8 +740,9 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
ProductDefinition prodDef = textProductMgr ProductDefinition prodDef = textProductMgr
.getProductDefinition(productName); .getProductDefinition(productName);
String dataSource = (String) prodDef.get("database"); String dataSource = (String) prodDef.get("database");
if (dataSource == null) if (dataSource == null) {
dataSource = "Official"; dataSource = "Official";
}
if (dataSource.equals("ISC")) { if (dataSource.equals("ISC")) {
selectedDataSource = getIscDataSource(); selectedDataSource = getIscDataSource();
@ -787,6 +793,7 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
* @param tabName * @param tabName
* Name of the tab to be removed. * Name of the tab to be removed.
*/ */
@Override
public void removeProductTab(String tabName) { public void removeProductTab(String tabName) {
TabItem[] items = tabFolder.getItems(); TabItem[] items = tabFolder.getItems();
@ -808,6 +815,7 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
* @param tabName * @param tabName
* Name of the tab. * Name of the tab.
*/ */
@Override
public void setTabState(ConfigData.productStateEnum state, String tabName) { public void setTabState(ConfigData.productStateEnum state, String tabName) {
TabItem[] items = tabFolder.getItems(); TabItem[] items = tabFolder.getItems();
@ -999,8 +1007,7 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
* @return The FcstDataSource * @return The FcstDataSource
*/ */
private String getFcstDataSource() { private String getFcstDataSource() {
return DataManager.getCurrentInstance().getParmManager() return dataMgr.getParmManager().getMutableDatabase().toString();
.getMutableDatabase().toString();
} }
/** /**
@ -1012,8 +1019,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
* @return The ISC Data Source * @return The ISC Data Source
*/ */
private String getIscDataSource() { private String getIscDataSource() {
java.util.List<DatabaseID> dbs = DataManager.getCurrentInstance() java.util.List<DatabaseID> dbs = dataMgr.getParmManager()
.getParmManager().getIscDatabases(); .getIscDatabases();
if (dbs.size() > 0) { if (dbs.size() > 0) {
// Always return the last one in the list // Always return the last one in the list
@ -1031,8 +1038,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
private String getOfficialDataSource() { private String getOfficialDataSource() {
String source = null; String source = null;
try { try {
ServerResponse<java.util.List<DatabaseID>> sr = DataManager ServerResponse<java.util.List<DatabaseID>> sr = dataMgr.getClient()
.getCurrentInstance().getClient().getOfficialDBName(); .getOfficialDBName();
source = sr.getPayload().get(0).toString(); source = sr.getPayload().get(0).toString();
} catch (GFEServerException e) { } catch (GFEServerException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,

View file

@ -45,8 +45,6 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.constants.StatusConstants;
import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.DataManager;
/** /**
@ -59,6 +57,7 @@ import com.raytheon.viz.gfe.core.DataManager;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 1, 2009 njensen Initial creation * May 1, 2009 njensen Initial creation
* Jan 15, 2010 3395 ryu Fix &quot;issued by&quot; functionality * Jan 15, 2010 3395 ryu Fix &quot;issued by&quot; functionality
* Apr 24, 2013 1936 dgilling Remove unused imports.
* *
* </pre> * </pre>
* *
@ -67,7 +66,8 @@ import com.raytheon.viz.gfe.core.DataManager;
*/ */
public class TextProductManager { public class TextProductManager {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(TextProductManager.class); private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TextProductManager.class);
private String issuedBy = ""; private String issuedBy = "";
@ -224,8 +224,8 @@ public class TextProductManager {
try { try {
varDict = (String) script.execute("getVarDict", map); varDict = (String) script.execute("getVarDict", map);
} catch (JepException e) { } catch (JepException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM, "Exception getting VarDict",
"Exception getting VarDict", e); e);
} }
return varDict; return varDict;