void removeMissingJarSystems(XModelObject object) { XModelObject[] os = object.getChildren("FileSystemJar"); // $NON-NLS-1$ for (int i = 0; i < os.length; i++) { JarSystemImpl jar = (JarSystemImpl) os[i]; String location = jar.getLocation(); if (location != null && !new File(location).isFile()) { jar.removeFromParent(); object.setModified(true); } } }
private XModelObject validateLib(XModelObject object) { XModelObject lib = object.getChildByPath("lib"); // $NON-NLS-1$ if (lib == null) { XModelObject wi = object.getChildByPath("WEB-INF"); // $NON-NLS-1$ if (wi == null) return null; XModelObject lb = wi.getChildByPath("lib"); // $NON-NLS-1$ if (lb == null) return null; lib = wi.getModel().createModelObject(XModelObjectConstants.ENT_FILE_SYSTEM_FOLDER, null); lib.setAttributeValue(XModelObjectConstants.ATTR_NAME, "lib"); // $NON-NLS-1$ lib.setAttributeValue( XModelObjectConstants.ATTR_NAME_LOCATION, wi.getAttributeValue(XModelObjectConstants.ATTR_NAME_LOCATION) + "/lib"); // $NON-NLS-1$ object.addChild(lib); object.setModified(true); } return lib; }