Issue #1602 Merged menu changes and D2D Nsharp changes to support NUCAPS NPP changes

Change-Id: Ia3375d8c4e03ffa143a74c965c9cf40cb2649402

Former-commit-id: ac58f7ba225688d0c2f56a8937e3477bf30bd8d1
This commit is contained in:
Max Schenkelberg 2013-02-11 16:11:34 -06:00
parent 8abc835e59
commit d610c1b862
6 changed files with 19 additions and 41 deletions

View file

@ -138,7 +138,7 @@ public class D2DNSharpResource extends
D2DNSharpDataObject pdo = dataResponseQueue.poll(); D2DNSharpDataObject pdo = dataResponseQueue.poll();
while (pdo != null) { while (pdo != null) {
if (pdos.get(pdo.getDataTime()) == pdo) { if (pdos.get(pdo.getDataTime()) == pdo) {
if (isValidSounding(pdo)) { if (pdo.getLayers() != null) {
stnInfo = pdo.getStationInfo(); stnInfo = pdo.getStationInfo();
myDataMap.put(stnInfo.getStnDisplayInfo(), myDataMap.put(stnInfo.getStnDisplayInfo(),
pdo.getLayers()); pdo.getLayers());
@ -154,31 +154,6 @@ public class D2DNSharpResource extends
} }
} }
/**
* Determine if a dataObject has enough valid layers to build a sounding
* without freezing or crashing CAVE.
*
* @param pdo
* @return
*/
protected boolean isValidSounding(D2DNSharpDataObject pdo) {
if (pdo.getLayers() == null) {
return false;
}
int numberOfWindLayers = 0;
for (NcSoundingLayer layer : pdo.getLayers()) {
if (layer.getWindSpeed() > 0) {
numberOfWindLayers += 1;
if (numberOfWindLayers >= 2) {
return true;
}
}
}
return false;
}
private NsharpResourceHandler getHandler() throws VizException { private NsharpResourceHandler getHandler() throws VizException {
List<NsharpAbstractPaneResource> paneRscs = descriptor List<NsharpAbstractPaneResource> paneRscs = descriptor
.getResourceList().getResourcesByTypeAsType( .getResourceList().getResourcesByTypeAsType(

View file

@ -157,6 +157,10 @@ public abstract class D2DNSharpResourceData extends
List<NcSoundingLayer> layers = profileList.getSoundingLyLst(); List<NcSoundingLayer> layers = profileList.getSoundingLyLst();
layers = NsharpDataHandling.organizeSoundingDataForShow(layers, layers = NsharpDataHandling.organizeSoundingDataForShow(layers,
profileList.getStationElevation()); profileList.getStationElevation());
if (layers != null && layers.size() < 3) {
// set invalid data to null
layers = null;
}
dataObject.setLayers(layers); dataObject.setLayers(layers);
} }

View file

@ -25,6 +25,9 @@ import java.util.Set;
import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.MenuManager;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.menus.IMenuService;
import org.eclipse.ui.menus.MenuUtil;
import com.raytheon.uf.common.menus.xml.CommonAbstractMenuContribution; import com.raytheon.uf.common.menus.xml.CommonAbstractMenuContribution;
import com.raytheon.uf.common.menus.xml.VariableSubstitution; import com.raytheon.uf.common.menus.xml.VariableSubstitution;
@ -77,9 +80,9 @@ public class SubmenuContributionItem extends MenuManager {
* @param mListener * @param mListener
*/ */
public SubmenuContributionItem(VariableSubstitution[] includeSubstitutions, public SubmenuContributionItem(VariableSubstitution[] includeSubstitutions,
String name, CommonAbstractMenuContribution[] ci, String id, String name, CommonAbstractMenuContribution[] ci,
Set<String> removals) { Set<String> removals) {
super(processNameSubstitution(includeSubstitutions, name)); super(processNameSubstitution(includeSubstitutions, name), id);
this.subs = includeSubstitutions; this.subs = includeSubstitutions;
this.contribs = ci; this.contribs = ci;
this.removals = removals; this.removals = removals;
@ -144,6 +147,10 @@ public class SubmenuContributionItem extends MenuManager {
add(item); add(item);
} }
} }
IMenuService menuService = (IMenuService) PlatformUI.getWorkbench()
.getService(IMenuService.class);
menuService.populateContributionManager(
SubmenuContributionItem.this, MenuUtil.menuUri(getId()));
} }
} }
} }

View file

@ -72,7 +72,7 @@ public class IncludeMenuContribution extends
newItem.substitutions = item.substitutions; newItem.substitutions = item.substitutions;
newItem.suppressErrors = item.suppressErrors; newItem.suppressErrors = item.suppressErrors;
return new IContributionItem[] { new SubmenuContributionItem(subs, return new IContributionItem[] { new SubmenuContributionItem(subs,
item.subMenuName, item.id, item.subMenuName,
new CommonAbstractMenuContribution[] { newItem }, removals) }; new CommonAbstractMenuContribution[] { newItem }, removals) };
} }
return getContributionItemsInternal(items, subs, removals); return getContributionItemsInternal(items, subs, removals);

View file

@ -83,7 +83,8 @@ public class IncludeMenuItem extends CommonIncludeMenuItem implements
throws VizException { throws VizException {
if (subMenuName != null) { if (subMenuName != null) {
submenuCont = new SubmenuContributionItem(incomingSubs, submenuCont = new SubmenuContributionItem(incomingSubs,
subMenuName, null, removalsIn) { "IncludeSubMenuContributionId_" + subMenuName, subMenuName,
null, removalsIn) {
@Override @Override
protected synchronized IContributionItem[][] getContributionItems() { protected synchronized IContributionItem[][] getContributionItems() {
@ -98,16 +99,6 @@ public class IncludeMenuItem extends CommonIncludeMenuItem implements
} }
return this.contributionItems; return this.contributionItems;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.MenuManager#getId()
*/
@Override
public String getId() {
return "IncludeSubMenuContributionId_"+subMenuName;
}
}; };
return new IContributionItem[] { submenuCont }; return new IContributionItem[] { submenuCont };
} }

View file

@ -65,7 +65,8 @@ public class SubmenuContribution extends
return new IContributionItem[0]; return new IContributionItem[0];
return new IContributionItem[] { new SubmenuContributionItem(subs, return new IContributionItem[] { new SubmenuContributionItem(subs,
item.menuText, item.contributions, new HashSet<String>()) }; item.id, item.menuText, item.contributions,
new HashSet<String>()) };
} }
} }