Package org.eclipse.wst.validation

Examples of org.eclipse.wst.validation.ValidatorMessage


        return res;
    }

    private void addValidatorMessage(ValidationResult res, IProject project, String msg) {

        ValidatorMessage message = ValidatorMessage.create(msg, project);
        message.setAttribute(IMarker.LOCATION, project.getName());
        message.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);

        res.add(message);
    }
View Full Code Here


        Logger pluginLogger = Activator.getDefault() .getPluginLogger();

        try {

            for (IFile descriptor : scValidator.findMissingScrDescriptors(m)) {
                ValidatorMessage dsMessage = ValidatorMessage.create(
                        "No DS descriptor found at path " + descriptor.getProjectRelativePath(), m);
                dsMessage.setAttribute(IMarker.LOCATION, m.getName());
                dsMessage.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);

                res.add(dsMessage);

            }
View Full Code Here

        messages.addAll(result2.getReporter(new NullProgressMonitor()).getMessages());
        messages.addAll(result3.getReporter(new NullProgressMonitor()).getMessages());
        for (int i = 0; i < messages.size(); i++) {
          IMessage message = (IMessage) messages.get(i);
          if (message.getText() != null && message.getText().length() > 0) {
            ValidatorMessage vmessage = ValidatorMessage.create(message.getText(), resource);
            if (message.getAttributes() != null) {
              Map attrs = message.getAttributes();
              Iterator it = attrs.entrySet().iterator();
              while (it.hasNext()) {
                Map.Entry entry = (Map.Entry) it.next();
                if (!(entry.getValue() instanceof String || entry.getValue() instanceof Integer || entry.getValue() instanceof Boolean)) {
                  it.remove();
                }
              }
              vmessage.setAttributes(attrs);
            }
            vmessage.setAttribute(IMarker.LINE_NUMBER, message.getLineNumber());
            vmessage.setAttribute(IMarker.MESSAGE, message.getText());
            if (message.getOffset() > -1) {
              vmessage.setAttribute(IMarker.CHAR_START, message.getOffset());
              vmessage.setAttribute(IMarker.CHAR_END, message.getOffset() + message.getLength());
            }
            int severity = 0;
            switch (message.getSeverity()) {
              case IMessage.HIGH_SEVERITY :
                severity = IMarker.SEVERITY_ERROR;
                break;
              case IMessage.NORMAL_SEVERITY :
                severity = IMarker.SEVERITY_WARNING;
                break;
              case IMessage.LOW_SEVERITY :
                severity = IMarker.SEVERITY_INFO;
                break;
            }
            vmessage.setAttribute(IMarker.SEVERITY, severity);
            vmessage.setType(MARKER_TYPE);
            result.add(vmessage);
          }
        }
        monitor.done();
      }
      // TLD
      else {
        try {
          final IJavaProject javaProject = JavaCore.create(file.getProject());
          if (javaProject.exists()) {
            IScopeContext[] scopes = new IScopeContext[]{new InstanceScope(), new DefaultScope()};
            ProjectScope projectScope = new ProjectScope(file.getProject());
            if (projectScope.getNode(PREFERENCE_NODE_QUALIFIER).getBoolean(JSPCorePreferenceNames.VALIDATION_USE_PROJECT_SETTINGS, false)) {
              scopes = new IScopeContext[]{projectScope, new InstanceScope(), new DefaultScope()};
            }
            Map[] problems = detectProblems(javaProject, file, scopes);
            for (int i = 0; i < problems.length; i++) {
              ValidatorMessage message = ValidatorMessage.create(problems[i].get(IMarker.MESSAGE).toString(), resource);
              message.setType(MARKER_TYPE);
              message.setAttributes(problems[i]);
              result.add(message);
            }
          }
        }
        catch (Exception e) {
View Full Code Here

          if (projectScope.getNode(PREFERENCE_NODE_QUALIFIER).getBoolean(JSPCorePreferenceNames.VALIDATION_USE_PROJECT_SETTINGS, false)) {
            scopes = new IScopeContext[]{projectScope, new InstanceScope(), new DefaultScope()};
          }
          Map[] problems = detectProblems(javaProject, tld, scopes);
          for (int i = 0; i < problems.length; i++) {
            ValidatorMessage message = ValidatorMessage.create(problems[i].get(IMarker.MESSAGE).toString(), resource);
            message.setType(MARKER_TYPE);
            message.setAttributes(problems[i]);
            result.add(message);
          }
        }
      }
      catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.eclipse.wst.validation.ValidatorMessage

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.