Package com.intellij.struts2.dom.struts.model

Examples of com.intellij.struts2.dom.struts.model.StrutsManager


    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

        actionTag.getAttributeValue("name") : actionTag.getAttributeValue("action");
    if (actionName == null || TaglibUtil.isDynamicExpression(actionName)) {
      return PsiReference.EMPTY_ARRAY;
    }

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

    final List<Action> actions = strutsModel.findActionsByName(actionName, actionTag.getAttributeValue("namespace"));
View Full Code Here

    final String extension = FileUtilRt.getExtension(filename);
    if (!SUPPORTED_EXTENSIONS.contains(extension)) {
      return Collections.emptyList();
    }

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

    final List<PsiFile> allFiles = containingFile.getViewProvider().getAllFiles();
View Full Code Here

  @Nullable
  public PathReference createWebPath(final String path,
                                     @NotNull final PsiElement psiElement,
                                     final ServletMappingInfo servletMappingInfo) {
    final StrutsManager strutsManager = StrutsManager.getInstance(psiElement.getProject());
    if (strutsManager.getCombinedModel(psiElement) == null) {
      return null;
    }

    return new PathReference(path, new ConstantFunction<PathReference, Icon>(Struts2Icons.Action)); /*{
TODO not needed so far ?!
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

TOP

Related Classes of com.intellij.struts2.dom.struts.model.StrutsManager

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.