Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IMethod


            } catch (JavaModelException e) {
                // this is compilation problem - don't show the message
                BytecodeOutlinePlugin.log(e, IStatus.WARNING);
            }
        } else if (childEl.getElementType() == IJavaElement.METHOD) {
            IMethod iMethod = (IMethod) childEl;
            try {
                methodName = createMethodSignature(iMethod);
            } catch (JavaModelException e) {
                // this is compilation problem - don't show the message
                BytecodeOutlinePlugin.log(e, IStatus.WARNING);
View Full Code Here


    return proposal;
  }

  private String getParameters(final IMethodBinding methBinding) throws JavaModelException
  {
    IMethod meth = (IMethod) methBinding.getJavaElement();
   
    if( meth == null )
      return "";
   
    String[] paramNames = meth.getParameterNames();

    String params= "";
    ITypeBinding[] paramTypes = methBinding.getParameterTypes();

    for(int i = 0; i < paramTypes.length; i++)
View Full Code Here

    @Override
    public void open()
    {
      try
      {
        IMethod method= (IMethod) realMethod.getJavaElement();

        if (method != null)
        {
          action.run(new StructuredSelection(method));
        }
View Full Code Here

        /*
         * Normally we do not traverse to methods but we can call the customise with a method
         */
        case IJavaElement.METHOD : {
            IMethod method = (IMethod) element;
            String typeName = ((IType) method.getParent()).getFullyQualifiedName();
            String methodName = method.getElementName();
            testNames.add(typeName + ":" + methodName);
        }
            break;

        /*
 
View Full Code Here

      selected = unit.getElementAt(selection.getOffset());
      List<IJavaElement> path = getJavaElementsPath(selected);
      if (path.size() >= 7) {
        IJavaElement el = path.get(6);
        if (el.getElementType() == IJavaElement.METHOD) {
          IMethod sm = (IMethod)el;
          int flags = sm.getFlags();
          String actionMethodName = el.getElementName();
          if (/*Flags.isPublic(flags) &&*/ Flags.isStatic(flags)) {
            return actionMethodName;
          }
          else {
View Full Code Here

    if (activeMenuSelection instanceof IStructuredSelection) {
      IStructuredSelection selection = (IStructuredSelection) activeMenuSelection;
      p = Navigation.getProject(selection);
      Object firstElement = selection.getFirstElement();
      if (firstElement instanceof IMethod) {
        IMethod m = (IMethod) firstElement;
        ICompilationUnit unit = m.getCompilationUnit();
        try {
          IPackageDeclaration[] packs = unit.getPackageDeclarations();
          if (packs.length < 1) {
            info("This action can only apply to controllers.");
            return null;
          } else {
            packageName = packs[0].getElementName();
            if (!packageName.startsWith("controllers")) {
              info("This action can only apply to controllers.");
              return null;
            }
          }

          IType type = unit.getTypes()[0];
          controllerName = type.getElementName();
          String superclassName = type.getSuperclassName();
          if (superclassName.toLowerCase().contains("japid")) {
            useJapid = true;
          }

          List<IJavaElement> path = getJavaElementsPath(m);
          if (path.size() == 7) {
            int flags = m.getFlags();
           
            if (Flags.isPublic(flags) && Flags.isStatic(flags)) {
              viewName = m.getElementName();
            } else {
              info("The selected method " + m.getElementName()
                  + " is not public static of the top controller, thus not a valid action method.");
              return null;
            }
          }
        } catch (JavaModelException e) {
View Full Code Here

      selected = unit.getElementAt(selection.getOffset());
      List<IJavaElement> path = getJavaElementsPath(selected);
      if (path.size() >= 7) {
        IJavaElement el = path.get(6);
        if (el.getElementType() == IJavaElement.METHOD) {
          IMethod sm = (IMethod)el;
          int flags = sm.getFlags();
          String actionMethodName = el.getElementName();
          if (Flags.isPublic(flags) && Flags.isStatic(flags)) {
            return actionMethodName;
          }
          else {
View Full Code Here

    } catch (JavaModelException e) {}
    if (parent == null) {
      return null;
    }
    try {
      IMethod method = findMethod(parent, query);
      if (method != null) return method;
      ITypeHierarchy hierarchy = parent.newTypeHierarchy(null);
      for (IType superclass: hierarchy.getAllSuperclasses(parent)) {
        method = findMethod(superclass, query);
        if (method != null) return method;
View Full Code Here

        }
      }
    if (sourceRange != null) {
      FilesAccess.goToCharacter(editorPart, sourceRange.getOffset());
    } else if (PlayPlugin.showConfirm("The method " + methodName + " doesn't exist. Do you want to create it?")) {
        IMethod newMethod = type.createMethod("public static void "+methodName+"() {\n\n}\n", null, false, null);
        FilesAccess.goToCharacter(editorPart, newMethod.getSourceRange().getOffset());
    }
  }
View Full Code Here

        success = false;
      }
    }
    StringBuilder builder = new StringBuilder();
    String getMethodName = getCreationMethodName();
    IMethod method = type.getMethod(getMethodName, new String[0]);
    if (method != null && method.exists()) {
      try {
        sibling = getSibling(type, method);
        method.delete(false, monitor);
      } catch (JavaModelException e) {
        ParserPlugin.getLogger().error(e);
        success = false;
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.IMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.