Package org.objectstyle.wolips.bindings.api

Examples of org.objectstyle.wolips.bindings.api.Wo


  }

  public Wo getApi(IJavaProject javaProject, TypeCache cache) throws JavaModelException, ApiModelException {
    String elementTypeName = getElementType();
    IType elementType = BindingReflectionUtils.findElementType(javaProject, elementTypeName, false, cache);
    Wo wo = ApiUtils.findApiModelWo(elementType, cache.getApiCache(javaProject));
    return wo;
  }
View Full Code Here


      if (BindingReflectionUtils.memberIsDeprecated(elementType)) {
        problems.add(new WodElementDeprecationProblem(this, "The component named '" + elementTypeName + "' is deprecated.", getElementTypePosition(), lineNumber, PreferenceConstants.WARNING.equals(deprecationSeverity)));
      }
    }

    Wo wo = null;
    if (!PreferenceConstants.IGNORE.equals(wodMissingComponentSeverity)) {
      IType elementType = BindingReflectionUtils.findElementType(javaProject, elementTypeName, false, typeCache);
      if (elementType == null || (!elementType.getElementName().equals(elementTypeName) && !elementType.getFullyQualifiedName().equals(elementTypeName))) {
        problems.add(new WodElementProblem(this, "The class for '" + elementTypeName + "' is either missing or does not extend WOElement.", getElementTypePosition(), lineNumber, PreferenceConstants.WARNING.equals(wodMissingComponentSeverity)));
      }
      else {
        String wodApiProblemSeverity = Activator.getDefault().getPluginPreferences().getString(PreferenceConstants.WOD_API_PROBLEMS_SEVERITY_KEY);
        if (!PreferenceConstants.IGNORE.equals(wodApiProblemSeverity)) {
          try {
            wo = ApiUtils.findApiModelWo(elementType, typeCache.getApiCache(javaProject));
            if (wo != null) {
              Map<String, String> bindingsMap = getBindingsMap();
              List<Binding> bindings = wo.getBindings();
              for (Binding binding : bindings) {
                String bindingName = binding.getName();
                if (binding.isExplicitlyRequired() && !bindingsMap.containsKey(bindingName)) {
                  problems.add(new ApiBindingValidationProblem(this, binding, getElementNamePosition(), lineNumber, PreferenceConstants.WARNING.equals(wodApiProblemSeverity)));
                }
              }
              List<Validation> failedValidations = wo.getFailedValidations(bindingsMap);
              for (Validation failedValidation : failedValidations) {
                problems.add(new ApiElementValidationProblem(this, failedValidation, getElementNamePosition(), lineNumber, PreferenceConstants.WARNING.equals(wodApiProblemSeverity)));
              }
            }
          }
          catch (Throwable e) {
            Activator.getDefault().log(e);
          }
        }
      }
    }

    Set<String> bindingNames = new HashSet<String>();
    Iterator<IWodBinding> checkForDuplicateBindingsIter = getBindings().iterator();
    while (checkForDuplicateBindingsIter.hasNext()) {
      IWodBinding binding = checkForDuplicateBindingsIter.next();
      String bindingName = binding.getName();
      if (bindingNames.contains(bindingName)) {
        problems.add(new WodBindingNameProblem(this, binding, bindingName, "Duplicate binding named '" + bindingName + "'", binding.getNamePosition(), binding.getLineNumber(), false));
      }
      else {
        bindingNames.add(bindingName);
      }
    }

    JavaModelException javaModelException = null;

    if (checkBindingValues && javaFileType != null) {
      Iterator<IWodBinding> bindingsIter = getBindings().iterator();
      while (bindingsIter.hasNext()) {
        IWodBinding binding = bindingsIter.next();
        try {
          IApiBinding apiBinding = null;
          if (wo != null) {
            apiBinding = wo.getBinding(binding.getName());
          }
          binding.fillInBindingProblems(this, apiBinding, javaProject, javaFileType, problems, typeCache, htmlCache);
        }
        catch (JavaModelException t) {
          javaModelException = t;
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.bindings.api.Wo

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.