use of org.eclipse.xsd.XSDComplexTypeDefinition in project tmdm-studio-se by Talend.
the class ComplexTypeConfigComposite method refresh.
private void refresh() {
XSDTypeDefinition selectedExtends = getExtends();
radGroupAll.setEnabled(!isExtendsSelected());
radGroupSequence.setEnabled(!isExtendsSelected());
radGroupChoice.setEnabled(!isExtendsSelected());
if (!getDefaultExtends().equals(selectedExtends) && selectedExtends instanceof XSDComplexTypeDefinition && !Util.isAllComplexType((XSDComplexTypeDefinition) selectedExtends)) {
radGroupAll.setSelection(false);
radGroupSequence.setSelection(Util.isSequenceComplexType((XSDComplexTypeDefinition) selectedExtends));
radGroupChoice.setSelection(Util.isChoiceComplexType((XSDComplexTypeDefinition) selectedExtends));
}
comboExtends.getCombo().setEnabled(!isGroupAll());
}
use of org.eclipse.xsd.XSDComplexTypeDefinition in project tmdm-studio-se by Talend.
the class SimpleTypeInputDialog method modifyText.
public void modifyText(ModifyEvent e) {
getButton(IDialogConstants.OK_ID).setEnabled(true);
// $NON-NLS-1$
infoLabel.setText("");
String type = elemPanel.getText();
if (// $NON-NLS-1$
Pattern.compile("^\\s+\\w+\\s*").matcher(type).matches() || type.trim().replaceAll("\\s", "").length() != type.trim().length()) {
// $NON-NLS-1$//$NON-NLS-2$
infoLabel.setText(Messages.SimpleTypeInputDialog_infoLabelText);
getButton(IDialogConstants.OK_ID).setEnabled(false);
return;
}
type = type.trim();
if (!XSDUtil.isValidatedXSDName(type)) {
infoLabel.setText(Messages.InvalidName_Message);
getButton(IDialogConstants.OK_ID).setEnabled(false);
return;
}
for (XSDTypeDefinition simpType : xsdSchema.getTypeDefinitions()) {
String typeToCompare = simpType.getName();
// $NON-NLS-1$
int delimiter = type.indexOf(" : ");
if (delimiter != -1) {
type = type.substring(0, delimiter);
}
if (typeToCompare.equals(type)) {
if (caller instanceof XSDNewSimpleTypeDefinition) {
infoLabel.setText(Messages.SimpleTypeInputDialog_SameName);
getButton(IDialogConstants.OK_ID).setEnabled(false);
} else if ((caller instanceof XSDChangeToSimpleTypeAction || caller instanceof XSDChangeBaseTypeAction) && simpType instanceof XSDComplexTypeDefinition) {
infoLabel.setText(Messages.SimpleTypeInputDialog_SameName);
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
return;
}
}
}
use of org.eclipse.xsd.XSDComplexTypeDefinition 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.XSDComplexTypeDefinition in project tmdm-studio-se by Talend.
the class DataModelMainPage method validateType.
private void validateType() throws IllegalAccessException {
HashMap<String, Boolean> typeCntMap = new HashMap<String, Boolean>();
EList<XSDTypeDefinition> types = xsdSchema.getTypeDefinitions();
// $NON-NLS-1$
String tail = "";
for (XSDTypeDefinition type : types) {
if (type instanceof XSDComplexTypeDefinition) {
tail = Messages.ComplexText;
} else {
tail = Messages.SimpleText;
}
if (typeCntMap.get(type.getName() + tail + type.getTargetNamespace()) == Boolean.TRUE) {
}
typeCntMap.put(type.getName() + tail + type.getTargetNamespace(), Boolean.TRUE);
}
}
use of org.eclipse.xsd.XSDComplexTypeDefinition 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());
}
}
}
Aggregations