/******************************************************************************* * Copyright (c) 2010-2015 Henshin developers. All rights reserved. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * TU Berlin, University of Luxembourg, SES S.A. *******************************************************************************/ /** * */ package de.tub.tfs.henshin.editor.editparts.transformation_unit.graphical; import org.eclipse.draw2d.IFigure; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.henshin.model.HenshinPackage; import org.eclipse.emf.henshin.model.IndependentUnit; import org.eclipse.swt.graphics.Image; import de.tub.tfs.henshin.editor.figure.transformation_unit.TransformationUnitFigure; import de.tub.tfs.henshin.editor.ui.transformation_unit.TransUnitPage; import de.tub.tfs.henshin.editor.util.ColorUtil; import de.tub.tfs.henshin.editor.util.IconUtil; /** * The Class IndependentUnitEditPart. */ public class IndependentUnitEditPart extends TransformationUnitEditPart<IndependentUnit> { /** * Instantiates a new independent unit edit part. * * @param transUnitPage * the trans unit page * @param model * the model */ public IndependentUnitEditPart(TransUnitPage transUnitPage, IndependentUnit model) { super(transUnitPage, model); } /* * (non-Javadoc) * * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure() */ @Override protected IFigure createFigure() { IFigure figure = super.createFigure(); figure.setBackgroundColor(ColorUtil.getColor(5)); return figure; } /* * (non-Javadoc) * * @see * muvitorkit.gef.editparts.AdapterGraphicalEditPart#notifyChanged(org.eclipse * .emf.common.notify.Notification) */ @Override protected void notifyChanged(Notification notification) { super.notifyChanged(notification); final int featureId = notification.getFeatureID(HenshinPackage.class); switch (featureId) { case HenshinPackage.INDEPENDENT_UNIT__NAME: ((TransformationUnitFigure) getFigure()).setName(getCastedModel() .getName()); return; } } /* * (non-Javadoc) * * @see org.eclipse.gef.editparts.AbstractTreeEditPart#getImage() */ @Override protected Image getImage() { try { return IconUtil.getIcon("independent20.png"); } catch (Exception e) { return null; } } }