private static String getNextSrcName(XModelObject object) { if (object.getChildByPath("src") == null) return "src"; // $NON-NLS-1$ //$NON-NLS-2$ int i = 1; while (true) { String s = "src-" + i; // $NON-NLS-1$ if (object.getChildByPath(s) == null) return s; i++; } }
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; }