Exemplo n.º 1
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.gef.commands.Command#execute()
  */
 @Override
 public void execute() {
   newShape.setLocation(bounds.getLocation());
   final Dimension size = bounds.getSize();
   if (size.width > 0 && size.height > 0) newShape.setSize(size);
   redo();
 }
 /** Return true, if reconnecting the connection-instance to newTarget is allowed. */
 private boolean checkTargetReconnection() {
   // connection endpoints must be different Shapes
   if (newTarget.equals(oldSource)) {
     return false;
   }
   // return false, if the connection exists already
   for (final Iterator<WhenConnection> iter = newTarget.getTargetConnections().iterator();
       iter.hasNext(); ) {
     final WhenConnection conn = (WhenConnection) iter.next();
     // return false if a oldSource -> newTarget connection exists already
     // and it is a differenct instance that the connection-field
     if (conn.getSource().equals(oldSource) && !conn.equals(connection)) {
       return false;
     }
   }
   return true;
 }