use of org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType in project webtools.sourceediting by eclipse.
the class ComplexTypeEditPart method refreshVisuals.
protected void refreshVisuals() {
super.refreshVisuals();
Label label = getNameLabelFigure();
IComplexType complexType = (IComplexType) getModel();
if (complexType.isAbstract()) {
if (italicFont == null) {
Font font = label.getFont();
italicFont = getItalicFont(font);
}
if (italicFont != null) {
label.setFont(italicFont);
}
} else {
label.setFont(label.getParent().getFont());
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType in project webtools.sourceediting by eclipse.
the class ComplexTypeEditPart method createConnectionFigure.
public TypeReferenceConnection createConnectionFigure() {
connectionFigure = null;
IComplexType complexType = (IComplexType) getModel();
IType type = complexType.getSuperType();
if (type != null) {
AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getTargetEditPart(type);
if (referenceTypePart != null) {
connectionFigure = new TypeReferenceConnection(true);
// draw a line out from the top
connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.TOP, 1));
// TODO (cs) need to draw the target anchor to look like a UML inheritance relationship
// adding a label to the connection would help to
connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.BOTTOM, 0, 0));
connectionFigure.setConnectionRouter(new ManhattanConnectionRouter());
((CenteredConnectionAnchor) connectionFigure.getSourceAnchor()).setOther((CenteredConnectionAnchor) connectionFigure.getTargetAnchor());
connectionFigure.setHighlight(false);
}
}
return connectionFigure;
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType in project webtools.sourceediting by eclipse.
the class AddFieldAction method run.
public void run() {
if (getSelectedObjects().size() > 0) {
Object o = getSelectedObjects().get(0);
IComplexType type = null;
if (o instanceof IComplexType) {
type = (IComplexType) o;
} else if (o instanceof IField) {
IField field = (IField) o;
type = field.getContainerType();
}
if (type != null) {
// $NON-NLS-1$
Command command = type.getAddNewFieldCommand("");
if (command != null) {
getCommandStack().execute(command);
Adapter adapter = XSDAdapterFactory.getInstance().adapt(((BaseCommand) command).getAddedComponent());
selectAddedComponent(adapter);
} else {
// TODO ... pop up a command not implemented message
}
}
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType in project webtools.sourceediting by eclipse.
the class XSDGroupsForAnnotationEditPart method getModelChildren.
protected List getModelChildren() {
List xsdModelGroupList = new ArrayList();
List adapterList = new ArrayList();
IStructure structure = ((Annotation) getModel()).getOwner();
if (structure instanceof IComplexType) {
complexType = (IComplexType) structure;
if (complexType instanceof XSDComplexTypeDefinitionAdapter) {
XSDComplexTypeDefinitionAdapter adapter = (XSDComplexTypeDefinitionAdapter) complexType;
xsdModelGroupList = adapter.getModelGroups();
}
for (Iterator i = xsdModelGroupList.iterator(); i.hasNext(); ) {
Object obj = i.next();
if (obj instanceof XSDModelGroup) {
adapterList.add(XSDAdapterFactory.getInstance().adapt((XSDModelGroup) obj));
} else if (obj instanceof XSDModelGroupDefinition) {
adapterList.add(XSDAdapterFactory.getInstance().adapt((XSDModelGroupDefinition) obj));
}
}
} else if (structure instanceof XSDModelGroupDefinitionAdapter) {
XSDModelGroupDefinitionAdapter adapter = (XSDModelGroupDefinitionAdapter) structure;
XSDModelGroup group = adapter.getXSDModelGroupDefinition().getModelGroup();
if (group != null) {
adapterList.add(XSDAdapterFactory.getInstance().adapt(group));
}
}
return adapterList;
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType in project webtools.sourceediting by eclipse.
the class XSDBaseAdapter method getContainerType.
/**
* Implements IField getContainerType. Get parent Complex Type containing the field
* @return IComplexType
*/
public IComplexType getContainerType() {
XSDConcreteComponent xsdConcreteComponent = (XSDConcreteComponent) target;
XSDConcreteComponent parent = null;
XSDComplexTypeDefinition ct = null;
for (parent = xsdConcreteComponent.getContainer(); parent != null; ) {
if (parent instanceof XSDComplexTypeDefinition) {
ct = (XSDComplexTypeDefinition) parent;
break;
}
parent = parent.getContainer();
}
if (ct != null) {
return (IComplexType) XSDAdapterFactory.getInstance().adapt(ct);
}
return null;
}
Aggregations