Merge "Issue #1507: Improve responsiveness of menus that list smart tools or procedures by forcing UIControllers to be constructed at startup, not on demand." into development

Former-commit-id: a6d87cdd7e [formerly e70cfc5825 [formerly a1e38ed2f2da79028b04589a548b16543700f08f]]
Former-commit-id: e70cfc5825
Former-commit-id: cf0fc8d921
This commit is contained in:
Ron Anderson 2013-02-18 08:31:50 -06:00 committed by Gerrit Code Review
commit 7d09df8468

View file

@ -90,6 +90,9 @@ import com.raytheon.viz.gfe.smarttool.script.SmartToolUIController;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 03/12/2008 chammack Initial Creation.
* 02/15/2013 1507 dgilling Force procedureInterface and
* smartToolInterface to be
* initialized by constructor.
*
* </pre>
*
@ -217,7 +220,9 @@ public class DataManager {
SelectTRMgrInitJob strInitJob = new SelectTRMgrInitJob(this);
strInitJob.setSystem(true);
strInitJob.schedule();
// this.selectTimeRangeManager = new SelectTimeRangeManager(this);
initializeScriptControllers();
this.weGroupManager = new WEGroupManager(this);
this.editActionProcessor = new EditActionProcessor(this);
@ -474,41 +479,43 @@ public class DataManager {
this.gridManager = gridManager;
}
public SmartToolUIController getSmartToolInterface() {
if (smartToolInterface == null) {
VizApp.runSync(new Runnable() {
private void initializeScriptControllers() {
// it would be really nice to be able to spawn the construction of these
// two heavy objects into another thread. Unfortunately, Jep requires
// creation and all subsequent access to happen on the same thread. So
// we need to make use of runSync() here. It would be even be acceptable
// if we could make this a UIJob; unfortunately the thread most often
// used to create DataManager is the UI thread at perspective open, so
// we can't block and wait on the UI thread for a job that
// requires the UI thread to run.
VizApp.runSync(new Runnable() {
@Override
public void run() {
try {
DataManager.this.smartToolInterface = SmartToolFactory
.buildUIController(DataManager.this);
} catch (JepException e) {
statusHandler.handle(Priority.PROBLEM,
"Error initializing smart tool interface", e);
}
@Override
public void run() {
try {
DataManager.this.procedureInterface = ProcedureFactory
.buildUIController(DataManager.this);
} catch (JepException e) {
statusHandler.handle(Priority.PROBLEM,
"Error initializing procedure interface", e);
}
});
}
try {
DataManager.this.smartToolInterface = SmartToolFactory
.buildUIController(DataManager.this);
} catch (JepException e) {
statusHandler.handle(Priority.PROBLEM,
"Error initializing smart tool interface", e);
}
}
});
}
public SmartToolUIController getSmartToolInterface() {
return smartToolInterface;
}
public ProcedureUIController getProcedureInterface() {
if (procedureInterface == null) {
VizApp.runSync(new Runnable() {
@Override
public void run() {
try {
DataManager.this.procedureInterface = ProcedureFactory
.buildUIController(DataManager.this);
} catch (JepException e) {
statusHandler.handle(Priority.PROBLEM,
"Error initializing procedure interface", e);
}
}
});
}
return procedureInterface;
}