Merge "Issue #2074 fix null capabilities when loading procedures having to do with non-existent plugins" into development

Former-commit-id: 14306cdf24 [formerly 03a377c552 [formerly b2f4a27464ffb3f8f5bb9cdc16a7ff32028aa936]]
Former-commit-id: 03a377c552
Former-commit-id: 905e5bd035
This commit is contained in:
Nate Jensen 2013-06-07 10:30:14 -05:00 committed by Gerrit Code Review
commit be0564dab6
3 changed files with 34 additions and 17 deletions

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 2, 2009 chammack Initial creation * Feb 2, 2009 chammack Initial creation
* Jun 7, 2013 2074 mnash Fix for null capabilities trying to be added
* *
* </pre> * </pre>
* *
@ -191,7 +192,9 @@ public class Capabilities implements Iterable<AbstractCapability> {
collection).iterator(); collection).iterator();
while (collectionIterator.hasNext()) { while (collectionIterator.hasNext()) {
AbstractCapability cap = collectionIterator.next(); AbstractCapability cap = collectionIterator.next();
this.backingMap.put(cap.getClass(), cap); if (cap != null) {
this.backingMap.put(cap.getClass(), cap);
}
} }
} }

View file

@ -47,7 +47,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Sep 13, 2007 chammack Initial Creation. * Sep 13, 2007 chammack Initial Creation.
* Oct 16, 2012 1229 rferrel Change to use ProcedureDlg.displayDialog. * Oct 16, 2012 1229 rferrel Change to use ProcedureDlg.displayDialog.
* Oct 16, 2012 1229 rferrel Changes for non-blocking ProcedureListDlg. * Oct 16, 2012 1229 rferrel Changes for non-blocking ProcedureListDlg.
* * Jun 7, 2013 2074 mnash Don't open the dialog if no procedures are deserialized
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -77,10 +77,12 @@ public class OpenAWIPSProcedure extends AbstractHandler {
File f = selectedFile.getFile(); File f = selectedFile.getFile();
Procedure p = (Procedure) LoadSerializedXml Procedure p = (Procedure) LoadSerializedXml
.deserialize(f); .deserialize(f);
ProcedureDlg.displayDialog(LocalizationUtil if (p != null) {
.extractName(selectedFile.getName()), p, ProcedureDlg.displayDialog(LocalizationUtil
VizWorkbenchManager.getInstance() .extractName(selectedFile.getName()), p,
.getCurrentWindow().getShell()); VizWorkbenchManager.getInstance()
.getCurrentWindow().getShell());
}
} }
dialog = null; dialog = null;
} }

View file

@ -75,6 +75,7 @@ import com.raytheon.uf.viz.core.procedures.Procedure;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData; import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureComm.BundlePair; import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureComm.BundlePair;
import com.raytheon.viz.ui.HistoryList; import com.raytheon.viz.ui.HistoryList;
import com.raytheon.viz.ui.UiUtil; import com.raytheon.viz.ui.UiUtil;
@ -100,7 +101,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* Jan 15, 2013 DR 15699 D. Friedman Prompt for save when close button clicked. * Jan 15, 2013 DR 15699 D. Friedman Prompt for save when close button clicked.
* Jan 16, 2013 DR 15367 D. Friedman Enable save button for Up/Down changes. * Jan 16, 2013 DR 15367 D. Friedman Enable save button for Up/Down changes.
* Feb 25, 2013 1640 bsteffen Dispose old display in BundleLoader * Feb 25, 2013 1640 bsteffen Dispose old display in BundleLoader
* * Jun 7, 2013 2074 mnash Remove resource if doesn't instantiate correctly
* </pre> * </pre>
* *
* @author unknown * @author unknown
@ -193,15 +194,26 @@ public class ProcedureDlg extends CaveSWTDialog {
if (p != null && p.getBundles() != null) { if (p != null && p.getBundles() != null) {
Bundle[] bund = p.getBundles(); Bundle[] bund = p.getBundles();
for (Bundle b : bund) { for (Bundle b : bund) {
// remove any bad resource pairs from each display
for (AbstractRenderableDisplay display : b.getDisplays()) {
ResourceList rList = display.getDescriptor()
.getResourceList();
// modify the resource list so that we remove any null
// resource datas
for (ResourcePair rp : rList) {
if (rp.getResourceData() == null) {
rList.remove(rp);
}
}
}
// Check to see if frozen // Check to see if frozen
for (AbstractRenderableDisplay display : b.getDisplays()) { for (AbstractRenderableDisplay display : b.getDisplays()) {
for (ResourcePair rp : display.getDescriptor() ResourceList rList = display.getDescriptor()
.getResourceList()) { .getResourceList();
if (rp.getResourceData() != null) { for (ResourcePair rp : rList) {
if (rp.getResourceData().isFrozen()) { if (rp.getResourceData().isFrozen()) {
frozen = true; frozen = true;
break; break;
}
} }
} }
if (frozen) { if (frozen) {
@ -958,8 +970,7 @@ public class ProcedureDlg extends CaveSWTDialog {
} }
} }
private void handleCloseRequest() private void handleCloseRequest() {
{
if (saved) { if (saved) {
close(); close();
} else { } else {
@ -972,7 +983,8 @@ public class ProcedureDlg extends CaveSWTDialog {
* to close it * to close it
*/ */
private void showConfirmSaveDlg() { private void showConfirmSaveDlg() {
CaveSWTDialog dlg = new CaveSWTDialog(shell, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL, CAVE.DO_NOT_BLOCK) { CaveSWTDialog dlg = new CaveSWTDialog(shell, SWT.DIALOG_TRIM
| SWT.PRIMARY_MODAL, CAVE.DO_NOT_BLOCK) {
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {