1.1 --- a/xml.schema.ui.basic/src/org/netbeans/modules/xml/schema/ui/nodes/categorized/customizer/ComplexTypeCustomizer.java Fri Apr 22 14:52:57 2011 -0400
1.2 +++ b/xml.schema.ui.basic/src/org/netbeans/modules/xml/schema/ui/nodes/categorized/customizer/ComplexTypeCustomizer.java Tue Oct 30 16:47:50 2012 +0100
1.3 @@ -67,6 +67,7 @@
1.4 import org.netbeans.modules.xml.schema.model.ComplexExtensionDefinition;
1.5 import org.netbeans.modules.xml.schema.model.ComplexType;
1.6 import org.netbeans.modules.xml.schema.model.ComplexTypeDefinition;
1.7 +import org.netbeans.modules.xml.schema.model.Extension;
1.8 import org.netbeans.modules.xml.schema.model.GlobalComplexType;
1.9 import org.netbeans.modules.xml.schema.model.GlobalGroup;
1.10 import org.netbeans.modules.xml.schema.model.GlobalSimpleType;
1.11 @@ -84,6 +85,7 @@
1.12 import org.netbeans.modules.xml.schema.model.SimpleContentRestriction;
1.13 import org.netbeans.modules.xml.schema.model.SimpleExtension;
1.14 import org.netbeans.modules.xml.schema.ui.basic.editors.SchemaComponentSelectionPanel;
1.15 +import org.netbeans.modules.xml.xam.Reference;
1.16 import org.netbeans.modules.xml.xam.ui.customizer.MessageDisplayer;
1.17 import org.openide.util.HelpCtx;
1.18 import org.openide.util.NbBundle;
1.19 @@ -110,6 +112,11 @@
1.20 this(reference,null);
1.21 }
1.22
1.23 + static GlobalType getBase(Extension ext) {
1.24 + Reference<GlobalType> ref = ext.getBase();
1.25 + return ref == null ? null : ref.get();
1.26 + }
1.27 +
1.28 /**
1.29 * non UI component (model) initialization and access methods
1.30 */
1.31 @@ -137,7 +144,7 @@
1.32 contentType = ContentType.Restriction;
1.33 ComplexContentRestriction ccr =
1.34 (ComplexContentRestriction)cc.getLocalDefinition();
1.35 - gRef = ccr.getBase().get();
1.36 + gRef = getBase(ccr);
1.37 ComplexTypeDefinition innerDefinition = ccr.getDefinition();
1.38 if(innerDefinition instanceof All) {
1.39 innerContentType = ContentType.All;
1.40 @@ -152,7 +159,7 @@
1.41 contentType = ContentType.Extension;
1.42 ComplexExtension ce =
1.43 (ComplexExtension)cc.getLocalDefinition();
1.44 - gRef = ce.getBase().get();
1.45 + gRef = getBase(ce);
1.46 ComplexExtensionDefinition innerDefinition = ce.getLocalDefinition();
1.47 if(innerDefinition instanceof All) {
1.48 innerContentType = ContentType.All;
1.49 @@ -172,11 +179,11 @@
1.50 contentType = ContentType.Restriction;
1.51 SimpleContentRestriction scr =
1.52 (SimpleContentRestriction)sc.getLocalDefinition();
1.53 - if(scr.getBase()!=null)
1.54 - gRef = scr.getBase().get();
1.55 + Reference<GlobalType> ref = scr.getBase();
1.56 + gRef = ref == null ? null : ref.get();
1.57 } else if(sc.getLocalDefinition() instanceof SimpleExtension) {
1.58 contentType = ContentType.Extension;
1.59 - gRef = ((SimpleExtension)sc.getLocalDefinition()).getBase().get();
1.60 + gRef = getBase(((SimpleExtension)sc.getLocalDefinition()));
1.61 }
1.62 }
1.63 }