Codota Logo
AddArgumentCorrectionProposal
Code IndexAdd Codota to your IDE (free)

How to use
AddArgumentCorrectionProposal
in
org.eclipse.jdt.internal.ui.text.correction.proposals

Best Java code snippets using org.eclipse.jdt.internal.ui.text.correction.proposals.AddArgumentCorrectionProposal (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private boolean isMoreSpecific(ITypeBinding best, ITypeBinding curr) {
  return (canAssign(best, curr) && !canAssign(curr, best));
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private Expression evaluateArgumentExpressions(AST ast, ITypeBinding requiredType, String key) {
  CompilationUnit root= (CompilationUnit) fCallerNode.getRoot();
  int offset= fCallerNode.getStartPosition();
  Expression best= null;
  ITypeBinding bestType= null;
  ScopeAnalyzer analyzer= new ScopeAnalyzer(root);
  IBinding[] bindings= analyzer.getDeclarationsInScope(offset, ScopeAnalyzer.VARIABLES);
  for (int i= 0; i < bindings.length; i++) {
    IVariableBinding curr= (IVariableBinding) bindings[i];
    ITypeBinding type= curr.getType();
    if (type != null && canAssign(type, requiredType) && testModifier(curr)) {
      if (best == null || isMoreSpecific(bestType, type)) {
        best= ast.newSimpleName(curr.getName());
        bestType= type;
      }
      addLinkedPositionProposal(key, curr.getName(), null);
    }
  }
  Expression defaultExpression= ASTNodeFactory.newDefaultExpression(ast, requiredType);
  if (best == null) {
    best= defaultExpression;
  }
  addLinkedPositionProposal(key, ASTNodes.asString(defaultExpression), null);
  return best;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected ASTRewrite getRewrite() {
  AST ast= fCallerNode.getAST();
  ASTRewrite rewrite= ASTRewrite.create(ast);
  ChildListPropertyDescriptor property= getProperty();
  for (int i= 0; i < fInsertIndexes.length; i++) {
    int idx= fInsertIndexes[i];
    String key= "newarg_" + i; //$NON-NLS-1$
    Expression newArg= evaluateArgumentExpressions(ast, fParamTypes[idx], key);
    ListRewrite listRewriter= rewrite.getListRewrite(fCallerNode, property);
    listRewriter.insertAt(newArg, idx, null);
    addLinkedPosition(rewrite.track(newArg), i == 0, key);
  }
  return rewrite;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

  label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_addarguments_description, arg);
AddArgumentCorrectionProposal proposal= new AddArgumentCorrectionProposal(label, context.getCompilationUnit(), invocationNode, indexSkipped, paramTypes, IProposalRelevance.ADD_ARGUMENTS);
proposal.setImage(JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_ADD));
proposals.add(proposal);
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private Expression evaluateArgumentExpressions(AST ast, ITypeBinding requiredType, String key) {
  CompilationUnit root= (CompilationUnit) fCallerNode.getRoot();
  int offset= fCallerNode.getStartPosition();
  Expression best= null;
  ITypeBinding bestType= null;
  ScopeAnalyzer analyzer= new ScopeAnalyzer(root);
  IBinding[] bindings= analyzer.getDeclarationsInScope(offset, ScopeAnalyzer.VARIABLES);
  for (int i= 0; i < bindings.length; i++) {
    IVariableBinding curr= (IVariableBinding) bindings[i];
    ITypeBinding type= curr.getType();
    if (type != null && canAssign(type, requiredType) && testModifier(curr)) {
      if (best == null || isMoreSpecific(bestType, type)) {
        best= ast.newSimpleName(curr.getName());
        bestType= type;
      }
      addLinkedPositionProposal(key, curr.getName(), null);
    }
  }
  Expression defaultExpression= ASTNodeFactory.newDefaultExpression(ast, requiredType);
  if (best == null) {
    best= defaultExpression;
  }
  addLinkedPositionProposal(key, ASTNodes.asString(defaultExpression), null);
  return best;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
protected ASTRewrite getRewrite() {
  AST ast= fCallerNode.getAST();
  ASTRewrite rewrite= ASTRewrite.create(ast);
  ChildListPropertyDescriptor property= getProperty();
  for (int i= 0; i < fInsertIndexes.length; i++) {
    int idx= fInsertIndexes[i];
    String key= "newarg_" + i; //$NON-NLS-1$
    Expression newArg= evaluateArgumentExpressions(ast, fParamTypes[idx], key);
    ListRewrite listRewriter= rewrite.getListRewrite(fCallerNode, property);
    listRewriter.insertAt(newArg, idx, null);
    addLinkedPosition(rewrite.track(newArg), i == 0, key);
  }
  return rewrite;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

  label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_addarguments_description, arg);
AddArgumentCorrectionProposal proposal= new AddArgumentCorrectionProposal(label, context.getCompilationUnit(), invocationNode, indexSkipped, paramTypes, IProposalRelevance.ADD_ARGUMENTS);
proposal.setImage(JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_ADD));
proposals.add(proposal);
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private boolean isMoreSpecific(ITypeBinding best, ITypeBinding curr) {
  return (canAssign(best, curr) && !canAssign(curr, best));
}
org.eclipse.jdt.internal.ui.text.correction.proposalsAddArgumentCorrectionProposal

Most used methods

  • <init>
  • addLinkedPosition
  • addLinkedPositionProposal
  • canAssign
  • evaluateArgumentExpressions
  • getProperty
  • isMoreSpecific
  • setImage
  • testModifier

Popular in Java

  • Running tasks concurrently on multiple threads
  • requestLocationUpdates (LocationManager)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Join (org.hibernate.mapping)
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now