use of com.twinsoft.convertigo.eclipse.views.schema.SchemaViewContentProvider.NamedList in project convertigo by convertigo.
the class SchemaViewLabelProvider method getText.
public String getText(Object element) {
String txt = null;
if (element instanceof XmlSchema) {
XmlSchema schema = (XmlSchema) element;
String prefix = SchemaMeta.getPrefix(schema);
txt = prefix + "{" + schema.getTargetNamespace() + "}";
} else if (element instanceof XmlSchemaImport) {
txt = "import " + getText(((XmlSchemaImport) element).getSchema());
} else if (element instanceof XmlSchemaInclude) {
// txt = "include " + "(" +((XmlSchemaInclude) element).getSchemaLocation() +")";
txt = "include " + getText(((XmlSchemaInclude) element).getSchema());
} else if (element instanceof XmlSchemaDocumentation || element instanceof XmlSchemaAppInfo) {
NodeList nl = element instanceof XmlSchemaDocumentation ? ((XmlSchemaDocumentation) element).getMarkup() : ((XmlSchemaAppInfo) element).getMarkup();
if (nl != null && nl.getLength() > 0) {
txt = nl.item(0).getTextContent();
} else {
txt = "...";
}
} else if (element instanceof XmlSchemaObject) {
if (element instanceof XmlSchemaElement) {
if (((XmlSchemaElement) element).getRefName() == null) {
txt = ((XmlSchemaElement) element).getName();
}
} else if (element instanceof XmlSchemaAttribute) {
txt = ((XmlSchemaAttribute) element).getName();
} else if (element instanceof XmlSchemaAttributeGroup) {
txt = ((XmlSchemaAttributeGroup) element).getName().getLocalPart();
} else if (element instanceof XmlSchemaGroup) {
txt = ((XmlSchemaGroup) element).getName().getLocalPart();
} else if (element instanceof XmlSchemaType) {
XmlSchemaType type = (XmlSchemaType) element;
String name = type.getName();
if (name != null) {
txt = name;
}
}
if (txt == null) {
txt = element.getClass().getSimpleName().substring(9);
txt = "xsd:" + Character.toLowerCase(txt.charAt(0)) + txt.substring(1);
}
} else if (element instanceof NamedList) {
txt = ((NamedList) element).getName();
} else {
txt = "<?>";
}
return txt;
}
Aggregations