Package com.intellij.struts2.model.constant

Examples of com.intellij.struts2.model.constant.StrutsConstant


      @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


    }

    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

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

TOP

Related Classes of com.intellij.struts2.model.constant.StrutsConstant

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.