Component c = GraphBTUtil.getComponentByRef(model, layout.getCRef()); org.eclipse.swt.graphics.Image im = GraphBTUtil.getComponentImageDescription(c); try{ GraphitiUIPlugin.getDefault().getImageRegistry().put("GRAPHBT-IMAGE-"+layout.getCRef(), im); } catch (Exception e) { } Image image = gaService.createImage(containerShape, "GRAPHBT-IMAGE-"+layout.getCRef()); int width = im.getBounds().width; int height = im.getBounds().height; layout.setHeight(height); layout.setWidth(width); layout.setX(x); layout.setY(y); rectangle.setLineWidth(1); gaService.setLocationAndSize(image, x, y, width, height);
public void addImage(String ref,String path) { addImageFilePath(ref, path); }
GraphBTImageProvider imP = GraphBTUtil.getImageProvider(); String path = GraphBTUtil.getImageAbsolutePath(ProjectUtil.RESOURCE_LOCATION+"/"+c.getComponentRef()+".jpg"); System.out.println("Path "+path); imP.addImage(path, path); //register image by ID: path, and filePath: path Image image = gaService.createImage(containerShape, path);
try{ imP.addImage(path, path); } catch (Exception e) { } PictogramElement pe = Graphiti.getLinkService().getPictogramElements(getDiagramTypeProvider().getDiagram(), l).get(0); Image image = Graphiti.getGaCreateService().createImage(pe, path); image.setHeight(l.getHeight()); image.setWidth(l.getWidth());