ExpressionExpressionCompartmentItemSemanticEditPolicy.java :  » Workflow-Engines » osbl-1_0 » newprocess » diagram » edit » policies » Java Open Source

Java Open Source » Workflow Engines » osbl 1_0 
osbl 1_0 » newprocess » diagram » edit » policies » ExpressionExpressionCompartmentItemSemanticEditPolicy.java
package newprocess.diagram.edit.policies;

import newprocess.Expression;
import newprocess.NewprocessPackage;
import newprocess.diagram.edit.commands.AndOperatorCreateCommand;
import newprocess.diagram.edit.commands.OrOperatorCreateCommand;
import newprocess.diagram.providers.New_processElementTypes;

import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;

/**
 * @generated
 */
public class ExpressionExpressionCompartmentItemSemanticEditPolicy extends
    New_processBaseItemSemanticEditPolicy {

  /**
   * @generated NOT
   * @author sh
   */
  protected Command getCreateCommand(CreateElementRequest req) {
    if (New_processElementTypes.OrOperator_3003 == req.getElementType()) {
      if (req.getContainmentFeature() == null) {
        req.setContainmentFeature(NewprocessPackage.eINSTANCE
            .getExpression_HasTerms());
      }
      if (((Expression) req.getContainer()).acceptOperator())
        return getMSLWrapper(new OrOperatorCreateCommand(req));
      else
        return UnexecutableCommand.INSTANCE;
    }
    if (New_processElementTypes.AndOperator_3004 == req.getElementType()) {
      if (req.getContainmentFeature() == null) {
        req.setContainmentFeature(NewprocessPackage.eINSTANCE
            .getExpression_HasTerms());
      }
      if (((Expression) req.getContainer()).acceptOperator())
        return getMSLWrapper(new AndOperatorCreateCommand(req));
      else
        return UnexecutableCommand.INSTANCE;
    }
    return super.getCreateCommand(req);
  }

  @Override
  protected Command getDestroyElementCommand(DestroyElementRequest req) {
    return UnexecutableCommand.INSTANCE;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.