From 9327b7b7bcce48dd75f959df58d27f46eb6bd309 Mon Sep 17 00:00:00 2001 From: mjames-upc Date: Mon, 20 Apr 2015 17:29:07 -0600 Subject: [PATCH] build update, remove leftover plugins or else CAVE build barfs --- cave/build/static/linux/cave/cave.sh | 2 +- .../feature.xml | 7 - rpms/build/x86_64/build.sh | 2 +- rpms/unidata/buildEnvironment.sh | 2 +- .../.classpath | 7 - .../.project | 30 - .../META-INF/MANIFEST.MF | 15 - .../build.properties | 6 - .../edu.ucar.unidata.uf.viz.radarbrowser.ecl | 0 .../icons/browser.gif | Bin 144 -> 0 bytes .../icons/help.gif | Bin 259 -> 0 bytes .../icons/refresh.gif | Bin 327 -> 0 bytes .../icons/run.gif | Bin 379 -> 0 bytes .../plugin.xml | 68 -- .../schema/dataDefinition.exsd | 109 -- .../uf/viz/radarbrowser/Activator.java | 73 -- .../radarbrowser/DataTypePreferencePage.java | 247 ---- .../viz/radarbrowser/RadarBrowserLabel.java | 165 --- .../RadarBrowserPreferencesPage.java | 73 -- .../viz/radarbrowser/RadarBrowserUtils.java | 70 -- .../uf/viz/radarbrowser/RadarBrowserView.java | 427 ------- .../actions/RadarBrowserAction.java | 53 - .../jobs/RadarBrowserInitializeJob.java | 118 -- .../jobs/RadarBrowserQueryJob.java | 256 ---- .../edu.ucar.unidata.ui.ncradarui/.classpath | 7 - .../edu.ucar.unidata.ui.ncradarui/.project | 28 - .../META-INF/MANIFEST.MF | 42 - .../build.properties | 5 - .../edu.ucar.unidata.ui.ncradarui.ecl | 0 .../edu.ucar.unidata.ui.ncradarui/plugin.xml | 89 -- .../ucar/unidata/ui/ncradarui/Activator.java | 50 - .../ui/ncradarui/palette/HandlePrinting.java | 185 --- .../palette/NcradaruiPaletteAction.java | 67 -- .../palette/NcradaruiPaletteWindow.java | 1052 ----------------- 34 files changed, 3 insertions(+), 3252 deletions(-) delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/.classpath delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/.project delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/META-INF/MANIFEST.MF delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/build.properties delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/edu.ucar.unidata.uf.viz.radarbrowser.ecl delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/icons/browser.gif delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/icons/help.gif delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/icons/refresh.gif delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/icons/run.gif delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/plugin.xml delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/schema/dataDefinition.exsd delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/Activator.java delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/DataTypePreferencePage.java delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserLabel.java delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserPreferencesPage.java delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserUtils.java delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserView.java delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/actions/RadarBrowserAction.java delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/jobs/RadarBrowserInitializeJob.java delete mode 100644 unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/jobs/RadarBrowserQueryJob.java delete mode 100644 unidata/edu.ucar.unidata.ui.ncradarui/.classpath delete mode 100644 unidata/edu.ucar.unidata.ui.ncradarui/.project delete mode 100644 unidata/edu.ucar.unidata.ui.ncradarui/META-INF/MANIFEST.MF delete mode 100644 unidata/edu.ucar.unidata.ui.ncradarui/build.properties delete mode 100644 unidata/edu.ucar.unidata.ui.ncradarui/edu.ucar.unidata.ui.ncradarui.ecl delete mode 100644 unidata/edu.ucar.unidata.ui.ncradarui/plugin.xml delete mode 100644 unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/Activator.java delete mode 100644 unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/HandlePrinting.java delete mode 100644 unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/NcradaruiPaletteAction.java delete mode 100644 unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/NcradaruiPaletteWindow.java diff --git a/cave/build/static/linux/cave/cave.sh b/cave/build/static/linux/cave/cave.sh index b6ec361d8d..5870ba00dd 100644 --- a/cave/build/static/linux/cave/cave.sh +++ b/cave/build/static/linux/cave/cave.sh @@ -1,2 +1,2 @@ #!/bin/bash -/awips2/cave/run.sh -alertviz -perspective NCP \ No newline at end of file +/awips2/cave/run.sh -alertviz \ No newline at end of file diff --git a/ncep/com.raytheon.uf.viz.ncep.displays.feature/feature.xml b/ncep/com.raytheon.uf.viz.ncep.displays.feature/feature.xml index 38aa213111..6ec6672ba4 100644 --- a/ncep/com.raytheon.uf.viz.ncep.displays.feature/feature.xml +++ b/ncep/com.raytheon.uf.viz.ncep.displays.feature/feature.xml @@ -314,11 +314,4 @@ version="0.0.0" unpack="false"/> - - diff --git a/rpms/build/x86_64/build.sh b/rpms/build/x86_64/build.sh index 50ecaa668d..ed2eda4625 100644 --- a/rpms/build/x86_64/build.sh +++ b/rpms/build/x86_64/build.sh @@ -504,7 +504,7 @@ if [ "${1}" = "-ade" ]; then fi if [ "${1}" = "-cave" ]; then - buildCAVEsingle + buildCAVE fi if [ "${1}" = "-other" ]; then diff --git a/rpms/unidata/buildEnvironment.sh b/rpms/unidata/buildEnvironment.sh index 95bf79057e..884adc186f 100755 --- a/rpms/unidata/buildEnvironment.sh +++ b/rpms/unidata/buildEnvironment.sh @@ -13,7 +13,7 @@ export BUILD_WORKSPACE=${BUILD_DIR}/workspace # baseline is... export BASELINE="${JENKINS_WORKSPACE}" export AWIPSII_VERSION="14.4.1" -export BUILD_NUMBER="6" +export BUILD_NUMBER="7" export AWIPSII_RELEASE="1n${BUILD_NUMBER}" export AWIPSII_TOP_DIR="${BUILD_WORKSPACE}/tmp/rpms_built_dir" diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/.classpath b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/.classpath deleted file mode 100644 index afe7f5c925..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/.project b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/.project deleted file mode 100644 index b427a731e4..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/.project +++ /dev/null @@ -1,30 +0,0 @@ - - - edu.ucar.unidata.uf.viz.radarbrowser - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.eclipse.jem.beaninfo.BeanInfoNature - - diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/META-INF/MANIFEST.MF b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/META-INF/MANIFEST.MF deleted file mode 100644 index f24eb6c910..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/META-INF/MANIFEST.MF +++ /dev/null @@ -1,15 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: RadarBrowser Plug-in -Bundle-SymbolicName: edu.ucar.unidata.uf.viz.radarbrowser;singleton:=true -Bundle-Version: 1.14.0.qualifier -Bundle-Activator: edu.ucar.unidata.uf.viz.radarbrowser.Activator -Bundle-Vendor: Unidata -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 -Export-Package: edu.ucar.unidata.uf.viz.radarbrowser -Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0", - com.raytheon.viz.ui;bundle-version="1.14.0", - com.raytheon.uf.viz.core;bundle-version="1.14.3", - com.raytheon.uf.common.dataplugin, - com.raytheon.uf.viz.productbrowser;bundle-version="1.14.0" diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/build.properties b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/build.properties deleted file mode 100644 index 6c480f39f1..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/build.properties +++ /dev/null @@ -1,6 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - icons/ diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/edu.ucar.unidata.uf.viz.radarbrowser.ecl b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/edu.ucar.unidata.uf.viz.radarbrowser.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/icons/browser.gif b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/icons/browser.gif deleted file mode 100644 index 4b98a62c6eed7401e6fc5d44a2b319fdf56097de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 144 zcmZ?wbhEHb6krfw*v!BnlDS$SwCmuD|Ns9V|Nn8t|I3v-n!S$n`mZQ;UQyyaC(8~f z!GHu5f3h$#FmN;IfW$y%FtFGbob+71_gjX~`5)5h0xF3*POJPp9*Uh5I`d`89Sd{T mDpsFa%+I%fXlM~*P%zM%8#eWtcG&6%MSItj?e1V;um%8#wKpgL diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/icons/help.gif b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/icons/help.gif deleted file mode 100644 index 9d70301dae38843e0ad0ea28a42710f4c920ea9f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 259 zcmV+e0sQ_)Nk%w1VGsZi0K@U5T+@im_^v zw``QSd7ZwMvdp5p(@=n__51(&{r~9j_4NDy_x%6u^7Z!o|LpSh`ThU={{Qv-|M>m? z_x=C-{{Qy<|NsC0A^8LW0018VEC2ui01yBW000Gm;3tk`X+Do(pr)8Mgb)zTT0U^W z?HoWqBm<#9IH-g~!w8q*Bn*q1fs<(fKMz8r<6!JkoDSh?xL`1m9m0T!L@LTpc|+%{ z6&U&@o~2NBDm#AzS2%uu4h|L`78F(^LK+$zDjF6V1aU4f5IhhQKQ{(25)w2vEhs81 JEv+RX06QZIfSmvU diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/icons/refresh.gif b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/icons/refresh.gif deleted file mode 100644 index 3ca04d06ff9c811a6f791d029a802a7be4681ff4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 327 zcmZ?wbhEHb6krfwxXQrrJWa!4-LeYm0=|77MK@5?WI%v@BcT|Ns9CR0WDZSr{1@R2g(Yrh@#$z?O1g zQh|q#RHw+PiyoXB)1AE)3U1~skT{fJ?U6BUYICAZn$5HYp3GD7dKS#fQdLEHHy z6I^aRo~tUt;P2kV-Qf6T{aP*iM?lCLeYNChZ zME|t4Kq*J#ax2FU508od{@|VOltj+J(UOww!N5}U3iQCI3ZqHwGu%qFO+M$;f|G|KP zbfEZ?g^__lk3k2d733!dwiyo73p{kh9NV1~0xTMO)-@+?HCpL1C+*_|jkQs$L%3SK zWZD#%Uw+AK^#3sVq2$yax7_cq>g;#(C^lABHOjI%u}OEy<@M@F%Q8AK@K5dOm7mJO z;KV30f4Z*Rd;#G}fjokO)8$r)3o+Lza0p5E$no(>iVJg;1ab?@$%#scNeOe;IkR(c Y3G?y_b8(z@@nG_1@(Z}@>d0UX09ibCp#T5? diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/plugin.xml b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/plugin.xml deleted file mode 100644 index 0709edf26d..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/plugin.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/schema/dataDefinition.exsd b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/schema/dataDefinition.exsd deleted file mode 100644 index 68912bae86..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/schema/dataDefinition.exsd +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - [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/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/Activator.java b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/Activator.java deleted file mode 100644 index cebc6b3b0e..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/Activator.java +++ /dev/null @@ -1,73 +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 edu.ucar.unidata.uf.viz.radarbrowser; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "edu.ucar.unidata.uf.viz.radarbrowser"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (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/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/DataTypePreferencePage.java b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/DataTypePreferencePage.java deleted file mode 100644 index c9ff02b8ee..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/DataTypePreferencePage.java +++ /dev/null @@ -1,247 +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 edu.ucar.unidata.uf.viz.radarbrowser; - -import java.util.ArrayList; -import java.util.List; - -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 org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.ListEditor; -import org.eclipse.jface.preference.StringFieldEditor; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IViewReference; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; - -import com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition; -import com.raytheon.uf.viz.productbrowser.ProductBrowserPreference; - -import com.raytheon.uf.viz.productbrowser.ProductBrowserPreference.PreferenceType; - -/** - * Builds each data type's preference specifically for product browser - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 16, 2011            mnash     Initial creation
- * 
- * 
- * - * @author mnash - * @version 1.0 - */ - -public class DataTypePreferencePage extends FieldEditorPreferencePage implements - IWorkbenchPreferencePage { - - private static IExtension[] extensions; - - private List> prods = null; - - private List editors = null; - - private static boolean saved = false; - - public DataTypePreferencePage() { - super(GRID); - prods = new ArrayList>(); - editors = new ArrayList(); - setDescription("Specify Product Browser Settings..."); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - @Override - public void init(IWorkbench workbench) { - saved = false; - setPreferenceStore(Activator.getDefault().getPreferenceStore()); - setDescription("Data Type Preferences"); - IExtensionRegistry registry = Platform.getExtensionRegistry(); - IExtensionPoint point = registry - .getExtensionPoint(RadarBrowserUtils.DATA_DEFINITION_ID); - if (point != null) { - extensions = point.getExtensions(); - } else { - extensions = new IExtension[0]; - } - - for (IExtension ext : extensions) { - IConfigurationElement[] config = ext.getConfigurationElements(); - for (IConfigurationElement element : config) { - try { - AbstractProductBrowserDataDefinition prod = (AbstractProductBrowserDataDefinition) element - .createExecutableExtension("class"); - prods.add(prod); - } catch (CoreException e) { - e.printStackTrace(); - } - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk() - */ - @Override - public boolean performOk() { - boolean tf = super.performOk(); - for (IViewReference reference : PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage().getViewReferences()) { - if (!saved) { - if (RadarBrowserView.ID.equals(reference.getId())) { - ((RadarBrowserView) reference.getPart(true)) - .populateInitialProductTree(); - saved = true; - } - } - } - return tf; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.PreferencePage#performApply() - */ - @Override - protected void performApply() { - for (FieldEditor editor : editors) { - editor.store(); - } - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors - * () - */ - @Override - protected void createFieldEditors() { - String[][] fields = new String[prods.size()][2]; - for (int i = 0; i < fields.length; i++) { - for (int j = 0; j < fields[i].length; j++) { - fields[i][j] = prods.get(i).displayName; - } - } - - getPreferences(getProduct(getTitle())); - for (FieldEditor editor : editors) { - this.addField(editor); - } - } - - private AbstractProductBrowserDataDefinition getProduct(String name) { - for (AbstractProductBrowserDataDefinition prod : prods) { - if (name.equals(prod.displayName)) { - return prod; - } - } - return null; - } - - /** - * Per each type of product, goes in and decides what preferences it needs - * to display - * - * @param prod - */ - private void getPreferences( - final AbstractProductBrowserDataDefinition prod) { - List prefs = prod.getPreferences(); - for (ProductBrowserPreference pref : prefs) { - if (pref.getPreferenceType() == PreferenceType.EDITABLE_STRING) { - StringFieldEditor editor = new StringFieldEditor( - pref.getLabel() + prod.displayName, pref.getLabel(), - getFieldEditorParent()); - editors.add(editor); - } else if (pref.getPreferenceType() == PreferenceType.BOOLEAN) { - BooleanFieldEditor editor = new BooleanFieldEditor( - pref.getLabel() + prod.displayName, pref.getLabel(), - getFieldEditorParent()); - editors.add(editor); - } else if (pref.getPreferenceType() == PreferenceType.STRING_ARRAY) { - final String[] values = ((String[]) pref.getValue()); - ListEditor editor = new ListEditor(pref.getLabel() - + prod.displayName, pref.getLabel(), - getFieldEditorParent()) { - - @Override - protected String[] parseString(String stringList) { - return new String[0]; - } - - @Override - protected String getNewInputObject() { - return null; - } - - @Override - protected String createList(String[] items) { - String temp = ""; - for (int i = 0; i < items.length; i++) { - if (temp.isEmpty()) { - temp += items[i]; - } else { - temp += "," + items[i]; - } - } - return temp; - } - - @Override - protected void doFillIntoGrid(Composite parent, - int numColumns) { - super.doFillIntoGrid(parent, numColumns); - for (int i = 0; i < values.length; i++) { - getList().add(values[i]); - } - } - }; - editor.getButtonBoxControl(getFieldEditorParent()) - .getChildren()[0].setVisible(false); - editor.getButtonBoxControl(getFieldEditorParent()) - .getChildren()[1].setVisible(false); - editor.getButtonBoxControl(getFieldEditorParent()).layout(); - editors.add(editor); - } - } - } -} \ No newline at end of file diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserLabel.java b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserLabel.java deleted file mode 100644 index 96b05853c8..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserLabel.java +++ /dev/null @@ -1,165 +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 edu.ucar.unidata.uf.viz.radarbrowser; - -import java.util.Comparator; - -import com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition; - -/** - * Generic class for sending back information from the data definition classes - * to the product browser tree - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 21, 2010            mnash     Initial creation
- * 
- * 
- * - * @author mnash - * @version 1.0 - */ - -public class RadarBrowserLabel implements Comparable, - Comparator { - - public RadarBrowserLabel() { - } - - public RadarBrowserLabel(String name, String data) { - super(); - this.name = name; - this.data = data; - } - - private String name; - - private String data; - - private boolean product; - - private AbstractProductBrowserDataDefinition definition; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public boolean isProduct() { - return product; - } - - public void setProduct(boolean product) { - this.product = product; - } - - /** - * @return the definition - */ - public AbstractProductBrowserDataDefinition getDefinition() { - return definition; - } - - /** - * @param definition - * the definition to set - */ - public void setDefinition(AbstractProductBrowserDataDefinition definition) { - this.definition = definition; - } - - /* - * (non-Javadoc) - * - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - @Override - public int compare(RadarBrowserLabel o1, RadarBrowserLabel o2) { - if (o1.getName() != null && o2.getName() != null) { - return o1.getName().compareToIgnoreCase(o2.getName()); - } - return 0; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ - @Override - public int compareTo(RadarBrowserLabel that) { - return this.compare(this, that); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((data == null) ? 0 : data.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - RadarBrowserLabel other = (RadarBrowserLabel) obj; - if (data == null) { - if (other.data != null) - return false; - } else if (!data.equals(other.data)) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } -} diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserPreferencesPage.java b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserPreferencesPage.java deleted file mode 100644 index 0c19810666..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserPreferencesPage.java +++ /dev/null @@ -1,73 +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 edu.ucar.unidata.uf.viz.radarbrowser; - -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 10, 2011            mnash     Initial creation
- * 
- * 
- * - * @author mnash - * @version 1.0 - */ - -public class RadarBrowserPreferencesPage extends FieldEditorPreferencePage - implements IWorkbenchPreferencePage { - - public RadarBrowserPreferencesPage() { - super(GRID); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - @Override - public void init(IWorkbench workbench) { - setPreferenceStore(Activator.getDefault().getPreferenceStore()); - setDescription("Specify Product Browser Settings...\n\nFor each plugin, set different options."); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors - * () - */ - @Override - protected void createFieldEditors() { - } -} \ No newline at end of file diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserUtils.java b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserUtils.java deleted file mode 100644 index bdb78f6871..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserUtils.java +++ /dev/null @@ -1,70 +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 edu.ucar.unidata.uf.viz.radarbrowser; - -import java.io.File; -import java.net.URL; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.resource.ImageDescriptor; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; - -/** - * Utilities to be used by the product browser - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Aug 2, 2010            mnash     Initial creation
- * 
- * 
- * - * @author mnash - * @version 1.0 - */ - -public class RadarBrowserUtils { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(RadarBrowserUtils.class); - - public static final String DATA_DEFINITION_ID = "edu.ucar.unidata.uf.viz.radarbrowser.dataDefinition"; - - /** - * Gets the image descriptor so an image can be displayed (for icons) - * - * @param string - * @return - */ - public static ImageDescriptor getImageDescriptor(String string) { - String iconPath = "icons" + File.separator; - URL url = FileLocator.find(Activator.getDefault().getBundle(), - new Path(iconPath + string), null); - if (url != null && url.getFile() == null) { - url = FileLocator.find(Activator.getDefault().getBundle(), - new Path(".." + File.separator + iconPath + string), null); - } - return ImageDescriptor.createFromURL(url); - } -} diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserView.java b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserView.java deleted file mode 100644 index 2199df2b35..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/RadarBrowserView.java +++ /dev/null @@ -1,427 +0,0 @@ -package edu.ucar.unidata.uf.viz.radarbrowser; - -/** - * 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. - **/ - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -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 org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.ui.part.ViewPart; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.viz.core.rsc.DisplayType; -import com.raytheon.uf.viz.core.rsc.ResourceType; -import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability; -import com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition; -import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition; - -import edu.ucar.unidata.uf.viz.radarbrowser.jobs.RadarBrowserInitializeJob; -import edu.ucar.unidata.uf.viz.radarbrowser.jobs.RadarBrowserQueryJob; - -/** - * Product browser view implementation - * - *
- * 
- * SOFTWARE HISTORY
- * Date          Ticket#  Engineer    Description
- * ------------- -------- ----------- --------------------------
- * May 03, 2010           mnash       Initial creation
- * May 02, 2013  1949     bsteffen    Switch Product Browser from uengine to
- *                                    DbQueryRequest.
- * May 13, 2014  3135     bsteffen    Make all queries async.
- * 
- * 
- * 
- * - * @author mnash - * @version 1.0 - */ -public class RadarBrowserView extends ViewPart { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(RadarBrowserView.class); - - public static final String ID = "edu.ucar.unidata.uf.viz.radarbrowser.RadarBrowserView"; - - public static final String LABEL_DATA_KEY = "label"; - - public static final String DEF_DATA_KEY = "defintion"; - - private static IExtension[] extensions; - - private Tree productTree; - - private Action loadProductAction; - - private Action productInfoAction; - - private Action refreshAction; - - @Override - public void createPartControl(Composite parent) { - Composite fullComp = new Composite(parent, SWT.FILL); - fullComp.setLayout(new GridLayout(1, true)); - getDataTypes(); - createActions(); - createToolbar(); - createProductTree(fullComp); - createProductBrowserContextMenu(); - } - - /** - * Provides the actions available to the product tree - */ - private void createActions() { - refreshAction = new Action("Refresh Browser") { - @Override - public void run() { - populateInitialProductTree(); - } - }; - refreshAction.setId("refreshAction"); - refreshAction.setImageDescriptor(RadarBrowserUtils - .getImageDescriptor("refresh.gif")); - - productInfoAction = new Action("Product Info") { - @Override - public void run() { - displayInfo(); - } - }; - productInfoAction.setId("productInfoAction"); - productInfoAction.setImageDescriptor(RadarBrowserUtils - .getImageDescriptor("help.gif")); - - loadProductAction = new Action("Load Product") { - @Override - public void run() { - loadProduct(null); - } - }; - loadProductAction.setId("loadProductAction"); - loadProductAction.setImageDescriptor(RadarBrowserUtils - .getImageDescriptor("run.gif")); - } - - - /** - * Creates the product browser that spans the entire view... - * - * @param parent - */ - public void createProductTree(final Composite parent) { - GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); - productTree = new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL - | SWT.BORDER); - productTree.setLayoutData(gridData); - productTree.addListener(SWT.MouseDoubleClick, new Listener() { - @Override - public void handleEvent(Event event) { - if (event.button == 1) { - loadProductAction.run(); - } - } - }); - - productTree.addListener(SWT.Expand, new Listener() { - @Override - public void handleEvent(Event event) { - RadarBrowserQueryJob.startJob((TreeItem) event.item); - } - }); - - productTree.addListener(SWT.MouseMove, new Listener() { - @Override - public void handleEvent(Event event) { - productTree.setToolTipText(""); - } - }); - populateInitialProductTree(); - } - - /** - * Builds the toolbar at the top of the view - */ - private void createToolbar() { - IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager(); - mgr.add(refreshAction); - } - - /** - * Creating the right click menu, for the product tree - */ - private void createProductBrowserContextMenu() { - MenuManager menuMgr = new MenuManager(); - menuMgr.setRemoveAllWhenShown(true); - menuMgr.addMenuListener(new IMenuListener() { - @Override - public void menuAboutToShow(IMenuManager mgr) { - fillProductBrowserContextMenu(mgr); - } - }); - - Menu menu = menuMgr.createContextMenu(productTree); - productTree.setMenu(menu); - } - - - /** - * Takes the menu during the right click and fills it with actions pertinent - * to the product tree and pertinent to the item that is selected - * - * @param mgr - */ - protected void fillProductBrowserContextMenu(IMenuManager mgr) { - TreeItem[] selection = productTree.getSelection(); - if (selection != null && selection.length > 0) { - RadarBrowserLabel label = getLabel(selection[0]); - if (label == null) { - return; - } - // if not a product, do not give opportunity to load things - if (label.isProduct()) { - AbstractProductBrowserDataDefinition def = getDataDef(selection[0]); - Map> displayTypes = def - .getDisplayTypes(); - if (displayTypes != null && displayTypes.isEmpty() == false) { - MenuManager menuMgr = new MenuManager("Load As...", - RadarBrowserUtils.getImageDescriptor("run.gif"), - ""); - for (ResourceType type : displayTypes.keySet()) { - if (displayTypes.keySet().size() <= 1) { - for (DisplayType types : displayTypes.get(type)) { - menuMgr.add(getDisplayTypeAction(types)); - } - } - } - mgr.add(menuMgr); - } else { - mgr.add(loadProductAction); - } - } - mgr.add(productInfoAction); - } - } - - private Action getDisplayTypeAction(final DisplayType type) { - char[] name = type.name().toLowerCase().toCharArray(); - name[0] = Character.toUpperCase(name[0]); - Action action = new Action((String.valueOf(name))) { - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.action.Action#run() - */ - @Override - public void run() { - loadProduct(type); - } - }; - return action; - } - - /** - * Take the initial plugins available and populate them if they have any - * data. This function does not populate the tree with the data, just the - * plugin names. - * - * @param popData - */ - public void populateInitialProductTree() { - productTree.removeAll(); - for (IExtension ext : extensions) { - IConfigurationElement[] config = ext.getConfigurationElements(); - for (IConfigurationElement element : config) { - AbstractProductBrowserDataDefinition prod = null; - try { - prod = (AbstractProductBrowserDataDefinition) element - .createExecutableExtension("class"); - } catch (CoreException e) { - statusHandler - .error("A product browser data definition has failed to load.", - e); - continue; - } - String displayText = "Checking Availability of " - + prod.displayName + "..."; - /* Sort alphabetically. */ - int index = 0; - for (TreeItem items : productTree.getItems()) { - if (items.getText().compareToIgnoreCase(displayText) > 0) { - break; - } else { - index++; - } - } - TreeItem ti = new TreeItem(productTree, SWT.NONE, index); - ti.setText(displayText); - RadarBrowserLabel label = new RadarBrowserLabel( - prod.displayName, prod.displayName); - if (prod instanceof AbstractRequestableProductBrowserDataDefinition) { - AbstractRequestableProductBrowserDataDefinition arpbdd = (AbstractRequestableProductBrowserDataDefinition) prod; - label.setData(arpbdd.productName); - label.setProduct(arpbdd.order.length == 0); - } - ti.setData(LABEL_DATA_KEY, label); - ti.setData(DEF_DATA_KEY, prod); - Font font = ti.getFont(); - FontData fontData = font.getFontData()[0]; - fontData = new FontData(fontData.getName(), - fontData.getHeight(), SWT.BOLD); - font = new Font(ti.getDisplay(), fontData); - ti.setFont(font); - new RadarBrowserInitializeJob(ti).schedule(); - } - } - } - - /** - * Using reflection and the eclipse registry, agnostically finds the - * available types to populate the tree - */ - private void getDataTypes() { - IExtensionRegistry registry = Platform.getExtensionRegistry(); - IExtensionPoint point = registry - .getExtensionPoint(RadarBrowserUtils.DATA_DEFINITION_ID); - if (point != null) { - extensions = point.getExtensions(); - } else { - extensions = new IExtension[0]; - } - } - - private void loadProduct(DisplayType type) { - TreeItem[] selection = productTree.getSelection(); - if (selection != null) { - for (TreeItem item : selection) { - RadarBrowserLabel label = getLabel(selection[0]); - if (label == null) { - return; - } - // if not a product, do not give opportunity to load things - if (label.isProduct()) { - AbstractProductBrowserDataDefinition def = getDataDef(item); - String[] path = getProductURI(item, false); - if (type != null) { - def.loadProperties - .getCapabilities() - .getCapability(def.resourceData, - DisplayTypeCapability.class) - .setDisplayType(type); - } - def.constructResource(path, null); - } - } - } - } - - /** - * Adds tooltip text to the tree with information about the selected item - */ - private void displayInfo() { - StringBuilder stringBuilder = new StringBuilder(); - for (TreeItem ti : productTree.getSelection()) { - if (stringBuilder.length() > 0) { - stringBuilder.append("\n---------------\n"); - } - AbstractProductBrowserDataDefinition prod = getDataDef(ti); - String[] info = getProductURI(ti, false); - if (prod instanceof AbstractRequestableProductBrowserDataDefinition) { - AbstractRequestableProductBrowserDataDefinition aProd = (AbstractRequestableProductBrowserDataDefinition) prod; - stringBuilder.append(aProd.PLUGIN_NAME + " = " - + aProd.productName); - } else { - stringBuilder.append(prod.displayName); - } - for (int i = 1; i < info.length; i++) { - stringBuilder.append("\n"); - if (prod instanceof AbstractRequestableProductBrowserDataDefinition) { - stringBuilder - .append(((AbstractRequestableProductBrowserDataDefinition) prod).order[i - 1] - + " = " + info[i]); - } else { - stringBuilder.append(info[i]); - } - } - productTree.setToolTipText(stringBuilder.toString()); - } - } - - @Override - public void setFocus() { - productTree.setFocus(); - } - - /** - * Using the tree item, gets the URI based on where it is within the tree - * - * @param item - * @return - */ - public static String[] getProductURI(TreeItem item, boolean isName) { - List data = new ArrayList(); - while (item != null) { - RadarBrowserLabel label = getLabel(item); - if (isName || label.getData() == null) { - data.add(label.getName()); - } else { - data.add(label.getData()); - } - item = item.getParentItem(); - } - Collections.reverse(data); - return data.toArray(new String[0]); - } - - public static RadarBrowserLabel getLabel(TreeItem item) { - return (RadarBrowserLabel) item.getData(LABEL_DATA_KEY); - } - - public static AbstractProductBrowserDataDefinition getDataDef( - TreeItem item) { - return (AbstractProductBrowserDataDefinition) item - .getData(DEF_DATA_KEY); - } -} diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/actions/RadarBrowserAction.java b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/actions/RadarBrowserAction.java deleted file mode 100644 index 11b71633b4..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/actions/RadarBrowserAction.java +++ /dev/null @@ -1,53 +0,0 @@ -package edu.ucar.unidata.uf.viz.radarbrowser.actions; - -/** - * 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. - **/ - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; - -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.status.StatusConstants; - -import edu.ucar.unidata.uf.viz.radarbrowser.Activator; -import edu.ucar.unidata.uf.viz.radarbrowser.RadarBrowserView; - -public class RadarBrowserAction extends AbstractHandler { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(RadarBrowserAction.class); - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - // this opens the product browser view - try { - PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getActivePage().showView(RadarBrowserView.ID); - } catch (PartInitException e) { - statusHandler.handle(Priority.PROBLEM, - "Unable to open product browser", e); - } - return event; - } - -} diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/jobs/RadarBrowserInitializeJob.java b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/jobs/RadarBrowserInitializeJob.java deleted file mode 100644 index 89fb67be25..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/jobs/RadarBrowserInitializeJob.java +++ /dev/null @@ -1,118 +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 edu.ucar.unidata.uf.viz.radarbrowser.jobs; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.TreeItem; - -import com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition; - -import edu.ucar.unidata.uf.viz.radarbrowser.RadarBrowserView; - -/** - * - * Job for initializing {@link TreeItem}s for the {@link RadarBrowserView}. - * The tree items are assumed to be initially in a loading state and this job - * asynchronously calls - * {@link AbstractRadarBrowserDataDefinition#populateInitial()} to determine - * if the item should be expandable and then removes or configures the item on - * the UI thread. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date          Ticket#  Engineer    Description
- * ------------- -------- ----------- --------------------------
- * May 13, 2014  3135     bsteffen    Initial creation
- * 
- * 
- * - * @author bsteffen - * @version 1.0 - */ -public class RadarBrowserInitializeJob extends Job implements Runnable { - - protected final TreeItem item; - - protected final AbstractProductBrowserDataDefinition def; - - protected String displayName; - - /** - * Create a new Job for the provided item, this constructor must be called - * on the UI thread. - * - * @param item - * a TreeItem from the {@link RadarBrowserView} - */ - public RadarBrowserInitializeJob(TreeItem item) { - super(item.getText()); - this.item = item; - /* - * Def must be pulled out of item on the UI thread so it can be accessed - * off the UI thread. - */ - this.def = RadarBrowserView.getDataDef(item); - } - - /** - * Runnable method inherited from {@link Job} for running in the background. - */ - @Override - protected IStatus run(IProgressMonitor monitor) { - displayName = def.populateInitial(); - if (!item.isDisposed()) { - item.getDisplay().syncExec(this); - } - return Status.OK_STATUS; - - } - - /** - * Runnable method inherited from {@link Runnable}. This will be run on the - * UI thread. - */ - @Override - public void run() { - if (item.isDisposed()) { - return; - } - if (displayName == null) { - item.dispose(); - } else { - item.setText(displayName); - if (!RadarBrowserView.getLabel(item).isProduct()) { - /* - * gives the tree the ability to be opened by adding a "fake" - * tree item that will be disposed of later - */ - TreeItem fake = new TreeItem(item, SWT.NONE); - fake.setText("Loading..."); - } - } - - } - -} diff --git a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/jobs/RadarBrowserQueryJob.java b/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/jobs/RadarBrowserQueryJob.java deleted file mode 100644 index 50a3b7c506..0000000000 --- a/unidata/edu.ucar.unidata.uf.viz.radarbrowser/src/edu/ucar/unidata/uf/viz/radarbrowser/jobs/RadarBrowserQueryJob.java +++ /dev/null @@ -1,256 +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 edu.ucar.unidata.uf.viz.radarbrowser.jobs; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.TreeItem; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.viz.productbrowser.AbstractProductBrowserDataDefinition; -import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel; - -import edu.ucar.unidata.uf.viz.radarbrowser.RadarBrowserLabel; -import edu.ucar.unidata.uf.viz.radarbrowser.RadarBrowserView; - -/** - * - * Job for performing the population of the {@link RadarBrowserView} tree - * asynchronously. To avoid querying multiple times on the same item all - * instances of this class should be started with {@link #startJob(TreeItem)}. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date          Ticket#  Engineer    Description
- * ------------- -------- ----------- --------------------------
- * May 13, 2014  3135     bsteffen    Initial creation
- * Jun 24, 2014  3279     bclement    added error handling and item.clearAll() 
- *                                      to run methods to fix eternal 'Loading...' problem
- * Jul 07, 2014  3135     bsteffen    Remove child nodes when there are no results.
- * 
- * 
- * 
- * - * @author bsteffen - * @version 1.0 - */ -public class RadarBrowserQueryJob extends Job implements Runnable { - - private static final IUFStatusHandler log = UFStatus - .getHandler(RadarBrowserQueryJob.class); - - protected static final String JOB_DATA_KEY = "queryJob"; - - protected TreeItem item; - - protected final AbstractProductBrowserDataDefinition def; - - protected final String[] selection; - - protected List results; - - protected RadarBrowserQueryJob(TreeItem item) { - super(extractName(item)); - this.item = item; - /* - * Fields must be pulled off the item on the UI thread. - */ - this.def = RadarBrowserView.getDataDef(item); - this.selection = RadarBrowserView.getProductURI(item, false); - item.setData(JOB_DATA_KEY, this); - } - - /** - * Runnable method inherited from {@link Job} for running in the background. - */ - @Override - protected IStatus run(IProgressMonitor monitor) { - IStatus rval = Status.OK_STATUS; - try { - results = def.populateData(selection); - if (!item.isDisposed()) { - item.getDisplay().syncExec(this); - } - } catch (Throwable e) { - /* something has gone very wrong */ - log.error(e.getLocalizedMessage(), e); - rval = Status.CANCEL_STATUS; - /* clean up tree */ - if (!item.isDisposed()) { - item.getDisplay().syncExec(new Runnable() { - @Override - public void run() { - for (TreeItem child : item.getItems()) { - child.dispose(); - } - } - }); - } - } - return rval; - } - - /** - * Runnable method inherited from {@link Runnable}. This will be run on the - * UI thread. - */ - @Override - public void run() { - if (item.isDisposed()) { - return; - } - List results = this.results; - if (results == null) { - results = Collections.emptyList(); - } - /* - * If all children are disposed it can cause expand to disable so make - * sure we re enable it. - */ - boolean expanded = item.getExpanded(); - /* - * Attempt to merge any existing nodes with the labels returned from the - * query. If the order is the same then this should only perform simple - * additions/removals. If the order has changed for some reason this - * will copy some items to try to make the UI as consistent as possible. - */ - for (int i = 0; i < results.size(); i += 1) { - boolean create = true; - ProductBrowserLabel label = results.get(i); - while (i < item.getItemCount()) { - TreeItem childItem = item.getItem(i); - RadarBrowserLabel childLabel = RadarBrowserView - .getLabel(childItem); - if (childLabel != null && childLabel.equals(label)) { - create = false; - break; - } else if (results.contains(childLabel)) { - for (int j = i + 1; j < item.getItemCount(); j += 1) { - childItem = item.getItem(j); - childLabel = RadarBrowserView.getLabel(childItem); - if (childLabel.equals(label)) { - TreeItem child = new TreeItem(item, SWT.NONE, i); - copyItem(childItem, child); - childItem.dispose(); - create = false; - break; - } - } - break; - } else { - childItem.dispose(); - } - } - if (create) { - TreeItem child = new TreeItem(item, SWT.NONE, i); - child.setText(label.getName()); - child.setData(RadarBrowserView.LABEL_DATA_KEY, label); - child.setData(RadarBrowserView.DEF_DATA_KEY, def); - if (!label.isProduct()) { - TreeItem loading = new TreeItem(child, SWT.NONE); - loading.setText("Loading..."); - loading.setGrayed(true); - } - } - } - if (!results.isEmpty()) { - item.setExpanded(expanded); - } else { - for (TreeItem child : item.getItems()) { - child.dispose(); - } - } - item.setData(JOB_DATA_KEY, null); - } - - /** - * Recursively copy an item. This is only needed if a query is repeated and - * returns items in a new order. - * - * @param oldItem - * @param newItem - */ - protected void copyItem(TreeItem oldItem, TreeItem newItem) { - newItem.setText(oldItem.getText()); - for (TreeItem oldChild : oldItem.getItems()) { - TreeItem newChild = new TreeItem(newItem, SWT.NONE); - if (newItem.getItemCount() == 1) { - /* - * For recursive expansion to work newItem must be expanded - * after newChild is created but before newChild is expanded. - */ - newItem.setExpanded(oldItem.getExpanded()); - } - copyItem(oldChild, newChild); - } - newItem.setData(RadarBrowserView.LABEL_DATA_KEY, - RadarBrowserView - .getLabel(oldItem)); - newItem.setData(RadarBrowserView.DEF_DATA_KEY, - RadarBrowserView.getDataDef(oldItem)); - RadarBrowserQueryJob job = (RadarBrowserQueryJob) oldItem - .getData(JOB_DATA_KEY); - if (job != null) { - job.setItem(newItem); - newItem.setData(JOB_DATA_KEY, job); - } - - } - - protected void setItem(TreeItem item) { - this.item = item; - } - - protected static String extractName(TreeItem item) { - StringBuilder name = new StringBuilder(); - if (item.getItemCount() == 1) { - name.append("Querying"); - } else { - name.append("Refreshing"); - } - for (String label : RadarBrowserView.getProductURI(item, true)) { - name.append(" ").append(label); - } - return name.toString(); - } - - /** - * Start a new query job for the provided item only if there is not - * currently a job running. - * - * @param item - * a TreeItem from the {@link RadarBrowserView} - */ - public static void startJob(TreeItem item) { - if (item.getData(JOB_DATA_KEY) == null) { - new RadarBrowserQueryJob(item).schedule(); - } - } - -} diff --git a/unidata/edu.ucar.unidata.ui.ncradarui/.classpath b/unidata/edu.ucar.unidata.ui.ncradarui/.classpath deleted file mode 100644 index e8ea977a69..0000000000 --- a/unidata/edu.ucar.unidata.ui.ncradarui/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/unidata/edu.ucar.unidata.ui.ncradarui/.project b/unidata/edu.ucar.unidata.ui.ncradarui/.project deleted file mode 100644 index c7ddc9eed1..0000000000 --- a/unidata/edu.ucar.unidata.ui.ncradarui/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - edu.ucar.unidata.ui.ncradarui - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/unidata/edu.ucar.unidata.ui.ncradarui/META-INF/MANIFEST.MF b/unidata/edu.ucar.unidata.ui.ncradarui/META-INF/MANIFEST.MF deleted file mode 100644 index 525378044b..0000000000 --- a/unidata/edu.ucar.unidata.ui.ncradarui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,42 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Ncradarui Plug-in -Bundle-SymbolicName: edu.ucar.unidata.ui.ncradarui;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: edu.ucar.unidata.ui.ncradarui.Activator -Eclipse-BuddyPolicy: registered, ext, global -Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.common.serialization -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - com.raytheon.viz.ui;bundle-version="1.11.17", - org.geotools, - com.raytheon.viz.core;bundle-version="1.11.17", - gov.noaa.nws.ncep.ui.pgen, - gov.noaa.nws.ncep.viz.common;bundle-version="1.0.0", - com.raytheon.uf.common.pointdata, - com.raytheon.uf.viz.datacube -Eclipse-LazyStart: true -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-Vendor: SIB -Import-Package: com.raytheon.uf.common.dataplugin, - com.raytheon.uf.common.dataplugin.obs.metar, - com.raytheon.uf.common.inventory.exception, - com.raytheon.uf.common.pointdata, - com.raytheon.uf.viz.core, - com.raytheon.uf.viz.core.drawables, - com.raytheon.uf.viz.core.exception, - com.raytheon.uf.viz.core.map, - com.raytheon.uf.viz.core.rsc, - com.raytheon.viz.pointdata, - com.vividsolutions.jts.geom, - gov.noaa.nws.ncep.ui.nctextui.dbutil, - gov.noaa.nws.ncep.ui.nctextui.rsc, - gov.noaa.nws.ncep.viz.common.ui, - gov.noaa.nws.ncep.viz.localization, - gov.noaa.nws.ncep.viz.overlays, - gov.noaa.nws.ncep.viz.resources.manager, - gov.noaa.nws.ncep.viz.ui.display, - org.eclipse.ui.forms.widgets, - org.geotools.referencing, - org.geotools.referencing.datum, - org.opengis.referencing.crs diff --git a/unidata/edu.ucar.unidata.ui.ncradarui/build.properties b/unidata/edu.ucar.unidata.ui.ncradarui/build.properties deleted file mode 100644 index e9863e281e..0000000000 --- a/unidata/edu.ucar.unidata.ui.ncradarui/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml diff --git a/unidata/edu.ucar.unidata.ui.ncradarui/edu.ucar.unidata.ui.ncradarui.ecl b/unidata/edu.ucar.unidata.ui.ncradarui/edu.ucar.unidata.ui.ncradarui.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/unidata/edu.ucar.unidata.ui.ncradarui/plugin.xml b/unidata/edu.ucar.unidata.ui.ncradarui/plugin.xml deleted file mode 100644 index df0cb29f02..0000000000 --- a/unidata/edu.ucar.unidata.ui.ncradarui/plugin.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/Activator.java b/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/Activator.java deleted file mode 100644 index 4ab7fdc01e..0000000000 --- a/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/Activator.java +++ /dev/null @@ -1,50 +0,0 @@ -package edu.ucar.unidata.ui.ncradarui; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "edu.ucar.unidata.ui.ncradarui"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (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/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/HandlePrinting.java b/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/HandlePrinting.java deleted file mode 100644 index 3dcfe514ba..0000000000 --- a/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/HandlePrinting.java +++ /dev/null @@ -1,185 +0,0 @@ -/** - * - * edu.ucar.unidata.ui.ncradarui.palette.HandlePrinting - * - * This java class performs the NCRADAR GUI text printing handling. - * It should be able to be used by other project as well. - * This code has been developed by the SIB for use in the AWIPS2 system. - * - *
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    	Engineer    Description
- * -------		------- 	-------- 	-----------
- * 1/21/2010		TBD		Chin Chen	Initial coding
- *
- * 
- * - * @author Chin Chen - * @version 1.0 - */ -package edu.ucar.unidata.ui.ncradarui.palette; - - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.printing.PrintDialog; -import org.eclipse.swt.printing.Printer; -import org.eclipse.swt.printing.PrinterData; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; - -public class HandlePrinting { - private Printer printer; - private StringBuffer wordBuffer; - private int lineHeight = 0; - private int tabWidth = 0; - private int leftMargin, rightMargin, topMargin, bottomMargin; - private int x, y; - private int index, end; - private String text; - private GC gc; - - private static HandlePrinting printHandle=null; - public static HandlePrinting getPrintHandle() { - if(printHandle==null) - printHandle = new HandlePrinting(); - return printHandle; - } - public void handlePrint(String intext) { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - text = intext; - PrintDialog dialog = new PrintDialog(shell, SWT.NULL); - PrinterData data = dialog.open(); - if (data == null) return; - if (data.printToFile) { - data.fileName = "print.out"; // you probably want to ask the user for a filename - } - - /* Do the printing in a background thread so that spooling does not freeze the UI. */ - printer = new Printer(data); - Thread printingThread = new Thread("Printing") { - public void run() { - print(printer); - printer.dispose(); - } - }; - printingThread.start(); - } - - private void print(Printer printer) { - String tabs; - Font printerFont; - Color printerForegroundColor, printerBackgroundColor; - - if (printer.startJob("Ncradar")) { // the string is the job name - shows up in the printer's job list - Rectangle clientArea = printer.getClientArea(); - Rectangle trim = printer.computeTrim(0, 0, 0, 0); - Point dpi = printer.getDPI(); - leftMargin = dpi.x + trim.x; // one inch from left side of paper - rightMargin = clientArea.width - dpi.x + trim.x + trim.width; // one inch from right side of paper - topMargin = dpi.y + trim.y; // one inch from top edge of paper - bottomMargin = clientArea.height - dpi.y + trim.y + trim.height; // one inch from bottom edge of paper - - /* Create a buffer for computing tab width. */ - int tabSize = 4; // is tab width a user setting in your UI? - StringBuffer tabBuffer = new StringBuffer(tabSize); - for (int i = 0; i < tabSize; i++) tabBuffer.append(' '); - tabs = tabBuffer.toString(); - - /* Create printer GC, and create and set the printer font & foreground color. */ - gc = new GC(printer); - printerFont = new Font(printer, "Courier", 8, SWT.NORMAL); - gc.setFont(printerFont); - tabWidth = gc.stringExtent(tabs).x; - lineHeight = gc.getFontMetrics().getHeight(); - - RGB rgb = new RGB(0,0,0);//Black - printerForegroundColor = new Color(printer, rgb); - gc.setForeground(printerForegroundColor); - rgb = new RGB(255,255,255);//white - printerBackgroundColor = new Color(printer, rgb); - gc.setBackground(printerBackgroundColor); - - /* Print text to current gc using word wrap */ - printText(); - printer.endJob(); - - /* Cleanup graphics resources used in printing */ - printerFont.dispose(); - printerForegroundColor.dispose(); - printerBackgroundColor.dispose(); - gc.dispose(); - } - } - - void printText() { - String textToPrint; - /* Get the text to print */ - textToPrint = text; - printer.startPage(); - wordBuffer = new StringBuffer(); - x = leftMargin; - y = topMargin; - index = 0; - end = textToPrint.length(); - while (index < end) { - char c = textToPrint.charAt(index); - index++; - if (c != 0) { - if (c == 0x0a || c == 0x0d) { - if (c == 0x0d && index < end && textToPrint.charAt(index) == 0x0a) { - index++; // if this is cr-lf, skip the lf - } - printWordBuffer(); - newline(); - } else { - if (c != '\t') { - wordBuffer.append(c); - } - if (Character.isWhitespace(c)) { - printWordBuffer(); - if (c == '\t') { - x += tabWidth; - } - } - } - } - } - if (y + lineHeight <= bottomMargin) { - printer.endPage(); - } - } - - void printWordBuffer() { - if (wordBuffer.length() > 0) { - String word = wordBuffer.toString(); - int wordWidth = gc.stringExtent(word).x; - if (x + wordWidth > rightMargin) { - /* word doesn't fit on current line, so wrap */ - newline(); - } - gc.drawString(word, x, y, false); - x += wordWidth; - wordBuffer = new StringBuffer(); - } - } - - void newline() { - x = leftMargin; - y += lineHeight; - if (y + lineHeight > bottomMargin) { - printer.endPage(); - if (index + 1 < end) { - y = topMargin; - printer.startPage(); - } - } - } -} - diff --git a/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/NcradaruiPaletteAction.java b/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/NcradaruiPaletteAction.java deleted file mode 100644 index 372f30f39e..0000000000 --- a/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/NcradaruiPaletteAction.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * edu.ucar.unidata.ui.ncradarui.palette.NcradaruiPaletteAction - * - * 12/24/2009 - * - * This code has been developed by the SIB for use in the AWIPS2 system. - * - * @author Chin Chen - * @version 1.0 - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * 06/28/2011 T402 X. Guo Re-format NCRADAR view panel, check - * the click action on nctext legend - */ - -package edu.ucar.unidata.ui.ncradarui.palette; - - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; - -import gov.noaa.nws.ncep.ui.nctextui.rsc.NctextuiResource; - - -public class NcradaruiPaletteAction extends AbstractHandler { - - @Override - public Object execute(ExecutionEvent arg0) throws ExecutionException { - - /* - * The viewID string is in the XML file for NCRADARUI extension point. - */ - - IWorkbenchPage wpage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - - IViewPart vpart = wpage.findView( "edu.ucar.unidata.ui.NCRADARUI" ); - - try { - - if ( vpart == null ){ - - vpart = wpage.showView( "edu.ucar.unidata.ui.NCRADARUI" ); - if (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null) { - NctextuiResource nctextMapResource = NctextuiResource.getNctextuiResource(); - nctextMapResource.setPoints(null); - } - } - else { - - if ( ! wpage.isPartVisible(vpart) ) vpart = wpage.showView( "edu.ucar.unidata.ui.NCRADARUI" ); - - } - } - catch (Exception e) { - - e.printStackTrace(); - - } - - return null; - } - -} diff --git a/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/NcradaruiPaletteWindow.java b/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/NcradaruiPaletteWindow.java deleted file mode 100644 index d3c3ed13d0..0000000000 --- a/unidata/edu.ucar.unidata.ui.ncradarui/src/edu/ucar/unidata/ui/ncradarui/palette/NcradaruiPaletteWindow.java +++ /dev/null @@ -1,1052 +0,0 @@ -/* - * - * edu.ucar.unidata.ui.ncradarui.palette.NcradaruiPaletteWindow - * - * This java class performs the NCRADAR GUI construction. - * This code has been developed by the SIB for use in the AWIPS2 system. - * - *
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    	Engineer    Description
- * -------		------- 	-------- 	-----------
- * 12/24/2009		TBD		Chin Chen	Initial coding
- * 06/28/2011       T402       X. Guo   Re-format NCRADAR view panel, check
- *                                      the click action on ncradar legend
- * 02/15/2012     #972      G. Hull     NatlCntrsEditor 
- *
- * 
- * - * @author Chin Chen - * @version 1.0 - */ -package edu.ucar.unidata.ui.ncradarui.palette; - -import gov.noaa.nws.ncep.ui.nctextui.dbutil.EReportTimeRange; -import gov.noaa.nws.ncep.ui.nctextui.dbutil.NctextDbQuery; -import gov.noaa.nws.ncep.ui.nctextui.dbutil.NctextStationInfo; -import gov.noaa.nws.ncep.ui.nctextui.rsc.NctextuiResource; -import gov.noaa.nws.ncep.viz.ui.display.NatlCntrsEditor; -import gov.noaa.nws.ncep.viz.ui.display.NcDisplayMngr; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; - -import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; -import com.raytheon.uf.viz.core.drawables.ResourcePair; -import com.raytheon.viz.ui.UiUtil; - -public class NcradaruiPaletteWindow extends ViewPart implements - SelectionListener, DisposeListener, IPartListener { - - private String selectedGp = null; - - private String selectedType = null; - - private IWorkbenchPage page; - - private org.eclipse.swt.widgets.List gpWdgList = null; - - private org.eclipse.swt.widgets.List typeWdgList = null; - - private NctextDbQuery query; - - private EReportTimeRange timeCovered = EReportTimeRange.TWELVE_HOURS; - - private boolean isState = false; - - private boolean replaceText = true; - - private String gpLabelStr = "Select Data Type Group "; - - private String productLabelStr = "Select Data Type Product"; - - private Group dataTypeGp; - - private Group prodListGp; - - private Group timeGp; - - private Group staStnGp; - - private Group textGp; - - private String currentProductName = null; - - private int colWidth = 200; - - private int listHeight = 150; - - private int btnGapY = 5; - - private int btnGapX = 5; - - private int timeBtnWidth = 40; - - private int staBtnWidth = 75; - - private int btnHeight = 20; - - private int pushbtnHeight = 25; - - private int labelGap = 20; - - private static int ASCII_CR_VAL = 13; - - private Text text; - - private Button nextBtn, prevBtn; - - private java.util.List points = new ArrayList(); - - // private static NCMapEditor mapEditor = null; - private HandlePrinting printingHandle; - - private boolean isEditorVisible = true; - - private int dataTypeGpItem = 0; - - private int dataTypePdItem = 0; - - /* - * public static NCMapEditor getMapEditor() { if(mapEditor== null) - * createMapEditor(); return mapEditor; } - */ - // handle Text Mode - private java.util.List currentTextReports = null; - - private int currentTextIndex; - - public int getCurrentTextIndex() { - return currentTextIndex; - } - - public void setCurrentTextIndex(int currentTextIndex) { - this.currentTextIndex = currentTextIndex; - } - - public java.util.List getCurrentTextReports() { - return currentTextReports; - } - - public void setCurrentTextReports( - java.util.List currentTextReports) { - this.currentTextReports = currentTextReports; - } - - public java.util.List getPoints() { - return points; - } - - public void setPoints(java.util.List points) { - this.points = points; - } - - public boolean isReplaceText() { - return replaceText; - } - - public void setReplaceText(boolean replaceText) { - this.replaceText = replaceText; - } - - public EReportTimeRange getTimeCovered() { - return timeCovered; - } - - public void setTimeCovered(EReportTimeRange timeCovered) { - this.timeCovered = timeCovered; - } - - public boolean isState() { - return isState; - } - - public void setState(boolean isState) { - this.isState = isState; - } - - public String getCurrentProductName() { - return currentProductName; - } - - public void setCurrentProductName(String currentProductName) { - this.currentProductName = currentProductName; - } - - public void enableNextBtn(boolean enable) { - nextBtn.setEnabled(enable); - } - - public void enablePrevBtn(boolean enable) { - prevBtn.setEnabled(enable); - } - - public void setEditorVisible(boolean isVisible) { - this.isEditorVisible = isVisible; - } - - public boolean getEditorVisible() { - return this.isEditorVisible; - } - - public void setDataTypeGroupItem(int item) { - this.dataTypeGpItem = item; - } - - public int getDataTypeGroupItem() { - return this.dataTypeGpItem; - } - - public void setDataTypeProductItem(int item) { - this.dataTypePdItem = item; - } - - public int getDataTypeProductItem() { - return this.dataTypePdItem; - } - - /* - * private static void createMapEditor(){ // create an editor MapEditor - * if(mapEditor != null) return; File rbdFile = - * LocalizationManager.getInstance().getLocalizationFile("defaultRBDFile"); - * try { mapEditor = - * NcDisplayMngr.createNatlCntrsEditor("NCRadar-Map","NCRADAR" ); NcMapRBD rbd - * = NcMapRBD.unmarshalRBD( rbdFile, null ); rbd.setNcEditor( mapEditor ); - * ResourceBndlLoader rbdLoader = new ResourceBndlLoader("DefaultMap"); - * rbdLoader.addRBD( rbd ); VizApp.runSync( rbdLoader ); - * //System.out.println("NcradaruiPaletteWindow create editor "+ - * mapEditor.toString()); } catch ( Exception ve ) { - * System.out.println("Could not load initial editor: " + ve.getMessage()); - * ve.printStackTrace(); } } - */ - /** - * Constructor - * - */ - public NcradaruiPaletteWindow() { - - super(); - if (ncradaruiPaletteWindow == null) - ncradaruiPaletteWindow = this; - else { - NcradaruiPaletteWindow tmp = ncradaruiPaletteWindow; - ncradaruiPaletteWindow = this; - ncradaruiPaletteWindow.setCurrentProductName(tmp - .getCurrentProductName()); - ncradaruiPaletteWindow.setDataTypeGroupItem(tmp - .getDataTypeGroupItem()); - ncradaruiPaletteWindow.setDataTypeProductItem(tmp - .getDataTypeProductItem()); - ; - ncradaruiPaletteWindow.selectedGp = tmp.selectedGp; - ncradaruiPaletteWindow.selectedType = tmp.selectedType; - ncradaruiPaletteWindow.setTimeCovered(tmp.getTimeCovered()); - ncradaruiPaletteWindow.setState(tmp.isState()); - } - // System.out.println("ncradaruiPaletteWindow is created!!!!!!!!!!!!"); - - // create an editor - // createMapEditor(); - - } - - // create this singleton object - private static NcradaruiPaletteWindow ncradaruiPaletteWindow = null; - - public static NcradaruiPaletteWindow getAccess() { - return ncradaruiPaletteWindow; - } - - /** - * Invoked by the workbench to initialize this View. - */ - public void init(IViewSite site) { - // System.out.println("ncradaruiPaletteWindow inited!!"); - try { - - super.init(site); - - } catch (PartInitException pie) { - - pie.printStackTrace(); - - } - NctextuiResource.registerMouseHandler(); - page = site.getPage(); - page.addPartListener(this); - - } - - /** - * Disposes resource. invoked by the workbench - */ - public void dispose() { - // System.out.println("NcradaruiPaletteWindow dispose me, isEditorVisible="+ - // isEditorVisible); - if (!isEditorVisible) { - NctextuiResource.unregisterMouseHandler(); - return; - } else { - super.dispose(); - - NatlCntrsEditor editor = NctextuiResource.getMapEditor(); - - if (editor != null) { - for (IRenderableDisplay display : UiUtil - .getDisplaysFromContainer(editor)) { - // System.out.println("display " + display.toString()); - for (ResourcePair rp : display.getDescriptor() - .getResourceList()) { - if (rp.getResource() instanceof NctextuiResource) { - NctextuiResource rsc = (NctextuiResource) rp - .getResource(); - rsc.unload(); - } - } - } - } - ncradaruiPaletteWindow = null; - - /* - * remove the workbench part listener - */ - page.removePartListener(this); - } - - } - - private void close() { - IWorkbenchPage wpage = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - - IViewPart vpart = wpage.findView("edu.ucar.unidata.ui.NCRADARUI"); - wpage.hideView(vpart); - - NcDisplayMngr.setPanningMode(); - } - - /** - * Invoked by the workbench, this method sets up the SWT controls for the - * ncradar palette - */ - @Override - public void createPartControl(Composite parent) { - - parent.setLayout(new GridLayout(1, false)); - // create textGp group. It contains text and textMode group - textGp = new Group(parent, SWT.SHADOW_OUT); - textGp.setLayout(new GridLayout()); - textGp.setText("Text Report"); - GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); - textGp.setLayoutData(data); - - createTextArea(textGp); - createTextModeGp(textGp); - - // Create ConfigGp group. It contains dataTypegp, dataProductGp, time - // cover group and state/stn group - Group configGp = new Group(parent, SWT.SHADOW_ETCHED_OUT); - configGp.setLayout(new GridLayout(3, false)); - - createGpList(configGp); - - createProductList(configGp); - - createTimeCoverBtns(configGp); - if (currentProductName != null) - handleStnMarkingRequestByBtn(); - // createStaStnBtns(configGp); - - } - - public void createGpList(Composite parent) { - dataTypeGp = new Group(parent, SWT.SHADOW_ETCHED_IN); - dataTypeGp.setText(gpLabelStr); - - // create GP widget list - gpWdgList = new org.eclipse.swt.widgets.List(dataTypeGp, SWT.SINGLE - | SWT.V_SCROLL); - gpWdgList.setBounds(dataTypeGp.getBounds().x + btnGapX, - dataTypeGp.getBounds().y + labelGap, colWidth, listHeight); - // query gp list form ncradardbrsc - query = NctextDbQuery.getAccess(); - // query = ncradarDbQueryX.getAccess(); - java.util.List groupList = query.getDataTypeGpList(); - - if ((groupList != null) && (groupList.size() > 0) - && (dataTypeGpItem < groupList.size())) - selectedGp = groupList.get(dataTypeGpItem); /* - * set default select gp - * to first gp in the - * list - */ - else - return; - // add gp item to gp widget list - for (String str : groupList) { - gpWdgList.add(str); - } - - gpWdgList.setSelection(dataTypeGpItem); - - // create a selection listener to handle user's selection on gp list - gpWdgList.addListener(SWT.Selection, new Listener() { - java.util.List prodTypeList; - - public void handleEvent(Event e) { - if (gpWdgList.getSelectionCount() > 0) { - selectedGp = gpWdgList.getSelection()[0]; - // System.out.println("selected gp is " + selectedGp); - // query selected gp's product type list form ncradardbrsc - prodTypeList = query.getGpProductList(selectedGp); - typeWdgList.removeAll(); - - for (String str : prodTypeList) { - // add product type list to widget list, note that - // Widgget list was created earlier. This part of code - // is - // listener event handler and is invoked when user picks - // gp - typeWdgList.add(str); - } - typeWdgList.setSelection(0); - setDataTypeGroupItem(gpWdgList.getSelectionIndex()); - } - } - }); - - } - - public void createProductList(Composite parent) { - prodListGp = new Group(parent, SWT.SHADOW_ETCHED_IN); - prodListGp.setText(productLabelStr); - // create product type widget list - typeWdgList = new org.eclipse.swt.widgets.List(prodListGp, SWT.SINGLE - | SWT.V_SCROLL | SWT.H_SCROLL); - - typeWdgList.setBounds(prodListGp.getBounds().x + btnGapX, - prodListGp.getBounds().y + labelGap, colWidth, listHeight); - - /* add default product type list */ - java.util.List tempprodTypeList; - tempprodTypeList = query.getGpProductList(selectedGp); - typeWdgList.removeAll(); - - if (tempprodTypeList == null || tempprodTypeList.size() == 0) - return; - for (String str : tempprodTypeList) { - // add default product type list to widget list, note that Widgget - // list was created earlier. - typeWdgList.add(str); - } - - typeWdgList.setSelection(dataTypePdItem); - typeWdgList.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - if (typeWdgList.getSelectionCount() > 0) { - selectedType = typeWdgList.getSelection()[0]; - // System.out.println("selected type is " + selectedType); - currentProductName = selectedType; - // handle station marking here, when user picked product - // type - handleProductTypeStnMarking(); - setDataTypeProductItem(typeWdgList.getSelectionIndex()); - } - } - }); - } - - private void handleProductTypeStnMarking() { - points = query.getProductStaList(selectedType, timeCovered); - - if (points != null && points.size() == 1) { - NctextuiResource.getNctextuiResource().setPoints(points); - NctextuiResource.getNctextuiResource().setPickedStnPt(points); - displayProduct(points.get(0)); - } else { - - if (points != null && points.size() > 1) { - text.setText(" "); - } else { - text.setText("No Station Reports This Product At Selected Time Range"); - } - nextBtn.setEnabled(false); - prevBtn.setEnabled(false); - NatlCntrsEditor mapEditor = NctextuiResource.getMapEditor(); - if (mapEditor != null) { - mapEditor.refresh(); - PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getActivePage().bringToTop(mapEditor); - } - - NctextuiResource.getNctextuiResource().setPoints(points); - NctextuiResource.getNctextuiResource().setPickedStnPt(null); - // ncradaruiModalTool.setModal(); - } - } - - private void handleStnMarkingRequestByBtn() { - points = query.getProductStaList(selectedType, timeCovered); - if (points != null && points.size() == 1) { - NctextuiResource.getNctextuiResource().setPoints(points); - NctextuiResource.getNctextuiResource().setPickedStnPt(points); - displayProduct(points.get(0)); - } else { - if ((points != null) && (points.size() != 0)) { - - if (replaceText) - text.setText(" "); - } else { - if (replaceText) - text.setText("No Report Available"); - } - - nextBtn.setEnabled(false); - prevBtn.setEnabled(false); - NatlCntrsEditor mapEditor = NctextuiResource.getMapEditor(); - if (mapEditor != null) { - mapEditor.refresh(); - PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getActivePage().bringToTop(mapEditor); - } - - NctextuiResource.getNctextuiResource().setPoints(points); - if (replaceText) - NctextuiResource.getNctextuiResource().setPickedStnPt(null); - - // ncradaruiModalTool.setModal(); - } - } - - public void createTimeCoverBtns(Composite parent) { - - Group composite = new Group(parent, SWT.NORMAL); - composite.setLayout(new GridLayout(1, false)); - - timeGp = new Group(composite, SWT.SHADOW_ETCHED_IN); - timeGp.setText("Hour Covered"); - - Listener btnListeener = new Listener() { - public void handleEvent(Event event) { - String btnText = ((Button) (event.widget)).getText(); - if (btnText.equals("1")) - timeCovered = EReportTimeRange.ONE_HOUR; - else if (btnText.equals("3")) - timeCovered = EReportTimeRange.THREE_HOURS; - else if (btnText.equals("6")) - timeCovered = EReportTimeRange.SIX_HOURS; - else if (btnText.equals("12")) - timeCovered = EReportTimeRange.TWELVE_HOURS; - else if (btnText.equals("24")) - timeCovered = EReportTimeRange.TWENTYFOUR_HOURS; - else if (btnText.equals("48")) - timeCovered = EReportTimeRange.FORTYEIGHT_HOURS; - else - timeCovered = EReportTimeRange.NONE; - handleStnMarkingRequestByBtn(); - System.out.println("button event # " - + ((Button) (event.widget)).getText()); - } - - }; - - Button oneHrBtn = new Button(timeGp, SWT.RADIO | SWT.BORDER); - oneHrBtn.setText("1"); - oneHrBtn.setEnabled(true); - oneHrBtn.setBounds(timeGp.getBounds().x + btnGapX, timeGp.getBounds().y - + labelGap, timeBtnWidth, btnHeight); - oneHrBtn.addListener(SWT.MouseUp, btnListeener); - - Button threeHrBtn = new Button(timeGp, SWT.RADIO); - threeHrBtn.setText("3"); - threeHrBtn.setEnabled(true); - threeHrBtn.setBounds( - btnGapX + oneHrBtn.getBounds().x + oneHrBtn.getBounds().width, - timeGp.getBounds().y + labelGap, timeBtnWidth, btnHeight); - - threeHrBtn.addListener(SWT.MouseUp, btnListeener); - - Button sixHrBtn = new Button(timeGp, SWT.RADIO); - sixHrBtn.setText("6"); - sixHrBtn.setEnabled(true); - sixHrBtn.setBounds(threeHrBtn.getBounds().x - + threeHrBtn.getBounds().width + btnGapX, timeGp.getBounds().y - + labelGap, timeBtnWidth, btnHeight); - - sixHrBtn.addListener(SWT.MouseUp, btnListeener); - - Button twelveHrBtn = new Button(timeGp, SWT.RADIO); - twelveHrBtn.setText("12"); - twelveHrBtn.setEnabled(true); - // twelveHrBtn.setSelection(true);//default selection - twelveHrBtn.setBounds(timeGp.getBounds().x + btnGapX, - oneHrBtn.getBounds().y + oneHrBtn.getBounds().height + btnGapY, - timeBtnWidth, btnHeight); - - twelveHrBtn.addListener(SWT.MouseUp, btnListeener); - - Button twentyfourHrBtn = new Button(timeGp, SWT.RADIO); - twentyfourHrBtn.setText("24"); - twentyfourHrBtn.setEnabled(true); - twentyfourHrBtn.setBounds(btnGapX + twelveHrBtn.getBounds().x - + twelveHrBtn.getBounds().width, threeHrBtn.getBounds().y - + threeHrBtn.getBounds().height + btnGapY, timeBtnWidth, - btnHeight); - - twentyfourHrBtn.addListener(SWT.MouseUp, btnListeener); - - Button fourtyeightHrBtn = new Button(timeGp, SWT.RADIO); - fourtyeightHrBtn.setText("48"); - fourtyeightHrBtn.setEnabled(true); - fourtyeightHrBtn.setBounds(btnGapX + twentyfourHrBtn.getBounds().x - + twentyfourHrBtn.getBounds().width, sixHrBtn.getBounds().y - + sixHrBtn.getBounds().height + btnGapY, timeBtnWidth, - btnHeight); - - fourtyeightHrBtn.addListener(SWT.MouseUp, btnListeener); - - Button allHrBtn = new Button(timeGp, SWT.RADIO); - allHrBtn.setText("all"); - allHrBtn.setEnabled(true); - allHrBtn.setBounds(btnGapX + fourtyeightHrBtn.getBounds().x - + fourtyeightHrBtn.getBounds().width, sixHrBtn.getBounds().y - + sixHrBtn.getBounds().height + btnGapY, timeBtnWidth, - btnHeight); - - if (timeCovered == EReportTimeRange.ONE_HOUR) - oneHrBtn.setSelection(true); - else if (timeCovered == EReportTimeRange.THREE_HOURS) - threeHrBtn.setSelection(true); - else if (timeCovered == EReportTimeRange.SIX_HOURS) - sixHrBtn.setSelection(true); - else if (timeCovered == EReportTimeRange.TWELVE_HOURS) - twelveHrBtn.setSelection(true); - else if (timeCovered == EReportTimeRange.TWENTYFOUR_HOURS) - twentyfourHrBtn.setSelection(true); - else if (timeCovered == EReportTimeRange.FORTYEIGHT_HOURS) - fourtyeightHrBtn.setSelection(true); - else - allHrBtn.setSelection(true); - - allHrBtn.addListener(SWT.MouseUp, btnListeener); - createStaStnBtns(composite); - } - - public void createStaStnBtns(Composite parent) { - staStnGp = new Group(parent, SWT.LEFT); - staStnGp.setText("Select By "); - - Button stationBtn = new Button(staStnGp, SWT.RADIO); - stationBtn.setText("station"); - stationBtn.setEnabled(true); - stationBtn.setBounds(staStnGp.getBounds().x + btnGapX, - staStnGp.getBounds().y + labelGap, staBtnWidth, btnHeight); - if (!isState) - stationBtn.setSelection(true); - - stationBtn.addListener(SWT.MouseUp, new Listener() { - public void handleEvent(Event event) { - isState = false; - handleStnMarkingRequestByBtn(); - } - }); - Button stateBtn = new Button(staStnGp, SWT.RADIO); - stateBtn.setText("state"); - stateBtn.setEnabled(true); - if (isState) - stateBtn.setSelection(true); - stateBtn.setBounds(stationBtn.getBounds().x - + stationBtn.getBounds().width + btnGapX, - staStnGp.getBounds().y + labelGap, staBtnWidth, btnHeight); - - stateBtn.addListener(SWT.MouseUp, new Listener() { - public void handleEvent(Event event) { - isState = true; - handleStnMarkingRequestByBtn(); - } - }); - } - - public void createTextArea(Composite parent) { - - // Text display area - text = new Text(parent, SWT.V_SCROLL | SWT.H_SCROLL); - - GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); - text.setLayoutData(data); - Font font = text.getFont(); - FontData[] fontData = font.getFontData(); - for (int i = 0; i < fontData.length; i++) { - // fontData[i].setHeight(12); - fontData[i].setName("courier"); - } - Font newFont = new Font(font.getDevice(), fontData); - text.setFont(newFont); - } - - public Text getText() { - return text; - } - - public void setText(Text text) { - this.text = text; - } - - private String removeCR(String curStr) { - int i = ASCII_CR_VAL; - char asciiCr = (char) i; - String newStr = curStr.replace(asciiCr, ' '); - return newStr; - } - - public void createTextModeGp(Composite parent) { - printingHandle = HandlePrinting.getPrintHandle(); - Group textModeGp = new Group(parent, SWT.SHADOW_OUT); - textModeGp.setText("Text Mode:"); - - Button replaceBtn = new Button(textModeGp, SWT.RADIO); - replaceBtn.setText("Replace"); - replaceBtn.setEnabled(true); - replaceBtn.setBounds(textModeGp.getBounds().x + btnGapX, - textModeGp.getBounds().y + labelGap, staBtnWidth, btnHeight); - replaceBtn.setSelection(true); - - replaceBtn.addListener(SWT.MouseUp, new Listener() { - public void handleEvent(Event event) { - replaceText = true; - text.setText(""); - handleStnMarkingRequestByBtn(); - } - }); - Button appendBtn = new Button(textModeGp, SWT.RADIO); - appendBtn.setText("Append"); - appendBtn.setEnabled(true); - appendBtn.setBounds(replaceBtn.getBounds().x - + replaceBtn.getBounds().width + btnGapX, - textModeGp.getBounds().y + labelGap, staBtnWidth, btnHeight); - - appendBtn.addListener(SWT.MouseUp, new Listener() { - public void handleEvent(Event event) { - replaceText = false; - nextBtn.setEnabled(false); - prevBtn.setEnabled(false); - } - }); - - // Push buttons for Previous text info - prevBtn = new Button(textModeGp, SWT.PUSH); - prevBtn.setText("Previous"); - prevBtn.setEnabled(false); - prevBtn.setBounds(appendBtn.getBounds().x + appendBtn.getBounds().width - + btnGapX, textModeGp.getBounds().y + labelGap, staBtnWidth, - pushbtnHeight); - - prevBtn.addListener(SWT.MouseUp, new Listener() { - public void handleEvent(Event event) { - // Action to display previous text report - if ((currentTextReports != null) - && (currentTextReports.size() > currentTextIndex + 1)) { - String dispStr = removeCR((String) currentTextReports - .get(currentTextIndex + 1)[0]); - String curText = text.getText(); - int endIndex = curText.indexOf("----"); - if (endIndex != -1) { - curText = curText.substring(0, endIndex + 4); - text.setText(curText + "\n" + dispStr); - } else - text.setText(dispStr); - - nextBtn.setEnabled(true); - currentTextIndex++; - if (currentTextReports.size() <= currentTextIndex + 1) { - prevBtn.setEnabled(false); - } - } - } - }); - - // Push buttons for Next text info - nextBtn = new Button(textModeGp, SWT.PUSH); - nextBtn.setText("Next"); - nextBtn.setEnabled(false); - nextBtn.setBounds(prevBtn.getBounds().x + prevBtn.getBounds().width - + btnGapX, textModeGp.getBounds().y + labelGap, staBtnWidth, - pushbtnHeight); - - nextBtn.addListener(SWT.MouseUp, new Listener() { - public void handleEvent(Event event) { - // Action to display next text report - if ((currentTextReports != null) - && (currentTextReports.size() > currentTextIndex) - && (currentTextIndex >= 1)) { - String dispStr = removeCR((String) currentTextReports - .get(currentTextIndex - 1)[0]); - String curText = text.getText(); - int endIndex = curText.indexOf("----"); - if (endIndex != -1) { - curText = curText.substring(0, endIndex + 4); - text.setText(curText + "\n" + dispStr); - } else - text.setText(dispStr); - prevBtn.setEnabled(true); - currentTextIndex--; - if (currentTextIndex == 0) { - nextBtn.setEnabled(false); - } - } - - } - }); - - // Push buttons for print text info - Button printBtn = new Button(textModeGp, SWT.PUSH); - printBtn.setText("Print"); - printBtn.setEnabled(true); - printBtn.setBounds(nextBtn.getBounds().x + nextBtn.getBounds().width - + btnGapX, textModeGp.getBounds().y + labelGap, staBtnWidth, - pushbtnHeight); - - printBtn.addListener(SWT.MouseUp, new Listener() { - public void handleEvent(Event event) { - // Action to print text report - printingHandle.handlePrint(text.getText()); - } - }); - - } - - public void widgetDefaultSelected(SelectionEvent se) { - - } - - /* - * invoked when widget is disposed - * - * @see - * org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt - * .events.DisposeEvent) - */ - public void widgetDisposed(DisposeEvent event) { - - } - - @Override - public void partActivated(IWorkbenchPart part) { - if (part instanceof NcradaruiPaletteWindow) { - NctextuiResource rsc = NctextuiResource.getNctextuiResource(); - if (rsc != null) - rsc.setEditable(true); - } - } - - @Override - public void partBroughtToTop(IWorkbenchPart part) { - partActivated(part); - } - - @Override - public void partClosed(IWorkbenchPart part) { - // System.out.println("NcradaruiPaletteWindow::Something closed: "+part.getClass().getCanonicalName() - // ); - } - - @Override - public void partDeactivated(IWorkbenchPart part) { - } - - @Override - public void partOpened(IWorkbenchPart part) { - // System.out.println("Something Opened: "+part.getClass().getCanonicalName() - // ); - } - - /** - * - * @return the currently selected category on the palette - */ - public String getCurrentCategory() { - return null; - } - - @Override - public void setFocus() { - // TODO Auto-generated method stub - - } - - @Override - public void widgetSelected(SelectionEvent e) { - // TODO Auto-generated method stub - - } - - public void displayProduct(NctextStationInfo StnPt) { - NatlCntrsEditor mapEditor = NctextuiResource.getMapEditor(); - - if (StnPt != null && (mapEditor != null)) { - // add RED "X" marker(s) on picked stn - List rtnStateStnLst = new ArrayList(); - if (ncradaruiPaletteWindow.isState() == true) { - - List stateStnLst = query - .getStateStationInfoList(ncradaruiPaletteWindow - .getCurrentProductName() + StnPt.getState()); - // need to filter out those stns does not have reports in DB - // now, use points list for reference - for (NctextStationInfo stnInState : stateStnLst) { - for (NctextStationInfo stnHasRpt : points) { - if (stnInState.getStnid().equals(stnHasRpt.getStnid()) == true) { - rtnStateStnLst.add(stnInState); - break; - } - } - } - } else { - rtnStateStnLst.add(StnPt); - } - Text text = ncradaruiPaletteWindow.getText(); - if (ncradaruiPaletteWindow.isReplaceText() == false) { - // APPEND mode - // List prevPickedStnLst = - // ncradaruiPaletteWindow.getncradaruiResource().getPickedStnPt(); - List prevPickedStnLst = NctextuiResource - .getNctextuiResource().getPickedStnPt(); - if (prevPickedStnLst.size() > 0) { - if (rtnStateStnLst.addAll(prevPickedStnLst) == false) { - // System.out.println("handleMouseUp : add picked stn failed"); - return; - } - } - } else { - // REPLACE mode - text.setText(""); - } - // ncradaruiPaletteWindow.getncradaruiResource().setPickedStnPt(rtnStateStnLst); - NctextuiResource.getNctextuiResource().setPickedStnPt( - rtnStateStnLst); - mapEditor.refresh(); - // ncradaruiModalTool.setModal(); - // QUERY DB now....Object[0] = Rawrecord text data, Object[1] = - // issuesite - List> rptLstList = query.getProductDataListList( - ncradaruiPaletteWindow.selectedGp, - ncradaruiPaletteWindow.getCurrentProductName(), StnPt, - ncradaruiPaletteWindow.getTimeCovered(), - ncradaruiPaletteWindow.isState(), null); - if (rptLstList.isEmpty()) { - if (ncradaruiPaletteWindow.isState()) - text.append("--State " + StnPt.getState() + "--" - + ncradaruiPaletteWindow.getCurrentProductName() - + " Report (Station picked " + StnPt.getStnid() - + ")\n"); - else - text.append("--Text-- " + ": " - + ncradaruiPaletteWindow.getCurrentProductName() - + ": Reporting Station: (" + StnPt.getStnid() - + ") " + StnPt.getStnname() + "\n"); - if (ncradaruiPaletteWindow.getTimeCovered().getTimeRange() == 0) - text.append("Report unavailable in database.\n"); - else - text.append("Report unavailable within " - + ncradaruiPaletteWindow.getTimeCovered() - .getTimeRange() + " hour(s) range.\n"); - - ncradaruiPaletteWindow.enablePrevBtn(false); - } else { - String textToDisp; - String textRawStr; - StringBuilder textStr; - if (ncradaruiPaletteWindow.isState()) { - // SelectBy State mode - textStr = new StringBuilder("--State " + StnPt.getState() - + "--" - + ncradaruiPaletteWindow.getCurrentProductName() - + " Report\n"); - - for (List lstObj : rptLstList) { - textStr.append("--Station " - + (String) (lstObj.get(0))[1] + "-- : " - + ncradaruiPaletteWindow.getCurrentProductName() - + "\n"); - textRawStr = (String) (lstObj.get(0))[0]; - // remove CR before displaying - textToDisp = removeCR(textRawStr); - textStr.append(textToDisp + "\n"); - } - - // When put text string to Text display, use "setText" but - // not "append" method, so, the text will show from top - if (ncradaruiPaletteWindow.isReplaceText() == false) { - // get current text string from Text - StringBuilder textStr1 = new StringBuilder( - text.getText()); - textStr1.append(textStr.toString()); - text.setText(textStr1.toString()); - } else - text.setText(textStr.toString()); - } else { - // SelectBy Station mode - // "----" used as text header delimiter - String textHeader = "--Text-- " + ": " - + ncradaruiPaletteWindow.getCurrentProductName() - + ": Reporting Station: (" + StnPt.getStnid() - + ") " + StnPt.getStnname() + "----" + "\n"; - ncradaruiPaletteWindow.setCurrentTextReports(rptLstList - .get(0)); - - int currentTextIndex = 0; - ncradaruiPaletteWindow.setCurrentTextIndex(currentTextIndex); - textRawStr = (String) (rptLstList.get(0) - .get(currentTextIndex))[0]; - // remove CR before displaying - textToDisp = removeCR(textRawStr); - // When put text string to Text display, use "setText" but - // not "append" method, so, the text will show from top - if (ncradaruiPaletteWindow.isReplaceText() == false) { - // Append mode: get current text string from Text - StringBuilder textStr1 = new StringBuilder( - text.getText()); - textStr1.append(textHeader + textToDisp); - text.setText(textStr1.toString()); - } else - // Replace mode - text.setText(textHeader + textToDisp); - if ((rptLstList.get(0).size() > 1) - && (ncradaruiPaletteWindow.isReplaceText() == true)) { - // System.out.println("debug 1 list size "+ - // rptLstList.get(0).size()); - ncradaruiPaletteWindow.enablePrevBtn(true); - } else { - ncradaruiPaletteWindow.enablePrevBtn(false); - } - } - } - } - } - -}