Package com.intellij.psi.impl.source.jsp

Examples of com.intellij.psi.impl.source.jsp.WebDirectoryUtil


          struts2TilesModels.add(new TilesModelImpl(definitions, domFileElement, STRUTS2_TILES_MODEL));
        }
      }
    };

    final WebDirectoryUtil webDirectoryUtil = WebDirectoryUtil.getWebDirectoryUtil(project);
    final Collection<WebFacet> webFacets = WebFacet.getInstances(module);
    for (final WebFacet webFacet : webFacets) {
      final WebApp webApp = webFacet.getRoot();
      if (webApp == null) {
        continue;
      }

      // determine configured tiles config files
      @NonNls final Set<String> tilesConfigNames = findConfiguredTilesPaths(webApp);

      // no configured paths? use default
      if (tilesConfigNames.isEmpty()) {
        tilesConfigNames.add(DEFAULT_TILES_XML);
      }

      // resolve to XmlFile
      final Set<XmlFile> tilesFileSet = new HashSet<XmlFile>();
      for (final String tilesPath : tilesConfigNames) {
        final PsiElement tilesXmlFile = webDirectoryUtil.findFileByPath(tilesPath, webFacet);
        if (tilesXmlFile instanceof XmlFile) {
          tilesFileSet.add((XmlFile) tilesXmlFile);
        }
      }
View Full Code Here


   */
  public static void addWebDirectoryAndCurrentNamespaceAsRoots(final PsiElement psiElement,
                                                               final String namespace,
                                                               final WebFacet webFacet,
                                                               final FileReferenceSet set) {
    final WebDirectoryUtil directoryUtil = WebDirectoryUtil.getWebDirectoryUtil(psiElement.getProject());
    set.addCustomization(
        FileReferenceSet.DEFAULT_PATH_EVALUATOR_OPTION,
        new Function<PsiFile, Collection<PsiFileSystemItem>>() {
          public Collection<PsiFileSystemItem> fun(final PsiFile file) {
            final List<PsiFileSystemItem> basePathRoots = new ArrayList<PsiFileSystemItem>();

            // 1. add all configured web root mappings
            final List<WebRoot> webRoots = webFacet.getWebRoots(true);
            for (final WebRoot webRoot : webRoots) {
              final String webRootPath = webRoot.getRelativePath();
              final WebDirectoryElement webRootBase =
                  directoryUtil.findWebDirectoryElementByPath(webRootPath, webFacet);
              ContainerUtil.addIfNotNull(webRootBase, basePathRoots);
            }

            // 2. add parent <package> "namespace" as result prefix directory path if not ROOT
            if (!Comparing.equal(namespace, StrutsPackage.DEFAULT_NAMESPACE)) {
              final WebDirectoryElement packageBase =
                  directoryUtil.findWebDirectoryElementByPath(namespace, webFacet);
              ContainerUtil.addIfNotNull(packageBase, basePathRoots);
            }

            return basePathRoots;
          }
View Full Code Here

TOP

Related Classes of com.intellij.psi.impl.source.jsp.WebDirectoryUtil

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.