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

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


  protected StrutsPackage convertString(@Nullable final String name, ConvertContext context) {
    if (name == null) {
      return null;
    }

    final StrutsModel strutsModel = ConverterUtil.getStrutsModel(context);
    if (strutsModel == null) {
      return null;
    }

    return ContainerUtil.find(strutsModel.getStrutsPackages(), new Condition<StrutsPackage>() {
      public boolean value(final StrutsPackage strutsPackage) {
        return Comparing.equal(name, strutsPackage.getName().getStringValue());
      }
    });
  }
View Full Code Here


    });
  }

  @Override
  protected Object[] getReferenceVariants(ConvertContext context, GenericDomValue<List<StrutsPackage>> genericDomValue) {
    final StrutsModel strutsModel = ConverterUtil.getStrutsModel(context);
    if (strutsModel == null) {
      return ArrayUtil.EMPTY_OBJECT_ARRAY;
    }

    final Collection<StrutsPackage> variants = removeCurrentElementFromVariants(context, strutsModel.getStrutsPackages());
    return ElementPresentationManager.getInstance().createVariants(variants);
  }
View Full Code Here

    if (DomUtil.hasXml(actionClassAttribute)) {
      return actionClassAttribute.getValue();
    }

    // resolve parent package <default-class-ref> (walk upwards)
    final DefaultClassRef ref = getStrutsPackage().searchDefaultClassRef();
    if (ref != null) {
      return ref.getDefaultClass().getValue();
    }

    // nothing found in parents --> error highlighting
    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

    if (!(paramsElement instanceof InterceptorRef)) {
      return PsiReference.EMPTY_ARRAY;
    }

    InterceptorRef interceptorRef = (InterceptorRef) paramsElement;
    final InterceptorOrStackBase value = interceptorRef.getName().getValue();
    if (!(value instanceof InterceptorStack)) {
      return PsiReference.EMPTY_ARRAY;
    }

    final String text = nameAttributeValue.getValue();
View Full Code Here

    public PsiElement resolve() {
      if (resolvedInterceptorRef == null) {
        return null;
      }

      final InterceptorOrStackBase interceptorDeclaration = resolvedInterceptorRef.getName().getValue();
      if (interceptorDeclaration == null) {
        return null;
      }

      final DomTarget domTarget = DomTarget.getTarget(interceptorDeclaration);
View Full Code Here

    @Override
    public Object[] getVariants() {
      final List<InterceptorRef> allInterceptorRefs = interceptorStack.getInterceptorRefs();
      List<LookupElement> names = new ArrayList<LookupElement>(allInterceptorRefs.size());
      for (InterceptorRef interceptorRef : allInterceptorRefs) {
        final InterceptorOrStackBase resolvedInterceptor = interceptorRef.getName().getValue();
        if (resolvedInterceptor == null) {
          continue;
        }

        final String interceptorName = StringUtil.notNullize(resolvedInterceptor.getName().getStringValue());
        names.add(LookupElementBuilder.create(resolvedInterceptor, interceptorName)
                                      .withIcon(ElementPresentationManager.getIcon(resolvedInterceptor)));
      }
      return ArrayUtil.toObjectArray(names, LookupElement.class);
    }
View Full Code Here

*/
public abstract class InterceptorRefImpl implements InterceptorRef {

  @Nullable
  public PsiClass getParamsClass() {
    final InterceptorOrStackBase interceptorOrStack = getName().getValue();
    if (interceptorOrStack instanceof Interceptor) {
      return ((Interceptor) interceptorOrStack).getInterceptorClass().getValue();
    }
    return null;
  }
View Full Code Here

                                            final DomElement paramsElement) {
    if (!(paramsElement instanceof InterceptorRef)) {
      return PsiReference.EMPTY_ARRAY;
    }

    InterceptorRef interceptorRef = (InterceptorRef) paramsElement;
    final InterceptorOrStackBase value = interceptorRef.getName().getValue();
    if (!(value instanceof InterceptorStack)) {
      return PsiReference.EMPTY_ARRAY;
    }

    final String text = nameAttributeValue.getValue();
    final boolean hasDot = StringUtil.containsChar(text, '.');
    final int idx = hasDot ? text.indexOf('.') : text.length();
    final String refName = text.substring(0, idx);

    final InterceptorStack stack = (InterceptorStack) value;
    final InterceptorRef resolvedInterceptorRef =
        ContainerUtil.find(stack.getInterceptorRefs(), new Condition<InterceptorRef>() {
          @Override
          public boolean value(final InterceptorRef ref) {
            return Comparing.strEqual(refName, ref.getName().getStringValue());
          }
        });

    final List<PsiReference> customReferences = new ArrayList<PsiReference>(2);
    customReferences.add(new InterceptorRefPsiReference(nameAttributeValue,
                                                        TextRange.from(1, idx),
                                                        resolvedInterceptorRef,
                                                        stack));

    if (resolvedInterceptorRef == null) {
      return ArrayUtil.toObjectArray(customReferences, PsiReference.class);
    }

    final String propertyText = text.substring(idx + 1, text.length());
    final PsiClass paramsClass = resolvedInterceptorRef.getParamsClass();
    final BeanPropertyPathReferenceSet beanPropertyPathReferenceSet =
        new BeanPropertyPathReferenceSet(propertyText, nameAttributeValue, idx + 2, '.', paramsClass, false);

    Collections.addAll(customReferences, beanPropertyPathReferenceSet.getPsiReferences());
View Full Code Here

    final String text = nameAttributeValue.getValue();
    final boolean hasDot = StringUtil.containsChar(text, '.');
    final int idx = hasDot ? text.indexOf('.') : text.length();
    final String refName = text.substring(0, idx);

    final InterceptorStack stack = (InterceptorStack) value;
    final InterceptorRef resolvedInterceptorRef =
        ContainerUtil.find(stack.getInterceptorRefs(), new Condition<InterceptorRef>() {
          @Override
          public boolean value(final InterceptorRef ref) {
            return Comparing.strEqual(refName, ref.getName().getStringValue());
          }
        });
View Full Code Here

TOP

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

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.