Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IMethod


    String mName = mthd.getName();
    Class<?>[] pTypes = mthd.getParameterTypes();
    String eventName = pTypes[0].getName();
    eventName = imports.addImport(eventName);
    String eventSig = Signature.createTypeSignature(eventName, false);
    IMethod imthd = type.getMethod(mName, new String[] { eventSig });
    if (!imthd.exists()) {
      StringBuilder builder = new StringBuilder();
      builder.append("public void " + mName + "(");
      builder.append(eventName
          + " event){\n//TODO Add event code here.\n}\n");
      String content = builder.toString();
View Full Code Here


      Method m = mthd.getMethod();
      Class[] ptypes = m.getParameterTypes();
      String pcName = ptypes[0].getName();
      pcName = imports.addImport(pcName);
      String pcSig = Signature.createTypeSignature(pcName, false);
      IMethod imthd = meType.getMethod(m.getName(), new String[] { pcSig });
      if (!imthd.exists()) {
        if (methods.get(mthd) != null) {
          StringBuilder builder = new StringBuilder();
          if (override)
            builder.append("\n");
          builder.append(createEventMethodStub(monitor, meType, m, pcName));
          return createEventMethod(meType, builder.toString(), monitor);
        } else {
          if (!override) {
            return createEventMethod(meType, createEventMethodStub(monitor, meType, m, pcName), monitor);
          }
        }
      } else {
        if (methods.get(mthd) == null) {
          if (override) {
            try {
              imthd.delete(true, monitor);
            } catch (JavaModelException e) {
              ParserPlugin.getLogger().error(e);
              return false;
            }
          }
View Full Code Here

    }
    return null;
  }

  private IJavaElement getInitMethodSibling(IType type) {
    IMethod method = type.getMethod(INIT_METHOD_NAME, new String[0]);
    if (method != null && method.exists()) {
      return getSibling(type, method);
    }
    return null;
  }
View Full Code Here

      if (!createField(type, imports, monitor))
        return false;
    }
    IJavaElement sibling = null;
    String mName = NamespaceUtil.getGetMethodName(adaptable, name);
    IMethod method = type.getMethod(mName, new String[0]);
    if (method != null && method.exists()) {
      try {
        sibling = getSibling(type, method);
        method.delete(false, monitor);
      } catch (JavaModelException e) {
        ParserPlugin.getLogger().error(e);
        return false;
      }
    }
View Full Code Here

    public void launch(IEditorPart editor, String mode)
    {
        ITypeRoot element = JavaUI.getEditorInputTypeRoot(editor.getEditorInput());
        if (element != null)
        {
            IMethod selectedMethod = resolveSelectedMethodName(editor, element);
            if (selectedMethod != null)
            {
                launch(new Object[] {selectedMethod}, mode);
            }
            else
View Full Code Here

    public ILaunchConfiguration[] getLaunchConfigurations(final IEditorPart editor)
    {
        final ITypeRoot element = JavaUI.getEditorInputTypeRoot(editor.getEditorInput());
        if (element != null)
        {
            IMethod selectedMethod = null;
            if (Display.getCurrent() == null)
            {
                final IMethod[] temp = new IMethod[1];
                Runnable runnable = new Runnable()
                {
View Full Code Here

        // a test name was specified just run the single test
        if (testElements.length == 1)
        {
            if (testElements[0] instanceof IMethod)
            {
                IMethod method = (IMethod) testElements[0];
                programArguments.add("-test"); //$NON-NLS-1$
                programArguments.add(method.getDeclaringType().getFullyQualifiedName() + ':' + method.getElementName());
            }
            else if (testElements[0] instanceof IType)
            {
                IType type = (IType) testElements[0];
                programArguments.add("-classNames"); //$NON-NLS-1$
View Full Code Here

    methodDeclaration.setProperty("Signature", signature.toString());

    // creation of ASTRewrite
    astRoot.recordModifications();
    IMethod method = null;
    String content = createPreambule(methodDeclaration) + "\r\n"
        + methodDeclaration.toString();
    try {
      method = astRoot.getTypeRoot().findPrimaryType()
          .createMethod(content, null, overwrite, null);
View Full Code Here

        CompilationUnit astRoot = (CompilationUnit) parser
            .createAST(null);

        // creation of ASTRewrite
        astRoot.recordModifications();
        IMethod method = null;
        String content = createPreambule(selectedElement) + "\r\n"
            + selectedElement.toString();
        try {
          method = astRoot.getTypeRoot().findPrimaryType()
              .createMethod(content, null, overwrite, null);
View Full Code Here

          return null;
        }
        argumentTypeNames[i] = typeName;
      }
      // return binary method
      IMethod binaryMethod = createBinaryMethodHandle(type, method.selector, argumentTypeNames);
      if (binaryMethod == null) {
        // when first attempt fails, try with similar matches if any...
        PossibleMatch similarMatch = this.currentPossibleMatch.getSimilarMatch();
        while (similarMatch != null) {
          type = ((ClassFile)similarMatch.openable).getType();
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.