コード例 #1
0
  /**
   * {@inheritDoc}
   *
   * <p>Subclasses may replace, but usually should not need to. Consider replacing {@linkplain
   * #createDartCompletionProposal(CompletionProposal) createDartCompletionProposal} instead.
   */
  @Override
  public void accept(CompletionProposal proposal) {
    long start = DEBUG ? System.currentTimeMillis() : 0;
    try {
      if (isFiltered(proposal)) {
        return;
      }

      DartContentAssistInvocationContext ctxt = getInvocationContext();
      proposal.applyPartitionOffset(ctxt.getPartitionOffset());
      if (proposal.getKind() == CompletionProposal.POTENTIAL_METHOD_DECLARATION) {
        acceptPotentialMethodDeclaration(proposal);
      } else {
        IDartCompletionProposal dartProposal = createDartCompletionProposal(proposal);
        if (dartProposal != null) {
          fDartProposals.add(dartProposal);
          if (proposal.getKind() == CompletionProposal.KEYWORD) {
            fKeywords.add(dartProposal);
          }
        }
      }
    } catch (IllegalArgumentException e) {
      // all signature processing method may throw IAEs
      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=84657
      // don't abort, but log and show all the valid proposals
      DartToolsPlugin.log(
          new Status(
              IStatus.ERROR,
              DartToolsPlugin.getPluginId(),
              IStatus.OK,
              "Exception when processing proposal for: " + String.valueOf(proposal.getCompletion()),
              e)); //$NON-NLS-1$
    }

    if (DEBUG) {
      fUITime += System.currentTimeMillis() - start;
    }
  }
コード例 #2
0
 /**
  * Sets the invocation context.
  *
  * <p>Subclasses may extend.
  *
  * @param context the invocation context
  */
 public void setInvocationContext(DartContentAssistInvocationContext context) {
   Assert.isNotNull(context);
   fInvocationContext = context;
   context.setCollector(this);
 }
コード例 #3
0
 @Override
 public com.google.dart.engine.ast.CompilationUnit getInputUnit() {
   return fInvocationContext.getInputUnit();
 }