Examples of AbstractCompletionContext


Examples of org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext

  }

  @Override
  public void apply(ICompletionReporter reporter) throws BadLocationException {
    // let NamespaceClassInstantiationStrategy to deal with namespace prefix
    AbstractCompletionContext completionContext = (AbstractCompletionContext) getContext();
    String suffix = getSuffix(completionContext);
    addAlias(reporter, suffix);
    if (completionContext.getPrefix() != null
        && completionContext.getPrefix().indexOf(
            NamespaceReference.NAMESPACE_SEPARATOR) >= 0) {
      return;
    }
    super.apply(reporter);
    ICompletionContext context = getContext();
    AbstractCompletionContext concreteContext = (AbstractCompletionContext) context;
    addSelf(concreteContext, reporter);
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext

  }

  @Override
  public void apply(ICompletionReporter reporter) throws BadLocationException {
    ICompletionContext context = getContext();
    AbstractCompletionContext abstractContext = (AbstractCompletionContext) context;
    if (abstractContext.getPrefixWithoutProcessing().trim().length() == 0) {
      return;
    }
    super.apply(reporter);
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext

  }

  public SourceRange getReplacementRange(ICompletionContext context)
      throws BadLocationException {

    AbstractCompletionContext completionContext = (AbstractCompletionContext) context;

    int length = completionContext.getPrefix().length();

    int start = completionContext.getOffset() - length;
    int prefixEnd = completionContext.getPrefixEnd();

    if (start + length < prefixEnd) {
      length = prefixEnd - start;
    }
View Full Code Here

Examples of org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext

  }

  public SourceRange getReplacementRangeWithBraces(ICompletionContext context)
      throws BadLocationException {

    AbstractCompletionContext completionContext = (AbstractCompletionContext) context;

    int length = completionContext.getPrefix().length();
    int start = completionContext.getOffset() - length;
    int prefixEnd = completionContext.getPrefixEnd();

    if (start + length < prefixEnd) {
      length = prefixEnd - start;
    }

    IStructuredDocument document = completionContext.getDocument();

    int endOfReplacement = start + length;
    if (document.getLength() == start) {
      endOfReplacement = start;
    } else if (endOfReplacement < document.getLength() - 2) {
View Full Code Here

Examples of org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext

  }

  public void apply(ICompletionReporter reporter) throws BadLocationException {
    ICompletionContext context = getContext();

    AbstractCompletionContext abstractContext = (AbstractCompletionContext) context;
    CompletionRequestor requestor = abstractContext
        .getCompletionRequestor();

    if (abstractContext.getPrefixWithoutProcessing().trim().length() == 0) {
      return;
    }

    String prefix = abstractContext.getPrefix();
    if (prefix.startsWith("$")) { //$NON-NLS-1$
      return;
    }

    MatchRule matchRule = MatchRule.PREFIX;
    if (requestor.isContextInformationMode()) {
      matchRule = MatchRule.EXACT;
    }

    ISourceModule sourceModule = abstractContext.getSourceModule();

    IType enclosingType = null;
    try {
      IModelElement enclosingElement = sourceModule
          .getElementAt(abstractContext.getOffset());

      if (enclosingElement != null && enclosingElement instanceof IType) {
        enclosingType = (IType) enclosingElement;
      }

    } catch (ModelException e) {
      PHPCorePlugin.log(e);
    }

    IDLTKSearchScope scope = null;
    IModelElement[] enclosingTypeConstants = null;

    if (enclosingType != null
        && isStartOfStatement(prefix, abstractContext,
            abstractContext.getOffset())) {
      // See the case of testClassStatement1.pdtt and
      // testClassStatement2.pdtt
      scope = SearchEngine.createSearchScope(enclosingType);
    } else {
      scope = getSearchScope(abstractContext);
View Full Code Here

Examples of org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext

    super(context);
  }

  public void apply(ICompletionReporter reporter) throws BadLocationException {
    // let NamespaceInstanceOfStrategy to deal with namespace prefix
    AbstractCompletionContext completionContext = (AbstractCompletionContext) getContext();
    // String suffix = getSuffix(completionContext);
    // addAlias(reporter, suffix);
    if (completionContext.getPrefix() != null
        && completionContext.getPrefix().indexOf(
            NamespaceReference.NAMESPACE_SEPARATOR) >= 0) {
      return;
    }

    super.apply(reporter);
    ICompletionContext context = getContext();
    AbstractCompletionContext concreteContext = (AbstractCompletionContext) context;
    addSelf(concreteContext, reporter);
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext

  }

  public void apply(ICompletionReporter reporter) throws BadLocationException {

    ICompletionContext context = getContext();
    AbstractCompletionContext abstractContext = (AbstractCompletionContext) context;
    SourceRange replacementRange = getReplacementRange(abstractContext);

    IType[] types = getTypes(abstractContext);

    for (IType type : types) {
View Full Code Here

Examples of org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext

    super(context);
  }

  public void apply(ICompletionReporter reporter) throws BadLocationException {

    AbstractCompletionContext context = (AbstractCompletionContext) getContext();
    String prefix = context.getPrefix();
    String suffix = ""; //$NON-NLS-1$
    SourceRange replaceRange = getReplacementRange(context);
    // if (context.getEnclosingType() != null) {
    // try {
    // int flags = context.getEnclosingType().getFlags();
    // if (!PHPFlags.isNamespace(flags)) {
    // for (String keyword : KEYWORDS) {
    // if (keyword.startsWith(prefix)) {
    // reporter.reportKeyword(keyword, suffix,
    // replaceRange);
    // }
    // }
    // }
    // } catch (ModelException e) {
    // PHPCorePlugin.log(e);
    // }
    // }

    PHPVersion phpVersion = context.getPhpVersion();
    if (phpVersion.isGreaterThan(PHPVersion.PHP5_3)) {
      for (String keyword : KEYWORDS) {
        if (keyword.startsWith(prefix)) {
          reporter.reportKeyword(keyword, suffix, replaceRange);
        }
View Full Code Here

Examples of org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext

  }

  public void apply(ICompletionReporter reporter) throws BadLocationException {

    ICompletionContext context = getContext();
    AbstractCompletionContext concreteContext = (AbstractCompletionContext) context;
    ISourceModule sourceModule = concreteContext.getSourceModule();
    String prefix = concreteContext.getPrefix();
    SourceRange replaceRange = getReplacementRange(concreteContext);
    boolean withoutSemicolon = concreteContext.getNextWord().trim()
        .equals(IPHPKeywordsInitializer.SEMICOLON_SUFFIX);
    Collection<KeywordData> keywordsList = PHPKeywords.getInstance(
        sourceModule.getScriptProject().getProject()).findByPrefix(
        prefix);
    for (KeywordData keyword : keywordsList) {
View Full Code Here

Examples of org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext

  }

  @SuppressWarnings("unchecked")
  public void apply(ICompletionReporter reporter) throws BadLocationException {

    AbstractCompletionContext abstractContext = (AbstractCompletionContext) getContext();
    CompletionRequestor requestor = abstractContext.getCompletionRequestor();

    int offset = abstractContext.getOffset();

    // find function arguments
    ISourceModule sourceModule = abstractContext.getSourceModule();
    ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(sourceModule, null);

    Declaration declaration = ASTUtils.findDeclarationAfterPHPdoc(moduleDeclaration, offset);
    if (declaration instanceof MethodDeclaration) {

      String prefix = abstractContext.getPrefix();
      SourceRange replaceRange = getReplacementRange(abstractContext);
      String suffix = ""; //$NON-NLS-1$

      List<Argument> arguments = ((MethodDeclaration) declaration).getArguments();
      for (Argument arg : arguments) {
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.