Пример #1
0
 private boolean hasMainMethod(IType t) {
   try {
     for (IMethod m : t.getMethods()) {
       if (m.isMainMethod()) {
         return true;
       }
     }
   } catch (Exception e) {
     BootActivator.log(e);
   }
   return false;
 }
 /**
  * Returns the smallest enclosing <code>IType</code> if the specified object is a main method, or
  * <code>null</code>
  *
  * @param o the object to inspect
  * @return the smallest enclosing <code>IType</code> of the specified object if it is a main
  *     method or <code>null</code> if it is not
  */
 private IType isMainMethod(Object o) {
   if (o instanceof IAdaptable) {
     IAdaptable adapt = (IAdaptable) o;
     IJavaElement element = (IJavaElement) adapt.getAdapter(IJavaElement.class);
     if (element != null && element.getElementType() == IJavaElement.METHOD) {
       try {
         IMethod method = (IMethod) element;
         if (method.isMainMethod()) {
           return method.getDeclaringType();
         }
       } catch (JavaModelException jme) {
         JDIDebugUIPlugin.log(jme);
       }
     }
   }
   return null;
 }