Examples of Diagnostic


Examples of org.eclipse.emf.common.util.Diagnostic

   
    try {
      Resource resource = loadTargetPlatform(uri);
      subMonitor.worked(2);
     
      Diagnostic resourceDiagnostic = EcoreUtil.computeDiagnostic(resource, true);
      if (resourceDiagnostic.getSeverity() >= Diagnostic.WARNING) {
        ret.merge(resourceDiagnostic);
      }

      if (resourceDiagnostic.getSeverity() < Diagnostic.ERROR) {
        TargetPlatform targetPlatform = null;
        if (resource != null && !resource.getContents().isEmpty()) {
          targetPlatform = (TargetPlatform) resource.getContents().get(0);
        }
        if (targetPlatform == null) {
          ret.merge(new BasicDiagnostic(Diagnostic.ERROR, TargetPlatformBundleActivator.PLUGIN_ID, -1, "Error occured while loading the file " + uri + ".", null));
        } else if (subMonitor.isCanceled()) {
          ret.merge(Diagnostic.CANCEL_INSTANCE);
        } else {
          SubMonitor diagnosticianMonitor = subMonitor.newChild(90).setWorkRemaining(targetPlatform.getLocations().size());
          Diagnostic validation = new CustomDiagnostician(diagnosticianMonitor).validate(targetPlatform);
          if (validation.getSeverity() >= Diagnostic.WARNING) {
            ret.merge(validation);
          } else if (subMonitor.isCanceled()) {
            ret.merge(Diagnostic.CANCEL_INSTANCE);
          }
         
          if (validation.getSeverity() < Diagnostic.ERROR) {
            Diagnostic diagnostic = doGenerateTargetDefinitionFile(uri, targetPlatform, subMonitor.newChild(8));
            if (diagnostic.getSeverity() >= Diagnostic.WARNING) {
              ret.merge(diagnostic);
            }
          }
          subMonitor.setWorkRemaining(0);
        }
View Full Code Here

Examples of org.eclipse.emf.common.util.Diagnostic

      subMonitor.worked(5);
     
      if (subMonitor.isCanceled()) {
        ret.merge(Diagnostic.CANCEL_INSTANCE);
      } else {
        Diagnostic diagnostic = resolvedTargetPlatform.resolve(repositoryManager, subMonitor.newChild(90));
        if (diagnostic.getSeverity() >= Diagnostic.WARNING) {
          ret.merge(diagnostic);
        }
        if (subMonitor.isCanceled()) {
          ret.merge(Diagnostic.CANCEL_INSTANCE);
        } else if (ret.getSeverity() < Diagnostic.ERROR) {
          diagnostic = doGenerateTargetDefinitionFile(uri, resolvedTargetPlatform);
          if (diagnostic.getSeverity() >= Diagnostic.WARNING) {
            ret.merge(diagnostic);
          }
          subMonitor.worked(5);
        }
      }
View Full Code Here

Examples of org.eclipse.emf.common.util.Diagnostic

    BasicDiagnostic ret = new BasicDiagnostic();
    TargetDefinitionGenerator generator = new TargetDefinitionGenerator();
    String xml = generator.generate(resolvedTargetPlatform, (int)TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()));
    final URI targetDefinitionLocation = uri.trimFileExtension().appendFileExtension("target");
   
    Diagnostic diagnostic = serialize(targetDefinitionLocation, xml);
    if (diagnostic.getSeverity() >= Diagnostic.WARNING) {
      ret.merge(diagnostic);
    }
   
    return ret;
  }
View Full Code Here

Examples of org.eclipse.emf.common.util.Diagnostic

      _builder.append("}");
      _builder.newLine();
      final TargetPlatform targetPlatform = this.parser.parse(_builder);
      final ResolvedTargetPlatform resolvedTargetPlatform = ResolvedTargetPlatform.create(targetPlatform, this.indexBuilder);
      NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
      final Diagnostic d = resolvedTargetPlatform.resolve(new MockMetadataRepositoryManager(null) {
        public IMetadataRepository loadRepository(final URI location, final IProgressMonitor monitor) throws ProvisionException, OperationCanceledException {
          IMetadataRepository _xifexpression = null;
          String _string = location.toString();
          boolean _equals = "unknownHost".equals(_string);
          if (_equals) {
            throw new ProvisionException("Unknown Host");
          } else {
            _xifexpression = super.loadRepository(location, monitor);
          }
          return _xifexpression;
        }
      }, _nullProgressMonitor);
      int _severity = d.getSeverity();
      Assert.assertEquals(Diagnostic.ERROR, _severity);
      List<Diagnostic> _children = d.getChildren();
      Diagnostic _head = IterableExtensions.<Diagnostic>head(_children);
      String _message = _head.getMessage();
      String _plus = ("Message is " + _message);
      List<Diagnostic> _children_1 = d.getChildren();
      Diagnostic _head_1 = IterableExtensions.<Diagnostic>head(_children_1);
      String _message_1 = _head_1.getMessage();
      boolean _startsWith = _message_1.startsWith("Unknown Host");
      Assert.assertTrue(_plus, _startsWith);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
View Full Code Here

Examples of org.eclipse.emf.common.util.Diagnostic

          }
          return _xifexpression;
        }
      });
      NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
      final Diagnostic d = resolvedTargetPlatform.resolve(_mockMetadataRepositoryManager, _nullProgressMonitor);
      int _severity = d.getSeverity();
      Assert.assertEquals(Diagnostic.ERROR, _severity);
      List<Diagnostic> _children = d.getChildren();
      String _join = IterableExtensions.join(_children, ", ");
      List<Diagnostic> _children_1 = d.getChildren();
      final Function1<Diagnostic, Boolean> _function = new Function1<Diagnostic, Boolean>() {
        public Boolean apply(final Diagnostic it) {
          int _severity = it.getSeverity();
          return Boolean.valueOf((_severity >= Diagnostic.WARNING));
        }
View Full Code Here

Examples of org.eclipse.emf.common.util.Diagnostic

                    constraintSet.add(TagIdentifierFactory.createJSPTagWrapper(
                            tagId.getUri(), tagId.getName()));
                }
                final MemberConstraint memberConstraint = new MemberConstraint(
                        constraintSet);
                final Diagnostic diag = memberConstraint.isSatisfied(set);

                if (diag.getSeverity() != Diagnostic.OK)
                {
                    _containmentValidationCount++; // found a violation

                    final List data = diag.getData();

                    for (final Iterator it = data.iterator(); it.hasNext();)
                    {
                        final TagIdentifier missingParent = (TagIdentifier) it
                                .next();
View Full Code Here

Examples of org.eclipse.emf.common.util.Diagnostic

            final IStructuredDocumentContext context,
            final Node node,
            final TagIdentifier missingParent)
    {

      Diagnostic diagnostic = null;
      if (missingParent.equals(IJSFConstants.TAG_IDENTIFIER_VIEW)) {
        diagnostic = DiagnosticFactory.create_CONTAINMENT_ERROR_MISSING_VIEW(node.getNodeName());
      }
      else if (missingParent.equals(IJSFConstants.TAG_IDENTIFIER_FORM)) {
        diagnostic = DiagnosticFactory.create_CONTAINMENT_ERROR_MISSING_FORM(node.getNodeName());
View Full Code Here

Examples of org.eclipse.emf.common.util.Diagnostic

    catch (Exception e) {
      exception = e;
      resource = editingDomain.getResourceSet().getResource(resourceURI, false);
    }

    Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
    if (diagnostic.getSeverity() != Diagnostic.OK) {
      resourceToDiagnosticMap.put(resource,  analyzeResourceProblems(resource, exception));
    }
    editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
  }
View Full Code Here

Examples of org.eclipse.emf.common.util.Diagnostic

    catch (Exception e) {
      exception = e;
      resource = editingDomain.getResourceSet().getResource(resourceURI, false);
    }

    Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
    if (diagnostic.getSeverity() != Diagnostic.OK) {
      resourceToDiagnosticMap.put(resource,  analyzeResourceProblems(resource, exception));
    }
    editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
  }
View Full Code Here

Examples of org.eclipse.emf.common.util.Diagnostic

   */
  private static void validate(DiagramEditPart diagramEditPart, View view) {
    View target = view;
    OntoUML.diagram.part.ValidationMarker.removeAllMarkers(diagramEditPart
        .getViewer());
    Diagnostic diagnostic = runEMFValidator(view);
    createMarkers(target, diagnostic, diagramEditPart);
    IBatchValidator validator = (IBatchValidator) ModelValidationService
        .getInstance().newValidator(EvaluationMode.BATCH);
    validator.setIncludeLiveConstraints(true);
    if (view.isSetElement() && view.getElement() != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.