Search in sources :

Example 1 with SubsetDeleteCommand

use of org.tmdmaker.ui.editor.gef3.commands.SubsetDeleteCommand in project tmdmaker by tmdmaker.

the class SubsetEntityComponentEditPolicy method createDeleteCommand.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.gef.editpolicies.ComponentEditPolicy#createDeleteCommand(org.eclipse.gef.requests.GroupRequest)
 */
@Override
protected Command createDeleteCommand(GroupRequest deleteRequest) {
    CompoundCommand ccommand = new CompoundCommand();
    SubsetDeleteCommand command1 = new SubsetDeleteCommand(getModel());
    ccommand.add(command1);
    if (getModel().isNotImplement()) {
        AbstractEntityModel original = ImplementRule.findOriginalImplementModel(getModel());
        ccommand.add(new ImplementDerivationModelsDeleteCommand(getModel(), original));
    }
    return ccommand;
}
Also used : ImplementDerivationModelsDeleteCommand(org.tmdmaker.ui.editor.gef3.commands.ImplementDerivationModelsDeleteCommand) SubsetDeleteCommand(org.tmdmaker.ui.editor.gef3.commands.SubsetDeleteCommand) AbstractEntityModel(org.tmdmaker.core.model.AbstractEntityModel) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

Example 2 with SubsetDeleteCommand

use of org.tmdmaker.ui.editor.gef3.commands.SubsetDeleteCommand in project tmdmaker by tmdmaker.

the class SubsetCreateDialog method addSubsetDeleteCommand.

private void addSubsetDeleteCommand() {
    List<EditSubsetEntity> deletedList = new ArrayList<EditSubsetEntity>();
    for (EditSubsetEntity e : deletedSubsetEntities) {
        if (e.getOriginal() != null) {
            deletedList.add(e);
        }
    }
    AbstractEntityModel original = null;
    for (EditSubsetEntity e : deletedList) {
        SubsetEntity subset = e.getOriginal();
        if (original == null) {
            original = ImplementRule.findOriginalImplementModel(subset);
        }
        if (subset != null) {
            SubsetDeleteCommand command = new SubsetDeleteCommand(subset);
            ccommand.add(command);
            if (subset.isNotImplement()) {
                ccommand.add(new ImplementDerivationModelsDeleteCommand(subset, original));
            }
        }
    }
}
Also used : SubsetEntity(org.tmdmaker.core.model.SubsetEntity) EditSubsetEntity(org.tmdmaker.ui.dialogs.model.EditSubsetEntity) ImplementDerivationModelsDeleteCommand(org.tmdmaker.ui.editor.gef3.commands.ImplementDerivationModelsDeleteCommand) SubsetDeleteCommand(org.tmdmaker.ui.editor.gef3.commands.SubsetDeleteCommand) ArrayList(java.util.ArrayList) EditSubsetEntity(org.tmdmaker.ui.dialogs.model.EditSubsetEntity) AbstractEntityModel(org.tmdmaker.core.model.AbstractEntityModel)

Aggregations

AbstractEntityModel (org.tmdmaker.core.model.AbstractEntityModel)2 ImplementDerivationModelsDeleteCommand (org.tmdmaker.ui.editor.gef3.commands.ImplementDerivationModelsDeleteCommand)2 SubsetDeleteCommand (org.tmdmaker.ui.editor.gef3.commands.SubsetDeleteCommand)2 ArrayList (java.util.ArrayList)1 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)1 SubsetEntity (org.tmdmaker.core.model.SubsetEntity)1 EditSubsetEntity (org.tmdmaker.ui.dialogs.model.EditSubsetEntity)1