public static String elementToHandle(final String project,final IJavaElement element){
  final String handle=element.getHandleIdentifier();
  if (project != null && !(element instanceof IJavaProject)) {
    IJavaProject javaProject=element.getJavaProject();
    if (project.equals(javaProject.getElementName())) {
      final String id=javaProject.getHandleIdentifier();
      return handle.substring(id.length());
    }
  }
  return handle;
}

public static String elementToHandle ( final String project , final IJavaElement element ) { final String handle = element . getHandleIdentifier ( ) ; if ( project != null && ! ( element instanceof IJavaProject ) ) { IJavaProject javaProject = element . getJavaProject ( ) ; if ( project . equals ( javaProject . getElementName ( ) ) ) { final String id = javaProject . getHandleIdentifier ( ) ; return handle . substring ( id . length ( ) ) ; } } return handle ; }
converts the specified element to an input handle .
