Examples of StrutsPackage


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

    }

    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

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

  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

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

   * @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

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

    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

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

    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

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

    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

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

    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

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

    final GenericAttributeValue<ResultType> typeAttribute = getType();
    if (DomUtil.hasXml(typeAttribute)) {
      return typeAttribute.getValue();
    }

    final StrutsPackage strutsPackage = getParentOfType(StrutsPackage.class, true);
    return strutsPackage != null ? strutsPackage.searchDefaultResultType() : null;
  }
View Full Code Here

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

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

    final StrutsPackage strutsPackage = getParentOfType(StrutsPackage.class, true);
    return strutsPackage != null ? strutsPackage.searchDefaultResultType() : null;
  }
View Full Code Here

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

    final JamParentPackage jamElement = getPackageJam("jam", JamParentPackage.META_PACKAGE);
    checkResolve(jamElement);
  }

  private static void checkResolve(@NotNull final JamParentPackage jamParentPackage) {
    final StrutsPackage strutsPackage = jamParentPackage.getValue().getValue();
    assertNotNull(strutsPackage);
    assertEquals("myPackage", strutsPackage.getName().getStringValue());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.