build update, remove leftover plugins or else CAVE build barfs
This commit is contained in:
parent
e1968e86d4
commit
9327b7b7bc
34 changed files with 3 additions and 3252 deletions
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
/awips2/cave/run.sh -alertviz -perspective NCP
|
/awips2/cave/run.sh -alertviz
|
|
@ -314,11 +314,4 @@
|
||||||
version="0.0.0"
|
version="0.0.0"
|
||||||
unpack="false"/>
|
unpack="false"/>
|
||||||
|
|
||||||
<plugin
|
|
||||||
id="edu.ucar.unidata.ui.ncradarui"
|
|
||||||
download-size="0"
|
|
||||||
install-size="0"
|
|
||||||
version="0.0.0"
|
|
||||||
unpack="false"/>
|
|
||||||
|
|
||||||
</feature>
|
</feature>
|
||||||
|
|
|
@ -504,7 +504,7 @@ if [ "${1}" = "-ade" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1}" = "-cave" ]; then
|
if [ "${1}" = "-cave" ]; then
|
||||||
buildCAVEsingle
|
buildCAVE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1}" = "-other" ]; then
|
if [ "${1}" = "-other" ]; then
|
||||||
|
|
|
@ -13,7 +13,7 @@ export BUILD_WORKSPACE=${BUILD_DIR}/workspace
|
||||||
# baseline is...
|
# baseline is...
|
||||||
export BASELINE="${JENKINS_WORKSPACE}"
|
export BASELINE="${JENKINS_WORKSPACE}"
|
||||||
export AWIPSII_VERSION="14.4.1"
|
export AWIPSII_VERSION="14.4.1"
|
||||||
export BUILD_NUMBER="6"
|
export BUILD_NUMBER="7"
|
||||||
export AWIPSII_RELEASE="1n${BUILD_NUMBER}"
|
export AWIPSII_RELEASE="1n${BUILD_NUMBER}"
|
||||||
|
|
||||||
export AWIPSII_TOP_DIR="${BUILD_WORKSPACE}/tmp/rpms_built_dir"
|
export AWIPSII_TOP_DIR="${BUILD_WORKSPACE}/tmp/rpms_built_dir"
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
|
||||||
<classpathentry excluding="com/raytheon/uf/viz/productbrowser/AbstractNonRequestableProductBrowser.java|com/raytheon/uf/viz/productbrowser/bookmarks/RequestableBookmark.java" kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
|
@ -1,30 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>edu.ucar.unidata.uf.viz.radarbrowser</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -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"
|
|
|
@ -1,6 +0,0 @@
|
||||||
source.. = src/
|
|
||||||
output.. = bin/
|
|
||||||
bin.includes = META-INF/,\
|
|
||||||
.,\
|
|
||||||
plugin.xml,\
|
|
||||||
icons/
|
|
Binary file not shown.
Before Width: | Height: | Size: 144 B |
Binary file not shown.
Before Width: | Height: | Size: 259 B |
Binary file not shown.
Before Width: | Height: | Size: 327 B |
Binary file not shown.
Before Width: | Height: | Size: 379 B |
|
@ -1,68 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<?eclipse version="3.2"?>
|
|
||||||
<plugin>
|
|
||||||
<extension-point id="dataDefinition" name="dataDefinition" schema="schema/dataDefinition.exsd"/>
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.views">
|
|
||||||
<view
|
|
||||||
allowMultiple="false"
|
|
||||||
category="com.raytheon.viz.ui"
|
|
||||||
class="edu.ucar.unidata.uf.viz.radarbrowser.RadarBrowserView"
|
|
||||||
id="edu.ucar.unidata.uf.viz.radarbrowser.RadarBrowserView"
|
|
||||||
icon="icons/browser.gif"
|
|
||||||
name="Radar Browser"
|
|
||||||
restorable="true"/>
|
|
||||||
</extension>
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.preferencePages">
|
|
||||||
<page
|
|
||||||
class="edu.ucar.unidata.uf.viz.radarbrowser.RadarBrowserPreferencesPage"
|
|
||||||
id="edu.ucar.unidata.uf.viz.radarbrowser.radarbrowserpreferencespage"
|
|
||||||
name="Radar Browser"/>
|
|
||||||
</extension>
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.menus">
|
|
||||||
<menuContribution
|
|
||||||
allPopups="false"
|
|
||||||
locationURI="menu:CAVE?after=group1">
|
|
||||||
<command
|
|
||||||
commandId="edu.ucar.unidata.uf.viz.radarbrowser.radarBrowser"
|
|
||||||
label="Radar Browser"
|
|
||||||
style="push">
|
|
||||||
</command>
|
|
||||||
</menuContribution>
|
|
||||||
</extension>
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.commands">
|
|
||||||
<command
|
|
||||||
id="edu.ucar.unidata.uf.viz.radarbrowser.radarBrowser"
|
|
||||||
name="Radar Browser">
|
|
||||||
</command>
|
|
||||||
</extension>
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.handlers">
|
|
||||||
<handler
|
|
||||||
class="edu.ucar.unidata.uf.viz.radarbrowser.actions.RadarBrowserAction"
|
|
||||||
commandId="edu.ucar.unidata.uf.viz.radarbrowser.radarBrowser">
|
|
||||||
</handler>
|
|
||||||
</extension>
|
|
||||||
</plugin>
|
|
|
@ -1,109 +0,0 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<!-- Schema file written by PDE -->
|
|
||||||
<schema targetNamespace="edu.ucar.unidata.uf.viz.radarbrowser" xmlns="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.schema plugin="edu.ucar.unidata.uf.viz.radarbrowser" id="uradarBrowserDataDefinition" name="uradarBrowserDataDefinition"/>
|
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter description of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<element name="extension">
|
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.element />
|
|
||||||
</appInfo>
|
|
||||||
</annotation>
|
|
||||||
<complexType>
|
|
||||||
<sequence minOccurs="1" maxOccurs="unbounded">
|
|
||||||
<element ref="dataDefinition"/>
|
|
||||||
</sequence>
|
|
||||||
<attribute name="point" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="id" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.attribute translatable="true"/>
|
|
||||||
</appInfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<element name="dataDefinition">
|
|
||||||
<complexType>
|
|
||||||
<attribute name="class" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.attribute kind="java" basedOn="edu.ucar.unidata.uf.viz.radarbrowser.AbstractRadarBrowserDataDefinition:"/>
|
|
||||||
</appInfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.section type="since"/>
|
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter the first release in which this extension point appears.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.section type="examples"/>
|
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter extension point usage example here.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.section type="apiinfo"/>
|
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter API information here.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.section type="implementation"/>
|
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter information about supplied implementation of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
|
|
||||||
</schema>
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* May 16, 2011 mnash Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author mnash
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class DataTypePreferencePage extends FieldEditorPreferencePage implements
|
|
||||||
IWorkbenchPreferencePage {
|
|
||||||
|
|
||||||
private static IExtension[] extensions;
|
|
||||||
|
|
||||||
private List<AbstractProductBrowserDataDefinition<?>> prods = null;
|
|
||||||
|
|
||||||
private List<FieldEditor> editors = null;
|
|
||||||
|
|
||||||
private static boolean saved = false;
|
|
||||||
|
|
||||||
public DataTypePreferencePage() {
|
|
||||||
super(GRID);
|
|
||||||
prods = new ArrayList<AbstractProductBrowserDataDefinition<?>>();
|
|
||||||
editors = new ArrayList<FieldEditor>();
|
|
||||||
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<ProductBrowserPreference> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* May 21, 2010 mnash Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author mnash
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class RadarBrowserLabel implements Comparable<RadarBrowserLabel>,
|
|
||||||
Comparator<RadarBrowserLabel> {
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* May 10, 2011 mnash Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @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() {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Aug 2, 2010 mnash Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @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<ResourceType, List<DisplayType>> 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<String> data = new ArrayList<String>();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------- -------- ----------- --------------------------
|
|
||||||
* May 13, 2014 3135 bsteffen Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @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...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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)}.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @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<ProductBrowserLabel> 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<ProductBrowserLabel> 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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>edu.ucar.unidata.ui.ncradarui</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -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
|
|
|
@ -1,5 +0,0 @@
|
||||||
source.. = src/
|
|
||||||
output.. = bin/
|
|
||||||
bin.includes = META-INF/,\
|
|
||||||
.,\
|
|
||||||
plugin.xml
|
|
|
@ -1,89 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<?eclipse version="3.3"?>
|
|
||||||
<plugin>
|
|
||||||
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.commands">
|
|
||||||
<command
|
|
||||||
id="edu.ucar.unidata.ui.ncradarui.palette"
|
|
||||||
name="Ncradar">
|
|
||||||
</command>
|
|
||||||
<command
|
|
||||||
id="edu.ucar.unidata.ui.ncradarui.rsc.NcradaruiTool"
|
|
||||||
name="Ncradarui Selecting">
|
|
||||||
</command>
|
|
||||||
<!--
|
|
||||||
<command
|
|
||||||
id="edu.ucar.unidata.ui.ncradarui.help"
|
|
||||||
name="NCRADAR Help">
|
|
||||||
</command>
|
|
||||||
-->
|
|
||||||
</extension>
|
|
||||||
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.handlers">
|
|
||||||
<handler
|
|
||||||
class="edu.ucar.unidata.ui.ncradarui.palette.NcradaruiPaletteAction"
|
|
||||||
commandId="edu.ucar.unidata.ui.ncradarui.palette">
|
|
||||||
</handler>
|
|
||||||
<!--
|
|
||||||
<handler
|
|
||||||
class="edu.ucar.unidata.ui.ncradarui.rsc.NcradaruiModalTool"
|
|
||||||
commandId="edu.ucar.unidata.ui.ncradarui.rsc.NcradaruiTool">
|
|
||||||
</handler>
|
|
||||||
|
|
||||||
<handler
|
|
||||||
class="edu.ucar.unidata.ui.ncradarui.productManage.HelpHandler"
|
|
||||||
commandId="edu.ucar.unidata.ui.ncradarui.help">
|
|
||||||
</handler>
|
|
||||||
-->
|
|
||||||
</extension>
|
|
||||||
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.views">
|
|
||||||
<category
|
|
||||||
id="edu.ucar.unidata.ui.ncradarui.view"
|
|
||||||
name="Ncradar Views"/>
|
|
||||||
<view
|
|
||||||
allowMultiple="false"
|
|
||||||
category="edu.ucar.unidata.ui.ncradarui.view"
|
|
||||||
class="edu.ucar.unidata.ui.ncradarui.palette.NcradaruiPaletteWindow"
|
|
||||||
id="edu.ucar.unidata.ui.NCRADARUI"
|
|
||||||
name="NCRADAR"
|
|
||||||
restorable="true">
|
|
||||||
</view>
|
|
||||||
</extension>
|
|
||||||
<extension
|
|
||||||
point="com.raytheon.uf.viz.core.classContext">
|
|
||||||
<classContext
|
|
||||||
class="edu.ucar.unidata.ui.ncradarui.classContext1">
|
|
||||||
</classContext>
|
|
||||||
<classContext
|
|
||||||
class="edu.ucar.unidata.ui.ncradarui.palette.NcradaruiPaletteWindow">
|
|
||||||
<contextId
|
|
||||||
id="gov.noaa.nws.ncep.viz.ui.display.NCMapContext">
|
|
||||||
</contextId>
|
|
||||||
</classContext>
|
|
||||||
</extension>
|
|
||||||
<!--
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.menus">
|
|
||||||
<menuContribution
|
|
||||||
locationURI="toolbar:edu.ucar.unidata.ui.NCRADARUI">
|
|
||||||
<command
|
|
||||||
commandId="edu.ucar.unidata.ui.ncradarui.help"
|
|
||||||
label="Help"
|
|
||||||
mnemonic="H"
|
|
||||||
style="push">
|
|
||||||
</command>
|
|
||||||
</menuContribution>
|
|
||||||
</extension>
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
<extension
|
|
||||||
point="edu.ucar.unidata.ui.ncradarui.palette">
|
|
||||||
</extension>
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
</plugin>
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------- ------- -------- -----------
|
|
||||||
* 1/21/2010 TBD Chin Chen Initial coding
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue