Merge "Issue #2361 don't initialize SerializationUtil's JAXBContext in CAVE startup" into development
Former-commit-id:0146ae59df
[formerly c27baf85e0eaf7f6dd6f2d36d19243ae37dc0dac] Former-commit-id:4f47800cae
This commit is contained in:
commit
93e93de742
4 changed files with 191 additions and 209 deletions
|
@ -25,16 +25,12 @@ import java.io.FileReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.ui.application.WorkbenchAdvisor;
|
import org.eclipse.ui.application.WorkbenchAdvisor;
|
||||||
import org.osgi.framework.Bundle;
|
import org.osgi.framework.Bundle;
|
||||||
|
|
||||||
import com.raytheon.uf.common.comm.HttpClient;
|
import com.raytheon.uf.common.comm.HttpClient;
|
||||||
import com.raytheon.uf.common.datastorage.DataStoreFactory;
|
import com.raytheon.uf.common.datastorage.DataStoreFactory;
|
||||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
@ -70,6 +66,7 @@ import com.raytheon.viz.ui.personalities.awips.CAVE;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Aug 4, 2011 njensen Initial creation
|
* Aug 4, 2011 njensen Initial creation
|
||||||
* Apr 23, 2013 1939 randerso Return null from initializeSerialization
|
* Apr 23, 2013 1939 randerso Return null from initializeSerialization
|
||||||
|
* Nov 14, 2013 2361 njensen Remove initializeSerialization()
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -120,11 +117,17 @@ public class ThinClientComponent extends CAVE implements IThinClientComponent {
|
||||||
com.raytheon.uf.viz.thinclient.cave.Activator.PLUGIN_ID, "",
|
com.raytheon.uf.viz.thinclient.cave.Activator.PLUGIN_ID, "",
|
||||||
"ThinClientPluginBlacklist.txt");
|
"ThinClientPluginBlacklist.txt");
|
||||||
if (blacklistFile != null && blacklistFile.exists()) {
|
if (blacklistFile != null && blacklistFile.exists()) {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(
|
BufferedReader reader = null;
|
||||||
blacklistFile));
|
try {
|
||||||
String line = null;
|
reader = new BufferedReader(new FileReader(blacklistFile));
|
||||||
while (null != (line = reader.readLine())) {
|
String line = null;
|
||||||
pluginBlacklist.add(line.trim());
|
while (null != (line = reader.readLine())) {
|
||||||
|
pluginBlacklist.add(line.trim());
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (reader != null) {
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -203,16 +206,4 @@ public class ThinClientComponent extends CAVE implements IThinClientComponent {
|
||||||
statsJob.shutdown();
|
statsJob.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Job initializeSerialization() {
|
|
||||||
try {
|
|
||||||
SerializationUtil.getJaxbContext();
|
|
||||||
} catch (JAXBException e) {
|
|
||||||
statusHandler.handle(Priority.CRITICAL,
|
|
||||||
"An error occured initializing Serialization", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,14 +26,9 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
|
|
||||||
import org.eclipse.core.internal.runtime.InternalPlatform;
|
import org.eclipse.core.internal.runtime.InternalPlatform;
|
||||||
import org.eclipse.core.runtime.ILogListener;
|
import org.eclipse.core.runtime.ILogListener;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
|
||||||
import org.eclipse.equinox.app.IApplication;
|
import org.eclipse.equinox.app.IApplication;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
@ -46,7 +41,6 @@ import org.eclipse.ui.statushandlers.StatusAdapter;
|
||||||
import com.raytheon.uf.common.datastorage.DataStoreFactory;
|
import com.raytheon.uf.common.datastorage.DataStoreFactory;
|
||||||
import com.raytheon.uf.common.pypies.PyPiesDataStoreFactory;
|
import com.raytheon.uf.common.pypies.PyPiesDataStoreFactory;
|
||||||
import com.raytheon.uf.common.pypies.PypiesProperties;
|
import com.raytheon.uf.common.pypies.PypiesProperties;
|
||||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
@ -99,6 +93,7 @@ import com.raytheon.viz.core.units.UnitRegistrar;
|
||||||
* before connecting to JMS to avoid deadlock
|
* before connecting to JMS to avoid deadlock
|
||||||
* May 23, 2013 #2005 njensen Shutdown on spring initialization errors
|
* May 23, 2013 #2005 njensen Shutdown on spring initialization errors
|
||||||
* Oct 15, 2013 2361 njensen Added startupTimer
|
* Oct 15, 2013 2361 njensen Added startupTimer
|
||||||
|
* Nov 14, 2013 2361 njensen Removed initializing serialization at startup
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -197,7 +192,6 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
|
||||||
}
|
}
|
||||||
UFStatus.setHandlerFactory(new VizStatusHandlerFactory());
|
UFStatus.setHandlerFactory(new VizStatusHandlerFactory());
|
||||||
|
|
||||||
Job serializationJob = initializeSerialization();
|
|
||||||
initializeDataStoreFactory();
|
initializeDataStoreFactory();
|
||||||
initializeObservers();
|
initializeObservers();
|
||||||
|
|
||||||
|
@ -238,12 +232,6 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
|
||||||
try {
|
try {
|
||||||
initializeSimulatedTime();
|
initializeSimulatedTime();
|
||||||
|
|
||||||
// wait for serialization initialization to complete before
|
|
||||||
// opening JMS connection to avoid deadlock in class loaders
|
|
||||||
if (serializationJob != null) {
|
|
||||||
serializationJob.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
// open JMS connection to allow alerts to be received
|
// open JMS connection to allow alerts to be received
|
||||||
NotificationManagerJob.connect();
|
NotificationManagerJob.connect();
|
||||||
|
|
||||||
|
@ -423,25 +411,6 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
|
||||||
!LocalizationManager.internalAlertServer).run();
|
!LocalizationManager.internalAlertServer).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Job initializeSerialization() {
|
|
||||||
Job job = new Job("Loading Serialization") {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
|
||||||
try {
|
|
||||||
SerializationUtil.getJaxbContext();
|
|
||||||
} catch (JAXBException e) {
|
|
||||||
statusHandler.handle(Priority.CRITICAL,
|
|
||||||
"An error occured initializing Serialization", e);
|
|
||||||
}
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
job.schedule();
|
|
||||||
return job;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize any observers needed by the application
|
* Initialize any observers needed by the application
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -157,6 +157,7 @@ public class StyleManager {
|
||||||
clz.addAll(subClassLocator.locateSubClasses(MatchCriteria.class));
|
clz.addAll(subClassLocator.locateSubClasses(MatchCriteria.class));
|
||||||
clz.addAll(subClassLocator.locateSubClasses(Level.class));
|
clz.addAll(subClassLocator.locateSubClasses(Level.class));
|
||||||
subClassLocator.save();
|
subClassLocator.save();
|
||||||
|
this.subClassLocator = null;
|
||||||
try {
|
try {
|
||||||
return new JAXBManager(clz.toArray(new Class[0]));
|
return new JAXBManager(clz.toArray(new Class[0]));
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import gov.noaa.nws.ncep.staticdataprovider.StaticDataProvider;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.controls.PgenFileNameDisplay;
|
import gov.noaa.nws.ncep.ui.pgen.controls.PgenFileNameDisplay;
|
||||||
import gov.noaa.nws.ncep.viz.common.area.AreaMenusMngr;
|
import gov.noaa.nws.ncep.viz.common.area.AreaMenusMngr;
|
||||||
import gov.noaa.nws.ncep.viz.common.area.NcAreaProviderMngr;
|
import gov.noaa.nws.ncep.viz.common.area.NcAreaProviderMngr;
|
||||||
import gov.noaa.nws.ncep.viz.common.area.PredefinedAreaFactory;
|
|
||||||
import gov.noaa.nws.ncep.viz.common.display.INatlCntrsRenderableDisplay;
|
import gov.noaa.nws.ncep.viz.common.display.INatlCntrsRenderableDisplay;
|
||||||
import gov.noaa.nws.ncep.viz.common.display.INcPaneID;
|
import gov.noaa.nws.ncep.viz.common.display.INcPaneID;
|
||||||
import gov.noaa.nws.ncep.viz.common.display.NcDisplayType;
|
import gov.noaa.nws.ncep.viz.common.display.NcDisplayType;
|
||||||
|
@ -24,15 +23,16 @@ import gov.noaa.nws.ncep.viz.rsc.satellite.units.NcSatelliteUnits;
|
||||||
import gov.noaa.nws.ncep.viz.tools.frame.FrameDataDisplay;
|
import gov.noaa.nws.ncep.viz.tools.frame.FrameDataDisplay;
|
||||||
import gov.noaa.nws.ncep.viz.tools.imageProperties.FadeDisplay;
|
import gov.noaa.nws.ncep.viz.tools.imageProperties.FadeDisplay;
|
||||||
import gov.noaa.nws.ncep.viz.ui.display.AbstractNcEditor;
|
import gov.noaa.nws.ncep.viz.ui.display.AbstractNcEditor;
|
||||||
import gov.noaa.nws.ncep.viz.ui.display.NcEditorUtil;
|
|
||||||
import gov.noaa.nws.ncep.viz.ui.display.NcDisplayMngr;
|
import gov.noaa.nws.ncep.viz.ui.display.NcDisplayMngr;
|
||||||
|
import gov.noaa.nws.ncep.viz.ui.display.NcEditorUtil;
|
||||||
|
|
||||||
import java.awt.font.NumericShaper;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.bind.JAXBException;
|
||||||
|
|
||||||
import org.eclipse.core.commands.Command;
|
import org.eclipse.core.commands.Command;
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.jface.action.ContributionItem;
|
import org.eclipse.jface.action.ContributionItem;
|
||||||
|
@ -41,6 +41,10 @@ import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.ui.commands.ICommandService;
|
import org.eclipse.ui.commands.ICommandService;
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.satellite.units.SatelliteUnits;
|
import com.raytheon.uf.common.dataplugin.satellite.units.SatelliteUnits;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||||
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.application.ProgramArguments;
|
import com.raytheon.uf.viz.application.ProgramArguments;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||||
|
@ -104,7 +108,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* 03/15/2013 #972/#875 G. Hull override openNewEditor() to be called after raytheon code change to NewAbstractEditor
|
* 03/15/2013 #972/#875 G. Hull override openNewEditor() to be called after raytheon code change to NewAbstractEditor
|
||||||
* 04/15/2013 #864 G. Hull display warnings from RD loading.
|
* 04/15/2013 #864 G. Hull display warnings from RD loading.
|
||||||
* 04/17/2013 #863 G. Hull Initialize Predefined Areas
|
* 04/17/2013 #863 G. Hull Initialize Predefined Areas
|
||||||
*
|
* 11/14/2013 #2361 N. Jensen Initialize SerializationUtil when activated
|
||||||
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author
|
* @author
|
||||||
|
@ -115,58 +120,60 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
/** The National Centers Perspective Class */
|
/** The National Centers Perspective Class */
|
||||||
// put this in common to avoid dependencies on this project
|
// put this in common to avoid dependencies on this project
|
||||||
public static final String NC_PERSPECTIVE = NmapCommon.NatlCntrsPerspectiveID;
|
public static final String NC_PERSPECTIVE = NmapCommon.NatlCntrsPerspectiveID;
|
||||||
|
|
||||||
public static final String newDisplayCmd = "gov.noaa.nws.ncep.viz.ui.newMapEditor";
|
public static final String newDisplayCmd = "gov.noaa.nws.ncep.viz.ui.newMapEditor";
|
||||||
|
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(NCPerspectiveManager.class);
|
||||||
|
|
||||||
private IVizEditorChangedListener displayChangeListener = null;
|
private IVizEditorChangedListener displayChangeListener = null;
|
||||||
|
|
||||||
// Issue the newDisplay command the same as if called from the main menu
|
// Issue the newDisplay command the same as if called from the main menu
|
||||||
// new Display
|
// new Display
|
||||||
@Override
|
@Override
|
||||||
public AbstractEditor openNewEditor() {
|
public AbstractEditor openNewEditor() {
|
||||||
|
|
||||||
AbstractEditor curEd = NcDisplayMngr.getActiveNatlCntrsEditor();
|
AbstractEditor curEd = NcDisplayMngr.getActiveNatlCntrsEditor();
|
||||||
|
|
||||||
NcDisplayType dt = NcEditorUtil.getNcDisplayType( curEd );
|
NcDisplayType dt = NcEditorUtil.getNcDisplayType(curEd);
|
||||||
|
|
||||||
if( dt == NcDisplayType.NSHARP_DISPLAY ) {
|
if (dt == NcDisplayType.NSHARP_DISPLAY) {
|
||||||
// MessageDialog errDlg = new MessageDialog(
|
// MessageDialog errDlg = new MessageDialog(
|
||||||
// perspectiveWindow.getShell(), "Error", null,
|
// perspectiveWindow.getShell(), "Error", null,
|
||||||
// "Can't create more than one NSharp Editor.",
|
// "Can't create more than one NSharp Editor.",
|
||||||
// MessageDialog.ERROR, new String[] { "OK" }, 0);
|
// MessageDialog.ERROR, new String[] { "OK" }, 0);
|
||||||
// errDlg.open();
|
// errDlg.open();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ICommandService service = (ICommandService)curEd.getSite()
|
ICommandService service = (ICommandService) curEd.getSite().getService(
|
||||||
.getService(ICommandService.class);
|
ICommandService.class);
|
||||||
|
|
||||||
Command cmd = service.getCommand( newDisplayCmd );
|
Command cmd = service.getCommand(newDisplayCmd);
|
||||||
if( cmd == null ) {
|
if (cmd == null) {
|
||||||
System.out.println("Error getting cmd: "+newDisplayCmd );
|
System.out.println("Error getting cmd: " + newDisplayCmd);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("promptForName", "false" );
|
params.put("promptForName", "false");
|
||||||
|
|
||||||
ExecutionEvent exec = new ExecutionEvent(cmd, params, null,null);
|
ExecutionEvent exec = new ExecutionEvent(cmd, params, null, null);
|
||||||
Object obj = cmd.executeWithChecks(exec);
|
Object obj = cmd.executeWithChecks(exec);
|
||||||
|
|
||||||
if( obj != null &&
|
if (obj != null && obj instanceof AbstractEditor) {
|
||||||
obj instanceof AbstractEditor ) {
|
|
||||||
|
|
||||||
return (AbstractEditor)obj;
|
return (AbstractEditor) obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("sanity check: cmd, "+ newDisplayCmd+
|
|
||||||
", not returning an editor object");
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println("Error executing cmd: "+newDisplayCmd );
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
System.out.println("sanity check: cmd, " + newDisplayCmd
|
||||||
|
+ ", not returning an editor object");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Error executing cmd: " + newDisplayCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -176,30 +183,32 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
// force DESK level to be created.
|
// force DESK level to be created.
|
||||||
NcPathManager.getInstance();
|
NcPathManager.getInstance();
|
||||||
|
|
||||||
if( !NcGridInventory.getInstance().isInitialized() ) {
|
if (!NcGridInventory.getInstance().isInitialized()) {
|
||||||
long t0 = System.currentTimeMillis();
|
long t0 = System.currentTimeMillis();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NcGridInventory.getInstance().initialize( 5 ); // try 5 times
|
NcGridInventory.getInstance().initialize(5); // try 5 times
|
||||||
}
|
} catch (final VizException e) {
|
||||||
catch ( final VizException e ) {
|
|
||||||
// NcGridInventory.getInstance().dumpNcGribInventory();
|
// NcGridInventory.getInstance().dumpNcGribInventory();
|
||||||
MessageDialog errDlg = new MessageDialog(
|
MessageDialog errDlg = new MessageDialog(
|
||||||
perspectiveWindow.getShell(), "Error", null, "Error initializing NcGridInventory\n"+
|
perspectiveWindow.getShell(),
|
||||||
"Please click OK and wait while a new inventory is created", MessageDialog.ERROR,
|
"Error",
|
||||||
new String[] { "OK" }, 0);
|
null,
|
||||||
errDlg.open();
|
"Error initializing NcGridInventory\n"
|
||||||
|
+ "Please click OK and wait while a new inventory is created",
|
||||||
try {
|
MessageDialog.ERROR, new String[] { "OK" }, 0);
|
||||||
NcGridInventory.getInstance().createInventory();
|
errDlg.open();
|
||||||
} catch (VizException e1) {
|
|
||||||
errDlg = new MessageDialog(
|
try {
|
||||||
perspectiveWindow.getShell(), "Error", null, "Error creating NcGridInventory\n",
|
NcGridInventory.getInstance().createInventory();
|
||||||
MessageDialog.ERROR, new String[] { "OK" }, 0);
|
} catch (VizException e1) {
|
||||||
errDlg.open();
|
errDlg = new MessageDialog(perspectiveWindow.getShell(),
|
||||||
}
|
"Error", null, "Error creating NcGridInventory\n",
|
||||||
|
MessageDialog.ERROR, new String[] { "OK" }, 0);
|
||||||
|
errDlg.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GridMapper.GridMapperInit();
|
GridMapper.GridMapperInit();
|
||||||
GempakGridParmInfoLookup.getInstance();
|
GempakGridParmInfoLookup.getInstance();
|
||||||
GempakGridVcrdInfoLookup.getInstance();
|
GempakGridVcrdInfoLookup.getInstance();
|
||||||
|
@ -210,13 +219,13 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
displayChangeListener = new IVizEditorChangedListener() {
|
displayChangeListener = new IVizEditorChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void editorChanged(IDisplayPaneContainer container) {
|
public void editorChanged(IDisplayPaneContainer container) {
|
||||||
if( container == null )
|
if (container == null)
|
||||||
return;
|
return;
|
||||||
else if( container instanceof AbstractNcEditor ) {
|
else if (container instanceof AbstractNcEditor) {
|
||||||
// ((AbstractNcEditor) container).refreshGUIElements();
|
// ((AbstractNcEditor) container).refreshGUIElements();
|
||||||
NcEditorUtil.refreshGUIElements( (AbstractNcEditor)container );
|
NcEditorUtil
|
||||||
}
|
.refreshGUIElements((AbstractNcEditor) container);
|
||||||
else {
|
} else {
|
||||||
// display a warning/error msg
|
// display a warning/error msg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,35 +246,34 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
|
|
||||||
// read in and validate all of the Predefined Area files.
|
// read in and validate all of the Predefined Area files.
|
||||||
try {
|
try {
|
||||||
List<VizException> warnings = NcAreaProviderMngr.initialize();//.getWarnings();//PredefinedAreasMngr.readPredefinedAreas();
|
List<VizException> warnings = NcAreaProviderMngr.initialize();// .getWarnings();//PredefinedAreasMngr.readPredefinedAreas();
|
||||||
|
|
||||||
if( warnings != null && !warnings.isEmpty() ) {
|
|
||||||
final StringBuffer msgBuf = new StringBuffer(
|
|
||||||
"The following Warnings occurs while loading the Predefined Areas::\n\n");
|
|
||||||
int numWarns = 0;
|
|
||||||
for( VizException vizex : warnings ) {
|
|
||||||
msgBuf.append(" -- " + vizex.getMessage() + "\n");
|
|
||||||
|
|
||||||
if (++numWarns > 20) {
|
if (warnings != null && !warnings.isEmpty()) {
|
||||||
msgBuf.append(" .....and more....");
|
final StringBuffer msgBuf = new StringBuffer(
|
||||||
break;
|
"The following Warnings occurs while loading the Predefined Areas::\n\n");
|
||||||
}
|
int numWarns = 0;
|
||||||
}
|
for (VizException vizex : warnings) {
|
||||||
|
msgBuf.append(" -- " + vizex.getMessage() + "\n");
|
||||||
|
|
||||||
VizApp.runAsync(new Runnable() {
|
if (++numWarns > 20) {
|
||||||
@Override
|
msgBuf.append(" .....and more....");
|
||||||
public void run() {
|
break;
|
||||||
MessageDialog warnDlg = new MessageDialog(
|
}
|
||||||
perspectiveWindow.getShell(), "Warning", null,
|
}
|
||||||
msgBuf.toString(), MessageDialog.WARNING,
|
|
||||||
new String[] { "OK" }, 0);
|
|
||||||
warnDlg.open();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
VizApp.runAsync(new Runnable() {
|
||||||
}
|
@Override
|
||||||
catch (VizException el) {
|
public void run() {
|
||||||
|
MessageDialog warnDlg = new MessageDialog(
|
||||||
|
perspectiveWindow.getShell(), "Warning", null,
|
||||||
|
msgBuf.toString(), MessageDialog.WARNING,
|
||||||
|
new String[] { "OK" }, 0);
|
||||||
|
warnDlg.open();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (VizException el) {
|
||||||
MessageDialog errDlg = new MessageDialog(
|
MessageDialog errDlg = new MessageDialog(
|
||||||
perspectiveWindow.getShell(), "Error", null,
|
perspectiveWindow.getShell(), "Error", null,
|
||||||
"Error Reading in Predefined Areas:\n\n" + el.getMessage(),
|
"Error Reading in Predefined Areas:\n\n" + el.getMessage(),
|
||||||
|
@ -293,7 +301,8 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
final StringBuffer errBuf = new StringBuffer(
|
final StringBuffer errBuf = new StringBuffer(
|
||||||
"There were errors creating the following Resource Defintions:\n\n");
|
"There were errors creating the following Resource Defintions:\n\n");
|
||||||
int numErrs = 0;
|
int numErrs = 0;
|
||||||
for (VizException vizex : ResourceDefnsMngr.getInstance().getBadResourceDefnsErrors()) {
|
for (VizException vizex : ResourceDefnsMngr.getInstance()
|
||||||
|
.getBadResourceDefnsErrors()) {
|
||||||
errBuf.append(" -- " + vizex.getMessage() + "\n");
|
errBuf.append(" -- " + vizex.getMessage() + "\n");
|
||||||
|
|
||||||
if (++numErrs > 20) {
|
if (++numErrs > 20) {
|
||||||
|
@ -314,13 +323,15 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !ResourceDefnsMngr.getInstance().getResourceDefnWarnings().isEmpty()) {
|
if (!ResourceDefnsMngr.getInstance().getResourceDefnWarnings()
|
||||||
|
.isEmpty()) {
|
||||||
|
|
||||||
final StringBuffer msgBuf = new StringBuffer(
|
final StringBuffer msgBuf = new StringBuffer(
|
||||||
"The following Warnings occurs while loading the Resource Definitions::\n\n");
|
"The following Warnings occurs while loading the Resource Definitions::\n\n");
|
||||||
int numWarns = 0;
|
int numWarns = 0;
|
||||||
for( VizException vizex : ResourceDefnsMngr.getInstance().getResourceDefnWarnings() ) {
|
for (VizException vizex : ResourceDefnsMngr.getInstance()
|
||||||
msgBuf.append(" -- " + vizex.getMessage() + "\n");
|
.getResourceDefnWarnings()) {
|
||||||
|
msgBuf.append(" -- " + vizex.getMessage() + "\n");
|
||||||
|
|
||||||
if (++numWarns > 20) {
|
if (++numWarns > 20) {
|
||||||
msgBuf.append(" .....and more....");
|
msgBuf.append(" .....and more....");
|
||||||
|
@ -342,8 +353,7 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
|
|
||||||
// ResourceDefnsMngr.getInstance().createInventory();
|
// ResourceDefnsMngr.getInstance().createInventory();
|
||||||
|
|
||||||
}
|
} catch (VizException el) {
|
||||||
catch (VizException el) {
|
|
||||||
MessageDialog errDlg = new MessageDialog(
|
MessageDialog errDlg = new MessageDialog(
|
||||||
perspectiveWindow.getShell(), "Error", null,
|
perspectiveWindow.getShell(), "Error", null,
|
||||||
"Error Initializing NcInventory:\n\n" + el.getMessage(),
|
"Error Initializing NcInventory:\n\n" + el.getMessage(),
|
||||||
|
@ -351,7 +361,6 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
errDlg.open();
|
errDlg.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Load either the default RBD or RBDs in the command line spf
|
// Load either the default RBD or RBDs in the command line spf
|
||||||
//
|
//
|
||||||
List<AbstractRBD<?>> rbdsToLoad = new ArrayList<AbstractRBD<?>>();
|
List<AbstractRBD<?>> rbdsToLoad = new ArrayList<AbstractRBD<?>>();
|
||||||
|
@ -408,30 +417,32 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
ResourceBndlLoader rbdLoader = new ResourceBndlLoader("Loading SPF: ");
|
ResourceBndlLoader rbdLoader = new ResourceBndlLoader("Loading SPF: ");
|
||||||
|
|
||||||
// loop thru the rbds and load them into a new editor.
|
// loop thru the rbds and load them into a new editor.
|
||||||
for( final AbstractRBD<?> rbd : rbdsToLoad ) {
|
for (final AbstractRBD<?> rbd : rbdsToLoad) {
|
||||||
|
|
||||||
rbd.initTimeline();
|
rbd.initTimeline();
|
||||||
|
|
||||||
AbstractEditor editor;
|
AbstractEditor editor;
|
||||||
|
|
||||||
try {
|
|
||||||
editor = NcDisplayMngr.createNatlCntrsEditor(
|
|
||||||
rbd.getDisplayType(), rbd.getRbdName(), rbd.getPaneLayout() );
|
|
||||||
rbdLoader.addRBD( rbd, editor );
|
|
||||||
|
|
||||||
} catch (final VizException e) {
|
try {
|
||||||
|
editor = NcDisplayMngr.createNatlCntrsEditor(
|
||||||
|
rbd.getDisplayType(), rbd.getRbdName(),
|
||||||
|
rbd.getPaneLayout());
|
||||||
|
rbdLoader.addRBD(rbd, editor);
|
||||||
|
|
||||||
|
} catch (final VizException e) {
|
||||||
VizApp.runAsync(new Runnable() {
|
VizApp.runAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MessageDialog errDlg = new MessageDialog(
|
MessageDialog errDlg = new MessageDialog(
|
||||||
perspectiveWindow.getShell(), "Error", null,
|
perspectiveWindow.getShell(), "Error", null,
|
||||||
"Error Creating Eclipse Editor for RBD "+rbd.getRbdName()+"\n"
|
"Error Creating Eclipse Editor for RBD "
|
||||||
|
+ rbd.getRbdName() + "\n"
|
||||||
+ e.getMessage(), MessageDialog.ERROR,
|
+ e.getMessage(), MessageDialog.ERROR,
|
||||||
new String[] { "OK" }, 0);
|
new String[] { "OK" }, 0);
|
||||||
errDlg.open();
|
errDlg.open();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VizApp.runAsync(rbdLoader);
|
VizApp.runAsync(rbdLoader);
|
||||||
|
@ -441,6 +452,15 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
public void activate() {
|
public void activate() {
|
||||||
super.activate();
|
super.activate();
|
||||||
|
|
||||||
|
// initialize SerializationUtil's JAXBContext until deprecated
|
||||||
|
// ISerializableObject usage is replaced
|
||||||
|
try {
|
||||||
|
SerializationUtil.getJaxbContext();
|
||||||
|
} catch (JAXBException e) {
|
||||||
|
statusHandler.handle(Priority.CRITICAL,
|
||||||
|
"An error occured initializing Serialization", e);
|
||||||
|
}
|
||||||
|
|
||||||
// add an EditorChangedListener
|
// add an EditorChangedListener
|
||||||
VizWorkbenchManager.getInstance().addListener(displayChangeListener);
|
VizWorkbenchManager.getInstance().addListener(displayChangeListener);
|
||||||
|
|
||||||
|
@ -451,31 +471,30 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
// read in and validate all of the Predefined Area files.
|
// read in and validate all of the Predefined Area files.
|
||||||
|
|
||||||
List<VizException> warnings = NcAreaProviderMngr.reinitialize();
|
List<VizException> warnings = NcAreaProviderMngr.reinitialize();
|
||||||
|
|
||||||
if( warnings != null && !warnings.isEmpty() ) {
|
|
||||||
final StringBuffer msgBuf = new StringBuffer(
|
|
||||||
"The following Warnings occurs while re-initializing the Predefined Areas::\n\n");
|
|
||||||
int numWarns = 0;
|
|
||||||
for( VizException vizex : warnings ) {
|
|
||||||
msgBuf.append(" -- " + vizex.getMessage() + "\n");
|
|
||||||
|
|
||||||
if (++numWarns > 20) {
|
if (warnings != null && !warnings.isEmpty()) {
|
||||||
msgBuf.append(" .....and more....");
|
final StringBuffer msgBuf = new StringBuffer(
|
||||||
break;
|
"The following Warnings occurs while re-initializing the Predefined Areas::\n\n");
|
||||||
}
|
int numWarns = 0;
|
||||||
}
|
for (VizException vizex : warnings) {
|
||||||
|
msgBuf.append(" -- " + vizex.getMessage() + "\n");
|
||||||
|
|
||||||
VizApp.runAsync(new Runnable() {
|
if (++numWarns > 20) {
|
||||||
@Override
|
msgBuf.append(" .....and more....");
|
||||||
public void run() {
|
break;
|
||||||
MessageDialog warnDlg = new MessageDialog(
|
}
|
||||||
perspectiveWindow.getShell(), "Warning", null,
|
}
|
||||||
msgBuf.toString(), MessageDialog.WARNING,
|
|
||||||
new String[] { "OK" }, 0);
|
VizApp.runAsync(new Runnable() {
|
||||||
warnDlg.open();
|
@Override
|
||||||
}
|
public void run() {
|
||||||
});
|
MessageDialog warnDlg = new MessageDialog(perspectiveWindow
|
||||||
}
|
.getShell(), "Warning", null, msgBuf.toString(),
|
||||||
|
MessageDialog.WARNING, new String[] { "OK" }, 0);
|
||||||
|
warnDlg.open();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// relayout the shell since we added widgets
|
// relayout the shell since we added widgets
|
||||||
perspectiveWindow.getShell().layout(true, true);
|
perspectiveWindow.getShell().layout(true, true);
|
||||||
|
@ -538,8 +557,8 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
// (this won't last long since the perspective will remove/save off the
|
// (this won't last long since the perspective will remove/save off the
|
||||||
// editors.
|
// editors.
|
||||||
|
|
||||||
if( !NcDisplayMngr.isNatlCntrsEditor( editor ) ) {
|
if (!NcDisplayMngr.isNatlCntrsEditor(editor)) {
|
||||||
// if (!(editor instanceof AbstractNcEditor)) {
|
// if (!(editor instanceof AbstractNcEditor)) {
|
||||||
return superHandlers;
|
return superHandlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +578,7 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseMove(int x, int y) {
|
public boolean handleMouseMove(int x, int y) {
|
||||||
// Set mouse position
|
// Set mouse position
|
||||||
Coordinate ll = ((AbstractEditor) editor).translateClick(x, y);
|
Coordinate ll = editor.translateClick(x, y);
|
||||||
gov.noaa.nws.ncep.viz.common.CoorBean.getInstance().setCoor(ll);
|
gov.noaa.nws.ncep.viz.common.CoorBean.getInstance().setCoor(ll);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -579,27 +598,29 @@ public class NCPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
handlers.add(handler);
|
handlers.add(handler);
|
||||||
return handlers.toArray(new IInputHandler[handlers.size()]);
|
return handlers.toArray(new IInputHandler[handlers.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addContextMenuItems(IMenuManager menuManager,
|
public void addContextMenuItems(IMenuManager menuManager,
|
||||||
IDisplayPaneContainer container, IDisplayPane pane) {
|
IDisplayPaneContainer container, IDisplayPane pane) {
|
||||||
if( !(container instanceof AbstractEditor) ) {
|
if (!(container instanceof AbstractEditor)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : add menu actions to minimize/maximize the selected pane.
|
|
||||||
//
|
|
||||||
if( container instanceof AbstractNcEditor &&
|
|
||||||
pane.getRenderableDisplay() instanceof INatlCntrsRenderableDisplay ) {
|
|
||||||
|
|
||||||
int numPanes = NcEditorUtil.getNumberOfPanes( (AbstractEditor)container );
|
// TODO : add menu actions to minimize/maximize the selected pane.
|
||||||
|
//
|
||||||
if( numPanes > 1 ) {
|
if (container instanceof AbstractNcEditor
|
||||||
INcPaneID pid = ((INatlCntrsRenderableDisplay)pane.getRenderableDisplay()).getPaneId();
|
&& pane.getRenderableDisplay() instanceof INatlCntrsRenderableDisplay) {
|
||||||
|
|
||||||
// menuManager.add( new xxx(pid) );
|
int numPanes = NcEditorUtil
|
||||||
}
|
.getNumberOfPanes((AbstractEditor) container);
|
||||||
// options to delete this pane?? add a new pane.?
|
|
||||||
}
|
if (numPanes > 1) {
|
||||||
|
INcPaneID pid = ((INatlCntrsRenderableDisplay) pane
|
||||||
|
.getRenderableDisplay()).getPaneId();
|
||||||
|
|
||||||
|
// menuManager.add( new xxx(pid) );
|
||||||
|
}
|
||||||
|
// options to delete this pane?? add a new pane.?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue