Package org.aspectj.org.eclipse.jdt.internal.codeassist

Examples of org.aspectj.org.eclipse.jdt.internal.codeassist.CompletionEngine


    public char[][] getPackageName() {
      return null;
    }
  };
 
  CompletionEngine engine = new CompletionEngine(environment, mapper.getCompletionRequestor(requestor), options, project);
 
  if (this.installedVars != null) {
    IBinaryType binaryType = this.getRootCodeSnippetBinary();
    if (binaryType != null) {
      engine.lookupEnvironment.cacheBinaryType(binaryType, null /*no access restriction*/);
    }
   
    ClassFile[] classFiles = installedVars.classFiles;
    for (int i = 0; i < classFiles.length; i++) {
      ClassFile classFile = classFiles[i];
      IBinaryType binary = null;
      try {
        binary = new ClassFileReader(classFile.getBytes(), null);
      } catch (ClassFormatException e) {
        e.printStackTrace(); // Should never happen since we compiled this type
      }
      engine.lookupEnvironment.cacheBinaryType(binary, null /*no access restriction*/);
    }
  }
 
  engine.complete(sourceUnit, mapper.startPosOffset + completionPosition, mapper.startPosOffset);
}
View Full Code Here


  if (requestor == null) {
    throw new IllegalArgumentException("Completion requestor cannot be null"); //$NON-NLS-1$
  }
  JavaProject project = (JavaProject) getJavaProject();
  SearchableEnvironment environment = project.newSearchableNameEnvironment(owner);
  CompletionEngine engine = new CompletionEngine(environment, requestor, project.getOptions(true), project);

  String source = getClassFile().getSource();
  if (source != null && insertion > -1 && insertion < source.length()) {
    // code complete
   
    char[] prefix = CharOperation.concat(source.substring(0, insertion).toCharArray(), new char[]{'{'});
    char[] suffix =  CharOperation.concat(new char[]{'}'}, source.substring(insertion).toCharArray());
    char[] fakeSource = CharOperation.concat(prefix, snippet, suffix);
   
    BasicCompilationUnit cu =
      new BasicCompilationUnit(
        fakeSource,
        null,
        getElementName(),
        project); // use project to retrieve corresponding .java IFile

    engine.complete(cu, prefix.length + position, prefix.length);
  } else {
    engine.complete(this, snippet, position, localVariableTypeNames, localVariableNames, localVariableModifiers, isStatic);
  }
  if (NameLookup.VERBOSE) {
    System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
    System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

    throw new IllegalArgumentException("Completion requestor cannot be null"); //$NON-NLS-1$
  }
 
  JavaProject project = (JavaProject) getJavaProject();
  SearchableEnvironment environment = project.newSearchableNameEnvironment(owner);
  CompletionEngine engine = new CompletionEngine(environment, requestor, project.getOptions(true), project);

  String source = getCompilationUnit().getSource();
  if (source != null && insertion > -1 && insertion < source.length()) {
   
    char[] prefix = CharOperation.concat(source.substring(0, insertion).toCharArray(), new char[]{'{'});
    char[] suffix = CharOperation.concat(new char[]{'}'}, source.substring(insertion).toCharArray());
    char[] fakeSource = CharOperation.concat(prefix, snippet, suffix);
   
    BasicCompilationUnit cu =
      new BasicCompilationUnit(
        fakeSource,
        null,
        getElementName(),
        getParent());

    engine.complete(cu, prefix.length + position, prefix.length);
  } else {
    engine.complete(this, snippet, position, localVariableTypeNames, localVariableNames, localVariableModifiers, isStatic);
  }
  if (NameLookup.VERBOSE) {
    System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
    System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

  // set unit to skip
  environment.unitToSkip = unitToSkip;

  // code complete
  CompletionEngine engine = new CompletionEngine(environment, requestor, project.getOptions(true), project);
  engine.complete(cu, position, 0);
  if(performanceStats != null) {
    performanceStats.endRun();
  }
  if (NameLookup.VERBOSE) {
    System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.codeassist.CompletionEngine

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.