Package org.objectstyle.wolips.bindings.wod

Examples of org.objectstyle.wolips.bindings.wod.WodProblem


  public void addParseProblem(IWodElement element, String message, RulePosition rulePosition, boolean warning) {
    Position position = rulePosition.getPosition();
    try {
      int lineNumber = _document.getLineOfOffset(position.getOffset());
      WodProblem problem;
      if (element != null) {
        problem = new WodElementProblem(element, message, position, lineNumber, warning);
      }
      else {
        problem = new WodProblem(message, position, lineNumber, warning);
      }
      addParseProblem(problem);
    }
    catch (BadLocationException e) {
      Activator.getDefault().log(e);
View Full Code Here


    _cache = cache;
    _element = element;
    int offset = element.getOffset() + 1;
    int length = element.getName().length();
    int lineNumber = WodHtmlUtils.getLineAtOffset(_cache.getHtmlEntry().getContents(), offset);
    WodProblem problem = new WodProblem(message, new Position(offset, length), lineNumber, warning);
    _wodProblems = new LinkedList<WodProblem>();
    _wodProblems.add(problem);
  }
View Full Code Here

          htmlCacheEntry.getHtmlElementCache().addHtmlElement(elementName);

          if (wodModel != null) {
            IWodElement wodElement = wodModel.getElementNamed(woElementName);
            if (wodElement == null) {
              WodProblem undefinedElement = new WodBindingValueProblem(wodElement, new SimpleWodBinding(null, "name", null), "name", "The element '" + woElementName + "' is not defined in " + wodFile.getName(), null, -1, false);
              inlineProblems.add(new InlineWodProblem(woElement, undefinedElement, _cache));
            }
          }
        }
View Full Code Here

    try {
      this.parseModel();
    }
    catch (Throwable e) {
      e.printStackTrace();
      problems.add(new WodProblem(e.getMessage(), null, 0, true));
      return problems;
    }
    if (_file == null) {
      return problems;
    }
    boolean validateWooEncodings = Activator.getDefault().getPluginPreferences().getBoolean(PreferenceConstants.VALIDATE_WOO_ENCODINGS_KEY);
    if (validateWooEncodings) {
      try {
        String componentCharset = _file.getParent().getDefaultCharset();
        String encoding = CharSetUtils.encodingNameFromObjectiveC(this.getEncoding());
        if (!(encoding.equals(componentCharset))) {
          problems.add(new WodProblem("WOO Encoding type " + encoding + " doesn't match component " + componentCharset, null, 0, true));
        }
 
        if (_file.getParent().exists()) {
          for (IResource element : _file.getParent().members()) {
            if (element.getType() == IResource.FILE) {
              IFile file = (IFile) element;
              String fileExtension = file.getFileExtension();
              if (fileExtension != null && file.getFileExtension().matches("(xml|html|xhtml|wod)") && !file.getCharset().equals(encoding)) {
                problems.add(new WodProblem("WOO Encoding type " + encoding + " doesn't match " + file.getName() + " of " + file.getCharset(), null, 0, true));
              }
            }
          }
        }
 
      }
      catch (CoreException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
    }

    if (type == null) {
      if (getDisplayGroups().length != 0) {
        problems.add(new WodProblem("Display groups are defined for component " + _file.getParent().getName() + " but class was not found", null, 0, false));
      }
      return problems;
    }

    for (DisplayGroup displayGroup : getDisplayGroups()) {
      try {
        if (type != null) {

          // Validate WODisplayGroup variable is declared.
          BindingValueKeyPath bindingValueKeyPath = new BindingValueKeyPath(displayGroup.getName(), type, type.getJavaProject(), WodParserCache.getTypeCache());
          if (!(bindingValueKeyPath.isValid() && !bindingValueKeyPath.isAmbiguous())) {
            //XXX Walk type hierarchy and check that is a WODisplayGroup
            problems.add(new WodProblem("WODisplayGroup " + displayGroup.getName() + " is configured but not declared in class", null, 0, false));
          }

          if (!displayGroup.isHasMasterDetail()) {
          // Validate editing context
          bindingValueKeyPath = new BindingValueKeyPath(displayGroup.getEditingContext(), type, type.getJavaProject(), WodParserCache.getTypeCache());
          if (!(bindingValueKeyPath.isValid() && !bindingValueKeyPath.isAmbiguous())) {
            problems.add(new WodProblem("Editing context for display group " + displayGroup.getName() + " not found", null, 0, false));
          }
          }
        }
      }
      catch (JavaModelException e) {
View Full Code Here

        }
        try {
          wooModel.loadModelFromStream(wooFile.getContents());
        }
        catch (Throwable e) {
          WodModelUtils.createMarker(wooFile, new WodProblem(e.getMessage(), null, 0, false));
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.bindings.wod.WodProblem

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.