Package org.pdtextensions.semanticanalysis.model.validators

Examples of org.pdtextensions.semanticanalysis.model.validators.Validator


   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setValidator(Validator newValidator) {
    Validator oldValidator = validator;
    validator = newValidator;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ValidatorsPackage.TYPE__VALIDATOR, oldValidator, validator));
  }
View Full Code Here


  private void registerValidator(IConfigurationElement el) {
    if (!el.getName().equals(ELEMENT_VALIDATOR)) {
      return;
    }

    final Validator validator = ValidatorsFactory.eINSTANCE.createValidator();
    String categoryId = el.getAttribute(ATTR_CATEGORY);

    validator.setId(el.getAttribute(ATTR_ID));
    if (!categories.containsKey(categoryId)) {
      if (categoryId != null)
        PEXAnalysisPlugin.error(String.format("Validator %s has reference to a non-existent category %s", validator.getId(), categoryId)); //$NON-NLS-1$

      categoryId = DEFAULT_CATEGORY_ID;
    }

    validator.setCategory(categories.get(categoryId));
    validator.getCategory().getValidators().add(validator);
   
    for (IConfigurationElement typeCfg : el.getChildren(ELEMENT_TYPE)) {
      Type type = ValidatorsFactory.eINSTANCE.createType();
      type.setId(typeCfg.getAttribute(ATTR_ID));
     
      type.setDefaultSeverity(ProblemSeverity.valueOf(preferences.node(validator.getId()).get(type.getId(), typeCfg.getAttribute(ATTR_DEFAULT_SEVERITY) == null ? DEFAULT_SEVERITY: typeCfg.getAttribute(ATTR_DEFAULT_SEVERITY)).toUpperCase()));
      type.setLabel(typeCfg.getAttribute(ATTR_LABEL));
      type.setDescription(typeCfg.getAttribute(ATTR_DESCRIPTION));
     
      type.setValidator(validator);
      validator.getTypes().add(type);
    }

    validators.put(validator.getId(), validator);
  }
View Full Code Here

  }

  @Test
  public void initializeValidator() {
    String validatorId = "org.pdtextensions.semanticanalysis.tests.validator";
    Validator validator = testService.getManager().getValidator(validatorId);

    assertNotNull(validator);
    assertEquals(ProblemSeverity.INFO, validator.getType("default").getDefaultSeverity());
    assertEquals("org.pdtextensions.semanticanalysis.tests.category",
        validator.getCategory().getId());
   
    assertEquals(2, validator.getTypes().size());
    assertNotNull(validator.getType("default"));
    assertTrue(validator.getType("default") instanceof Type);
   
    Type orig = validator.getType("default");
   
    assertNotNull(orig.getId());
    assertEquals(orig.getId(), "default");
   
    assertNotNull(validator.getType("second"));
   
  }
View Full Code Here

TOP

Related Classes of org.pdtextensions.semanticanalysis.model.validators.Validator

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.