Issue #2969 Fixed error when Topo parm is unloaded.
Fixed check state of Topography menu item. Change-Id: I3cd13d91b489425e05efd68fd6bbbfd9a9d3cd4b Former-commit-id:4bb7f13198
[formerly346984b8ab
] [formerly11fbd86558
] [formerlyd556055299
[formerly11fbd86558
[formerly 3856ce7fc5c5ac85ca26e71da326457f0bb0b2b5]]] Former-commit-id:d556055299
Former-commit-id: dec5605ca65dcc7794d7aa2a917294e93e71160b [formerlyac7c5460f6
] Former-commit-id:3ac3d5de1b
This commit is contained in:
parent
65caa7fbec
commit
5001c1f2be
3 changed files with 54 additions and 8 deletions
|
@ -27,11 +27,15 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.ui.commands.IElementUpdater;
|
||||
import org.eclipse.ui.menus.UIElement;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
|
||||
import com.raytheon.viz.gfe.core.msgs.EnableDisableTopoMsg;
|
||||
import com.raytheon.viz.gfe.core.msgs.EnableDisableTopoMsg.Action;
|
||||
import com.raytheon.viz.gfe.core.msgs.Message;
|
||||
import com.raytheon.viz.gfe.core.parm.Parm;
|
||||
|
||||
/**
|
||||
* Handle the GFE Topography menu item
|
||||
|
@ -42,6 +46,7 @@ import com.raytheon.viz.gfe.core.msgs.Message;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 2, 2008 #1160 randerso Initial creation
|
||||
* Nov 20, 2013 #2331 randerso Re-implemented using message
|
||||
* Apr 02, 2014 #2969 randerso Fix state of Topography menu item
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -53,6 +58,8 @@ public class TopoHandler extends AbstractHandler implements IElementUpdater {
|
|||
private IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TopoHandler.class);
|
||||
|
||||
public static String commandId = "com.raytheon.viz.gfe.actions.topo";
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -62,11 +69,21 @@ public class TopoHandler extends AbstractHandler implements IElementUpdater {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
Action lastAction = Message.inquireLastMessage(
|
||||
EnableDisableTopoMsg.class).getAction();
|
||||
boolean topoDisplayed = false;
|
||||
DataManager dm = DataManagerUIFactory.getCurrentInstance();
|
||||
if (dm != null) {
|
||||
Parm[] parms = dm.getParmManager().getDisplayedParms();
|
||||
ParmID topoId = dm.getTopoManager().getCompositeParmID();
|
||||
for (Parm p : parms) {
|
||||
if (p.getParmID().equals(topoId)) {
|
||||
topoDisplayed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Action newAction;
|
||||
if (lastAction.equals(Action.ENABLE)) {
|
||||
if (topoDisplayed) {
|
||||
newAction = Action.DISABLE;
|
||||
} else {
|
||||
newAction = Action.ENABLE;
|
||||
|
@ -88,8 +105,25 @@ public class TopoHandler extends AbstractHandler implements IElementUpdater {
|
|||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void updateElement(final UIElement element, Map parameters) {
|
||||
element.setChecked(Message
|
||||
.inquireLastMessage(EnableDisableTopoMsg.class).getAction()
|
||||
.equals(EnableDisableTopoMsg.Action.ENABLE));
|
||||
boolean topoDisplayed = false;
|
||||
DataManager dm = DataManagerUIFactory.getCurrentInstance();
|
||||
if (dm != null) {
|
||||
Parm[] parms = dm.getParmManager().getDisplayedParms();
|
||||
ParmID topoId = dm.getTopoManager().getCompositeParmID();
|
||||
for (Parm p : parms) {
|
||||
if (p.getParmID().equals(topoId)) {
|
||||
topoDisplayed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final boolean checked = topoDisplayed;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
element.setChecked(checked);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.commands.ICommandService;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.GeneralEnvelope;
|
||||
import org.opengis.geometry.Envelope;
|
||||
|
@ -46,6 +48,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
|||
import com.raytheon.viz.core.ColorUtil;
|
||||
import com.raytheon.viz.gfe.Activator;
|
||||
import com.raytheon.viz.gfe.PythonPreferenceStore;
|
||||
import com.raytheon.viz.gfe.actions.TopoHandler;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.IParmManager;
|
||||
import com.raytheon.viz.gfe.core.ISampleSetManager;
|
||||
|
@ -73,6 +76,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
|||
* 12/02/2008 1450 randerso Moved getEditors method into UiUtil for general use
|
||||
* 04/09/2009 1288 rjpeter Add sample set listener,ensure remove called for listeners
|
||||
* 08/20/2009 2310 njensen Separated most logic out into AbstractSpatialDisplayManager
|
||||
* 04/02/2014 2969 randerso Fix state of Topography menu item
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -361,6 +365,11 @@ public class GFESpatialDisplayManager extends AbstractSpatialDisplayManager
|
|||
createResourceFromParm(desc, addParm, false);
|
||||
}
|
||||
}
|
||||
if (PlatformUI.isWorkbenchRunning()) {
|
||||
ICommandService service = (ICommandService) PlatformUI
|
||||
.getWorkbench().getService(ICommandService.class);
|
||||
service.refreshElements(TopoHandler.commandId, null);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -140,6 +140,7 @@ import com.raytheon.viz.gfe.types.MutableInteger;
|
|||
* 11/21/2013 #2331 randerso Merge with AbstractParmManager and deleted MockParmManager
|
||||
* to simplify maintenance of this class.
|
||||
* Changed handling of enabling/disabling Topo parm
|
||||
* 04/02/2014 #2969 randerso Fix error when Toop parm is unloaded.
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -780,7 +781,9 @@ public class ParmManager implements IParmManager, IMessageClient {
|
|||
parmIDs.addAll(Arrays.asList(vcParms));
|
||||
} else if ((cacheParmIDs == null)
|
||||
&& (!dbID.getDbType().equals("V"))) {
|
||||
uncachedDbs.add(dbID);
|
||||
if (this.availableServerDatabases.contains(dbID)) {
|
||||
uncachedDbs.add(dbID);
|
||||
}
|
||||
} else {
|
||||
parmIDs.addAll(cacheParmIDs);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue