/* * (non-Javadoc) * * @see org.eclipse.papyrus.layout.LayouttoolInterface#execute(java.util.Map) */ public void execute(Map<EditPart, Rectangle> map) { TransactionalEditingDomain ted = getTransactionalEditingDomain(); if (ted != null) { CommandStack cs = null; // Add a command to apply new bounds of all nodes for (Entry<EditPart, Rectangle> s : map.entrySet()) { SetBoundsCommand boundsCommand = new SetBoundsCommand( ted, "apply layout", new EObjectAdapter((View) s.getKey().getModel()), s.getValue()); command.add(boundsCommand); GraphicalEditPart gep = (GraphicalEditPart) s.getKey(); if (cs == null) { cs = gep.getViewer().getEditDomain().getCommandStack(); } } try { // Execute layout commands with animation Animation.markBegin(); cs.execute(new ICommandProxy(command)); Animation.run(1000); } catch (Exception e) { Activator.getDefault().log(e.getMessage() + " : Cannot apply new bounds of all nodes", e); } } }
/* (non-Javadoc) * @see org.eclipse.draw2d.Figure#paint(org.eclipse.draw2d.Graphics) */ @Override public void paint(Graphics graphics) { int oldAntialias = graphics.getAntialias(); if (Animation.isAnimating() && Animation.getProgress() < .9) { graphics.setAntialias(SWT.OFF); } else { graphics.setAntialias(antialiasing); } super.paint(graphics); graphics.setAntialias(oldAntialias); }