Package com.intellij.struts2.reference.jsp

Examples of com.intellij.struts2.reference.jsp.ActionLinkReferenceProviderTest


        xmlTag.getAttributeValue(ACTION_ATTRIBUTE_NAME);
    if (actionPath == null) {
      return;
    }

    final StrutsModel strutsModel = StrutsManager.getInstance(element.getProject()).getCombinedModel(module);
    if (strutsModel == null) {
      return;
    }

    final String namespace = xmlTag.getAttributeValue("namespace");
    final List<Action> actions = strutsModel.findActionsByName(actionPath, namespace);
    if (actions.isEmpty()) {
      return;
    }

    // resolve to action method should be exactly 1
View Full Code Here


    return files.isEmpty() ||
           files.size() != getActionsForClazz(project, clazz, module).size();
  }

  private static List<Action> getActionsForClazz(final Project project, final PsiClass clazz, final Module module) {
    final StrutsModel model = StrutsManager.getInstance(project).getCombinedModel(module);
    if (model == null) {
      return Collections.emptyList();
    }

    return model.findActionsByClass(clazz);
  }
View Full Code Here

      final Module module = context.getModuleByFile(file);
      if (module != null &&
          enabledForModule.get(module)) {
        final PsiFile psiFile = psiManager.findFile(file);
        if (psiFile instanceof XmlFile) {
          final StrutsModel model = strutsManager.getModelByFile((XmlFile) psiFile);
          if (model != null) {
            for (final XmlFile configFile : model.getConfigFiles()) {
              ContainerUtil.addIfNotNull(configFile.getVirtualFile(), files);
            }
          }
        }
      }
View Full Code Here

        StrutsFacet.getInstance(module) == null) {
      return;
    }

    final StrutsManager strutsManager = StrutsManager.getInstance(element.getProject());
    final StrutsModel strutsModel = strutsManager.getCombinedModel(module);
    if (strutsModel == null) {
      return;
    }

    installValidationTargets(element, lineMarkerInfos, clazz);

    final List<Action> actions = strutsModel.findActionsByClass(clazz);
    if (actions.isEmpty()) {
      return;
    }

    installActionTargets(element, lineMarkerInfos, actions);
View Full Code Here

                                           final JamStringAttributeElement<InterceptorOrStackBase> context) {
    if (s == null) {
      return null;
    }

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

    return ContainerUtil.find(strutsModel.getAllInterceptorsAndStacks(), new Condition<InterceptorOrStackBase>() {
      public boolean value(final InterceptorOrStackBase interceptorOrStackBase) {
        return Comparing.strEqual(s, interceptorOrStackBase.getName().getStringValue());
      }
    });
  }
View Full Code Here

    });
  }

  @Override
  public Collection<InterceptorOrStackBase> getVariants(final JamStringAttributeElement<InterceptorOrStackBase> context) {
    final StrutsModel strutsModel = StrutsJamUtils.getStrutsModel(context);
    if (strutsModel == null) {
      return Collections.emptyList();
    }

    return strutsModel.getAllInterceptorsAndStacks();
  }
View Full Code Here

  @Override
  @Nullable
  public <T> T getConvertedValue(@NotNull final PsiElement context,
                                 @NotNull final StrutsConstantKey<T> strutsConstantKey) {
    final PsiFile containingFile = context.getContainingFile();
    final StrutsModel strutsModel = getStrutsModel(containingFile);
    if (strutsModel == null) {
      return null;
    }

    final String stringValue = getStringValue(containingFile,
                                              strutsModel,
                                              strutsConstantKey.getKey());
    if (stringValue == null) {
      return null;
    }

    final Converter<T> converter = findConverter(context, strutsConstantKey);
    if (converter == null) {
      //noinspection unchecked
      return (T) stringValue;
    }

    final DomFileElement<StrutsRoot> first = strutsModel.getRoots().iterator().next();

    final ConvertContext convertContext = ConvertContextFactory.createConvertContext(first);
    //noinspection unchecked
    return converter.fromString(stringValue, convertContext);
  }
View Full Code Here

   * @return {@code null} if no model could be determined.
   */
  @Nullable
  private static StrutsModel getStrutsModel(final PsiFile psiFile) {
    final StrutsManager strutsManager = StrutsManager.getInstance(psiFile.getProject());
    final StrutsModel model;
    if (psiFile instanceof XmlFile &&
        strutsManager.isStruts2ConfigFile((XmlFile) psiFile)) {
      model = strutsManager.getModelByFile((XmlFile) psiFile);
    } else {
      model = strutsManager.getCombinedModel(psiFile);
View Full Code Here

*/
public class UnknownHandlerRefConverterImpl extends UnknownHandlerRefConverter {

  @NotNull
  public Collection<? extends Bean> getVariants(final ConvertContext convertContext) {
    final StrutsModel model = ConverterUtil.getStrutsModel(convertContext);

    if (model == null) {
      return Collections.emptyList();
    }

View Full Code Here

  public Bean fromString(@Nullable final String name, final ConvertContext convertContext) {
    if (StringUtil.isEmpty(name)) {
      return null;
    }

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

    return ContainerUtil.find(getBeansOfTypeUnknownHandler(strutsModel), new Condition<Bean>() {
View Full Code Here

TOP

Related Classes of com.intellij.struts2.reference.jsp.ActionLinkReferenceProviderTest

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.