/*******************************************************************************
* 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.PriorityUnit;
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 PriorityUnitEditPart.
*/
public class PriorityUnitEditPart extends
TransformationUnitEditPart<PriorityUnit> {
/**
* Instantiates a new priority unit edit part.
*
* @param transUnitPage
* the trans unit page
* @param model
* the model
*/
public PriorityUnitEditPart(TransUnitPage transUnitPage, PriorityUnit 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(4));
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.PRIORITY_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("priority25.png");
} catch (Exception e) {
return null;
}
}
}