/** * Run using * * @aHelper. This will set a MOF attibute value to the owner of the helper. */ protected void primRun(ModifierHelper aHelper) { if (aHelper.isComplete()) { Object value = getValue(aHelper); if (valueChanged(aHelper.getOwner(), aHelper.getFeature(), value, aHelper.shouldUnsetValue())) setObjectAttribute(aHelper.getOwner(), aHelper.getFeature(), value, aHelper.shouldUnsetValue()); } }
/** * Return an AddCommand that will be executed by a CommandStack. */ protected Command createAddCommand(ModifierHelper aHelper) { Object value = getValue(aHelper); Command command = null; if (valueChanged(aHelper.getOwner(), aHelper.getFeature(), value, false)) { command = AddCommand.create(getEditingDomain(), aHelper.getOwner(), aHelper.getFeature(), value); ((AbstractCommand) command).setLabel(createCommandLabel(ADD_PATTERN, aHelper.getFeature())); setStatus(VALUE_CHANGE); } else { setStatus(NO_VALUE_CHANGE); } return command; }
/** * Return a SetCommand that will be executed by a CommandStack. */ protected Command createSingleCommand(ModifierHelper aHelper) { Object value = getValue(aHelper); Command command = null; if (valueChanged(aHelper.getOwner(), aHelper.getFeature(), value, aHelper.shouldUnsetValue())) { command = SetCommand.create(getEditingDomain(), aHelper.getOwner(), aHelper.getFeature(), value); ((AbstractCommand) command).setLabel(createCommandLabel(SET_PATTERN, aHelper.getFeature())); setStatus(VALUE_CHANGE); } else { setStatus(NO_VALUE_CHANGE); } return command; }
/** * Return a Remove Command that will be executed by a CommandStack. */ protected Command createRemoveCommand(ModifierHelper aHelper) { Object value = getValue(aHelper); Command command = null; EStructuralFeature feature = aHelper.getFeature(); if (valueChanged(aHelper.getOwner(), feature, value, true)) { if (isValueEqual(aHelper, value)) { command = RemoveCommand.create(getEditingDomain(), aHelper.getOwner(), feature, (Collection) value); } else { command = RemoveCommand.create(getEditingDomain(), aHelper.getOwner(), feature, value); } ((AbstractCommand) command).setLabel(createCommandLabel(REMOVE_PATTERN, feature)); setStatus(VALUE_CHANGE); } else { setStatus(NO_VALUE_CHANGE); } return command; }