Search in sources :

Example 1 with IType

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IType in project webtools.sourceediting by eclipse.

the class XSDSimpleTypeEditPart method createConnectionFigure.

public TypeReferenceConnection createConnectionFigure() {
    TypeReferenceConnection connectionFigure = null;
    XSDSimpleTypeDefinitionAdapter adapter = (XSDSimpleTypeDefinitionAdapter) getModel();
    IType superType = adapter.getSuperType();
    if (superType != null) {
        AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getTargetEditPart(superType);
        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;
}
Also used : XSDSimpleTypeDefinitionAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter) CenteredConnectionAnchor(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor) AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) ManhattanConnectionRouter(org.eclipse.draw2d.ManhattanConnectionRouter) TypeReferenceConnection(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.TypeReferenceConnection) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Example 2 with IType

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IType in project webtools.sourceediting by eclipse.

the class TopLevelFieldEditPart method createConnectionFigure.

public TypeReferenceConnection createConnectionFigure() {
    TypeReferenceConnection connectionFigure = null;
    IField field = (IField) getModel();
    IType type = field.getType();
    if (type != null) {
        AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(type);
        if (referenceTypePart != null) {
            connectionFigure = new TypeReferenceConnection();
            connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.RIGHT, 0));
            int targetAnchorYOffset = 12;
            connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.HEADER_LEFT, 0, targetAnchorYOffset));
            connectionFigure.setHighlight(false);
        }
    }
    return connectionFigure;
}
Also used : AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) Point(org.eclipse.draw2d.geometry.Point) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Example 3 with IType

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IType in project webtools.sourceediting by eclipse.

the class TopLevelFieldEditPart method shouldDrawConnection.

protected boolean shouldDrawConnection() {
    IField field = (IField) getModel();
    IType type = field.getType();
    return (type != null);
}
Also used : IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Example 4 with IType

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IType in project webtools.sourceediting by eclipse.

the class ReferencedTypeColumn method getChildren.

public List getChildren() {
    List result = new ArrayList();
    if (model instanceof IStructure) {
        IStructure structure = (IStructure) model;
        for (Iterator i = structure.getFields().iterator(); i.hasNext(); ) {
            IField field = (IField) i.next();
            IType type = field.getType();
            if (// && type.isComplexType())
            type != null) {
                if (!result.contains(type)) {
                    if (type instanceof IGraphElement) {
                        if (((IGraphElement) type).isFocusAllowed())
                            result.add(type);
                    }
                }
            }
        }
    } else if (model instanceof IField) {
        IField field = (IField) model;
        IType type = field.getType();
        if (// && type.isComplexType())
        type != null) {
            if (type instanceof IGraphElement) {
                if (((IGraphElement) type).isFocusAllowed())
                    result.add(type);
            }
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) IStructure(org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Example 5 with IType

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IType in project webtools.sourceediting by eclipse.

the class BaseFieldEditPart method getTargetConnectionEditPart.

private EditPart getTargetConnectionEditPart() {
    EditPart result = null;
    IField field = (IField) getModel();
    IType type = field.getType();
    if (type != null) {
        // getTargetEditPart(type);
        result = getTargetEP(type);
    }
    return result;
}
Also used : AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) TargetConnectionSpacingFigureEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart) ConnectableEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.ConnectableEditPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EditPart(org.eclipse.gef.EditPart) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Aggregations

IType (org.eclipse.wst.xsd.ui.internal.adt.facade.IType)8 IField (org.eclipse.wst.xsd.ui.internal.adt.facade.IField)6 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)4 ArrayList (java.util.ArrayList)3 IStructure (org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure)3 List (java.util.List)2 ManhattanConnectionRouter (org.eclipse.draw2d.ManhattanConnectionRouter)2 Iterator (java.util.Iterator)1 Point (org.eclipse.draw2d.geometry.Point)1 EditPart (org.eclipse.gef.EditPart)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 XSDSimpleTypeDefinitionAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter)1 CenteredConnectionAnchor (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor)1 TypeReferenceConnection (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.TypeReferenceConnection)1 IGraphElement (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement)1 RootHolder (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder)1 IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)1 IComplexType (org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType)1 IModel (org.eclipse.wst.xsd.ui.internal.adt.facade.IModel)1 ConnectableEditPart (org.eclipse.wst.xsd.ui.internal.design.editparts.ConnectableEditPart)1