Examples of IMethod


Examples of org.eclipse.jdt.core.IMethod

    } 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

Examples of org.eclipse.jdt.core.IMethod

        }
      }
    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

Examples of org.eclipse.jdt.core.IMethod

        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

Examples of org.eclipse.jdt.core.IMethod

  public String getCreationMethodName() {
    return NamespaceUtil.getInitMethodName(adapter.getID());
 

  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

Examples of org.eclipse.jdt.core.IMethod

    return success;
  }

  private boolean createRootCode(IType type, ImportRewrite imports, IProgressMonitor monitor) {
    String init_name = INIT_METHOD_NAME;
    IMethod method = type.getMethod(INIT_METHOD_NAME, new String[0]);
    IJavaElement sibling = null;
    if (method != null && method.exists()) {
      try {
        sibling = getSibling(type, method);
        method.delete(false, monitor);
      } catch (JavaModelException e) {
        ParserPlugin.getLogger().error(e);
        return false;
      }
    }else{
      method = type.getMethod(INITIALIZE_METHOD_NAME, 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;
        }
        init_name = INITIALIZE_METHOD_NAME;
View Full Code Here

Examples of org.eclipse.jdt.core.IMethod

    Class[] pTypes = mEvent.getParameterTypes();
    String pcName = pTypes[0].getName();
    pcName = imports.addImport(pcName);
    String[] paras = new String[] { Signature.createTypeSignature(pcName,
        false) };
    IMethod eventMethod = type.getMethod(methodName, paras);
    if (!eventMethod.exists()) {
      StringBuilder builder = new StringBuilder(0);
      builder.append("private void ");
      builder.append(methodName + "(");
      builder.append(pcName);
      builder.append(" event");
View Full Code Here

Examples of org.eclipse.jdt.core.IMethod

  }

  @Override
  protected boolean createConstructor(IType type, ImportRewrite imports,
      IProgressMonitor monitor) {
    IMethod cons = type.getMethod(type.getElementName(), new String[0]);
    if (!cons.exists()) {
      StringBuilder builder = new StringBuilder();
      builder.append("public " + type.getElementName() + "(){\n");
      builder.append(INIT_METHOD_NAME + "();\n");
      builder.append("}\n");
      try {
View Full Code Here

Examples of org.eclipse.jdt.core.IMethod

    String unitname = unit.getElementName();
    int dot = unitname.indexOf('.');
    if (dot != -1)
      unitname = unitname.substring(0, dot);
    IType type = unit.getType(unitname);
    IMethod method = type.getMethod(methodName, new String[0]);
    JavaUI.revealInEditor(editor, (IJavaElement) method);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IMethod

    try {
      String sig = field.getTypeSignature();
      if (acceptTypeSignature(sig)) {
        String fieldName = field.getElementName();
        String getMethodName = NamespaceUtil.getInitMethodName(fieldName);
        IMethod method = type.getMethod(getMethodName, new String[0]);
        if (method != null && method.exists()) {
          return true;
        }
      }
    } catch (JavaModelException e) {
      ParserPlugin.getLogger().error(e);
View Full Code Here

Examples of org.eclipse.jdt.core.IMethod

  }

 
  public boolean removeField(IType type, String fieldName,
      IProgressMonitor monitor) {
    IMethod method = type.getMethod(NamespaceUtil.getInitMethodName(fieldName), new String[0]);
    if (method != null && method.exists()) {
      try {
        method.delete(true, monitor);
        return true;
      } catch (JavaModelException e) {
        ParserPlugin.getLogger().error(e);
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.