Search in sources :

Example 6 with IField

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IField 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)

Example 7 with IField

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

the class BaseFieldEditPart method refreshVisuals.

protected void refreshVisuals() {
    super.refreshVisuals();
    IFieldFigure figure = getFieldFigure();
    IField field = (IField) getModel();
    figure.getNameLabel().setText(field.getName());
    figure.getTypeLabel().setText(field.getTypeName());
    figure.refreshVisuals(getModel());
    figure.recomputeLayout();
    ((GraphicalEditPart) getRoot()).getFigure().invalidateTree();
}
Also used : IFieldFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField)

Example 8 with IField

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IField 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
            }
        }
    }
}
Also used : BaseCommand(org.eclipse.wst.xsd.ui.internal.common.commands.BaseCommand) Command(org.eclipse.gef.commands.Command) Adapter(org.eclipse.emf.common.notify.Adapter) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) IComplexType(org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType)

Example 9 with IField

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

the class FocusTypeColumn method getChildren.

public List getChildren() {
    List result = new ArrayList();
    if (model instanceof IType) {
        IType type = (IType) model;
        if (type.getSuperType() != null) {
            result.add(type.getSuperType());
        }
        result.add(type);
    } else if (model instanceof IField || model instanceof IStructure) {
        result.add(model);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) 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 10 with IField

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

the class XSDBaseFieldEditPart method directEditNameField.

protected void directEditNameField() {
    Object model = getModel();
    IFieldFigure fieldFigure = getFieldFigure();
    if (model instanceof IField) {
        IField field = (IField) model;
        if (field.isReference()) {
            ReferenceDirectEditManager manager = null;
            if (field instanceof XSDElementDeclarationAdapter) {
                manager = new ElementReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
            } else if (field instanceof XSDAttributeDeclarationAdapter) {
                manager = new AttributeReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
            }
            if (manager != null) {
                ReferenceUpdateCommand elementUpdateCommand = new ReferenceUpdateCommand();
                elementUpdateCommand.setDelegate(manager);
                adtDirectEditPolicy.setUpdateCommand(elementUpdateCommand);
                manager.show();
            }
        } else {
            LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, null));
            NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
            adtDirectEditPolicy.setUpdateCommand(wrapper);
            manager.show();
        }
    }
}
Also used : ElementReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager) LabelEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager) XSDAttributeDeclarationAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeDeclarationAdapter) LabelCellEditorLocator(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator) IFieldFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) AttributeReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.AttributeReferenceDirectEditManager) XSDElementDeclarationAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter) AttributeReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.AttributeReferenceDirectEditManager) ReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ReferenceDirectEditManager) ElementReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager)

Aggregations

IField (org.eclipse.wst.xsd.ui.internal.adt.facade.IField)16 IType (org.eclipse.wst.xsd.ui.internal.adt.facade.IType)6 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)4 IFieldFigure (org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure)4 IStructure (org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure)4 ArrayList (java.util.ArrayList)3 IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)3 List (java.util.List)2 IFigure (org.eclipse.draw2d.IFigure)2 EditPart (org.eclipse.gef.EditPart)2 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)2 ElementReferenceDirectEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager)2 LabelCellEditorLocator (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator)2 LabelEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager)2 Annotation (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation)2 IGraphElement (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement)2 IModel (org.eclipse.wst.xsd.ui.internal.adt.facade.IModel)2 Iterator (java.util.Iterator)1 Label (org.eclipse.draw2d.Label)1 Point (org.eclipse.draw2d.geometry.Point)1