Esempio n. 1
0
  public LoadedDeclarations parse(XModelObject o, IPath source, IKbProject sp) {
    if (o == null) return null;

    if (o.getParent() instanceof FolderImpl) {
      IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(source);
      if (f != null && f.exists()) {
        try {
          ((FolderImpl) o.getParent()).updateChildFile(o, f.getLocation().toFile());
        } catch (XModelException e) {
          ModelPlugin.getPluginLog().logError(e);
        }
        if (o.getParent() == null) {
          boolean b = isLikelyComponentSource(f);
          if (!b) return null;
          o = EclipseResourceUtil.getObjectByResource(o.getModel(), f);
          if (o == null) return null;
        }
      }
    }

    LoadedDeclarations ds = new LoadedDeclarations();
    if (LibraryScanner.isTLDFile(o)) {
      parseTLD(o, source, ds);
    } else if (LibraryScanner.isFaceletTaglibFile(o)) {
      parseFaceletTaglib(o, source, ds);
    } else if (LibraryScanner.isFacesConfigFile(o)) {
      parseFacesConfig(o, source, ds);
    }
    return ds;
  }
Esempio n. 2
0
 /**
  * This method should be called only if isRelevant returns true; Makes simple check if this java
  * file contains annotation Name.
  *
  * @param resource
  * @return
  */
 public boolean isLikelyComponentSource(IFile f) {
   if (!f.isSynchronized(IFile.DEPTH_ZERO) || !f.exists()) return false;
   XModel model = InnerModelHelper.createXModel(f.getProject());
   if (model == null) return false;
   XModelObject o = EclipseResourceUtil.getObjectByResource(model, f);
   return (o != null)
       && (LibraryScanner.isTLDFile(o)
           || LibraryScanner.isFaceletTaglibFile(o)
           || LibraryScanner.isFacesConfigFile(o));
 }