Exemplo n.º 1
0
 /**
  * @param functionName
  * @return FunctionType
  */
 private FunctionType getFunctionTypeByName(String functionName) {
   MetaModelRegistry.getEventsFor(widget.getType());
   Set<FunctionType> functions = MetaModelRegistry.getFunctionsFor(event.getEventType());
   for (FunctionType ft : functions) {
     if (ft.getName().equals(functionName)) {
       return ft;
     }
   }
   return null;
 }
Exemplo n.º 2
0
  /** Fills the function list. */
  private void fillFunctionsList() {
    fctList.removeAll();

    ArrayList<String> names = new ArrayList<String>();

    MetaModelRegistry.getEventsFor(widget.getType());
    Set<FunctionType> functions = MetaModelRegistry.getFunctionsFor(event.getEventType());

    for (FunctionType ft : functions) {
      String funcName = ft.getName();
      names.add(funcName);
    }

    Collections.sort(names);
    fctList.setItems(names.toArray(new String[] {}));
  }
Exemplo n.º 3
0
  /**
   * Creates the properties for the Event. Existing properties are reused so that their values are
   * conserved.
   */
  private void createProperties() {
    Map<String, Property> existingProperties = new HashMap<String, Property>();
    for (Property p : event.getProperties()) {
      existingProperties.put(p.getTypeName(), p);
    }

    // Clear the old properties
    event.getProperties().clear();

    for (PropertyType pt : event.getEventType().getPropertyTypes()) {
      Property p = existingProperties.get(pt.getName());
      if (p == null) {
        // Create a new property
        p = ModelFactory.eINSTANCE.createProperty();
        p.setTypeName(pt.getName());
        p.setLibraryName(pt.getLibrary().getName());
      }
      event.getProperties().add(p);
    }
  }