[157419] [Editor] Add Extension Components Dialog chokes when a category has invalid file location
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java index 2228b43..05075e0 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java
@@ -231,6 +231,11 @@ SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema) categories[i].getData(); XSDSchema schema = getASISchemaModel(spec); + + if (schema == null) + { + continue; + } List components = buildInput(schema); specToComponentsList.put(spec, components); @@ -444,9 +449,16 @@ if (xsdSchema == null){ MessageBox errDialog = new MessageBox(getShell(), SWT.ICON_ERROR); errDialog.setText(Messages._UI_ERROR_INVALID_CATEGORY); - errDialog.setMessage(Messages._UI_ERROR_FILE_CANNOT_BE_PARSED - + "\n" + Messages._UI_ERROR_VALIDATE_THE_FILE); //$NON-NLS-1$ + // TODO (trung) I was forced to use a String in Messages to make the error clearer + // When we are back to development phase, use another string: "Extension Category: " + // not "Extension Categories:" + " " like we are using here + errDialog.setMessage(Messages._UI_LABEL_EXTENSION_CATEGORIES + " " + spec.getDisplayName() //$NON-NLS-1$ + + "\n" //$NON-NLS-1$ + + Messages._UI_ERROR_FILE_CANNOT_BE_PARSED + + "\n" + Messages._UI_ERROR_VALIDATE_THE_FILE); //$NON-NLS-1$ errDialog.open(); + + elementTableViewer.setInput(new ArrayList(0)); return; } @@ -534,7 +546,7 @@ String currentValue = prefStore.getString(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS); String specDesc = " " + "\t" + schemaSpec.getDisplayName() + "\t"+ - "\t" + schemaSpec.getNamespaceURI() + "\t" + schemaSpec.getLocation() + "\t" + + schemaSpec.getNamespaceURI() + "\t" + schemaSpec.getLocation() + "\t" + schemaSpec.isDefautSchema() + "\t" + schemaSpec.getSourceHint() + "\t" + schemaSpec.isFromCatalog(); currentValue += specDesc + "\n"; @@ -562,7 +574,7 @@ if ( dName.equals(displayName ) ) { oneSpecDesc = " " + "\t" + newSpec.getDisplayName() + "\t"+ - "\t" + newSpec.getNamespaceURI() + "\t" + newSpec.getLocation() + "\t" + + newSpec.getNamespaceURI() + "\t" + newSpec.getLocation() + "\t" + newSpec.isDefautSchema() + "\t" + newSpec.getSourceHint() + "\t" + newSpec.isFromCatalog(); }