diff --git a/cave/com.raytheon.uf.viz.core/res/spring/viz.xml b/cave/com.raytheon.uf.viz.core/res/spring/viz.xml index a26254b298..d8490fae24 100644 --- a/cave/com.raytheon.uf.viz.core/res/spring/viz.xml +++ b/cave/com.raytheon.uf.viz.core/res/spring/viz.xml @@ -69,9 +69,7 @@ - - - + diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java index a6b6e3ec1c..49de8e9701 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java @@ -52,8 +52,10 @@ import com.raytheon.uf.viz.core.Activator; * SOFTWARE HISTORY * * Date Ticket# Engineer Description - * ------------- -------- ----------- -------------------------- + * ------------- -------- ----------- ----------------------------------------- * Oct 18, 2013 2491 bsteffen Initial creation + * Dec 10, 2013 2602 bsteffen Add null checks to detect unloaded + * bundles. * * * @@ -256,7 +258,13 @@ public class SubClassLocator implements ISubClassLocator { private Set> loadClassesFromCache(Bundle bundle, Collection classNames) { BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); + if (bundleWiring == null) { + return Collections.emptySet(); + } ClassLoader loader = bundleWiring.getClassLoader(); + if (loader == null) { + return Collections.emptySet(); + } HashSet> result = new HashSet>(classNames.size(), 1.0f); for (String className : classNames) { diff --git a/cave/com.raytheon.uf.viz.ui.menus/plugin.xml b/cave/com.raytheon.uf.viz.ui.menus/plugin.xml index a9cb64e917..7ceb055a7e 100644 --- a/cave/com.raytheon.uf.viz.ui.menus/plugin.xml +++ b/cave/com.raytheon.uf.viz.ui.menus/plugin.xml @@ -2,6 +2,7 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/widgets/SubmenuContributionItem.java b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/widgets/SubmenuContributionItem.java index 3d99c861bd..45ea89b798 100644 --- a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/widgets/SubmenuContributionItem.java +++ b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/widgets/SubmenuContributionItem.java @@ -37,7 +37,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.VariableSubstitutionUtil; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.jobs.JobPool; -import com.raytheon.uf.viz.ui.menus.xml.AbstractMenuContributionItem; +import com.raytheon.uf.viz.ui.menus.xml.IContribItemProvider; import com.raytheon.uf.viz.ui.menus.xml.MenuXMLMap; /** @@ -46,11 +46,12 @@ import com.raytheon.uf.viz.ui.menus.xml.MenuXMLMap; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 26, 2009            chammack     Initial creation
- * May 08, 2013 1978       bsteffen    Perform variable substitution on subMenu
- *                                     IDs.
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * Mar 26, 2009           chammack    Initial creation
+ * May 08, 2013  1978     bsteffen    Perform variable substitution on subMenu
+ *                                    IDs.
+ * Dec 11, 2013  2602     bsteffen    Update MenuXMLMap.
  * 
  * 
* @@ -120,8 +121,8 @@ public class SubmenuContributionItem extends MenuManager { for (int i = 0; i < contribs.length; i++) { try { - AbstractMenuContributionItem amc = MenuXMLMap.xmlMapping - .get(contribs[i].getClass()); + IContribItemProvider amc = MenuXMLMap + .getProvider(contribs[i].getClass()); contributionItems[i] = amc.getContributionItems( contribs[i], this.subs, this.removals); diff --git a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuContribution.java b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuContribution.java index 05ba0e55ba..5b7bea3c66 100644 --- a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuContribution.java +++ b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuContribution.java @@ -42,14 +42,16 @@ import com.raytheon.uf.viz.ui.menus.DiscoverMenuContributions; import com.raytheon.uf.viz.ui.menus.widgets.SubmenuContributionItem; /** - * TODO Add Description + * Providex ability to include menus from other localization files. * *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Apr 27, 2009            chammack     Initial creation
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * Apr 27, 2009           chammack    Initial creation
+ * Dec 11, 2013  2602     bsteffen    Update MenuXMLMap.
+ * 
  * 
  * 
* @@ -103,8 +105,8 @@ public class IncludeMenuContribution extends if (mtf.contributions != null) { for (CommonAbstractMenuContribution c : mtf.contributions) { - AbstractMenuContributionItem amc = MenuXMLMap.xmlMapping - .get(c.getClass()); + IContribItemProvider amc = MenuXMLMap.getProvider(c + .getClass()); IContributionItem[] contribItems = amc .getContributionItems(c, combinedSub, removals); if (contribItems != null && contribItems.length > 0) { diff --git a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuItem.java b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuItem.java index 27a2c4e058..42c44202dc 100644 --- a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuItem.java +++ b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuItem.java @@ -52,9 +52,10 @@ import com.raytheon.uf.viz.ui.menus.widgets.SubmenuContributionItem; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 12, 2009            chammack    Initial creation
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * Mar 12, 2009           chammack    Initial creation
+ * Dec 11, 2013  2602     bsteffen    Update MenuXMLMap.
  * 
  * 
* @@ -136,8 +137,8 @@ public class IncludeMenuItem extends CommonIncludeMenuItem implements if (mtf.contributions != null) { for (CommonAbstractMenuContribution c : mtf.contributions) { - AbstractMenuContributionItem amc = MenuXMLMap.xmlMapping - .get(c.getClass()); + IContribItemProvider amc = MenuXMLMap.getProvider(c + .getClass()); if (removalsSet.contains(c.id)) continue; diff --git a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/MenuXMLMap.java b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/MenuXMLMap.java index 38199488b0..4bef434642 100644 --- a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/MenuXMLMap.java +++ b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/MenuXMLMap.java @@ -22,6 +22,14 @@ package com.raytheon.uf.viz.ui.menus.xml; import java.util.HashMap; import java.util.Map; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; + +import com.raytheon.uf.common.menus.xml.CommonAbstractMenuContribution; import com.raytheon.uf.common.menus.xml.CommonBundleMenuContribution; import com.raytheon.uf.common.menus.xml.CommonCommandContribution; import com.raytheon.uf.common.menus.xml.CommonDynamicMenuContribution; @@ -31,6 +39,9 @@ import com.raytheon.uf.common.menus.xml.CommonSeparatorMenuContribution; import com.raytheon.uf.common.menus.xml.CommonSubmenuContribution; import com.raytheon.uf.common.menus.xml.CommonTitleContribution; import com.raytheon.uf.common.menus.xml.CommonToolbarSubmenuContribution; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; /** * TODO Add Description @@ -38,10 +49,11 @@ import com.raytheon.uf.common.menus.xml.CommonToolbarSubmenuContribution; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 28, 2010            mnash     Initial creation
- * Jul 31, 2012 875        rferrel     Added DynamicMenuContribution.
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * Jun 28, 2010           mnash       Initial creation
+ * Jul 31, 2012  875      rferrel     Added DynamicMenuContribution.
+ * Dec 11, 2013  2602     bsteffen    Load providers from extension point.
  * 
  * 
* @@ -50,9 +62,16 @@ import com.raytheon.uf.common.menus.xml.CommonToolbarSubmenuContribution; */ public class MenuXMLMap { - public static final Map, AbstractMenuContributionItem> xmlMapping = new HashMap, AbstractMenuContributionItem>(); - static { + private static final IUFStatusHandler statusHandler = UFStatus + .getHandler(DynamicMenuContribution.class); + + private static final String EXTENSION_ID = "com.raytheon.uf.viz.ui.menus.contribItemProvider"; + + private static final Map, IContribItemProvider> xmlMapping = init(); + + private static Map, IContribItemProvider> init() { + Map, IContribItemProvider> xmlMapping = new HashMap, IContribItemProvider>(); xmlMapping.put(CommonBundleMenuContribution.class, new BundleMenuContribution()); xmlMapping.put(CommonCommandContribution.class, @@ -70,10 +89,31 @@ public class MenuXMLMap { new ToolbarSubmenuContribution()); xmlMapping.put(CommonDynamicMenuContribution.class, new DynamicMenuContribution()); + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IExtensionPoint point = registry.getExtensionPoint(EXTENSION_ID); + if (point != null) { + IExtension[] extensions = point.getExtensions(); + for (IExtension extension : extensions) { + for (IConfigurationElement element : extension + .getConfigurationElements()) { + try { + CommonAbstractMenuContribution contrib = (CommonAbstractMenuContribution) element + .createExecutableExtension("contribution"); + IContribItemProvider provider = (IContribItemProvider) element + .createExecutableExtension("itemProvider"); + xmlMapping.put(contrib.getClass(), provider); + } catch (CoreException e) { + statusHandler.handle(Priority.PROBLEM, + "Error preparing menu contributions.", e); + } + } + } + } + return xmlMapping; } - public static void registerMapping(Class clazz, - AbstractMenuContributionItem item) { - xmlMapping.put(clazz, item); + public static IContribItemProvider getProvider( + Class contribClass) { + return xmlMapping.get(contribClass); } } diff --git a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/ToolbarSubmenuContribution.java b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/ToolbarSubmenuContribution.java index d190589798..489f4b2339 100644 --- a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/ToolbarSubmenuContribution.java +++ b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/ToolbarSubmenuContribution.java @@ -32,6 +32,23 @@ import com.raytheon.uf.common.menus.xml.VariableSubstitution; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.ui.menus.widgets.ToolbarSubmenuContributionItem; +/** + * + * Contribution for adding submenus to a tool bar. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * Dec 11, 2013  2602     bsteffen    Update MenuXMLMap.
+ * 
+ * 
+ * + * @author unknown + * @version 1.0 + */ public class ToolbarSubmenuContribution extends AbstractMenuContributionItem { @@ -52,8 +69,8 @@ public class ToolbarSubmenuContribution extends List contribItemList = new ArrayList(); for (CommonAbstractMenuContribution amc : item.contributions) { - AbstractMenuContributionItem common = MenuXMLMap.xmlMapping - .get(amc.getClass()); + IContribItemProvider common = MenuXMLMap + .getProvider(amc.getClass()); contribItemList.addAll(Arrays.asList(common.getContributionItems( amc, subs, removals))); } diff --git a/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF index 367976ea9a..41ba3ed83d 100644 --- a/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF @@ -1,30 +1,29 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Satellite Plug-in +Bundle-Name: Satellite Visualization Plug-in Bundle-SymbolicName: com.raytheon.viz.satellite;singleton:=true -Bundle-Version: 1.12.1174.qualifier -Bundle-Activator: com.raytheon.viz.satellite.Activator +Bundle-Version: 1.13.0.qualifier Bundle-Vendor: Raytheon Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.viz.core, com.raytheon.viz.ui Eclipse-BuddyPolicy: ext, global Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, com.raytheon.uf.viz.core, - com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", - com.raytheon.uf.common.dataplugin.satellite;bundle-version="1.0.0", - com.raytheon.uf.common.datastorage;bundle-version="1.12.1174", - com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", - com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", - com.raytheon.uf.common.colormap;bundle-version="1.12.1174", - com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", - com.raytheon.uf.common.message;bundle-version="1.12.1174", - com.raytheon.uf.viz.productbrowser;bundle-version="1.11.31", - com.raytheon.uf.viz.derivparam;bundle-version="1.12.1174", - com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174", - com.raytheon.viz.ui;bundle-version="1.12.1174", - com.raytheon.viz.core;bundle-version="1.12.1174", - javax.measure, - com.raytheon.uf.common.style;bundle-version="1.0.0" + com.raytheon.uf.common.dataplugin, + com.raytheon.uf.common.dataplugin.satellite, + com.raytheon.uf.common.datastorage, + com.raytheon.uf.common.serialization.comm, + com.raytheon.uf.common.geospatial, + com.raytheon.uf.common.colormap, + com.raytheon.uf.common.pointdata, + com.raytheon.uf.common.message, + com.raytheon.uf.viz.productbrowser, + com.raytheon.uf.viz.derivparam, + com.raytheon.uf.viz.ui.menus, + com.raytheon.uf.common.style, + com.raytheon.viz.ui, + com.raytheon.viz.core, + javax.measure Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.satellite, com.raytheon.viz.satellite.rsc diff --git a/cave/com.raytheon.viz.satellite/plugin.xml b/cave/com.raytheon.viz.satellite/plugin.xml index 2722917d76..c7d3cc2bce 100644 --- a/cave/com.raytheon.viz.satellite/plugin.xml +++ b/cave/com.raytheon.viz.satellite/plugin.xml @@ -48,4 +48,11 @@ name="Satellite" category="com.raytheon.uf.viz.productbrowser.productbrowserpreferencespage"/>
+ + + +
diff --git a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/Activator.java b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/Activator.java deleted file mode 100644 index 47db1614a2..0000000000 --- a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/Activator.java +++ /dev/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.satellite; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -import com.raytheon.uf.common.menus.xml.CommonSatBundleMenuContribution; -import com.raytheon.uf.viz.ui.menus.xml.MenuXMLMap; -import com.raytheon.viz.satellite.menu.SatBundleMenuContribution; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "com.raytheon.viz.satellite"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - plugin = this; - MenuXMLMap.registerMapping(CommonSatBundleMenuContribution.class, - new SatBundleMenuContribution()); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java index 3e4d6cfbdb..ffba76fc63 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java +++ b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java @@ -58,6 +58,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationConstants; import com.raytheon.uf.viz.core.localization.LocalizationInitializer; import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob; +import com.raytheon.uf.viz.core.procedures.ProcedureXmlManager; import com.raytheon.uf.viz.core.status.VizStatusHandlerFactory; import com.raytheon.uf.viz.personalities.cave.workbench.VizWorkbenchAdvisor; import com.raytheon.viz.alerts.jobs.AutoUpdater; @@ -75,25 +76,29 @@ import com.raytheon.viz.core.units.UnitRegistrar; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Apr 28, 2011 mschenke Initial creation - * May 16, 2012 #636 dgilling Ensure exception is thrown - * and CAVE immediately exits - * if connection cannot be made to - * localization server. - * May 31, 2012 #674 dgilling Allow SimulatedTime to be set from - * the command line. - * Oct 02, 2012 #1236 dgilling Allow SimulatedTime to be set from - * the command line even if practice - * mode is off. - * Jan 09, 2013 #1442 rferrel Changes to notify SimultedTime listeners. - * Apr 17, 2013 1786 mpduff startComponent now sets StatusHandlerFactory - * Apr 23, 2013 #1939 randerso Allow serialization to complete initialization - * before connecting to JMS to avoid deadlock - * May 23, 2013 #2005 njensen Shutdown on spring initialization errors - * Oct 15, 2013 2361 njensen Added startupTimer - * Nov 14, 2013 2361 njensen Removed initializing serialization at startup + * Date Ticket# Engineer Description + * ------------- -------- ----------- ----------------------------------------- + * Apr 28, 2011 mschenke Initial creation + * May 16, 2012 636 dgilling Ensure exception is thrown and CAVE + * immediately exits if connection cannot be + * made to localization server. + * May 31, 2012 674 dgilling Allow SimulatedTime to be set from the + * command line. + * Oct 02, 2012 1236 dgilling Allow SimulatedTime to be set from the + * command line even if practice mode is + * off. + * Jan 09, 2013 1442 rferrel Changes to notify SimultedTime listeners. + * Apr 17, 2013 1786 mpduff startComponent now sets + * StatusHandlerFactory + * Apr 23, 2013 1939 randerso Allow serialization to complete + * initialization before connecting to JMS + * to avoid deadlock + * May 23, 2013 2005 njensen Shutdown on spring initialization errors + * Oct 15, 2013 2361 njensen Added startupTimer + * Nov 14, 2013 2361 njensen Removed initializing serialization at + * startup + * Dec 10, 2013 2602 bsteffen Start loading ProcedureXmlManager in + * startComponent. * * * @@ -254,6 +259,8 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent { startInternal(componentName); } + ProcedureXmlManager.inititializeAsync(); + if (workbenchAdvisor != null) { returnCode = PlatformUI.createAndRunWorkbench(display, workbenchAdvisor); diff --git a/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF index 0c91c607db..5d095367a6 100644 --- a/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF @@ -2,40 +2,44 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Volume Browser Plug-in Bundle-SymbolicName: com.raytheon.viz.volumebrowser;singleton:=true -Bundle-Version: 1.12.1174.qualifier -Bundle-Activator: com.raytheon.viz.volumebrowser.Activator +Bundle-Version: 1.13.0.qualifier Bundle-Vendor: Raytheon -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.uf.viz.ui.menus +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, - com.raytheon.viz.core, + net.sf.swtaddons, + com.raytheon.uf.viz.core, com.raytheon.viz.ui, - com.raytheon.viz.pointdata, + com.raytheon.uf.viz.d2d.core, + com.raytheon.uf.viz.d2d.ui, + com.raytheon.uf.viz.core.maps, + com.raytheon.viz.core.graphing, + com.raytheon.uf.common.time, + com.raytheon.uf.common.localization, + com.raytheon.uf.common.style, + com.raytheon.uf.common.geospatial, + com.raytheon.viz.awipstools, + com.raytheon.uf.viz.points, + com.raytheon.uf.viz.xy, + com.raytheon.uf.viz.ui.menus, com.raytheon.uf.viz.xy.crosssection, com.raytheon.uf.viz.xy.timeheight, com.raytheon.uf.viz.xy.varheight, - com.raytheon.viz.awipstools, - com.raytheon.viz.grid, com.raytheon.uf.viz.xy.timeseries, + com.raytheon.uf.viz.d2d.nsharp, + gov.noaa.nws.ncep.ui.nsharp, + com.raytheon.uf.viz.derivparam, + com.raytheon.uf.common.dataplugin, + com.raytheon.viz.grid, + com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.viz.objectiveanalysis, + com.raytheon.viz.pointdata, com.raytheon.uf.common.pointdata, - net.sf.swtaddons;bundle-version="1.0.0", - com.raytheon.uf.viz.points;bundle-version="1.0.0", - com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0", - gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0", - com.raytheon.uf.common.comm;bundle-version="1.12.1174", - com.raytheon.uf.viz.core.maps;bundle-version="1.12.1174", - com.raytheon.uf.viz.d2d.core;bundle-version="1.12.1174", - com.raytheon.uf.viz.d2d.ui;bundle-version="1.12.1174", - com.raytheon.uf.viz.derivparam;bundle-version="1.12.1174", - com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0", - com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174", - com.raytheon.uf.viz.xy;bundle-version="1.12.1174", - com.raytheon.viz.core.graphing;bundle-version="1.12.1174", - com.raytheon.uf.common.style;bundle-version="1.0.0" -Bundle-ActivationPolicy: lazy + com.raytheon.uf.common.comm Export-Package: com.raytheon.viz.volumebrowser, com.raytheon.viz.volumebrowser.datacatalog, com.raytheon.viz.volumebrowser.vbui, com.raytheon.viz.volumebrowser.xml -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Import-Package: com.raytheon.viz.core.map, + com.raytheon.viz.core.rsc diff --git a/cave/com.raytheon.viz.volumebrowser/plugin.xml b/cave/com.raytheon.viz.volumebrowser/plugin.xml index aa5297ad1f..bc0375d068 100644 --- a/cave/com.raytheon.viz.volumebrowser/plugin.xml +++ b/cave/com.raytheon.viz.volumebrowser/plugin.xml @@ -42,10 +42,10 @@ - + - + @@ -79,4 +79,19 @@ + + + + + + + + diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/Activator.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/Activator.java deleted file mode 100644 index 1d19dae363..0000000000 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/Activator.java +++ /dev/null @@ -1,89 +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.volumebrowser; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -import com.raytheon.uf.common.menus.xml.CommonMenuContribution; -import com.raytheon.uf.common.menus.xml.CommonTitleImgContribution; -import com.raytheon.uf.common.menus.xml.CommonToolBarContribution; -import com.raytheon.uf.viz.ui.menus.xml.MenuXMLMap; -import com.raytheon.viz.volumebrowser.xml.MenuContribution; -import com.raytheon.viz.volumebrowser.xml.TitleImgContribution; -import com.raytheon.viz.volumebrowser.xml.ToolBarContribution; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "com.raytheon.viz.volumebrowser"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - plugin = this; - MenuXMLMap.registerMapping(CommonToolBarContribution.class, - new ToolBarContribution()); - MenuXMLMap.registerMapping(CommonMenuContribution.class, - new MenuContribution()); - MenuXMLMap.registerMapping(CommonTitleImgContribution.class, - new TitleImgContribution()); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/GridAlterBundleContributor.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/GridAlterBundleContributor.java index e7021d0c87..fef7177f42 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/GridAlterBundleContributor.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/GridAlterBundleContributor.java @@ -29,12 +29,8 @@ import com.raytheon.uf.common.dataplugin.grid.GridConstants; import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfo; import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfoLookup; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -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.core.drawables.AbstractRenderableDisplay; import com.raytheon.uf.viz.core.drawables.ResourcePair; -import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter; import com.raytheon.uf.viz.core.procedures.Bundle; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; @@ -55,10 +51,11 @@ import com.raytheon.viz.volumebrowser.xml.VbSourceList; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jan 4, 2010            mschenke     Initial creation
- * Oct 3, 2012  #1248      rferrel     Change to use adapter.
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * Jan 04, 2010           mschenke    Initial creation
+ * Oct 03, 2012  1248     rferrel     Change to use adapter.
+ * Dec 11, 2013  2602     bsteffen    Remove dead catch block.
  * 
  * 
* @@ -67,8 +64,6 @@ import com.raytheon.viz.volumebrowser.xml.VbSourceList; */ public class GridAlterBundleContributor extends AlterBundleContributorAdapter { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(GridAlterBundleContributor.class); private static final String GRID_KEY = "Grid"; @@ -78,26 +73,20 @@ public class GridAlterBundleContributor extends AlterBundleContributorAdapter { if (modelTitleToNameMap == null) { modelTitleToNameMap = new HashMap(); - try { - for (VbSource source : VbSourceList.getInstance().getEntries()) { - if (source.getName() != null) { - modelTitleToNameMap.put(source.getName(), + for (VbSource source : VbSourceList.getInstance().getEntries()) { + if (source.getName() != null) { + modelTitleToNameMap.put(source.getName(), source.getKey()); + } else { + DatasetInfo info = DatasetInfoLookup.getInstance().getInfo( + source.getKey()); + if (info == null) { + modelTitleToNameMap.put(source.getKey(), source.getKey()); } else { - DatasetInfo info = DatasetInfoLookup.getInstance() - .getInfo(source.getKey()); - if (info == null) { - modelTitleToNameMap.put(source.getKey(), - source.getKey()); - } else { - modelTitleToNameMap.put(info.getTitle(), - source.getKey()); - } + modelTitleToNameMap.put(info.getTitle(), + source.getKey()); } } - } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, - "Cannot load grid sources.", e); } } return modelTitleToNameMap; diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/ToolsAlterBundleContributor.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/ToolsAlterBundleContributor.java index f1956e30ab..e26a11b7bc 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/ToolsAlterBundleContributor.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/ToolsAlterBundleContributor.java @@ -49,7 +49,6 @@ import com.raytheon.uf.viz.points.PointUtilities; import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.uf.viz.points.data.IPointNode; import com.raytheon.uf.viz.xy.crosssection.rsc.CrossSectionResourceData; - import com.raytheon.viz.awipstools.ToolsDataManager; import com.raytheon.viz.volumebrowser.datacatalog.AbstractDataCatalog; import com.raytheon.viz.volumebrowser.datacatalog.DataCatalogManager; @@ -64,12 +63,13 @@ import com.vividsolutions.jts.geom.LineString; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Initial creation - * Aug 08, 2012 #875 rferrel Generate menu entries for points. - * Oct 03, 2012 #1248 rferrel Added listener for when points change. - * May 03, 2013 DR14824 mgamazaychikov Added alterResource method + * Date Ticket# Engineer Description + * ------------- -------- -------------- -------------------------------------- + * Aug 08, 2012 875 rferrel Generate menu entries for points. + * Oct 03, 2012 1248 rferrel Added listener for when points change. + * May 03, 2013 14824 mgamazaychikov Added alterResource method + * Dec 11, 2013 2602 bsteffen Fix compiler warnings and format. + * * * * @@ -86,9 +86,9 @@ public class ToolsAlterBundleContributor extends AlterBundleContributorAdapter { private static final String POINTS_KEY = "point"; private static final String LINES_KEY = "line"; - + private static final String PLUGIN_KEY = "pluginName"; - + private static final String REPORTYPE_KEY = "reportType"; private IPointChangedListener pointChangedListener; @@ -255,9 +255,9 @@ public class ToolsAlterBundleContributor extends AlterBundleContributorAdapter { for (ResourcePair rp : list) { AbstractResourceData rData = rp.getResourceData(); if (rData instanceof AbstractRequestableResourceData) { - alterResource((AbstractRequestableResourceData) rData, POINTS_KEY, - selectedString); - alterContainer((IPointsToolContainer) rData, selectedString); + alterResource((AbstractRequestableResourceData) rData, + POINTS_KEY, selectedString); + alterContainer((IPointsToolContainer) rData, selectedString); } else if (rData instanceof IResourceGroup) { alterResourceList(((IResourceGroup) rData).getResourceList(), selectedString); @@ -265,76 +265,73 @@ public class ToolsAlterBundleContributor extends AlterBundleContributorAdapter { } } - private void alterResource(AbstractRequestableResourceData data, String selectedKey, - String selectedString) { - if (selectedString == null) { - return; - } - HashMap metadataMap = data.getMetadataMap(); - HashMap metadataMapOld = new HashMap(); - // make a copy of original matedata map - metadataMapOld.putAll(metadataMap); - // obtain data catalog - AbstractDataCatalog ac = getDataCatalog (metadataMap); - if ( ac == null ) { - return; - } - // change the parameters in the original metadata map - ac.alterProductParameters(selectedKey, selectedString, - (HashMap) metadataMap); - - // in addition to metadata map resource data needs to be modified - // for CrossSectionResourceData - if (data instanceof CrossSectionResourceData) { - String theKeyToChange = null; - Iterator> it = metadataMap - .entrySet().iterator(); - while (it.hasNext()) { - @SuppressWarnings({ "unchecked", "rawtypes" }) - Map.Entry pairs = (Map.Entry) it - .next(); - String currentKey = (String) pairs.getKey(); - String currentValue = metadataMap.get(currentKey) - .getConstraintValue(); - if (metadataMapOld.containsKey(currentKey)) { - String oldValue = metadataMapOld.get(currentKey) - .getConstraintValue(); - if (!oldValue.equalsIgnoreCase(currentValue)) { - theKeyToChange = currentKey; - } - } - } - String stationID = metadataMap.get(theKeyToChange) - .getConstraintValue(); - List stationIDs = Arrays.asList(stationID - .split("\\s*,\\s*")); - ((CrossSectionResourceData) data).setStationIDs(stationIDs); - } - } + private void alterResource(AbstractRequestableResourceData data, + String selectedKey, String selectedString) { + if (selectedString == null) { + return; + } + HashMap metadataMap = data.getMetadataMap(); + HashMap metadataMapOld = new HashMap(); + // make a copy of original matedata map + metadataMapOld.putAll(metadataMap); + // obtain data catalog + AbstractDataCatalog ac = getDataCatalog(metadataMap); + if (ac == null) { + return; + } + // change the parameters in the original metadata map + ac.alterProductParameters(selectedKey, selectedString, metadataMap); - private AbstractDataCatalog getDataCatalog( - HashMap metadataMap) { - String pluginName = null; - String reportType = null; - if (metadataMap.containsKey(PLUGIN_KEY)) { - pluginName = metadataMap.get(PLUGIN_KEY).getConstraintValue(); - } else { - return null; - } - if (metadataMap.containsKey(REPORTYPE_KEY)) { - reportType = metadataMap.get(REPORTYPE_KEY).getConstraintValue(); - } else { - return null; - } - String sourcesKey = pluginName + reportType; + // in addition to metadata map resource data needs to be modified + // for CrossSectionResourceData + if (data instanceof CrossSectionResourceData) { + String theKeyToChange = null; + Iterator> it = metadataMap + .entrySet().iterator(); + while (it.hasNext()) { + Map.Entry pairs = it.next(); + String currentKey = pairs.getKey(); + String currentValue = metadataMap.get(currentKey) + .getConstraintValue(); + if (metadataMapOld.containsKey(currentKey)) { + String oldValue = metadataMapOld.get(currentKey) + .getConstraintValue(); + if (!oldValue.equalsIgnoreCase(currentValue)) { + theKeyToChange = currentKey; + } + } + } + String stationID = metadataMap.get(theKeyToChange) + .getConstraintValue(); + List stationIDs = Arrays.asList(stationID + .split("\\s*,\\s*")); + ((CrossSectionResourceData) data).setStationIDs(stationIDs); + } + } - SelectedData sd = new SelectedData(null, sourcesKey, null, null, null, - null, null); - return (AbstractDataCatalog) DataCatalogManager - .getDataCatalogManager().getDataCatalog(sd); - } + private AbstractDataCatalog getDataCatalog( + HashMap metadataMap) { + String pluginName = null; + String reportType = null; + if (metadataMap.containsKey(PLUGIN_KEY)) { + pluginName = metadataMap.get(PLUGIN_KEY).getConstraintValue(); + } else { + return null; + } + if (metadataMap.containsKey(REPORTYPE_KEY)) { + reportType = metadataMap.get(REPORTYPE_KEY).getConstraintValue(); + } else { + return null; + } + String sourcesKey = pluginName + reportType; - /** + SelectedData sd = new SelectedData(null, sourcesKey, null, null, null, + null, null); + return (AbstractDataCatalog) DataCatalogManager.getDataCatalogManager() + .getDataCatalog(sd); + } + + /** * @param rData * @param selectedString */ @@ -357,11 +354,11 @@ public class ToolsAlterBundleContributor extends AlterBundleContributorAdapter { line); ResourceList rl = display.getDescriptor().getResourceList(); for (ResourcePair rp : rl) { - AbstractResourceData rData = rp.getResourceData(); - if (rData instanceof AbstractRequestableResourceData) { - alterResource((AbstractRequestableResourceData) rData, LINES_KEY, - line); - } + AbstractResourceData rData = rp.getResourceData(); + if (rData instanceof AbstractRequestableResourceData) { + alterResource((AbstractRequestableResourceData) rData, + LINES_KEY, line); + } } } } diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/DataListsProdTableComp.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/DataListsProdTableComp.java index b87ded7aae..86744f23f0 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/DataListsProdTableComp.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/DataListsProdTableComp.java @@ -50,11 +50,7 @@ import org.eclipse.swt.widgets.Label; import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfo; import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfoLookup; -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.core.VizApp; -import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.points.IPointChangedListener; import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.viz.awipstools.IToolChangedListener; @@ -78,16 +74,19 @@ import com.raytheon.viz.volumebrowser.xml.VbSourceList; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 12, 2009 #2161      lvenable     Initial creation
- * Jul 31, 2012 #875       rferrel     Now uses markers.
- * Sep 26, 2012 #1216      rferrel     Change listener added to update
- *                                      points menu.
- * Jan 14, 2013 #1516      rferrel     Remove listeners on dispose and specify 
- *                                      Data Selection in Points Tool Action.
- * Dec 06, 2013 #2271      mpduff      Save the selected plane points so the menu's are 
- *                                      recreated correctly on a pointChange action.
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * May 12, 2009  2161     lvenable    Initial creation
+ * Jul 31, 2012  875      rferrel     Now uses markers.
+ * Sep 26, 2012  1216     rferrel     Change listener added to update points
+ *                                    menu.
+ * Jan 14, 2013  1516     rferrel     Remove listeners on dispose and specify
+ *                                    Data Selection in Points Tool Action.
+ * Dec 06, 2013  2271     mpduff      Save the selected plane points so the
+ *                                    menu's are recreated correctly on a
+ *                                    pointChange action.
+ * Dec 11, 2013  2602     bsteffen    Remove dead catch block.
+ * 
  * 
* * @author lvenable @@ -95,8 +94,6 @@ import com.raytheon.viz.volumebrowser.xml.VbSourceList; */ public class DataListsProdTableComp extends Composite implements IDataMenuAction { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(DataListsProdTableComp.class); /** * Listener to update planes current point menu. @@ -137,7 +134,7 @@ public class DataListsProdTableComp extends Composite implements * #getMatchingProposals(java.lang.String[], java.lang.String) */ @Override - protected List getMatchingProposals(String[] proposals, + protected List getMatchingProposals(String[] proposals, String contents) { return super.getMatchingProposals( getMatches(proposals, contents), ""); @@ -671,82 +668,76 @@ public class DataListsProdTableComp extends Composite implements * items/menus. */ - try { - // Linked HashMap used to preserve the ordering of categories - Map> catMap = new LinkedHashMap>(); - Map>> subCatMap = new LinkedHashMap>>(); - for (VbSource source : VbSourceList.getInstance().getEntries()) { - if (source.getViews() != null - && !source.getViews().contains(setting)) { - continue; - } - List catList = null; - if (source.getSubCategory() != null) { - catList = catMap.get(source.getCategory()); - if (catList == null) { - catList = new ArrayList(); - catMap.put(source.getCategory(), catList); - } - Map> subMap = subCatMap - .get(source.getCategory()); - if (subMap == null) { - subMap = new LinkedHashMap>(); - subCatMap.put(source.getCategory(), subMap); - } - catList = subMap.get(source.getSubCategory()); - if (catList == null) { - catList = new ArrayList(); - subMap.put(source.getSubCategory(), catList); - } - } else { - catList = catMap.get(source.getCategory()); - if (catList == null) { - catList = new ArrayList(); - catMap.put(source.getCategory(), catList); - } - } - MenuContribution mContrib = new MenuContribution(); - mContrib.xml.key = source.getKey(); - if (source.getName() != null) { - mContrib.xml.menuText = source.getName(); - } else { - // Attempt a lookup in the grib model table - DatasetInfo info = DatasetInfoLookup.getInstance().getInfo( - source.getKey()); - if (info != null) { - mContrib.xml.menuText = info.getTitle(); - } else { - mContrib.xml.menuText = source.getKey(); - } - } - catList.add(new MenuContributionItem(mContrib)); + // Linked HashMap used to preserve the ordering of categories + Map> catMap = new LinkedHashMap>(); + Map>> subCatMap = new LinkedHashMap>>(); + for (VbSource source : VbSourceList.getInstance().getEntries()) { + if (source.getViews() != null + && !source.getViews().contains(setting)) { + continue; } - for (Entry> entry : catMap - .entrySet()) { - ToolBarContribution tbContrib = new ToolBarContribution(); - tbContrib.xml.toolItemText = entry.getKey(); - tbContrib.xml.id = setting.toString() + entry.getKey(); + List catList = null; + if (source.getSubCategory() != null) { + catList = catMap.get(source.getCategory()); + if (catList == null) { + catList = new ArrayList(); + catMap.put(source.getCategory(), catList); + } Map> subMap = subCatMap - .get(entry.getKey()); - if (subMap != null) { - for (Entry> subEntry : subMap - .entrySet()) { - TitleImgContribution tContrib = new TitleImgContribution(); - tContrib.xml.titleText = subEntry.getKey(); - tContrib.xml.displayDashes = true; - tContrib.xml.displayImage = true; - entry.getValue().add( - new TitleImgContributionItem(tContrib)); - entry.getValue().addAll(subEntry.getValue()); - } + .get(source.getCategory()); + if (subMap == null) { + subMap = new LinkedHashMap>(); + subCatMap.put(source.getCategory(), subMap); + } + catList = subMap.get(source.getSubCategory()); + if (catList == null) { + catList = new ArrayList(); + subMap.put(source.getSubCategory(), catList); + } + } else { + catList = catMap.get(source.getCategory()); + if (catList == null) { + catList = new ArrayList(); + catMap.put(source.getCategory(), catList); } - sourceControl.toolbar.add(new ToolBarContributionItem( - tbContrib, entry.getValue().toArray( - new IContributionItem[0]))); - } - } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + MenuContribution mContrib = new MenuContribution(); + mContrib.xml.key = source.getKey(); + if (source.getName() != null) { + mContrib.xml.menuText = source.getName(); + } else { + // Attempt a lookup in the grib model table + DatasetInfo info = DatasetInfoLookup.getInstance().getInfo( + source.getKey()); + if (info != null) { + mContrib.xml.menuText = info.getTitle(); + } else { + mContrib.xml.menuText = source.getKey(); + } + } + catList.add(new MenuContributionItem(mContrib)); + } + for (Entry> entry : catMap.entrySet()) { + ToolBarContribution tbContrib = new ToolBarContribution(); + tbContrib.xml.toolItemText = entry.getKey(); + tbContrib.xml.id = setting.toString() + entry.getKey(); + Map> subMap = subCatMap.get(entry + .getKey()); + if (subMap != null) { + for (Entry> subEntry : subMap + .entrySet()) { + TitleImgContribution tContrib = new TitleImgContribution(); + tContrib.xml.titleText = subEntry.getKey(); + tContrib.xml.displayDashes = true; + tContrib.xml.displayImage = true; + entry.getValue() + .add(new TitleImgContributionItem(tContrib)); + entry.getValue().addAll(subEntry.getValue()); + } + } + sourceControl.toolbar.add(new ToolBarContributionItem(tbContrib, + entry.getValue().toArray(new IContributionItem[0]))); + } try { diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/widget/ToolBarContributionItem.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/widget/ToolBarContributionItem.java index 959e7a652c..c6661b276a 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/widget/ToolBarContributionItem.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/widget/ToolBarContributionItem.java @@ -39,6 +39,23 @@ import com.raytheon.viz.volumebrowser.xml.TitleImgContribution; import com.raytheon.viz.volumebrowser.xml.ToolBarContribution; import com.vividsolutions.jts.geom.Coordinate; +/** + * + * Contribution item for tool bar buttons. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * Dec 11, 2013  2602     bsteffen    Set the id of menu items.
+ * 
+ * 
+ * + * @author unkown + * @version 1.0 + */ public class ToolBarContributionItem extends ContributionItem { protected Menu menu; @@ -116,6 +133,7 @@ public class ToolBarContributionItem extends ContributionItem { GeoUtil.formatCoordinate(new Coordinate(i, i)) .split(" ")[coordinateIndex]); menuContribution.xml.key = keyPrefixString + i; + menuContribution.xml.id = idPrefixString + i; MenuContributionItem menuContributionItem = new MenuContributionItem( menuContribution); diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/ToolBarContribution.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/ToolBarContribution.java index bd792084ce..bf1f61e6b0 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/ToolBarContribution.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/ToolBarContribution.java @@ -31,9 +31,27 @@ import com.raytheon.uf.common.menus.xml.CommonToolBarContribution; import com.raytheon.uf.common.menus.xml.VariableSubstitution; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.ui.menus.xml.AbstractMenuContributionItem; +import com.raytheon.uf.viz.ui.menus.xml.IContribItemProvider; import com.raytheon.uf.viz.ui.menus.xml.MenuXMLMap; import com.raytheon.viz.volumebrowser.widget.ToolBarContributionItem; +/** + * + * Contribution Item for tool bars. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * Dec 11, 2013  2602     bsteffen    Update MenuXMLMap.
+ * 
+ * 
+ * + * @author unknown + * @version 1.0 + */ public class ToolBarContribution extends AbstractMenuContributionItem { @@ -49,8 +67,8 @@ public class ToolBarContribution extends List contribItemList = new ArrayList(); for (CommonAbstractMenuContribution amc : item.contributions) { - AbstractMenuContributionItem common = MenuXMLMap.xmlMapping - .get(amc.getClass()); + IContribItemProvider common = MenuXMLMap + .getProvider(amc.getClass()); contribItemList.addAll(Arrays.asList(common.getContributionItems( amc, subs, removals))); } diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSource.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSource.java index 0c2c7be8d3..9430d3628a 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSource.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSource.java @@ -6,28 +6,29 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; -import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu; /** * - * TODO Add Description + * Description of a single source for the volume browser. * *
  * 
  * SOFTWARE HISTORY
  * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jan 6, 2011            bsteffen     Initial creation
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * Jan 06, 2011           bsteffen    Initial creation
+ * Dec 11, 2013  2602     bsteffen    Remove ISerializableObject.
  * 
  * 
* * @author bsteffen * @version 1.0 + * @see VbSourceList */ @XmlAccessorType(XmlAccessType.NONE) -public class VbSource implements ISerializableObject { +public class VbSource { @XmlAttribute(required = true) private String key; diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSourceList.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSourceList.java index 55c5e22c56..0ff0853d35 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSourceList.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSourceList.java @@ -12,20 +12,19 @@ import com.raytheon.uf.common.localization.FileUpdatedMessage; import com.raytheon.uf.common.localization.ILocalizationFileObserver; import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.PathManagerFactory; -import com.raytheon.uf.common.serialization.ISerializableObject; -import com.raytheon.uf.viz.core.exception.VizException; /** * - * TODO Add Description + * List of sources for populating the volume browser tool bar menus * *
  * 
  * SOFTWARE HISTORY
  * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jan 6, 2011            bsteffen     Initial creation
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- -----------------------------------------
+ * Jan 06, 2011           bsteffen    Initial creation
+ * Dec 11, 2013  2602     bsteffen    Remove ISerializableObject.
  * 
  * 
* @@ -34,7 +33,7 @@ import com.raytheon.uf.viz.core.exception.VizException; */ @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement -public class VbSourceList implements ISerializableObject { +public class VbSourceList { private final static String VB_SOURCE_FILE = "volumebrowser/VbSources.xml"; @@ -78,7 +77,7 @@ public class VbSourceList implements ISerializableObject { this.entries = entries; } - public static VbSourceList getInstance() throws VizException { + public static VbSourceList getInstance() { synchronized (VB_SOURCE_FILE) { if (instance == null) { LocalizationFile file = PathManagerFactory.getPathManager()