Package com.intellij.struts2.dom.struts.constant

Examples of com.intellij.struts2.dom.struts.constant.Constant


    final PsiElement value = attributeElement.getPsiElement();
    if (value == null) {
      return null;
    }

    final StrutsManager instance = StrutsManager.getInstance(value.getProject());
    return instance.getCombinedModel(value);
  }
View Full Code Here


    if (module == null ||
        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);
View Full Code Here

   * @param psiFile Context file.
   * @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);
    }
    return model;
  }
View Full Code Here

* @author Dmitry Avdeev
*/
public class Struts2UrlConverter extends DeployedFileUrlConverter {

  public Collection<String> getTargetPaths(@NotNull final PsiFile sourceFile, @NotNull final WebFacet webFacet) {
    final StrutsModel combinedModel = StrutsManager.getInstance(sourceFile.getProject()).getCombinedModel(webFacet.getModule());
    if (combinedModel == null) {
      return Collections.emptyList();
    }

    final List<String> actionExtensions = StrutsConstantHelper.getActionExtensions(sourceFile);
    if (actionExtensions.isEmpty()) {
      return Collections.emptyList();
    }

    final String actionExtension = actionExtensions.get(0);

    @NonNls final ArrayList<String> list = new ArrayList<String>();
    combinedModel.processActions(new Processor<Action>() {
      public boolean process(final Action action) {
        for (final Result result : action.getResults()) {
          final PathReference pathReference = result.getValue();
          if (pathReference != null) {
            final PsiElement psiElement = pathReference.resolve();
View Full Code Here

        psiClass.hasModifierProperty(PsiModifier.ABSTRACT) ||
        !JamCommonUtil.isPlainJavaFile(psiClass.getContainingFile())) {
      return null;
    }

    final StrutsModel strutsModel = StrutsManager.getInstance(psiClass.getProject()).getCombinedModel(module);
    if (strutsModel == null ||
        !strutsModel.isActionClass(psiClass)) {
      return null;
    }

    final LayeredIcon layeredIcon = new LayeredIcon(2);
    final Icon original = PsiClassImplUtil.getClassIcon(flags, psiClass);
View Full Code Here

    myEdges.add(edge);
  }

  private void updateDataModel() {
    final StrutsModel model = StrutsManager.getInstance(myProject).getModelByFile(myFile);
    if (model == null) {
      return;
    }

    for (final StrutsPackage strutsPackage : model.getStrutsPackages()) {
      for (final Action action : strutsPackage.getActions()) {
        final ActionNode actionNode = new ActionNode(action, action.getName().getStringValue());
        addNode(actionNode);

        for (final Result result : action.getResults()) {
View Full Code Here

   * @param context Invoking context.
   * @return <code>null</code> if no StrutsModel found in current file/module.
   */
  @Nullable
  public static StrutsModel getStrutsModelOrCombined(final ConvertContext context) {
    final StrutsModel modelByFile = getStrutsModel(context);
    if (modelByFile != null) {
      return modelByFile;
    }

    return StrutsManager.getInstance(context.getFile().getProject()).getCombinedModel(context.getModule());
View Full Code Here

  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

TOP

Related Classes of com.intellij.struts2.dom.struts.constant.Constant

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.