use of org.eclipse.xsd.XSDParticle 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.XSDParticle in project tmdm-studio-se by Talend.
the class MatchRuleSelectionFilter method check.
public FilterResult check(Object obj) {
if (obj instanceof XSDParticle) {
XSDParticle particle = (XSDParticle) obj;
int maxOccurs = particle.getMaxOccurs();
if (maxOccurs > 1 || maxOccurs == -1) {
return FilterResult.DISABLE;
}
XSDTerm term = particle.getTerm();
if (term instanceof XSDElementDeclaration) {
XSDElementDeclaration element = ((XSDElementDeclaration) term);
XSDTypeDefinition type = element.getType();
if (type instanceof XSDSimpleTypeDefinition) {
return FilterResult.ENABLE;
}
}
}
return FilterResult.DISABLE;
}
use of org.eclipse.xsd.XSDParticle in project tmdm-studio-se by Talend.
the class DataModelMainPage method setLabelForElement.
private void setLabelForElement(XSDElementDeclaration xSDEle, boolean isAdd) {
if (xSDEle.getTypeDefinition() instanceof XSDComplexTypeDefinition) {
XSDAnnotationsStructure struc = null;
String labelValue = null;
List childrenList = Util.getComplexTypeDefinitionChildren((XSDComplexTypeDefinition) xSDEle.getTypeDefinition());
for (int j = 0; j < childrenList.size(); j++) {
List<XSDParticle> particles = new ArrayList<XSDParticle>();
if (childrenList.get(j) instanceof XSDModelGroup) {
particles = ((XSDModelGroup) childrenList.get(j)).getParticles();
}
for (int k = 0; k < particles.size(); k++) {
XSDParticle xSDCom = particles.get(k);
struc = new XSDAnnotationsStructure(xSDCom);
if (xSDCom.getContent() instanceof XSDElementDeclaration) {
labelValue = ((XSDElementDeclaration) xSDCom.getContent()).getName();
setLabel(struc, labelValue, isAdd);
setLabelForElement((XSDElementDeclaration) xSDCom.getContent(), isAdd);
}
}
}
}
}
use of org.eclipse.xsd.XSDParticle in project tmdm-studio-se by Talend.
the class DataModelMainPage method setAnnotationActions.
private void setAnnotationActions(Object obj, IMenuManager manager) {
if (obj instanceof XSDElementDeclaration) {
manager.add(setAnnotationDescriptionsAction);
manager.add(setAnnotationLookupFieldsAction);
manager.add(setAnnotationPrimaryKeyInfoAction);
}
if (obj instanceof XSDParticle) {
manager.add(setAnnotationDescriptionsAction);
manager.add(setAnnotationLabelAction);
XSDTerm term = ((XSDParticle) obj).getTerm();
if (term instanceof XSDElementDeclaration) {
boolean isComplexType = ((XSDElementDeclaration) term).getTypeDefinition() instanceof XSDComplexTypeDefinition;
if (!isComplexType) {
String fkValue = skipToFKAction.getFKInfo((XSDElementDeclaration) term);
if (fkValue != null) {
manager.add(skipToFKAction);
}
manager.add(setAnnotationForeignKeyAction);
manager.add(setAnnotationFKFilterAction);
manager.add(setAnnotationForeignKeyInfoAction);
}
}
}
if (exAdapter != null) {
exAdapter.setAnnotationActions(obj, manager);
}
// available models
java.util.List<IAvailableModel> availablemodels = AvailableModelUtil.getAvailableModels(isLocalInput());
for (int i = 0; i < availablemodels.size(); i++) {
IAvailableModel model = availablemodels.get(i);
model.fillContextMenu(obj, manager, this, dataModelName);
if (i == 1) {
manager.add(new Separator());
}
}
}
use of org.eclipse.xsd.XSDParticle in project tmdm-studio-se by Talend.
the class DataModelMainPage method setAnnotationActions2.
private void setAnnotationActions2(Object obj, IMenuManager manager) {
if (obj instanceof XSDElementDeclaration) {
manager.add(setAnnotationLabelAction);
manager.add(setAnnotationDescriptionsAction);
manager.add(setAnnotationLookupFieldsAction);
manager.add(setAnnotationPrimaryKeyInfoAction);
}
if (obj instanceof XSDParticle) {
manager.add(setAnnotationDescriptionsAction);
manager.add(setAnnotationLabelAction);
}
if (exAdapter != null) {
exAdapter.setAnnotationActions2(obj, manager);
}
// available models
java.util.List<IAvailableModel> availablemodels = AvailableModelUtil.getAvailableModels(isLocalInput());
for (int i = 0; i < availablemodels.size(); i++) {
IAvailableModel model = availablemodels.get(i);
model.fillContextMenu(obj, manager, this, dataModelName);
if (i == 1) {
manager.add(new Separator());
}
}
}
Aggregations