Package es.iiia.shapegrammar.model

Examples of es.iiia.shapegrammar.model.ShapeGrammarModel


        Object obj = ((IStructuredSelection) selection)
            .getFirstElement();
        // If we had a selection lets open the editor
        if (obj != null) {
          RuleModel rule = (RuleModel) obj;
          ShapeGrammarModel grammar = (ShapeGrammarModel) rule
              .getParent();
          grammar.deleteRule(rule);

          // now close the editor holding this rule
          for (IEditorReference editor : window.getActivePage()
              .getEditorReferences()) {
            if (editor.getEditor(false) instanceof RuleEditor) {
View Full Code Here


   
    if (canContinue) {
      String path = openFileDialog(workbenchWindow);
      if (path != null) {
        // create input
        ShapeGrammarModel model = initModel(path);

        if (model != null) {
          // load file
          loadFile(workbenchWindow, model);
View Full Code Here

      MessageDialog.openError(workbenchWindow.getShell(), "Load Error",
          "This is specific shape grammar. Please use proper loader");
      return null;
    }

    return new ShapeGrammarModel(path);
  }
View Full Code Here

    }
  }

  public void propertyChange(PropertyChangeEvent evt) {
    workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    ShapeGrammarModel model = initModel(evt.getNewValue().toString());
   
    if (model != null) {
      this.loadFile(workbenchWindow, model);
    }
  }
View Full Code Here

    boolean canContinue = workbenchWindow.getActivePage().closeAllEditors(
        true);

    if (canContinue) {
      // create new grammar
      ShapeGrammarModel newModel = this.createGrammar();
     
      // create input
      ShapeGrammarInput input = new ShapeGrammarInput(newModel);

      // reload views
View Full Code Here

    return null;
  }
 
  protected ShapeGrammarModel createGrammar() {
    return new ShapeGrammarModel();
  }
View Full Code Here

        Object obj = ((IStructuredSelection) selection)
            .getFirstElement();
        // If we had a selection lets open the editor
        if (obj != null) {
          ShapeModel shape = (ShapeModel) obj;
          ShapeGrammarModel grammar = (ShapeGrammarModel) shape
              .getParent();
          grammar.deleteShape(shape);
         
          // now close the editor holding this rule
          for (IEditorReference editor : window.getActivePage()
              .getEditorReferences()) {
            if (editor.getEditor(false) instanceof ShapeEditor) {
View Full Code Here

    return list;
    // return this.protocol.getShapeBasket();
  }
 
  public void exportFigure(String fileName) {
    ShapeGrammarModel grammar = new ShapeGrammarModel();
    grammar.getShapes().clear();

    ShapeModel wholeModel = grammar.addShape();   
    wholeModel.merge((ShapeModel) model);
   
    Rectangle2D modelBounds = wholeModel.getBounds();
   
    // now move to 0,0
    if (modelBounds.getMinX() < 0) {
      wholeModel.translate(-modelBounds.getMinX(), 0);
    }
    if (modelBounds.getMinY() < 0) {
      wholeModel.translate(0, -modelBounds.getMinY());
    }
   
    grammar.setCurrentFileName(fileName);
    grammar.save();
  }
View Full Code Here

  }

  public void setContent(ShapeGrammarInput input) {
    if (input != null) {
      // hook on property changes
      ShapeGrammarModel grammar = (ShapeGrammarModel) input.getNode();
      this.content = grammar;

      grammar.addPropertyChangeListener(this);
      for (NodeModel model : grammar.getRules()) {
        model.addPropertyChangeListener(this);
      }
    } else {
      this.content = null;
    }
View Full Code Here

  }

  public void setContent(ShapeGrammarInput input) {
    if (input != null) {
      // hook on property changes
      ShapeGrammarModel grammar = (ShapeGrammarModel) input.getNode();
      this.content = grammar;
     
      grammar.addPropertyChangeListener(this);
      for (NodeModel model : grammar.getShapes()) {
        model.addPropertyChangeListener(this);
      }
    } else {
      this.content = null;
    }   
View Full Code Here

TOP

Related Classes of es.iiia.shapegrammar.model.ShapeGrammarModel

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.