Package com.intellij.struts2.dom.struts.action

Examples of com.intellij.struts2.dom.struts.action.Action


  public String getErrorMessage(@Nullable final String s, final ConvertContext convertContext) {
    return "Cannot resolve Struts package '" + s + "'";
  }

  private static List<StrutsPackage> getStrutsPackages(final ConvertContext convertContext) {
    final StrutsModel model = ConverterUtil.getStrutsModelOrCombined(convertContext);
    if (model == null) {
      return Collections.emptyList();
    }

    return model.getStrutsPackages();
  }
View Full Code Here


  @NotNull
  public PsiReference[] getReferencesByElement(@NotNull final PsiElement psiElement,
                                               @NotNull final ProcessingContext context) {
    final StrutsManager strutsManager = StrutsManager.getInstance(psiElement.getProject());
    final StrutsModel strutsModel = strutsManager.getCombinedModel(psiElement);
    if (strutsModel == null) {
      return PsiReference.EMPTY_ARRAY;
    }

    final XmlAttributeValue xmlAttributeValue = (XmlAttributeValue) psiElement;
    final String path = xmlAttributeValue.getValue();

    // resolve to <action>
    final String actionName = TaglibUtil.trimActionPath(path);
    final String namespace = getNamespace(xmlAttributeValue);
    final List<Action> actions = strutsModel.findActionsByName(actionName, namespace);
    final Action action = actions.isEmpty() ? null : actions.get(0);

    final int bangIndex = StringUtil.indexOf(path, TaglibUtil.BANG_SYMBOL);
    if (bangIndex == -1) {
      return new PsiReference[]{new ActionReference(xmlAttributeValue, action, namespace, strutsModel)};
View Full Code Here

  @NotNull
  public PsiReference[] getReferencesByElement(@NotNull final PsiElement psiElement,
                                               @NotNull final ProcessingContext context) {

    final StrutsManager strutsManager = StrutsManager.getInstance(psiElement.getProject());
    final StrutsModel strutsModel = strutsManager.getCombinedModel(psiElement);
    if (strutsModel == null) {
      return PsiReference.EMPTY_ARRAY;
    }

    return new PsiReference[]{new NamespaceReference((XmlAttributeValue) psiElement, strutsModel)
View Full Code Here

        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

TOP

Related Classes of com.intellij.struts2.dom.struts.action.Action

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.