Package org.gvt.editpolicy

Source Code of org.gvt.editpolicy.ChsGraphicalNodeEditPolicy

package org.gvt.editpolicy;

import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy;
import org.eclipse.gef.requests.CreateConnectionRequest;
import org.eclipse.gef.requests.ReconnectRequest;
import org.gvt.command.CreateConnectionCommand;
import org.gvt.command.ReconnectConnectionCommand;

/**
* @author Cihan Kucukkececi
*
* Copyright: I-Vis Research Group, Bilkent University, 2007
*/
public class ChsGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy
{
  /* (�� Javadoc)
   * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getConnectionCompleteCommand(org.eclipse.gef.requests.CreateConnectionRequest)
   */
  protected Command getConnectionCompleteCommand(CreateConnectionRequest request)
  {
    CreateConnectionCommand command =
      (CreateConnectionCommand) request.getStartCommand();
    command.setTarget(getHost().getModel());

    return command;
  }

  /* (�� Javadoc)
   * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getConnectionCreateCommand(org.eclipse.gef.requests.CreateConnectionRequest)
   */
  protected Command getConnectionCreateCommand(CreateConnectionRequest request)
  {
    CreateConnectionCommand command = new CreateConnectionCommand();
    command.setSource(getHost().getModel());
    command.setConnection(request.getNewObject());
    request.setStartCommand(command);
    return command;
  }

  /* (�� Javadoc)
   * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getReconnectTargetCommand(org.eclipse.gef.requests.ReconnectRequest)
   */
  protected Command getReconnectTargetCommand(ReconnectRequest request)
  {
    ReconnectConnectionCommand command = new ReconnectConnectionCommand();
    command.setConnectionModel(request.getConnectionEditPart().getModel());
    command.setNewTarget(getHost().getModel());
    return command;

  }

  /* (�� Javadoc)
   * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getReconnectSourceCommand(org.eclipse.gef.requests.ReconnectRequest)
   */
  protected Command getReconnectSourceCommand(ReconnectRequest request)
  {
    ReconnectConnectionCommand command = new ReconnectConnectionCommand();
    command.setConnectionModel(request.getConnectionEditPart().getModel());
    command.setNewSource(getHost().getModel());
    return command;
  }
}
TOP

Related Classes of org.gvt.editpolicy.ChsGraphicalNodeEditPolicy

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.