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

Former-commit-id: 8613c7e96d [formerly 13940124bc] [formerly 8613c7e96d [formerly 13940124bc] [formerly 94efec9ec3 [formerly 12b144082433cbc6e54e80edf5a4ae4069e45b84]]]
Former-commit-id: 94efec9ec3
Former-commit-id: 2fbb05b3f7 [formerly cbdcae287a]
Former-commit-id: ed41c37fd2
This commit is contained in:
David Gillingham 2013-04-24 15:15:13 -05:00
parent 0d05710fa3
commit 5fabc47bb6
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.ui.PlatformUI;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog;
/**
* TODO Add Description FormatterlauncherAction.java Apr 11, 2008
* Displays Formatter Launcher dialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 11, 2008 Eric Babin Initial Creation
* Oct 23, 2012 1287 rferrel Changes for non-blocking FormatterLauncherDialog.
* Apr 11, 2008 ebabin Initial creation
* Oct 23, 2012 1287 rferrel Changes for non-blocking FormatterLauncherDialog.
* Apr 24, 2013 1936 dgilling Pass DataManager to
* FormatterLauncherDialog via constructor.
*
* </pre>
*
@ -60,7 +66,8 @@ public class FormatterlauncherAction extends AbstractHandler {
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
dialog = new FormatterLauncherDialog(shell);
DataManager dm = DataManagerUIFactory.getCurrentInstance();
dialog = new FormatterLauncherDialog(shell, dm);
dialog.setBlockOnOpen(false);
dialog.open();
} 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.script.SmartToolFactory;
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
@ -93,6 +94,8 @@ import com.raytheon.viz.gfe.smarttool.script.SmartToolUIController;
* 02/15/2013 1507 dgilling Force procedureInterface and
* smartToolInterface to be
* initialized by constructor.
* 04/24/2013 1936 dgilling Move initialization of TextProductMgr
* to GFE startup.
*
* </pre>
*
@ -159,6 +162,8 @@ public class DataManager {
private ProcedureUIController procedureInterface;
private TextProductManager textProductMgr;
private IToolController itoolInterface;
private EditActionProcessor editActionProcessor;
@ -507,6 +512,8 @@ public class DataManager {
statusHandler.handle(Priority.PROBLEM,
"Error initializing smart tool interface", e);
}
DataManager.this.textProductMgr = new TextProductManager();
}
});
}
@ -685,4 +692,8 @@ public class DataManager {
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.
* Oct 23, 2012 1287 rferrel Changes for non-blocking dialogs and code clean up.
* 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>
*
@ -205,6 +208,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
private TextProductManager textProductMgr;
private DataManager dataMgr;
private String selectedDataSource = null;
private boolean doClose = false;
@ -214,12 +219,14 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
*
* @param parent
* Parent Shell.
* @param dataMgr
* DataManager instance.
*/
public FormatterLauncherDialog(Shell parent) {
public FormatterLauncherDialog(Shell parent, DataManager dataMgr) {
super(parent);
setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE | SWT.RESIZE);
textProductMgr = new TextProductManager();
this.dataMgr = dataMgr;
this.textProductMgr = this.dataMgr.getTextProductMgr();
}
@Override
@ -326,10 +333,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
// Create all the items in the Data Source dropdown menu
// ------------------------------------------------------
DataManager dm = DataManager.getCurrentInstance();
// Get the CAVE operating mode
CAVEMode mode = dm.getOpMode();
CAVEMode mode = dataMgr.getOpMode();
// Forecast menu item, set text based on operating mode
fcstMI = new MenuItem(dataSourceMenu, SWT.RADIO);
@ -345,8 +350,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
fcstMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
selectedDataSource = DataManager.getCurrentInstance()
.getParmManager().getMutableDatabase().toString();
selectedDataSource = dataMgr.getParmManager()
.getMutableDatabase().toString();
}
});
@ -382,8 +387,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
}
});
} else {
selectedDataSource = DataManager.getCurrentInstance()
.getParmManager().getMutableDatabase().toString();
selectedDataSource = dataMgr.getParmManager().getMutableDatabase()
.toString();
}
}
@ -735,8 +740,9 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
ProductDefinition prodDef = textProductMgr
.getProductDefinition(productName);
String dataSource = (String) prodDef.get("database");
if (dataSource == null)
if (dataSource == null) {
dataSource = "Official";
}
if (dataSource.equals("ISC")) {
selectedDataSource = getIscDataSource();
@ -787,6 +793,7 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
* @param tabName
* Name of the tab to be removed.
*/
@Override
public void removeProductTab(String tabName) {
TabItem[] items = tabFolder.getItems();
@ -808,6 +815,7 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
* @param tabName
* Name of the tab.
*/
@Override
public void setTabState(ConfigData.productStateEnum state, String tabName) {
TabItem[] items = tabFolder.getItems();
@ -999,8 +1007,7 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
* @return The FcstDataSource
*/
private String getFcstDataSource() {
return DataManager.getCurrentInstance().getParmManager()
.getMutableDatabase().toString();
return dataMgr.getParmManager().getMutableDatabase().toString();
}
/**
@ -1012,8 +1019,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
* @return The ISC Data Source
*/
private String getIscDataSource() {
java.util.List<DatabaseID> dbs = DataManager.getCurrentInstance()
.getParmManager().getIscDatabases();
java.util.List<DatabaseID> dbs = dataMgr.getParmManager()
.getIscDatabases();
if (dbs.size() > 0) {
// Always return the last one in the list
@ -1031,8 +1038,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
private String getOfficialDataSource() {
String source = null;
try {
ServerResponse<java.util.List<DatabaseID>> sr = DataManager
.getCurrentInstance().getClient().getOfficialDBName();
ServerResponse<java.util.List<DatabaseID>> sr = dataMgr.getClient()
.getOfficialDBName();
source = sr.getPayload().get(0).toString();
} catch (GFEServerException e) {
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.exception.VizException;
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;
/**
@ -59,6 +57,7 @@ import com.raytheon.viz.gfe.core.DataManager;
* ------------ ---------- ----------- --------------------------
* May 1, 2009 njensen Initial creation
* Jan 15, 2010 3395 ryu Fix &quot;issued by&quot; functionality
* Apr 24, 2013 1936 dgilling Remove unused imports.
*
* </pre>
*
@ -67,7 +66,8 @@ import com.raytheon.viz.gfe.core.DataManager;
*/
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 = "";
@ -224,8 +224,8 @@ public class TextProductManager {
try {
varDict = (String) script.execute("getVarDict", map);
} catch (JepException e) {
statusHandler.handle(Priority.PROBLEM,
"Exception getting VarDict", e);
statusHandler.handle(Priority.PROBLEM, "Exception getting VarDict",
e);
}
return varDict;