Example usage for org.springframework.ide.eclipse.core.model.validation ValidationProblemAttribute ValidationProblemAttribute

List of usage examples for org.springframework.ide.eclipse.core.model.validation ValidationProblemAttribute ValidationProblemAttribute

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.core.model.validation ValidationProblemAttribute ValidationProblemAttribute.

Prototype

public ValidationProblemAttribute(String key, Object value) 

Source Link

Usage

From source file:org.eclipse.virgo.ide.manifest.internal.core.validation.BundleManifestValidationContext.java

public void errorIllegalAttributeValue(BundleManifestHeader header, ManifestElement element, String key,
        String value) {/*from   w ww. j a  v a 2 s.  c  o m*/
    String msg = NLS.bind(BundleManifestCoreMessages.BundleErrorReporter_att_value,
            (new String[] { value, key }));
    error(getRootElement(), "ILLEGAL_ATTRIBUTE_VALUE", msg, new ValidationProblemAttribute(IMarker.LINE_NUMBER,
            BundleManifestUtils.getLineNumber(getDocument(), header, key + "=")));
}

From source file:org.eclipse.virgo.ide.manifest.internal.core.validation.rules.ImportPackageBundleAndLibraryRule.java

private void validateVersionAttribute(BundleManifestHeader header, ManifestElement element,
        BundleManifestValidationContext context) {
    String version = null;/*  w  ww. j  av  a2s.c o m*/
    if (Constants.REQUIRE_BUNDLE.equals(header.getElementName())) {
        version = element.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE);
    } else {
        version = element.getAttribute(Constants.VERSION_ATTRIBUTE);
    }

    if (version == null)
        return;
    IStatus status = VersionUtil.validateVersionRange(version);
    if (!status.isOK()) {
        String errorId = getIllegalVersionErrorId(header);
        String artifactName = element.getValue();
        context.error(errorId, status.getMessage(),
                BundleManifestUtils.getPackageLineNumber(context.getBundleManifest().getDocument(), header,
                        element),
                new ValidationProblemAttribute(ManifestValidationRuleConstants.IMPORT_ARTIFACT_NAME,
                        artifactName));
    }
}

From source file:org.eclipse.virgo.ide.manifest.internal.core.validation.BundleManifestValidationContext.java

public void errorIllegalDirectiveValue(BundleManifestHeader header, ManifestElement element, String key,
        String value) {//from   w  ww .  j  a v a2  s . c  om
    String msg = NLS.bind(BundleManifestCoreMessages.BundleErrorReporter_dir_value,
            (new String[] { value, key }));
    error(getRootElement(), "ILLEGAL_DIRECTIVE_VALUE", msg, new ValidationProblemAttribute(IMarker.LINE_NUMBER,
            BundleManifestUtils.getLineNumber(getDocument(), header, key + ":=")));
}

From source file:org.eclipse.virgo.ide.manifest.internal.core.validation.BundleManifestValidationContext.java

public void errorIllegalValue(BundleManifestHeader header, ManifestElement element, String illegalValue,
        String errorId) {/*from  ww w . j a v a  2s.  c om*/
    String msg = NLS.bind(BundleManifestCoreMessages.BundleErrorReporter_illegal_value, illegalValue);
    error(getRootElement(), errorId, msg, new ValidationProblemAttribute(IMarker.LINE_NUMBER,
            BundleManifestUtils.getLineNumber(getDocument(), header, illegalValue)));
}

From source file:org.eclipse.virgo.ide.manifest.internal.core.validation.BundleManifestValidationContext.java

public BundleManifestHeader validateRequiredHeader(String name, String missingRequiredHeaderErrorId) {
    BundleManifestHeader header = getBundleManifest().getHeader(name);
    if (header == null) {
        String msg = NLS.bind(BundleManifestCoreMessages.BundleErrorReporter_headerMissing, name);
        error(getRootElement(), missingRequiredHeaderErrorId, msg,
                new ValidationProblemAttribute(IMarker.LINE_NUMBER, new Integer(1)));
    }/*from w w w. j av a  2 s.  c o  m*/
    return header;
}

From source file:org.eclipse.virgo.ide.manifest.internal.core.validation.BundleManifestValidationContext.java

private ValidationProblemAttribute[] mergeAttributes(int line, ValidationProblemAttribute... attributes) {
    List<ValidationProblemAttribute> attributeList = new ArrayList<ValidationProblemAttribute>();
    if (attributes != null && attributes.length > 0) {
        attributeList.addAll(Arrays.asList(attributes));
    }/*  www  . j  a  va2  s  . c  om*/
    attributeList.add(new ValidationProblemAttribute(IMarker.LINE_NUMBER, line));
    return attributeList.toArray(new ValidationProblemAttribute[attributeList.size()]);
}