Search in sources :

Example 1 with ImplementInfoEditDialog

use of org.tmdmaker.ui.dialogs.ImplementInfoEditDialog in project tmdmaker by tmdmaker.

the class ImplementInfoEditAction method run.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.jface.action.Action#run()
 */
@Override
public void run() {
    ImplementInfoEditDialog dialog = new ImplementInfoEditDialog(getPart().getViewer().getControl().getShell(), getModel());
    if (dialog.open() == Dialog.OK) {
        CompoundCommand ccommand = new CompoundCommand();
        ccommand.add(new ModelEditCommand(getModel(), dialog.getEditedValueEntity()));
        for (EditImplementAttribute ea : dialog.getEditedValueAttributes()) {
            IAttribute original = ea.getOriginalAttribute();
            IAttribute newAttribute = original.getCopy();
            ea.copyTo(newAttribute);
            ccommand.add(new AttributeEditCommand(original, newAttribute, ea.getContainerModel()));
        }
        SurrogateKey newSurrogateKey = new SurrogateKey();
        EditSurrogateKey edited = dialog.getEditedSurrogateKey();
        edited.copyTo(newSurrogateKey);
        ImplementRule.setSurrogateKeyDefaultValue(newSurrogateKey);
        SurrogateKey original = (SurrogateKey) edited.getOriginalAttribute();
        ccommand.add(new AttributeEditCommand(original, newSurrogateKey, edited.getContainerModel()));
        execute(ccommand);
    }
}
Also used : EditSurrogateKey(org.tmdmaker.ui.dialogs.model.EditSurrogateKey) EditImplementAttribute(org.tmdmaker.ui.dialogs.model.EditImplementAttribute) ImplementInfoEditDialog(org.tmdmaker.ui.dialogs.ImplementInfoEditDialog) IAttribute(org.tmdmaker.core.model.IAttribute) AttributeEditCommand(org.tmdmaker.ui.editor.gef3.commands.AttributeEditCommand) ModelEditCommand(org.tmdmaker.ui.editor.gef3.commands.ModelEditCommand) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) EditSurrogateKey(org.tmdmaker.ui.dialogs.model.EditSurrogateKey) SurrogateKey(org.tmdmaker.core.model.SurrogateKey)

Aggregations

CompoundCommand (org.eclipse.gef.commands.CompoundCommand)1 IAttribute (org.tmdmaker.core.model.IAttribute)1 SurrogateKey (org.tmdmaker.core.model.SurrogateKey)1 ImplementInfoEditDialog (org.tmdmaker.ui.dialogs.ImplementInfoEditDialog)1 EditImplementAttribute (org.tmdmaker.ui.dialogs.model.EditImplementAttribute)1 EditSurrogateKey (org.tmdmaker.ui.dialogs.model.EditSurrogateKey)1 AttributeEditCommand (org.tmdmaker.ui.editor.gef3.commands.AttributeEditCommand)1 ModelEditCommand (org.tmdmaker.ui.editor.gef3.commands.ModelEditCommand)1