use of org.eclipse.xsd.XSDNamedComponent in project tmdm-studio-se by Talend.
the class ElementFKInfosSection method getXSDSchemaChildren.
Object[] getXSDSchemaChildren(XSDSchema schema) {
List<XSDElementDeclaration> declarations = new ArrayList<XSDElementDeclaration>();
EList<XSDElementDeclaration> elementDeclarations = schema.getElementDeclarations();
for (XSDElementDeclaration declaration : elementDeclarations) {
if (declaration.eContainer().equals(schema)) {
declarations.add(declaration);
}
}
Object[] schemaChildren = Util.filterOutDuplicatedElems(declarations.toArray(new XSDNamedComponent[declarations.size()]));
return schemaChildren;
}
use of org.eclipse.xsd.XSDNamedComponent in project tmdm-studio-se by Talend.
the class SchemaTreeContentProvider method getXSDSchemaChildren.
protected Object[] getXSDSchemaChildren(XSDSchema schema) {
List<XSDElementDeclaration> declarations = new ArrayList<XSDElementDeclaration>();
List<Object> attributeDeclarations = new ArrayList<Object>();
if (null != xsdSchema) {
for (XSDSchemaContent cnt : xsdSchema.getContents()) {
if (cnt instanceof XSDInclude) {
XSDInclude incu = (XSDInclude) cnt;
String schemaLocation = incu.getSchemaLocation();
XSDSchema schemaInc = createSchema(schemaLocation);
addElementDeclarationFromSchema(schemaInc, declarations);
} else if (cnt instanceof XSDAttributeDeclaration) {
XSDAttributeDeclaration attriDec = (XSDAttributeDeclaration) cnt;
attributeDeclarations.add(attriDec);
}
}
}
addElementDeclarationFromSchema(schema, declarations);
Object[] schemaChildren = Util.filterOutDuplicatedElems(declarations.toArray(new XSDNamedComponent[declarations.size()]));
attributeDeclarations.addAll(Arrays.asList(schemaChildren));
return attributeDeclarations.toArray();
}
use of org.eclipse.xsd.XSDNamedComponent in project webtools.sourceediting by eclipse.
the class XSDAttributeGroupDefinitionSection method doHandleEvent.
public void doHandleEvent(Event event) {
super.doHandleEvent(event);
if (event.widget == nameText) {
String newValue = nameText.getText().trim();
if (input instanceof XSDNamedComponent) {
XSDNamedComponent namedComponent = (XSDNamedComponent) input;
if (!validateSection())
return;
Command command = null;
// Make sure an actual name change has taken place
String oldName = namedComponent.getName();
if (!newValue.equals(oldName)) {
command = new UpdateNameCommand(Messages._UI_ACTION_RENAME, namedComponent, newValue);
}
if (command != null && getCommandStack() != null) {
getCommandStack().execute(command);
}
// doReferentialIntegrityCheck(namedComponent, newValue);
}
}
}
use of org.eclipse.xsd.XSDNamedComponent in project webtools.sourceediting by eclipse.
the class XSDSimpleTypeSection method doHandleEvent.
// TODO: Common this up with element declaration
public void doHandleEvent(Event event) {
if (event.type == SWT.Traverse) {
if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
isTraversing = true;
return;
}
}
if (event.widget == nameText) {
if (!nameText.getEditable())
return;
String newValue = nameText.getText().trim();
if (input instanceof XSDNamedComponent) {
XSDNamedComponent namedComponent = (XSDNamedComponent) input;
if (!validateSection())
return;
Command command = null;
// Make sure an actual name change has taken place
String oldName = namedComponent.getName();
if (!newValue.equals(oldName)) {
command = new UpdateNameCommand(Messages._UI_ACTION_RENAME, namedComponent, newValue);
}
if (command != null && getCommandStack() != null) {
getCommandStack().execute(command);
}
}
}
}
use of org.eclipse.xsd.XSDNamedComponent in project webtools.sourceediting by eclipse.
the class XSDModelGroupDefinitionSection method doHandleEvent.
public void doHandleEvent(Event event) {
super.doHandleEvent(event);
if (event.widget == nameText) {
String newValue = nameText.getText().trim();
if (input instanceof XSDNamedComponent) {
XSDNamedComponent namedComponent = (XSDNamedComponent) input;
if (!validateSection())
return;
Command command = null;
// Make sure an actual name change has taken place
String oldName = namedComponent.getName();
if (!newValue.equals(oldName)) {
command = new UpdateNameCommand(Messages._UI_ACTION_RENAME, namedComponent, newValue);
}
if (command != null && getCommandStack() != null) {
getCommandStack().execute(command);
}
// doReferentialIntegrityCheck(namedComponent, newValue);
}
}
}
Aggregations