/** * @param mapping * @param forceDeleteOrgColor */ public DeleteMappingCommand(Mapping mapping, boolean forceDeleteOrgColor) { this.mapping = mapping; NodeLayout originLayout = HenshinLayoutUtil.INSTANCE.getLayout(mapping.getOrigin()); NodeLayout imageLayout = HenshinLayoutUtil.INSTANCE.getLayout(mapping.getImage()); List<Mapping> originMappings = ModelUtil.getReferences( mapping.getOrigin(), Mapping.class, HenshinUtil.INSTANCE.getTransformationSystem(mapping), HenshinPackage.Literals.MAPPING__ORIGIN); originMappings.remove(mapping); if (originMappings.isEmpty() || forceDeleteOrgColor) { add( new SimpleSetEFeatureCommand<NodeLayout, Integer>( originLayout, 0, HenshinLayoutPackage.Literals.NODE_LAYOUT__COLOR)); } add( new SimpleSetEFeatureCommand<NodeLayout, Integer>( imageLayout, 0, HenshinLayoutPackage.Literals.NODE_LAYOUT__COLOR)); add(new SimpleDeleteEObjectCommand(mapping)); }
/* * (non-Javadoc) * * @see muvitorkit.gef.directedit.IDirectEditPart#getDirectEditValidator() */ @Override public ICellEditorValidator getDirectEditValidator() { return new NameEditValidator( HenshinUtil.INSTANCE.getTransformationSystem(getCastedModel()), HenshinPackage.MODULE__UNITS, getCastedModel(), true); }