use of org.eclipse.xsd.XSDAnnotation in project tmdm-studio-se by Talend.
the class ElementFKInfosSection method getEntities.
@Override
public Set<String> getEntities() {
if (curXSDComponent instanceof XSDParticle) {
XSDParticle ele = ((XSDParticle) curXSDComponent);
XSDTerm term = ele.getTerm();
if (term instanceof XSDElementDeclaration) {
XSDAnnotation anno = ((XSDElementDeclaration) term).getAnnotation();
if (null != anno) {
Set<String> list = new HashSet<String>();
Util.getForeignKeyofParcle(list, anno);
return list;
}
}
}
return null;
}
use of org.eclipse.xsd.XSDAnnotation in project tmdm-studio-se by Talend.
the class DataModelMainPage method getStructureByActiveItem.
public XSDAnnotationsStructure getStructureByActiveItem() {
XSDComponent xSDCom = null;
XSDAnnotationsStructure struc = null;
IStructuredSelection selection = (TreeSelection) getTreeViewer().getSelection();
if (selection.getFirstElement() instanceof Element) {
TreePath tPath = ((TreeSelection) selection).getPaths()[0];
for (int i = 0; i < tPath.getSegmentCount(); i++) {
if (tPath.getSegment(i) instanceof XSDAnnotation) {
xSDCom = (XSDAnnotation) (tPath.getSegment(i));
}
}
} else {
xSDCom = (XSDComponent) selection.getFirstElement();
}
if (xSDCom != null) {
struc = new XSDAnnotationsStructure(xSDCom);
}
return struc;
}
use of org.eclipse.xsd.XSDAnnotation in project tmdm-studio-se by Talend.
the class DataModelMainPage method hasVisibleRule.
public boolean hasVisibleRule(XSDElementDeclaration xsdEl) {
XSDAnnotation annotation = xsdEl.getAnnotation();
List<Element> informations = annotation.getApplicationInformation();
for (Element el : informations) {
String name = el.getLocalName();
if ("appinfo".equals(name.toLowerCase())) {
// $NON-NLS-1$
// $NON-NLS-1$
name = el.getAttribute("source");
if (name.matches("X_Visible_Rule")) {
// $NON-NLS-1$
return true;
}
}
}
return false;
}
use of org.eclipse.xsd.XSDAnnotation in project tmdm-studio-se by Talend.
the class TreeExpandHelper method getName.
private String getName(Object objA) {
if (objA instanceof XSDElementDeclaration) {
XSDElementDeclaration decl = (XSDElementDeclaration) objA;
return decl.getName();
}
if (objA instanceof XSDModelGroup) {
XSDModelGroup goup = (XSDModelGroup) objA;
XSDParticle particle = (XSDParticle) goup.getContainer();
XSDComplexTypeDefinition complexTypeDefinition = (XSDComplexTypeDefinition) particle.getContainer();
String name = complexTypeDefinition.getName();
return name;
}
if (objA instanceof XSDModelGroupDefinition) {
XSDModelGroupDefinition goupDef = (XSDModelGroupDefinition) objA;
return goupDef.getName();
}
if (objA instanceof XSDParticle) {
XSDParticle particle = (XSDParticle) objA;
if (particle.getTerm() instanceof XSDElementDeclaration) {
XSDElementDeclaration decl = (XSDElementDeclaration) particle.getTerm();
return decl.getName();
}
}
if (objA instanceof XSDAnnotation) {
return null;
}
if (objA instanceof XSDIdentityConstraintDefinition) {
XSDIdentityConstraintDefinition constraint = (XSDIdentityConstraintDefinition) objA;
return constraint.getName();
}
if (objA instanceof XSDSimpleTypeDefinition) {
XSDSimpleTypeDefinition simpleDefine = (XSDSimpleTypeDefinition) objA;
return simpleDefine.getName();
}
if (objA instanceof XSDComplexTypeDefinition) {
XSDComplexTypeDefinition complexDefine = (XSDComplexTypeDefinition) objA;
return complexDefine.getName();
}
return null;
}
use of org.eclipse.xsd.XSDAnnotation in project tmdm-studio-se by Talend.
the class XSDEditor method resetTreeSelection.
private void resetTreeSelection(int newPageIndex) {
DataModelMainPage dataModelEditorPage = getDataModelEditorPage();
if (dataModelEditorPage != null) {
TreeViewer treeViewer = dataModelEditorPage.getTreeViewer();
if (newPageIndex == MODEL_PAGE_INDEX) {
treeViewer.setSelection(null);
} else if (newPageIndex == SOURCE_PAGE_INDEX) {
IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
if (!selection.isEmpty()) {
Object firstElement = selection.getFirstElement();
if ((firstElement instanceof XSDIdentityConstraintDefinition)) {
XSDIdentityConstraintDefinition cdf = (XSDIdentityConstraintDefinition) firstElement;
XSDConcreteComponent container = cdf.getContainer();
treeViewer.setSelection(new StructuredSelection(container));
} else if ((firstElement instanceof XSDXPathDefinition)) {
XSDXPathDefinition pathdef = (XSDXPathDefinition) firstElement;
XSDConcreteComponent container = pathdef.getContainer().getContainer();
treeViewer.setSelection(new StructuredSelection(container));
} else if (firstElement instanceof XSDAnnotation) {
XSDAnnotation annotation = (XSDAnnotation) firstElement;
XSDConcreteComponent container = annotation.getContainer();
treeViewer.setSelection(new StructuredSelection(container));
}
}
}
}
}
Aggregations