Step One
Copy the codes below:
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
package ext;
import java.util.Vector; import wt.folder.SubFolder; import wt.inf.container.WTContainerHelper; import wt.inf.container.WTContainerRef;
publicclass MyWindchillUtility {
//Get a text list of folder names in a product container publicstatic WTContainerRef getContainerRef(String orgName, String productName) { WTContainerRef containerRef =null; try { if (productName !=null&& !"".equals(productName)) containerRef = WTContainerHelper.service.getByPath("/wt.inf.container.OrgContainer="+ orgName +"/wt.pdmlink.PDMLinkProduct="+ productName); else containerRef = WTContainerHelper.service.getByPath("/wt.inf.container.OrgContainer="+ orgName); } catch (Exception e) { e.printStackTrace(); } return containerRef; }
publicstaticvoid folderDriver() {
WTContainerRef wtcontainerref = DGUtil.getContainerRef("LIGADP", "Test1"); //<Organization Container Name>, <Product Container Name> String oid = DGUtil.getStringOid(wtcontainerref.getContainer()); Vector v = (Vector)DGUtil.getSubFolderWithContainer(oid); for(int i=0;i<v.size();i++){ SubFolder sf = (SubFolder)v.get(i); System.out.println(sf.getFolderPath()); } }
publicstaticvoid main(String[] args) { MyWindchillUtility.folderDriver(); } }
| cs |
Step Two
Execute MyWindchillUtility on Windchill Shell: windchill ext.MyWindchillUtility