コード例 #1
0
ファイル: WidgetFactory.java プロジェクト: debabratahazra/DS
 /**
  * Creates a Property correctly initialized with the default value.
  *
  * @param propertyType The PropertyType
  * @return Property The newly created Property
  */
 private Property createProperty(PropertyType propertyType) {
   Property p = getModelFactory().createProperty();
   p.setTypeName(propertyType.getName());
   p.setLibraryName(propertyType.getLibrary().getName());
   p.setValue(propertyType.getDefaultValue());
   return p;
 }
コード例 #2
0
ファイル: EventDialog.java プロジェクト: debabratahazra/DS
  /**
   * 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);
    }
  }