Package com.intellij.struts2.dom.struts.strutspackage

Examples of com.intellij.struts2.dom.struts.strutspackage.ResultType


        if (o instanceof Result) {
          final Result result = (Result) o;
          final PathReference pathReference = result.getValue();
          final String displayPath = pathReference != null ? pathReference.getPath() : "???";
          final ResultType resultType = result.getEffectiveResultType();
          final String resultTypeValue = resultType != null ? resultType.getName().getStringValue() : "???";

          final DocumentationBuilder builder = new DocumentationBuilder();
          builder.addLine("Path", displayPath)
                 .addLine("Type", resultTypeValue);
          return builder.getText();
View Full Code Here


    // hack for STRPL-85: suppress <param>-highlighting within <result> for certain result-types
    if (converter instanceof ParamNameConverter) {
      final Result result = DomUtil.getParentOfType(value, Result.class, false);
      if (result != null) {
        final ResultType resultType = result.getEffectiveResultType();
        if (resultType == null) {
          return false; // error
        }

        final String resultTypeValue = resultType.getName().getStringValue();
        if (resultTypeValue != null && ResultTypeResolver.isChainOrRedirectType(resultTypeValue)) {
          return false;
        }
      }
    }

    final String stringValue = value.getStringValue();

    // suppress <action> "method" when using wildcards
    if (converter instanceof ActionMethodConverter &&
        ConverterUtil.hasWildcardReference(stringValue)) {
      return false;
    }

    // suppress <result> path
    if (converter instanceof StrutsPathReferenceConverter) {

      if (stringValue == null) {
        return false;
      }

      // nested <param>-tags are present
      if (!((ParamsElement)value).getParams().isEmpty()) {
        return false;
      }

      // unsupported result-type
      final ResultType resultType = ((HasResultType)value).getEffectiveResultType();
      if (resultType == null) {
        return false;
      }

      if (!ResultTypeResolver.hasResultTypeContributor(resultType.getName().getStringValue())) {
        return false;
      }

      // suppress paths with wildcard reference
      if (ConverterUtil.hasWildcardReference(stringValue)) {
View Full Code Here

      @Override
      public boolean process(final Action action) {
        final PsiClass actionClass = action.searchActionClass();
        if (actionClass != null) {
          for (final Result result1 : action.getResults()) {
            final ResultType resultType = result1.getEffectiveResultType();
            if (resultType != null &&
                FreeMarkerStrutsResultContributor.FREEMARKER.equals(resultType.getName().getStringValue())) {
              final PathReference reference = result1.getValue();
              final PsiElement target = reference == null ? null : reference.resolve();
              if (target != null &&
                  (file.getManager().areElementsEquivalent(file, target) ||
                   file.getManager().areElementsEquivalent(file.getOriginalFile(), target))) {
View Full Code Here

    }

    assert resultElement instanceof HasResultType : "not instance of HasResultType: " + resultElement +
                                                    ", text: " + psiElement.getText();

    final ResultType effectiveResultType = ((HasResultType) resultElement).getEffectiveResultType();
    if (effectiveResultType == null) {
      return null;
    }

    final String resultType = effectiveResultType.getName().getStringValue();
    if (resultType == null ||
        !matchesResultType(resultType)) {
      return null;
    }
View Full Code Here

*/
public abstract class ResultImpl implements Result {

  @Nullable
  public PsiClass getParamsClass() {
    final ResultType type = getEffectiveResultType();
    return type != null ? type.getResultTypeClass().getValue() : null;
  }
View Full Code Here

    final Ref<ResultType> resolveResult = new Ref<ResultType>();
    final Processor<StrutsPackage> processor = new Processor<StrutsPackage>() {
      @Override
      public boolean process(final StrutsPackage strutsPackage) {
        final ResultType result = ContainerUtil.find(strutsPackage.getResultTypes(), nameCondition);
        if (result != null) {
          resolveResult.set(result);
          return false;
        }
View Full Code Here

*/
public abstract class GlobalResultImpl implements GlobalResult {

  @Nullable
  public PsiClass getParamsClass() {
    final ResultType resultType = getType().getValue();
    return resultType != null ? resultType.getResultTypeClass().getValue() : null;
  }
View Full Code Here

    return resultType != null ? resultType.getResultTypeClass().getValue() : null;
  }

  @Nullable
  public ResultType getEffectiveResultType() {
    final ResultType resultType = getType().getValue();
    if (resultType != null) {
      return resultType;
    }

    final StrutsPackage strutsPackage = getParentOfType(StrutsPackage.class, true);
View Full Code Here

    }

    final List<HasResultType> variants = new ArrayList<HasResultType>();
    variants.addAll(action.getResults()); // Action-local first

    final StrutsPackage strutsPackage = action.getStrutsPackage();
    final GlobalResults globalResults = strutsPackage.getGlobalResults();
    variants.addAll(globalResults.getResults());

    return variants;
  }
View Full Code Here

  private static void registerDocumentationProviders() {
    ElementPresentationManager.registerDocumentationProvider(new NullableFunction<Object, String>() {
      public String fun(final Object o) {
        if (o instanceof Action) {
          final Action action = (Action) o;
          final StrutsPackage strutsPackage = action.getStrutsPackage();

          final DocumentationBuilder builder = new DocumentationBuilder();
          final PsiClass actionClass = action.searchActionClass();
          builder.addLine("Action", action.getName().getStringValue())
                 .addLine("Class", actionClass != null ? actionClass.getQualifiedName() : null)
                 .addLine("Method", action.getMethod().getStringValue())
                 .addLine("Package", strutsPackage.getName().getStringValue())
                 .addLine("Namespace", strutsPackage.searchNamespace());

          return builder.getText();
        }

        if (o instanceof Result) {
View Full Code Here

TOP

Related Classes of com.intellij.struts2.dom.struts.strutspackage.ResultType

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.