Package com.intellij.struts2.dom.struts

Examples of com.intellij.struts2.dom.struts.IncludeFileResolvingConverter


    return strutsPackage != null ? strutsPackage.getXmlTag() : null;
  }

  private static Collection<StrutsPackage> removeCurrentElementFromVariants(final ConvertContext context,
                                                                            final Collection<StrutsPackage> allVariants) {
    final StrutsPackage currentElement = (StrutsPackage)DomUtil.getDomElement(context.getTag());
    assert currentElement != null : "currentElement was null for " + context.getTag();
    final GenericDomValue currentNameElement = currentElement.getGenericInfo().getNameDomElement(currentElement);
    if (currentNameElement == null) {
      return allVariants; // skip due to XML errors
    }

    final String currentName = currentNameElement.getStringValue();
    if (currentName == null) {
      return allVariants; // skip due to XML errors
    }

    final StrutsPackage currentElementInVariants = DomUtil.findByName(allVariants, currentName);
    if (currentElementInVariants != null) {
      allVariants.remove(currentElementInVariants);
    }

    return allVariants;
View Full Code Here


    if (resultType == null ||
        !matchesResultType(resultType)) {
      return null;
    }

    final StrutsPackage strutsPackage = resultElement.getParentOfType(StrutsPackage.class, true);
    if (strutsPackage == null) {
      return null; // XML syntax error
    }

    return strutsPackage.searchNamespace();
  }
View Full Code Here

public abstract class StrutsPackageImpl extends BaseImpl implements StrutsPackage {

  @NotNull
  public String searchNamespace() {
    final Ref<String> result = new Ref<String>();
    final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(this, new Processor<StrutsPackage>() {
      @Override
      public boolean process(final StrutsPackage strutsPackage) {
        if (DomUtil.hasXml(strutsPackage.getNamespace())) {
          result.set(strutsPackage.getNamespace().getStringValue());
          return false;
        }
        return true;
      }
    });
    walker.walkUp();

    return result.isNull() ? DEFAULT_NAMESPACE : result.get();
  }
View Full Code Here

  }

  @Nullable
  public DefaultClassRef searchDefaultClassRef() {
    final Ref<DefaultClassRef> result = new Ref<DefaultClassRef>();
    final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(this, new Processor<StrutsPackage>() {
      @Override
      public boolean process(final StrutsPackage strutsPackage) {
        if (DomUtil.hasXml(strutsPackage.getDefaultClassRef())) {
          result.set(strutsPackage.getDefaultClassRef());
          return false;
        }
        return true;
      }
    });
    walker.walkUp();

    return result.get();
  }
View Full Code Here

        new CachedValueProvider<ResultType>() {
          @Nullable
          @Override
          public Result<ResultType> compute() {
            final Ref<ResultType> result = new Ref<ResultType>();
            final StrutsPackageHierarchyWalker walker =
              new StrutsPackageHierarchyWalker(StrutsPackageImpl.this, new Processor<StrutsPackage>() {
                @Override
                public boolean process(final StrutsPackage strutsPackage) {
                  final List<ResultType> resultTypes = strutsPackage.getResultTypes();
                  for (final ResultType resultType : resultTypes) {
                    final GenericAttributeValue<Boolean> defaultAttribute = resultType.getDefault();
                    if (DomUtil.hasXml(defaultAttribute) &&
                        defaultAttribute.getValue() == Boolean.TRUE) {
                      result.set(resultType);
                      return false;
                    }
                  }
                  return true;
                }
              });
            walker.walkUp();

            return Result.createSingleDependency(result.get(), PsiModificationTracker.MODIFICATION_COUNT);
          }
        }, false);
    }
View Full Code Here

        results.addAll(strutsPackage.getInterceptorStacks());
        return true;
      }
    };

    final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(getCurrentStrutsPackage(context),
                                                                                 processor);
    walker.walkUp();

    return results;
  }
View Full Code Here

          return false;
        }
        return true;
      }
    };
    final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(getCurrentStrutsPackage(context),
                                                                                 processor);
    walker.walkUp();

    return resolveResult.get();
  }
View Full Code Here

          ValidatorModelInspection.class, ValidatorConfigModelInspection.class);
  }

  public Collection<VirtualFile> getFilesToProcess(final Project project, final CompileContext context) {
    final PsiManager psiManager = PsiManager.getInstance(project);
    final ValidatorManager validatorManager = ValidatorManager.getInstance(project);

    // cache S2facet/validation settings per module
    @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
    final FactoryMap<Module, Boolean> enabledForModule = new FactoryMap<Module, Boolean>() {
      protected Boolean create(final Module module) {
        return isEnabledForModule(module) &&
               StrutsFacet.getInstance(module) != null;
      }
    };

    // collect all validation.xml files located in sources of S2-modules
    final Set<VirtualFile> files = new THashSet<VirtualFile>();
    for (final VirtualFile file : context.getProjectCompileScope().getFiles(StdFileTypes.XML, true)) {
      if (StringUtil.endsWith(file.getName(), FILENAME_EXTENSION_VALIDATION_XML)) {
        final PsiFile psiFile = psiManager.findFile(file);
        if (psiFile instanceof XmlFile &&
            validatorManager.isValidatorsFile((XmlFile) psiFile)) {
          final Module module = ModuleUtilCore.findModuleForFile(file, project);
          if (module != null &&
              enabledForModule.get(module)) {
            files.add(file);
          }
        }
      }
    }

    // add validator-config.xml if not default one from xwork.jar
    final Set<VirtualFile> descriptorFiles = new THashSet<VirtualFile>();
    for (final Module module : ModuleManager.getInstance(project).getModules()) {
      if (enabledForModule.get(module)) {
        final PsiFile psiFile = validatorManager.getValidatorConfigFile(module);
        if (psiFile != null &&
            validatorManager.isCustomValidatorConfigFile(psiFile)) {
          InspectionValidatorUtil.addFile(descriptorFiles, psiFile);
        }
      }
    }
    files.addAll(InspectionValidatorUtil.expandCompileScopeIfNeeded(descriptorFiles, context));
View Full Code Here

    final Module module = context.getModule();
    if (module == null) {
      return Collections.emptyList();
    }

    final ValidatorManager validatorManager = ValidatorManager.getInstance(module.getProject());
    return validatorManager.getValidators(module);
  }
View Full Code Here

    if (o instanceof Field) {
      return ((Field) o).getName().getStringValue();
    }

    if (o instanceof FieldValidator) {
      final ValidatorConfig validatorConfig = ((FieldValidator) o).getType().getValue();
      return validatorConfig != null ? validatorConfig.getName().getStringValue() : null;
    }

    if (o instanceof Message) {
      final String key = ((Message) o).getKey().getStringValue();
      return StringUtil.isNotEmpty(key) ? key : ((Message) o).getValue();
View Full Code Here

TOP

Related Classes of com.intellij.struts2.dom.struts.IncludeFileResolvingConverter

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.