public static XModelObject getJarEntryObject(IProject p, String jarFile, String entry) { if (p == null) { IFile f = EclipseResourceUtil.getFile(jarFile); if (f == null) return null; p = f.getProject(); } if (p == null) return null; IModelNature n = EclipseResourceUtil.getModelNature(p); XModel model = null; if (n != null) { model = n.getModel(); } else { XModelObject o = EclipseResourceUtil.createObjectForResource(p); if (o != null) model = o.getModel(); } if (model == null) return null; XModelObject[] fs = FileSystemsHelper.getFileSystems(model).getChildren(); for (XModelObject s : fs) { String loc = Paths.expand(s.get(XModelObjectConstants.ATTR_NAME_LOCATION), model.getProperties()); if (new File(loc).equals(new File(jarFile))) { XModelObject result = s.getChildByPath(entry); if (result == null && entry != null) { int q = entry.indexOf('/'); int d = entry.indexOf('.'); if (q > d && d >= 0) { String entry1 = entry.substring(0, q).replace('.', '/') + entry.substring(q); result = s.getChildByPath(entry1); } } if (result != null) return result; } } return (n == null) ? null : n.getModel().getByPath("/" + entry); // $NON-NLS-1$ }
private void updateLibs(XModelObject object) { if (WatcherLoader.isLocked(object.getModel())) { return; } IProject project = EclipseResourceUtil.getProject(object); if (project == null) return; XModelObject lib = validateLib(object); // if(lib == null) { // return; // } Libs libs = FileSystemsHelper.getLibs(object); if (libs != null) libs.update(); }