Package com.intellij.struts2.dom.struts.constant

Examples of com.intellij.struts2.dom.struts.constant.Constant


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


        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

    }

    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

   * @param context Invoking context.
   * @return Parent package.
   */
  @NotNull
  public static StrutsPackage getCurrentStrutsPackage(final ConvertContext context) {
    final StrutsPackage strutsPackage = DomUtil.getParentOfType(context.getInvocationElement(),
                                                                StrutsPackage.class,
                                                                true);
    assert strutsPackage != null : context.getInvocationElement();
    return strutsPackage;
  }
View Full Code Here

    return resolveResult.get();
  }

  private static StrutsPackage getCurrentStrutsPackage(final ConvertContext context) {
    final StrutsPackage strutsPackage = DomUtil.getParentOfType(context.getInvocationElement(),
                                                                StrutsPackage.class,
                                                                true);
    assert strutsPackage != null : context.getInvocationElement();
    return strutsPackage;
  }
View Full Code Here

    return ActionUtil.matchesPath(myPath, path);
  }

  @NotNull
  public StrutsPackage getStrutsPackage() {
    final StrutsPackage strutsPackage = DomUtil.getParentOfType(this, StrutsPackage.class, true);
    if (strutsPackage == null) {
      throw new IllegalStateException("could not resolve enclosing <package> for " + this + " (" + getNameValue() + ")");
    }
    return strutsPackage;
  }
View Full Code Here

TOP

Related Classes of com.intellij.struts2.dom.struts.constant.Constant

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.