Merge branch 'master_14.2.2' into asm_14.2.2
Former-commit-id: 274338d3dfb6a839a59da8740ed968d8f0779d7d
This commit is contained in:
commit
a8d6d58f31
21 changed files with 387 additions and 201 deletions
|
@ -26,14 +26,15 @@ import java.util.Set;
|
|||
|
||||
import com.raytheon.uf.viz.cloudheight.rsc.CloudHeightResource;
|
||||
import com.raytheon.uf.viz.cloudheight.rsc.CloudHeightResourceData;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource.ResourceStatus;
|
||||
import com.raytheon.uf.viz.core.rsc.IInitListener;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
||||
|
@ -53,9 +54,10 @@ import com.raytheon.viz.ui.perspectives.IRenderableDisplayCustomizer;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2013 2190 mschenke Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jul 31, 2013 2190 mschenke Initial creation
|
||||
* Mar 20, 2014 2932 bsteffen Better support of blended resources.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -198,8 +200,22 @@ public class D2DPopupSkewTDisplayCustomizer implements
|
|||
}
|
||||
|
||||
private boolean isCompatibleResource(ResourcePair rp) {
|
||||
return COMPATIBLE_CLASSES.contains(rp.getResourceData().getClass())
|
||||
&& CloudHeightResource.isValidContributor(rp.getResource());
|
||||
AbstractResourceData resourceData = rp.getResourceData();
|
||||
if (resourceData != null) {
|
||||
if (COMPATIBLE_CLASSES
|
||||
.contains(rp.getResourceData().getClass())) {
|
||||
return CloudHeightResource.isValidContributor(rp
|
||||
.getResource());
|
||||
} else if (resourceData instanceof IResourceGroup) {
|
||||
IResourceGroup group = (IResourceGroup) resourceData;
|
||||
for (ResourcePair internalPair : group.getResourceList()) {
|
||||
if (isCompatibleResource(internalPair)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private synchronized void addResources(IDescriptor descriptor) {
|
||||
|
|
|
@ -26,6 +26,7 @@ gov.noaa.nws.ncep.viz.rsc.idft
|
|||
gov.noaa.nws.ncep.viz.rsc.intlsig
|
||||
gov.noaa.nws.ncep.viz.rsc.lightning
|
||||
gov.noaa.nws.ncep.viz.rsc.mosaic
|
||||
gov.noaa.nws.ncep.viz.rsc.ncgrid
|
||||
gov.noaa.nws.ncep.viz.rsc.ncscat
|
||||
gov.noaa.nws.ncep.viz.rsc.nonconvsigmet
|
||||
gov.noaa.nws.ncep.viz.rsc.plotdata
|
||||
|
|
|
@ -23,6 +23,9 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.commands.Command;
|
||||
import org.eclipse.core.commands.CommandEvent;
|
||||
import org.eclipse.core.commands.ICommandListener;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
|
@ -43,7 +46,12 @@ import org.eclipse.swt.widgets.Label;
|
|||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.commands.ICommandService;
|
||||
import org.eclipse.ui.menus.CommandContributionItem;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.ui.menus.widgets.tearoff.TearOffMenuDialog.MenuPathElement;
|
||||
|
||||
/**
|
||||
|
@ -57,6 +65,7 @@ import com.raytheon.uf.viz.ui.menus.widgets.tearoff.TearOffMenuDialog.MenuPathEl
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 15, 2011 mnash Initial creation
|
||||
* Apr 10, 2013 DR 15185 D. Friedman Preserve tear-offs over perspective switches.
|
||||
* Jev 26, 2014 2842 mpduff Utilize the command listener.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,6 +74,8 @@ import com.raytheon.uf.viz.ui.menus.widgets.tearoff.TearOffMenuDialog.MenuPathEl
|
|||
*/
|
||||
|
||||
public class MenuItemComposite extends Composite {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(MenuItemComposite.class);
|
||||
|
||||
private boolean separator = false;
|
||||
|
||||
|
@ -85,17 +96,30 @@ public class MenuItemComposite extends Composite {
|
|||
|
||||
private SelectionListener radioListener = null;
|
||||
|
||||
private ICommandListener commandListener;
|
||||
|
||||
private List<String> myPath;
|
||||
|
||||
/** Enabled color */
|
||||
private final Color enabledColor;
|
||||
|
||||
/** Disabled color */
|
||||
private final Color disabledColor;
|
||||
|
||||
/**
|
||||
* @param parent
|
||||
* @param style
|
||||
*/
|
||||
public MenuItemComposite(Composite parent, int style) {
|
||||
super(parent, style);
|
||||
enabledColor = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
|
||||
disabledColor = Display.getCurrent()
|
||||
.getSystemColor(SWT.COLOR_DARK_GRAY);
|
||||
}
|
||||
|
||||
// creates both labels and ties them together
|
||||
/**
|
||||
* Creates both labels and ties them together
|
||||
*/
|
||||
public void addLabels(MenuItem it, int labelStyle) {
|
||||
if (it.isDisposed()) {
|
||||
return;
|
||||
|
@ -115,6 +139,7 @@ public class MenuItemComposite extends Composite {
|
|||
Collections.reverse(myPath);
|
||||
|
||||
item = it;
|
||||
|
||||
itemPath = new MenuPathElement(it);
|
||||
|
||||
String[] labels = item.getText().split("\t");
|
||||
|
@ -163,22 +188,21 @@ public class MenuItemComposite extends Composite {
|
|||
createUpdateListener();
|
||||
}
|
||||
|
||||
if (item.isEnabled()) {
|
||||
// add the listeners to both the first and the second
|
||||
// control, so the same thing happens if you scroll over either,
|
||||
// or the MenuItemComposite
|
||||
MouseTrackAdapter mouseTrackAdapter = getMouseTrackAdapter();
|
||||
firstItem.addMouseTrackListener(mouseTrackAdapter);
|
||||
secondItem.addMouseTrackListener(mouseTrackAdapter);
|
||||
this.addMouseTrackListener(mouseTrackAdapter);
|
||||
// add the listeners to both the first and the second
|
||||
// control, so the same thing happens if you scroll over either,
|
||||
// or the MenuItemComposite
|
||||
MouseTrackAdapter mouseTrackAdapter = getMouseTrackAdapter();
|
||||
firstItem.addMouseTrackListener(mouseTrackAdapter);
|
||||
secondItem.addMouseTrackListener(mouseTrackAdapter);
|
||||
this.addMouseTrackListener(mouseTrackAdapter);
|
||||
|
||||
MouseAdapter mouseAdapter = getMouseAdapter();
|
||||
firstItem.addMouseListener(mouseAdapter);
|
||||
secondItem.addMouseListener(mouseAdapter);
|
||||
this.addMouseListener(mouseAdapter);
|
||||
} else {
|
||||
setForeground(Display.getCurrent().getSystemColor(
|
||||
SWT.COLOR_DARK_GRAY));
|
||||
MouseAdapter mouseAdapter = getMouseAdapter();
|
||||
firstItem.addMouseListener(mouseAdapter);
|
||||
secondItem.addMouseListener(mouseAdapter);
|
||||
this.addMouseListener(mouseAdapter);
|
||||
|
||||
if (!item.isEnabled()) {
|
||||
setForeground(disabledColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,14 +213,68 @@ public class MenuItemComposite extends Composite {
|
|||
*
|
||||
*/
|
||||
private void addItemListeners() {
|
||||
if (item == null)
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (updateListener != null) {
|
||||
item.addListener(SWT.Modify, updateListener);
|
||||
}
|
||||
if (radioListener != null) {
|
||||
item.addSelectionListener(radioListener);
|
||||
}
|
||||
|
||||
if (item.getData() instanceof CommandContributionItem) {
|
||||
final Command c = ((ICommandService) PlatformUI.getWorkbench()
|
||||
.getService(ICommandService.class))
|
||||
.getCommand(((CommandContributionItem) item.getData())
|
||||
.getCommand().getId());
|
||||
|
||||
commandListener = new ICommandListener() {
|
||||
@Override
|
||||
public void commandChanged(CommandEvent commandEvent) {
|
||||
if (item.isDisposed() || firstItem.isDisposed()
|
||||
|| secondItem.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getData() instanceof CommandContributionItem) {
|
||||
CommandContributionItem itm = (CommandContributionItem) item
|
||||
.getData();
|
||||
if (itm.getCommand().getId().equals(c.getId())) {
|
||||
boolean enabled = true;
|
||||
if (commandEvent.getCommand().getHandler() != null) {
|
||||
enabled = commandEvent.getCommand()
|
||||
.getHandler().isEnabled();
|
||||
} else {
|
||||
enabled = commandEvent.getCommand().isEnabled();
|
||||
}
|
||||
|
||||
firstItem.setEnabled(enabled);
|
||||
secondItem.setEnabled(enabled);
|
||||
if (enabled) {
|
||||
setForeground(enabledColor);
|
||||
} else {
|
||||
setForeground(disabledColor);
|
||||
setBackground(Display.getCurrent()
|
||||
.getSystemColor(
|
||||
SWT.COLOR_WIDGET_BACKGROUND));
|
||||
|
||||
// changes the arrow image to the unhighlighted
|
||||
// version
|
||||
if (secondItem instanceof Label) {
|
||||
if (((Label) secondItem).getImage() != null) {
|
||||
((Label) secondItem).setImage(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
c.addCommandListener(commandListener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,8 +289,8 @@ public class MenuItemComposite extends Composite {
|
|||
for (Control comp : firstItem.getParent().getParent()
|
||||
.getChildren()) {
|
||||
MenuItemComposite composite = (MenuItemComposite) comp;
|
||||
if (composite.getItem().getText().equals(
|
||||
((MenuItem) e.widget).getText())) {
|
||||
if (composite.getItem().getText()
|
||||
.equals(((MenuItem) e.widget).getText())) {
|
||||
if (composite.firstItem instanceof Button) {
|
||||
((Button) composite.firstItem)
|
||||
.setSelection(composite.getItem()
|
||||
|
@ -337,14 +415,16 @@ public class MenuItemComposite extends Composite {
|
|||
// we want all the colors to be the same for background
|
||||
// and foreground, so we set that here, this is to tell
|
||||
// the whole thing to be highlighted
|
||||
setBackground(Display.getCurrent().getSystemColor(
|
||||
SWT.COLOR_LIST_SELECTION));
|
||||
setForeground(Display.getCurrent().getSystemColor(
|
||||
SWT.COLOR_LIST_SELECTION_TEXT));
|
||||
// changes the arrow image to the highlighted version
|
||||
if (secondItem instanceof Label) {
|
||||
if (((Label) secondItem).getImage() != null) {
|
||||
((Label) secondItem).setImage(highlightedArrow);
|
||||
if (item.isEnabled()) {
|
||||
setBackground(Display.getCurrent().getSystemColor(
|
||||
SWT.COLOR_LIST_SELECTION));
|
||||
setForeground(Display.getCurrent().getSystemColor(
|
||||
SWT.COLOR_LIST_SELECTION_TEXT));
|
||||
// changes the arrow image to the highlighted version
|
||||
if (secondItem instanceof Label) {
|
||||
if (((Label) secondItem).getImage() != null) {
|
||||
((Label) secondItem).setImage(highlightedArrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -354,14 +434,17 @@ public class MenuItemComposite extends Composite {
|
|||
// we want all the colors to be the same for background
|
||||
// and foreground, so we set that here, this is to
|
||||
// unhighlight the whole thing
|
||||
setBackground(Display.getCurrent().getSystemColor(
|
||||
SWT.COLOR_WIDGET_BACKGROUND));
|
||||
setForeground(Display.getCurrent().getSystemColor(
|
||||
SWT.COLOR_WIDGET_FOREGROUND));
|
||||
// changes the arrow image to the unhighlighted version
|
||||
if (secondItem instanceof Label) {
|
||||
if (((Label) secondItem).getImage() != null) {
|
||||
((Label) secondItem).setImage(arrow);
|
||||
if (item.isEnabled()) {
|
||||
setBackground(Display.getCurrent().getSystemColor(
|
||||
SWT.COLOR_WIDGET_BACKGROUND));
|
||||
|
||||
setForeground(Display.getCurrent().getSystemColor(
|
||||
SWT.COLOR_WIDGET_FOREGROUND));
|
||||
// changes the arrow image to the unhighlighted version
|
||||
if (secondItem instanceof Label) {
|
||||
if (((Label) secondItem).getImage() != null) {
|
||||
((Label) secondItem).setImage(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -379,8 +462,10 @@ public class MenuItemComposite extends Composite {
|
|||
MouseAdapter mouseAdapter = new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) {
|
||||
MenuItem item = getItem();
|
||||
|
||||
final MenuItem item = getItem();
|
||||
if (!item.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (item.getMenu() != null) {
|
||||
// This is item opens a submenu, get the y offset based on
|
||||
// the location of the click
|
||||
|
@ -401,7 +486,9 @@ public class MenuItemComposite extends Composite {
|
|||
Event event = new Event();
|
||||
event.type = SWT.Selection;
|
||||
event.widget = item;
|
||||
list.handleEvent(event);
|
||||
if (item.isEnabled()) {
|
||||
list.handleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
if (isDisposed()) {
|
||||
|
@ -438,11 +525,12 @@ public class MenuItemComposite extends Composite {
|
|||
// check that the radio groups match
|
||||
if (mic.getData("radioGroup").equals(
|
||||
parent.getData("radioGroup"))) {
|
||||
if (!parent.getItem()
|
||||
if (!parent
|
||||
.getItem()
|
||||
.getText()
|
||||
.replaceAll("&", "")
|
||||
.equals(mic.getItem().getText().replaceAll(
|
||||
"&", ""))) {
|
||||
.equals(mic.getItem().getText()
|
||||
.replaceAll("&", ""))) {
|
||||
mic.getItem().setSelection(false);
|
||||
((Button) mic.firstItem)
|
||||
.setSelection(false);
|
||||
|
@ -452,7 +540,8 @@ public class MenuItemComposite extends Composite {
|
|||
}
|
||||
}
|
||||
} catch (NullPointerException e1) {
|
||||
e1.printStackTrace();
|
||||
statusHandler.error("Error executing menu action.",
|
||||
e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -480,6 +569,14 @@ public class MenuItemComposite extends Composite {
|
|||
}
|
||||
}
|
||||
|
||||
if (item.getData() instanceof CommandContributionItem) {
|
||||
ICommandService service = (ICommandService) PlatformUI
|
||||
.getWorkbench().getService(ICommandService.class);
|
||||
Command c = service.getCommand(((CommandContributionItem) item
|
||||
.getData()).getCommand().getId());
|
||||
c.removeCommandListener(commandListener);
|
||||
}
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -491,10 +588,11 @@ public class MenuItemComposite extends Composite {
|
|||
|
||||
private MenuItem getItem() {
|
||||
MenuItem item = getItemIfAvailable();
|
||||
if (item == null)
|
||||
throw new IllegalStateException(
|
||||
String.format("Could not find target of tear-off menu item \"%s\"",
|
||||
itemPath.getName()));
|
||||
if (item == null) {
|
||||
throw new IllegalStateException(String.format(
|
||||
"Could not find target of tear-off menu item \"%s\"",
|
||||
itemPath.getName()));
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -508,10 +606,11 @@ public class MenuItemComposite extends Composite {
|
|||
|
||||
private MenuItem findItem() {
|
||||
Menu menu = getTargetMenu();
|
||||
if (menu != null)
|
||||
if (menu != null) {
|
||||
return TearOffMenuDialog.findItem(menu, itemPath);
|
||||
else
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Menu getTargetMenu() {
|
||||
|
@ -524,5 +623,5 @@ public class MenuItemComposite extends Composite {
|
|||
|
||||
public void reconnect() {
|
||||
getItemIfAvailable();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -69,7 +69,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
|
||||
public class TearOffMenuDialog extends CaveSWTDialog {
|
||||
|
||||
private MenuPathElement[] menuPath;
|
||||
private final MenuPathElement[] menuPath;
|
||||
|
||||
private Menu menu;
|
||||
|
||||
|
@ -83,6 +83,8 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
*/
|
||||
ISimulatedTimeChangeListener stcl;
|
||||
|
||||
private Listener swtListener;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
*/
|
||||
|
@ -152,12 +154,15 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
int y = point.y;
|
||||
shell.setLocation(x, y);
|
||||
|
||||
shell.addListener(SWT.Show, new Listener() {
|
||||
swtListener = new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
updateItems();
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
shell.addListener(SWT.Show, swtListener);
|
||||
menu.addListener(SWT.Show, swtListener);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -208,6 +213,9 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
for (Control control : fullComp.getChildren()) {
|
||||
control.dispose();
|
||||
}
|
||||
|
||||
shell.removeListener(SWT.Show, swtListener);
|
||||
menu.removeListener(SWT.Show, swtListener);
|
||||
super.disposed();
|
||||
}
|
||||
|
||||
|
@ -216,10 +224,12 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
*/
|
||||
private void updateItems() {
|
||||
Menu menu = getMenuIfAvailable();
|
||||
if (menu == null)
|
||||
if (menu == null) {
|
||||
return;
|
||||
for (MenuItemComposite mic : getMenuItemComposites())
|
||||
}
|
||||
for (MenuItemComposite mic : getMenuItemComposites()) {
|
||||
mic.reconnect();
|
||||
}
|
||||
for (MenuItem item : menu.getItems()) {
|
||||
if (item.getData() instanceof BundleContributionItem) {
|
||||
((BundleContributionItem) item.getData()).refreshText();
|
||||
|
@ -230,8 +240,9 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
private List<MenuItemComposite> getMenuItemComposites() {
|
||||
List<MenuItemComposite> result = new ArrayList<MenuItemComposite>();
|
||||
for (Control c : fullComp.getChildren()) {
|
||||
if (c instanceof MenuItemComposite)
|
||||
if (c instanceof MenuItemComposite) {
|
||||
result.add((MenuItemComposite) c);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -243,10 +254,11 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
*/
|
||||
private static String getCleanMenuItemText(String text) {
|
||||
int pos = text.indexOf('\t');
|
||||
if (pos >= 0)
|
||||
if (pos >= 0) {
|
||||
return text.substring(0, pos);
|
||||
else
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
private Menu getMenuIfAvailable() {
|
||||
|
@ -256,22 +268,23 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
return menu;
|
||||
}
|
||||
|
||||
/*package*/ Menu getTargetMenu() {
|
||||
/* package */Menu getTargetMenu() {
|
||||
Menu menu = getMenuIfAvailable();
|
||||
if (menu == null) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Tear-off menu %s is not available", shell.getText()));
|
||||
throw new IllegalStateException(String.format(
|
||||
"Tear-off menu %s is not available", shell.getText()));
|
||||
}
|
||||
if (menu.getItems().length == 0)
|
||||
if (menu.getItems().length == 0) {
|
||||
tryToFillMenu(menu);
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
|
||||
private void tryToFillMenu(Menu menu) {
|
||||
/*
|
||||
* Menu may not have been created so call listeners. This still does
|
||||
* not work if all of the menu items need the workbench window to be
|
||||
* active in order to be enabled.
|
||||
* Menu may not have been created so call listeners. This still does not
|
||||
* work if all of the menu items need the workbench window to be active
|
||||
* in order to be enabled.
|
||||
*/
|
||||
|
||||
Shell shell = this.shell.getParent().getShell();
|
||||
|
@ -294,14 +307,17 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
MenuPathElement lastPathElement = null;
|
||||
for (int i = 0; i < menuPath.length; ++i) {
|
||||
MenuItem mi = findItem(container, menuPath[i]);
|
||||
if (mi == null)
|
||||
if (mi == null) {
|
||||
return null;
|
||||
}
|
||||
Menu mim = mi.getMenu();
|
||||
if (mim == null)
|
||||
if (mim == null) {
|
||||
throw new IllegalStateException(String.format(
|
||||
"Could not get target menu \"%s\" in %s",
|
||||
menuPath[i].getName(), lastPathElement != null ?
|
||||
'"' + lastPathElement.getName() + '"' : "menu bar"));
|
||||
menuPath[i].getName(),
|
||||
lastPathElement != null ? '"' + lastPathElement
|
||||
.getName() + '"' : "menu bar"));
|
||||
}
|
||||
tryToFillMenu(mim);
|
||||
container = mim;
|
||||
lastPathElement = menuPath[i];
|
||||
|
@ -310,39 +326,47 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
/**
|
||||
* Identifies a specific item in an SWT menu. It has been observed that
|
||||
* Identifies a specific item in an SWT menu. It has been observed that
|
||||
* associated data of a menu item maintains the same identity during a CAVE
|
||||
* session even if the MenuItem is recreated. However, the associated
|
||||
* data is not always unique. Menu item text is used to differentiate.
|
||||
* session even if the MenuItem is recreated. However, the associated data
|
||||
* is not always unique. Menu item text is used to differentiate.
|
||||
*/
|
||||
static class MenuPathElement {
|
||||
Object data;
|
||||
|
||||
String cleanText;
|
||||
|
||||
public MenuPathElement(MenuItem item) {
|
||||
data = item.getData();
|
||||
cleanText = getCleanMenuItemText(item.getText());
|
||||
}
|
||||
|
||||
public int getMatchLevel(MenuItem item) {
|
||||
int level = 0;
|
||||
if (item.getData() == data)
|
||||
if (item.getData() == data) {
|
||||
++level;
|
||||
if (cleanText.equals(item.getText()))
|
||||
}
|
||||
if (cleanText.equals(item.getText())) {
|
||||
++level;
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (cleanText != null && cleanText.length() > 0)
|
||||
if (cleanText != null && cleanText.length() > 0) {
|
||||
return cleanText;
|
||||
}
|
||||
Object value = data;
|
||||
if (value instanceof MenuManager)
|
||||
if (value instanceof MenuManager) {
|
||||
value = ((MenuManager) value).getId();
|
||||
else if (value instanceof ContributionItem)
|
||||
} else if (value instanceof ContributionItem) {
|
||||
value = ((ContributionItem) value).getId();
|
||||
}
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
||||
/*package*/ static MenuItem findItem(Menu menu, MenuPathElement pe) {
|
||||
/* package */static MenuItem findItem(Menu menu, MenuPathElement pe) {
|
||||
MenuItem best = null;
|
||||
int bestLevel = 0;
|
||||
for (MenuItem item : menu.getItems()) {
|
||||
|
@ -359,8 +383,9 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
ArrayList<MenuPathElement> data = new ArrayList<MenuPathElement>();
|
||||
while (menu != null) {
|
||||
MenuItem mi = menu.getParentItem();
|
||||
if (mi == null)
|
||||
if (mi == null) {
|
||||
break;
|
||||
}
|
||||
data.add(new MenuPathElement(mi));
|
||||
menu = menu.getParentMenu();
|
||||
}
|
||||
|
|
|
@ -3,4 +3,5 @@ output.. = bin/
|
|||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
localization/
|
||||
localization/,\
|
||||
icons/
|
||||
|
|
BIN
cave/com.raytheon.viz.mpe.ui/icons/back0.gif
Normal file
BIN
cave/com.raytheon.viz.mpe.ui/icons/back0.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 79 B |
BIN
cave/com.raytheon.viz.mpe.ui/icons/fwd0.gif
Normal file
BIN
cave/com.raytheon.viz.mpe.ui/icons/fwd0.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 79 B |
|
@ -805,6 +805,44 @@
|
|||
</parameter>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution
|
||||
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=hydrocommon-1">
|
||||
<toolbar
|
||||
id="com.raytheon.viz.mpe.ui.toolbar.mpecontrol">
|
||||
<command
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.chooseHourPrev"
|
||||
icon="icons/back0.gif"
|
||||
label="Previous Hour"
|
||||
style="push"
|
||||
tooltip="Previous Hour">
|
||||
<visibleWhen>
|
||||
<reference
|
||||
definitionId="com.raytheon.viz.inMPEActionSet">
|
||||
</reference>
|
||||
</visibleWhen>
|
||||
<parameter
|
||||
name="increment"
|
||||
value="-1">
|
||||
</parameter>
|
||||
</command>
|
||||
<command
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.chooseHourNext"
|
||||
icon="icons/fwd0.gif"
|
||||
label="Next Hour"
|
||||
style="push"
|
||||
tooltip="Next Hour">
|
||||
<visibleWhen>
|
||||
<reference
|
||||
definitionId="com.raytheon.viz.inMPEActionSet">
|
||||
</reference>
|
||||
</visibleWhen>
|
||||
<parameter
|
||||
name="increment"
|
||||
value="1">
|
||||
</parameter>
|
||||
</command>
|
||||
</toolbar>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.commands">
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Map;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.ui.AbstractSourceProvider;
|
||||
import org.eclipse.ui.ISources;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.services.ISourceProviderService;
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,8 @@ import org.eclipse.ui.services.ISourceProviderService;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 2, 2010 mschenke Initial creation
|
||||
* Sep 2, 2010 mschenke Initial creation
|
||||
* Feb 26, 2014 2842 mpduff Use PlatformUI rather than HandlerUtil.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,7 +49,7 @@ public class SaveBestEstimateProvider extends AbstractSourceProvider {
|
|||
|
||||
private static final String[] MENU_ENABLED = new String[] { "com.raytheon.viz.mpe.ui.saveBestEstBottom" };
|
||||
|
||||
private Map<String, Boolean> sourceMap = new HashMap<String, Boolean>();
|
||||
private final Map<String, Boolean> sourceMap = new HashMap<String, Boolean>();
|
||||
|
||||
private boolean enabled = false;
|
||||
|
||||
|
@ -88,9 +89,8 @@ public class SaveBestEstimateProvider extends AbstractSourceProvider {
|
|||
}
|
||||
|
||||
public static SaveBestEstimateProvider getProvider(ExecutionEvent event) {
|
||||
ISourceProviderService service = (ISourceProviderService) HandlerUtil
|
||||
.getActiveWorkbenchWindow(event).getService(
|
||||
ISourceProviderService.class);
|
||||
ISourceProviderService service = (ISourceProviderService) PlatformUI
|
||||
.getWorkbench().getService(ISourceProviderService.class);
|
||||
return (SaveBestEstimateProvider) service
|
||||
.getSourceProvider(MENU_ENABLED[0]);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.core.commands.ExecutionEvent;
|
|||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
|
@ -44,6 +45,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 23, 2008 randerso Initial creation
|
||||
* Feb 26, 2014 2842 mpduff Use PlatformUI rather than HandlerUtil.
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
|
@ -86,7 +88,7 @@ public class ChooseHour extends AbstractHandler {
|
|||
MPEDisplayManager dm = MPEDisplayManager.getInstance(pane);
|
||||
Date currentDate = dm.getCurrentEditDate();
|
||||
if ((increment == 0) || (currentDate == null)) {
|
||||
Shell shell = HandlerUtil.getActiveWorkbenchWindow(event)
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
ChooseDataPeriodDialog dialog = new ChooseDataPeriodDialog(shell);
|
||||
dialog.open();
|
||||
|
|
|
@ -22,11 +22,11 @@ package com.raytheon.viz.mpe.ui.actions;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.viz.mpe.ui.TransmitRFCBiasProvider;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
|
||||
/**
|
||||
* MPE Users guide specifies this command should clear all MPE data from screen
|
||||
|
@ -39,6 +39,7 @@ import com.raytheon.viz.mpe.ui.TransmitRFCBiasProvider;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 3, 2012 mschenke Initial creation
|
||||
* Feb 26, 2014 2842 mpduff Use PlatformUI rather than HandlerUtil.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,7 +58,8 @@ public class ClearMPEData extends FullScreen {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart editor = HandlerUtil.getActiveEditor(event);
|
||||
IEditorPart editor = EditorUtil.getActiveEditor();
|
||||
|
||||
if (editor instanceof IDisplayPaneContainer) {
|
||||
IDisplayPaneContainer container = (IDisplayPaneContainer) editor;
|
||||
for (IDisplayPane pane : container.getDisplayPanes()) {
|
||||
|
|
|
@ -25,12 +25,12 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
|
||||
import com.raytheon.viz.mpe.ui.rsc.MPEPolygonResource;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.input.EditableManager;
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,8 @@ import com.raytheon.viz.ui.input.EditableManager;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 1, 2009 mpduff Initial creation.
|
||||
* Jul 01, 2009 mpduff Initial creation.
|
||||
* Feb 26, 2014 2842 mpduff Use EditorUtil rather than HandlerUtil.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,7 +53,7 @@ public class DrawPolygonAction extends AbstractHandler {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
|
||||
IEditorPart activeEditor = EditorUtil.getActiveEditor();
|
||||
if (activeEditor instanceof IDisplayPaneContainer) {
|
||||
IDisplayPaneContainer container = (IDisplayPaneContainer) activeEditor;
|
||||
MPEDisplayManager.stopLooping(container);
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
|
@ -40,6 +40,7 @@ import com.raytheon.viz.mpe.ui.Activator;
|
|||
import com.raytheon.viz.mpe.ui.DisplayFieldData;
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
|
||||
import com.raytheon.viz.mpe.ui.rsc.MPEFieldResource;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
|
||||
/**
|
||||
* Handler class for saving the current best estimate
|
||||
|
@ -51,6 +52,7 @@ import com.raytheon.viz.mpe.ui.rsc.MPEFieldResource;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 2, 2013 mschenke Initial creation
|
||||
* Feb 26, 2014 2842 mpduff Use PlatformUI rather than HandlerUtil.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -69,14 +71,15 @@ public class SaveBestEstimateHandler extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart part = HandlerUtil.getActiveEditor(event);
|
||||
IEditorPart part = EditorUtil.getActiveEditor();
|
||||
if (part instanceof IDisplayPaneContainer) {
|
||||
IDisplayPaneContainer container = (IDisplayPaneContainer) part;
|
||||
IDisplayPane toSave = getPaneToSave(container);
|
||||
if (toSave != null) {
|
||||
MPEDisplayManager.stopLooping(container);
|
||||
IWorkbenchWindow activeWindow = HandlerUtil
|
||||
.getActiveWorkbenchWindow(event);
|
||||
|
||||
IWorkbenchWindow activeWindow = PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow();
|
||||
Shell shell = activeWindow.getShell();
|
||||
try {
|
||||
shell.setCursor(shell.getDisplay().getSystemCursor(
|
||||
|
|
|
@ -23,13 +23,13 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.viz.mpe.ui.DisplayFieldData;
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
|
||||
import com.raytheon.viz.mpe.ui.rsc.MPEFieldResource;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
|
||||
|
||||
/**
|
||||
|
@ -42,6 +42,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
|
|||
* Oct 27, 2008 randerso Initial creation.
|
||||
* Jul 21, 2009 mpduff Added code to update the Xmrg
|
||||
* data.
|
||||
* Feb 26, 2014 2842 mpduff Use EditorUtil rather than HandlerUtil.
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
|
@ -59,7 +60,7 @@ public class SetDisplayField extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
|
||||
IEditorPart activeEditor = EditorUtil.getActiveEditor();
|
||||
if (activeEditor instanceof IDisplayPaneContainer) {
|
||||
String f = event.getParameter("Field");
|
||||
return setDisplayField((IDisplayPaneContainer) activeEditor,
|
||||
|
|
|
@ -23,11 +23,11 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
|
||||
import com.raytheon.viz.mpe.ui.dialogs.timelapse.TimeLapseDlg;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
|
||||
/**
|
||||
* Time lapse action, can start/stop time lapsing in MPE
|
||||
|
@ -39,6 +39,7 @@ import com.raytheon.viz.mpe.ui.dialogs.timelapse.TimeLapseDlg;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 7, 2012 mschenke Initial creation
|
||||
* Feb 26, 2014 2842 mpduff Use EditorUtil rather than HandlerUtil.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -49,7 +50,7 @@ public class TimeLapseAction extends AbstractHandler {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart part = HandlerUtil.getActiveEditor(event);
|
||||
IEditorPart part = EditorUtil.getActiveEditor();
|
||||
if (part instanceof IDisplayPaneContainer) {
|
||||
IDisplayPaneContainer container = (IDisplayPaneContainer) part;
|
||||
String hourId = event.getParameter("Hour");
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.eclipse.jface.action.IAction;
|
|||
import org.eclipse.jface.action.IContributionItem;
|
||||
import org.eclipse.ui.ISources;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.actions.ActionFactory;
|
||||
import org.eclipse.ui.actions.CompoundContributionItem;
|
||||
import org.eclipse.ui.internal.WorkbenchWindow;
|
||||
import org.eclipse.ui.services.IEvaluationService;
|
||||
|
||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||
|
@ -35,16 +35,15 @@ public class ToggleToolbarContributionItem extends CompoundContributionItem {
|
|||
public void run() {
|
||||
IWorkbenchWindow activeWorkbenchWindow = VizWorkbenchManager
|
||||
.getInstance().getCurrentWindow();
|
||||
ActionFactory.IWorkbenchAction toggleToolbar = ActionFactory.TOGGLE_COOLBAR
|
||||
.create(activeWorkbenchWindow);
|
||||
toggleToolbar.run();
|
||||
// ActionFactory.IWorkbenchAction toggleToolbar =
|
||||
// ActionFactory.TOGGLE_COOLBAR
|
||||
// .create(activeWorkbenchWindow);
|
||||
// toggleToolbar.run();
|
||||
|
||||
// if (activeWorkbenchWindow instanceof WorkbenchWindow)
|
||||
// {
|
||||
// WorkbenchWindow window = (WorkbenchWindow)
|
||||
// activeWorkbenchWindow;
|
||||
// window.toggleToolbarVisibility();
|
||||
// }
|
||||
if (activeWorkbenchWindow instanceof WorkbenchWindow) {
|
||||
WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
|
||||
window.toggleToolbarVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -75,6 +75,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* Oct 14, 2013 2361 njensen Removed IDecoderGettable
|
||||
* Dec 10, 2013 2616 mpduff Added stationId to the unique constraint
|
||||
* jan 22, 2014 2713 dhladky Calendar conversion.
|
||||
* Mar 21, 2014 2939 dhladky Fixed mismatches in HDF5, DB records.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -85,7 +86,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@Entity
|
||||
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "madisseq")
|
||||
@Table(name = "madis", uniqueConstraints = { @UniqueConstraint(columnNames = {
|
||||
"location", "stationId", "refTime", "provider", "subProvider", "restriction" }) })
|
||||
"latitude", "longitude", "stationId", "refTime", "provider", "subProvider", "restriction" }) })
|
||||
@org.hibernate.annotations.Table(appliesTo = "madis", indexes = { @Index(name = "madis_wfsQueryIndex", columnNames = {
|
||||
"refTime", "location" }), })
|
||||
@DynamicSerialize
|
||||
|
@ -121,7 +122,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
|
|||
@Column
|
||||
@DataURI(position = 4)
|
||||
private int restriction;
|
||||
|
||||
|
||||
/** A string denoting the time of observation */
|
||||
@DynamicSerializeElement
|
||||
@Transient
|
||||
|
@ -349,7 +350,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
|
|||
@DynamicSerializeElement
|
||||
@Embedded
|
||||
private PointDataView pointDataView;
|
||||
|
||||
|
||||
public static final String PLUGIN_NAME = "madis";
|
||||
|
||||
public static final String STATION_ID = "stationId";
|
||||
|
@ -453,6 +454,19 @@ public class MadisRecord extends PersistablePluginDataObject implements
|
|||
|
||||
public static final String RESTRICTION = "RESTRICTION";
|
||||
}
|
||||
|
||||
/**
|
||||
* URI constructor
|
||||
* @param string
|
||||
*/
|
||||
public MadisRecord(String string) {
|
||||
super();
|
||||
}
|
||||
|
||||
//empty constructor
|
||||
public MadisRecord() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pointdata view
|
||||
|
@ -1086,4 +1100,14 @@ public class MadisRecord extends PersistablePluginDataObject implements
|
|||
public String getPluginName() {
|
||||
return PLUGIN_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow overwrite of MADIS records
|
||||
* MADIS records are frequently updated for even the same temporal
|
||||
* record. QC value changes will cause record re-submissions.
|
||||
* @return
|
||||
*/
|
||||
public boolean getAllowOverWrite() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.edex.database.handlers;
|
|||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -47,7 +48,8 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 5, 2011 njensen Initial creation
|
||||
* Apr 05, 2011 njensen Initial creation
|
||||
* Mar 24, 2014 2941 mpduff Sort data before returning it.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -180,6 +182,8 @@ public class TimeQueryHandler implements IRequestHandler<TimeQueryRequest> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(times);
|
||||
return times;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
<constructor-arg ref="madis-camel" />
|
||||
</bean>
|
||||
|
||||
<bean id="madisSeparator" class="com.raytheon.uf.edex.plugin.madis.MadisSeparator"
|
||||
depends-on="jmsIngestMadisConfig, jms-madis, madisThreadPool">
|
||||
<bean id="madisSeparator" class="com.raytheon.uf.edex.plugin.madis.MadisSeparator">
|
||||
<constructor-arg
|
||||
value="jms-durable:queue:Ingest.madisSeparator" />
|
||||
<!-- time in hours for orphan purging -->
|
||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.edex.pointdata.PointDataQuery;
|
|||
* 28 Mar 2013 1746 dhladky Created
|
||||
* 10 Jun 2013 1763 dhladky Updates for speed.
|
||||
* 08 Jul 2013 2171 dhladky Removed dataURI
|
||||
* 21 Mar 2014 2939 dhladky Fixed mismatches in HDF5, DB records.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -164,8 +165,10 @@ public class MadisPointDataTransform {
|
|||
public static final String RESTRICTION = "restriction";
|
||||
|
||||
public static final String TIME_OBS = "timeObs";
|
||||
|
||||
|
||||
public static final String ID = "id";
|
||||
|
||||
public static final String EQUAL = "=";
|
||||
|
||||
public static final String[] ALL_PARAMS = { DATASET, DEWPOINT,
|
||||
DEWPOINT_QCD, DEWPOINT_QCA, DEWPOINT_QCR, RH, RH_QCD, RH_QCA,
|
||||
|
@ -249,10 +252,7 @@ public class MadisPointDataTransform {
|
|||
private PointDataView buildView(PointDataContainer container,
|
||||
MadisRecord record) {
|
||||
PointDataView pdv = container.append();
|
||||
|
||||
// I think this is inefficient but, PlotData for SVG reads
|
||||
// the pointDataView so, the first 4 that are already in the
|
||||
// DB have to be here.
|
||||
|
||||
pdv.setLong(TIME_OBS, record.getDataTime().getRefTime().getTime());
|
||||
pdv.setString(PROVIDER, record.getProvider());
|
||||
pdv.setString(SUB_PROVIDER, record.getSubProvider());
|
||||
|
@ -310,75 +310,10 @@ public class MadisPointDataTransform {
|
|||
pdv.setString(PRESSURE_QCD, record.getPressure_qcd().toString());
|
||||
pdv.setInt(PRESSURE_QCA, record.getPressure_qca());
|
||||
pdv.setInt(PRESSURE_QCR, record.getPressure_qcr());
|
||||
|
||||
|
||||
return pdv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MadisRecord from a PointDataContainer
|
||||
*
|
||||
* @param pdc
|
||||
* @return
|
||||
*/
|
||||
public static MadisRecord toMadisRecord(MadisRecord mr) {
|
||||
|
||||
PointDataView pdv = mr.getPointDataView();
|
||||
mr.setDataset(pdv.getInt(DATASET));
|
||||
// dewpoint
|
||||
mr.setDewpoint(pdv.getFloat(DEWPOINT));
|
||||
mr.setDewpoint_qcd(QCD.fromString(pdv.getString(DEWPOINT_QCD)));
|
||||
mr.setDewpoint_qca(pdv.getInt(DEWPOINT_QCA));
|
||||
mr.setDewpoint_qcr(pdv.getInt(DEWPOINT_QCR));
|
||||
// relative humidty
|
||||
mr.setRh(pdv.getFloat(RH));
|
||||
mr.setRh_qcd(QCD.fromString(pdv.getString(RH_QCD)));
|
||||
mr.setRh_qca(pdv.getInt(RH_QCA));
|
||||
mr.setRh_qcr(pdv.getInt(RH_QCR));
|
||||
// altimeter setting
|
||||
mr.setAltimeter(pdv.getFloat(ALTIMETER));
|
||||
mr.setAltimeter_qcd(QCD.fromString(pdv.getString(ALTIMETER_QCD)));
|
||||
mr.setAltimeter_qca(pdv.getInt(ALTIMETER_QCA));
|
||||
mr.setAltimeter_qcr(pdv.getInt(ALTIMETER_QCR));
|
||||
// temperature
|
||||
mr.setTemperature(pdv.getFloat(TEMPERATURE));
|
||||
mr.setTemperature_qcd(QCD.fromString(pdv.getString(TEMPERATURE_QCD)));
|
||||
mr.setTemperature_qca(pdv.getInt(TEMPERATURE_QCA));
|
||||
mr.setTemperature_qcr(pdv.getInt(TEMPERATURE_QCR));
|
||||
// wind direction
|
||||
mr.setWindDirection(pdv.getNumber(WINDDIRECTION).intValue());
|
||||
mr.setWindDirection_qcd(QCD.fromString(pdv.getString(WINDDIRECTION_QCD)));
|
||||
mr.setWindDirection_qca(pdv.getInt(WINDDIRECTION_QCA));
|
||||
mr.setWindDirection_qcr(pdv.getInt(WINDDIRECTION_QCR));
|
||||
// precip rate
|
||||
mr.setPrecipRate(pdv.getFloat(PRECIPRATE));
|
||||
mr.setPrecipRate_qcd(QCD.fromString(pdv.getString(PRECIPRATE_QCD)));
|
||||
mr.setPrecipRate_qca(pdv.getInt(PRECIPRATE_QCA));
|
||||
mr.setPrecipRate_qcr(pdv.getInt(PRECIPRATE_QCR));
|
||||
// WINDSPEED
|
||||
mr.setWindSpeed(pdv.getFloat(WINDSPEED));
|
||||
mr.setWindSpeed_qcd(QCD.fromString(pdv.getString(WINDSPEED_QCD)));
|
||||
mr.setWindSpeed_qca(pdv.getInt(WINDSPEED_QCA));
|
||||
mr.setWindSpeed_qcr(pdv.getInt(WINDSPEED_QCR));
|
||||
// Wind Gust
|
||||
mr.setWindGust(pdv.getFloat(WINDGUST));
|
||||
mr.setWindGust_qcd(QCD.fromString(pdv.getString(WINDGUST_QCD)));
|
||||
mr.setWindGust_qca(pdv.getInt(WINDGUST_QCA));
|
||||
mr.setWindGust_qcr(pdv.getInt(WINDGUST_QCR));
|
||||
// Precipital Water
|
||||
mr.setPrecipitalWater(pdv.getFloat(PRECIPITALWATER));
|
||||
mr.setPrecipitalWater_qcd(QCD.fromString(pdv
|
||||
.getString(PRECIPITALWATER_QCD)));
|
||||
mr.setPrecipitalWater_qca(pdv.getInt(PRECIPITALWATER_QCA));
|
||||
mr.setPrecipitalWater_qcr(pdv.getInt(PRECIPITALWATER_QCR));
|
||||
// Pressure
|
||||
mr.setPressure(pdv.getFloat(PRESSURE));
|
||||
mr.setPressure_qcd(QCD.fromString(pdv.getString(PRESSURE_QCD)));
|
||||
mr.setPressure_qca(pdv.getInt(PRESSURE_QCA));
|
||||
mr.setPressure_qcr(pdv.getInt(PRESSURE_QCR));
|
||||
|
||||
return mr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MadisRecord from a PointDataContainer
|
||||
*
|
||||
|
@ -458,7 +393,7 @@ public class MadisPointDataTransform {
|
|||
try {
|
||||
request = new PointDataQuery(MadisRecord.PLUGIN_NAME);
|
||||
request.requestAllLevels();
|
||||
request.addParameter(ID, ""+record.getId(), "=");
|
||||
request.addParameter(ID, String.valueOf(record.getId()), EQUAL);
|
||||
request.setParameters(ALL_PARAMS_LIST);
|
||||
result = request.execute();
|
||||
|
||||
|
@ -483,9 +418,7 @@ public class MadisPointDataTransform {
|
|||
* @return populated Madis record Array
|
||||
* @throws PluginException
|
||||
*/
|
||||
// TODO I would like to make a PointDataInterface that could implement this
|
||||
// and other methods that all of these
|
||||
// will use.
|
||||
|
||||
public static PluginDataObject[] populatePointDataFields(
|
||||
PluginDataObject[] records) {
|
||||
|
||||
|
@ -507,10 +440,19 @@ public class MadisPointDataTransform {
|
|||
request.addParameter(ID, ids.toString(), IN);
|
||||
request.setParameters(ALL_PARAMS_LIST);
|
||||
result = request.execute();
|
||||
|
||||
|
||||
// correlate up the PointDataViews with the correct records.
|
||||
HashMap<Integer, PointDataView> pdvs = new HashMap<Integer, PointDataView>(records.length);
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
PointDataView pdv = result.readRandom(i);
|
||||
toMadisRecord((MadisRecord) records[i], pdv);
|
||||
// correlate ID from record with ID from PDV
|
||||
int id = pdv.getInt(ID);
|
||||
pdvs.put(id, pdv);
|
||||
}
|
||||
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
int id = records[i].getId();
|
||||
records[i] = toMadisRecord((MadisRecord)records[i], pdvs.get(id));
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package gov.noaa.nws.ncep.viz.gempak.nativelib;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
|
@ -10,20 +11,47 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
* Utility to load a specific native library
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- -----------------------------------------
|
||||
* --/--/---- Initial Creation
|
||||
* Mar 20, 2014 2919 njensen Safety checks, better error messages
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
public class LibraryLoader {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(LibraryLoader.class);
|
||||
|
||||
public static void load(String libName) {
|
||||
URL url = null;
|
||||
Path path = null;
|
||||
try {
|
||||
Bundle b = Activator.getDefault().getBundle();
|
||||
url = FileLocator.find(b, new Path(System.mapLibraryName(libName)),
|
||||
null);
|
||||
path = new Path(System.mapLibraryName(libName));
|
||||
url = FileLocator.find(b, path, null);
|
||||
if (url == null) {
|
||||
throw new FileNotFoundException("Unable to locate "
|
||||
+ path.toString());
|
||||
}
|
||||
url = FileLocator.resolve(url);
|
||||
System.load(url.getPath());
|
||||
} catch (Exception e) {
|
||||
String msg = "Could not Load native Library: " + url.getFile();
|
||||
String msg = "Could not load native Library: ";
|
||||
if (url != null) {
|
||||
msg += url.getFile();
|
||||
} else {
|
||||
msg += path.toString();
|
||||
}
|
||||
statusHandler.handle(Priority.PROBLEM, msg, e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue