Package es.iiia.shapegrammar.rule

Examples of es.iiia.shapegrammar.rule.RuleModel


        this.startShape);
  }

  public RuleModel addRule(ShapeGrammarRuleType type) {
    // create this rule
    RuleModel model = this.initRule(type);

    if (model != null) {
      // add to list of rules
      //model.setId(this.getRuleMaxId());
     
View Full Code Here


  public Object execute(ExecutionEvent event) throws ExecutionException {

    // get current model
    RuleEditor editor = (RuleEditor) HandlerUtil.getActiveEditor(event);
    RuleModel rule = (RuleModel) editor.getModel();

    // TODO: notify user that shape could be replaced
    if (rule.getLeftShape() != null) {

    }

    // replace current left shape with the one selected
    ISelection selection = HandlerUtil.getActivePart(event).getSite()
        .getSelectionProvider().getSelection();
    if (selection != null && selection instanceof IStructuredSelection) {
      Object obj = ((IStructuredSelection) selection).getFirstElement();
      // If we had a selection lets open the editor
      if (obj != null) {
        ShapeModel shape = (ShapeModel) obj;
       
        // find the center fo the window
//        IFigure part = ((RuleEditPart)editor.getGraphicalViewer().getContents()).getFigure();
//       
//        rule.setCenter(new PointModel(part.getBounds().getCenter().x, part.getBounds().getCenter().y));
        rule.setLeftShape(shape);       
      }
    }

    return null;
  }
View Full Code Here

TOP

Related Classes of es.iiia.shapegrammar.rule.RuleModel

Copyright © 2018 www.massapicom. 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.