예제 #1
0
 protected IPath componentPathForPackage(IPackageFragment _selection) {
   try {
     LocatePlugin locate = LocatePlugin.getDefault();
     for (IJavaElement element : _selection.getChildren()) {
       String componentName = locate.fileNameWithoutExtension(element.getElementName());
       LocalizedComponentsLocateResult result =
           locate.getLocalizedComponentsLocateResult(
               _selection.getJavaProject().getProject(), componentName);
       IFolder[] components = result.getComponents();
       if (components.length > 0) {
         IContainer selectionPath = components[0].getParent();
         return selectionPath.getFullPath();
       }
     }
   } catch (CoreException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (LocateException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return null;
 }