Search in sources :

Example 11 with StrutsPackage

use of com.intellij.struts2.dom.struts.strutspackage.StrutsPackage in project intellij-plugins by JetBrains.

the class GlobalResultImpl method getEffectiveResultType.

@Nullable
public ResultType getEffectiveResultType() {
    final ResultType resultType = getType().getValue();
    if (resultType != null) {
        return resultType;
    }
    final StrutsPackage strutsPackage = getParentOfType(StrutsPackage.class, true);
    return strutsPackage != null ? strutsPackage.searchDefaultResultType() : null;
}
Also used : StrutsPackage(com.intellij.struts2.dom.struts.strutspackage.StrutsPackage) ResultType(com.intellij.struts2.dom.struts.strutspackage.ResultType) Nullable(org.jetbrains.annotations.Nullable)

Example 12 with StrutsPackage

use of com.intellij.struts2.dom.struts.strutspackage.StrutsPackage in project intellij-plugins by JetBrains.

the class InterceptorRefResolveConverterImpl method getVariants.

@NotNull
public Collection<? extends InterceptorOrStackBase> getVariants(final ConvertContext context) {
    final List<InterceptorOrStackBase> results = new SmartList<>();
    final Processor<StrutsPackage> processor = strutsPackage -> {
        final List<InterceptorOrStackBase> allInterceptors = getAllInterceptors(strutsPackage);
        results.addAll(allInterceptors);
        return true;
    };
    final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(ConverterUtil.getCurrentStrutsPackage(context), processor);
    walker.walkUp();
    return results;
}
Also used : Collection(java.util.Collection) NonNls(org.jetbrains.annotations.NonNls) InterceptorOrStackBase(com.intellij.struts2.dom.struts.strutspackage.InterceptorOrStackBase) ContainerUtil(com.intellij.util.containers.ContainerUtil) StrutsPackageHierarchyWalker(com.intellij.struts2.dom.struts.strutspackage.StrutsPackageHierarchyWalker) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) SmartList(com.intellij.util.SmartList) Processor(com.intellij.util.Processor) StrutsPackage(com.intellij.struts2.dom.struts.strutspackage.StrutsPackage) ConverterUtil(com.intellij.struts2.dom.ConverterUtil) InterceptorRefResolveConverter(com.intellij.struts2.dom.struts.strutspackage.InterceptorRefResolveConverter) ConvertContext(com.intellij.util.xml.ConvertContext) NotNull(org.jetbrains.annotations.NotNull) Ref(com.intellij.openapi.util.Ref) Condition(com.intellij.openapi.util.Condition) StrutsPackageHierarchyWalker(com.intellij.struts2.dom.struts.strutspackage.StrutsPackageHierarchyWalker) InterceptorOrStackBase(com.intellij.struts2.dom.struts.strutspackage.InterceptorOrStackBase) List(java.util.List) SmartList(com.intellij.util.SmartList) StrutsPackage(com.intellij.struts2.dom.struts.strutspackage.StrutsPackage) SmartList(com.intellij.util.SmartList) NotNull(org.jetbrains.annotations.NotNull)

Example 13 with StrutsPackage

use of com.intellij.struts2.dom.struts.strutspackage.StrutsPackage in project intellij-plugins by JetBrains.

the class ResultImpl method getEffectiveResultType.

@Nullable
public ResultType getEffectiveResultType() {
    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;
}
Also used : StrutsPackage(com.intellij.struts2.dom.struts.strutspackage.StrutsPackage) ResultType(com.intellij.struts2.dom.struts.strutspackage.ResultType) Nullable(org.jetbrains.annotations.Nullable)

Example 14 with StrutsPackage

use of com.intellij.struts2.dom.struts.strutspackage.StrutsPackage in project intellij-plugins by JetBrains.

the class ResultTypeResolvingConverterImpl method getVariants.

@NotNull
public Collection<? extends ResultType> getVariants(final ConvertContext context) {
    final List<ResultType> results = new SmartList<>();
    final Processor<StrutsPackage> processor = strutsPackage -> {
        results.addAll(strutsPackage.getResultTypes());
        return true;
    };
    final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(ConverterUtil.getCurrentStrutsPackage(context), processor);
    walker.walkUp();
    return results;
}
Also used : StringUtil(com.intellij.openapi.util.text.StringUtil) Collection(java.util.Collection) NonNls(org.jetbrains.annotations.NonNls) ContainerUtil(com.intellij.util.containers.ContainerUtil) StrutsPackageHierarchyWalker(com.intellij.struts2.dom.struts.strutspackage.StrutsPackageHierarchyWalker) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) Comparing(com.intellij.openapi.util.Comparing) SmartList(com.intellij.util.SmartList) ResultType(com.intellij.struts2.dom.struts.strutspackage.ResultType) Processor(com.intellij.util.Processor) StrutsPackage(com.intellij.struts2.dom.struts.strutspackage.StrutsPackage) ConverterUtil(com.intellij.struts2.dom.ConverterUtil) ResultTypeResolvingConverter(com.intellij.struts2.dom.struts.action.ResultTypeResolvingConverter) ConvertContext(com.intellij.util.xml.ConvertContext) NotNull(org.jetbrains.annotations.NotNull) Ref(com.intellij.openapi.util.Ref) Condition(com.intellij.openapi.util.Condition) StrutsPackageHierarchyWalker(com.intellij.struts2.dom.struts.strutspackage.StrutsPackageHierarchyWalker) StrutsPackage(com.intellij.struts2.dom.struts.strutspackage.StrutsPackage) ResultType(com.intellij.struts2.dom.struts.strutspackage.ResultType) SmartList(com.intellij.util.SmartList) NotNull(org.jetbrains.annotations.NotNull)

Example 15 with StrutsPackage

use of com.intellij.struts2.dom.struts.strutspackage.StrutsPackage in project intellij-plugins by JetBrains.

the class StrutsPackageImpl method searchNamespace.

@NotNull
public String searchNamespace() {
    final Ref<String> result = new Ref<>();
    final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(this, strutsPackage -> {
        if (DomUtil.hasXml(strutsPackage.getNamespace())) {
            result.set(strutsPackage.getNamespace().getStringValue());
            return false;
        }
        return true;
    });
    walker.walkUp();
    return result.isNull() ? DEFAULT_NAMESPACE : result.get();
}
Also used : StrutsPackageHierarchyWalker(com.intellij.struts2.dom.struts.strutspackage.StrutsPackageHierarchyWalker) DefaultClassRef(com.intellij.struts2.dom.struts.strutspackage.DefaultClassRef) Ref(com.intellij.openapi.util.Ref) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

StrutsPackage (com.intellij.struts2.dom.struts.strutspackage.StrutsPackage)17 Nullable (org.jetbrains.annotations.Nullable)11 NotNull (org.jetbrains.annotations.NotNull)10 Ref (com.intellij.openapi.util.Ref)9 StrutsPackageHierarchyWalker (com.intellij.struts2.dom.struts.strutspackage.StrutsPackageHierarchyWalker)9 Processor (com.intellij.util.Processor)7 List (java.util.List)7 Condition (com.intellij.openapi.util.Condition)6 ResultType (com.intellij.struts2.dom.struts.strutspackage.ResultType)6 SmartList (com.intellij.util.SmartList)6 ContainerUtil (com.intellij.util.containers.ContainerUtil)6 ConvertContext (com.intellij.util.xml.ConvertContext)6 Collection (java.util.Collection)6 NonNls (org.jetbrains.annotations.NonNls)6 ConverterUtil (com.intellij.struts2.dom.ConverterUtil)4 StrutsModel (com.intellij.struts2.dom.struts.model.StrutsModel)3 DefaultClassRef (com.intellij.struts2.dom.struts.strutspackage.DefaultClassRef)3 InterceptorOrStackBase (com.intellij.struts2.dom.struts.strutspackage.InterceptorOrStackBase)3 InterceptorStack (com.intellij.struts2.dom.struts.strutspackage.InterceptorStack)3 DomUtil (com.intellij.util.xml.DomUtil)3