KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > bull > eclipse > jonas > actions > persistence > utils > PersistencePackage


1 /*
2  * Created on 8 mars 2005
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */

7 package com.bull.eclipse.jonas.actions.persistence.utils;
8
9 import org.eclipse.core.resources.IResource;
10 import org.eclipse.jdt.core.IJavaElement;
11 import org.eclipse.jdt.core.JavaModelException;
12
13 /**
14  * @author riase
15  *
16  * TODO To change the template for this generated type comment go to
17  * Window - Preferences - Java - Code Style - Code Templates
18  */

19 public class PersistencePackage {
20
21     static public String JavaDoc getPersistencePackage(IJavaElement resource[]) throws JavaModelException {
22         String JavaDoc packagePersistence = null;
23         for(int i=0;i<resource.length;i++) {
24             IJavaElement ele = (IJavaElement)resource[i];
25             if ("persistence".equals(ele.getCorrespondingResource().getLocation().lastSegment()) && !"".equals(ele.getElementName()))
26                     packagePersistence = ele.getElementName().substring(0, ele.getElementName().lastIndexOf("."));
27         }
28         return packagePersistence;
29     }
30 }
31
Popular Tags