use of org.palladiosimulator.editors.sirius.custom.style.rotatable.NodeImageExtension in project Palladio-Editors-Sirius by PalladioSimulator.
the class RotatableSVGWorkspaceImageFigure method refreshFigure.
/**
* Refresh the figure.
*
* @param imageStyle
* the image associated to the figure
*/
public void refreshFigure(final CustomStyle imageStyle) {
boolean found = false;
Iterator<NodeImageExtension> iterator = ExtensionActivator.getDefault().getImageExtensions().iterator();
while (iterator.hasNext() && !found) {
NodeImageExtension desc = (NodeImageExtension) iterator.next();
if (imageStyle.getId() != null && imageStyle.getId().equals(desc.getId())) {
if (currentImgPath != null) {
if (currentImgPath.equals(bottomImgPath)) {
currentImgPath = desc.getBottomImage();
} else if (currentImgPath.equals(leftImgPath)) {
currentImgPath = desc.getLeftImage();
} else if (currentImgPath.equals(rightImgPath)) {
currentImgPath = desc.getRightImage();
} else {
currentImgPath = desc.getTopImage();
}
} else {
currentImgPath = desc.getTopImage();
}
topImgPath = desc.getTopImage();
bottomImgPath = desc.getBottomImage();
leftImgPath = desc.getLeftImage();
rightImgPath = desc.getRightImage();
found = true;
}
}
refreshFigure();
this.repaint();
}
use of org.palladiosimulator.editors.sirius.custom.style.rotatable.NodeImageExtension in project Palladio-Editors-Sirius by PalladioSimulator.
the class ExtensionActivator method addImageExtensions.
/**
* add image extensions.
*/
private void addImageExtensions() {
imageExtensions = new ArrayList<NodeImageExtension>();
IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(NodeImageExtension.IMAGE_EXTENSION_ID);
for (IConfigurationElement configElement : configurationElements) {
String id = configElement.getAttribute(NodeImageExtension.ID);
String topImage = configElement.getAttribute(NodeImageExtension.TOP_IMAGE);
String bottomImage = configElement.getAttribute(NodeImageExtension.BOTTOM_IMAGE);
String leftImage = configElement.getAttribute(NodeImageExtension.LEFT_IMAGE);
String rightImage = configElement.getAttribute(NodeImageExtension.RIGHT_IMAGE);
imageExtensions.add(new NodeImageExtension(id, topImage, bottomImage, leftImage, rightImage));
}
}
use of org.palladiosimulator.editors.sirius.custom.style.rotatable.NodeImageExtension in project Palladio-Editors-Sirius by PalladioSimulator.
the class AbstractRotatableImageEditPart method createNodeShape.
/**
* @generated
*/
protected IFigure createNodeShape() {
CustomStyle imageStyle = (CustomStyle) resolveSemanticElement();
NodeImageExtension imageExtension = ExtensionActivator.getDefault().getBestImageExtension(imageStyle.getId());
primaryShape = new RotatableSVGWorkspaceImageFigure(imageExtension.getMode(), imageExtension.getTopImage(), imageExtension.getLeftImage(), imageExtension.getBottomImage(), imageExtension.getRightImage());
listener = new RotatableEditPartListener(this);
primaryShape.addFigureListener(listener);
EditPart parentEditPart = getParent();
if (parentEditPart instanceof GraphicalEditPart) {
GraphicalEditPart parentGraphicalEditPart = (GraphicalEditPart) parentEditPart;
NodeListener dEdgeEditPartListener = new PropagateFigureListenerAtConnectionFigure(listener);
parentGraphicalEditPart.addNodeListener(dEdgeEditPartListener);
}
return primaryShape;
}
Aggregations