Search in sources :

Example 1 with IAttributeEditPart

use of org.tmdmaker.ui.editor.gef3.editparts.IAttributeEditPart in project tmdmaker by tmdmaker.

the class AttributeComponentEditPolicy method createEditCommand.

@Override
protected Command createEditCommand() {
    EditAttribute edited = ((AttributeDialog) dialog).getEditedValue();
    if (!edited.isEdited()) {
        return null;
    }
    Attribute editedValueAttribute = new Attribute();
    edited.copyTo(editedValueAttribute);
    IAttribute original = edited.getOriginalAttribute();
    EditPart part = getHost();
    if (!(part instanceof IAttributeEditPart)) {
        return null;
    }
    AbstractEntityModel entity = ((IAttributeEditPart) part).getParentModel();
    return new AttributeEditCommand(original, editedValueAttribute, entity);
}
Also used : EditAttribute(org.tmdmaker.ui.dialogs.model.EditAttribute) IAttributeEditPart(org.tmdmaker.ui.editor.gef3.editparts.IAttributeEditPart) Attribute(org.tmdmaker.core.model.Attribute) EditAttribute(org.tmdmaker.ui.dialogs.model.EditAttribute) IAttribute(org.tmdmaker.core.model.IAttribute) IAttribute(org.tmdmaker.core.model.IAttribute) EditPart(org.eclipse.gef.EditPart) IAttributeEditPart(org.tmdmaker.ui.editor.gef3.editparts.IAttributeEditPart) AttributeDialog(org.tmdmaker.ui.dialogs.AttributeDialog) AttributeEditCommand(org.tmdmaker.ui.editor.gef3.commands.AttributeEditCommand) AbstractEntityModel(org.tmdmaker.core.model.AbstractEntityModel)

Aggregations

EditPart (org.eclipse.gef.EditPart)1 AbstractEntityModel (org.tmdmaker.core.model.AbstractEntityModel)1 Attribute (org.tmdmaker.core.model.Attribute)1 IAttribute (org.tmdmaker.core.model.IAttribute)1 AttributeDialog (org.tmdmaker.ui.dialogs.AttributeDialog)1 EditAttribute (org.tmdmaker.ui.dialogs.model.EditAttribute)1 AttributeEditCommand (org.tmdmaker.ui.editor.gef3.commands.AttributeEditCommand)1 IAttributeEditPart (org.tmdmaker.ui.editor.gef3.editparts.IAttributeEditPart)1