Search in sources :

Example 1 with CoreASTProvider

use of org.eclipse.jdt.core.manipulation.CoreASTProvider in project eclipse.jdt.ls by eclipse.

the class CompletionHandlerTest method setUp.

@Before
public void setUp() {
    mockLSP3Client();
    CoreASTProvider sharedASTProvider = CoreASTProvider.getInstance();
    sharedASTProvider.disposeAST();
    // sharedASTProvider.clearASTCreationCount();
    javaClient = new JavaClientConnection(client);
    lifeCycleHandler = new DocumentLifeCycleHandler(javaClient, preferenceManager, projectsManager, true);
}
Also used : CoreASTProvider(org.eclipse.jdt.core.manipulation.CoreASTProvider) JavaClientConnection(org.eclipse.jdt.ls.core.internal.JavaClientConnection) Before(org.junit.Before)

Example 2 with CoreASTProvider

use of org.eclipse.jdt.core.manipulation.CoreASTProvider in project eclipse.jdt.ls by eclipse.

the class DiagnosticsCommand method getNonProjectCompilationUnits.

private static List<ICompilationUnit> getNonProjectCompilationUnits(ICompilationUnit target, IProgressMonitor monitor) {
    List<ICompilationUnit> candidates = new ArrayList<>();
    CoreASTProvider sharedASTProvider = CoreASTProvider.getInstance();
    if (target == null) {
        List<ICompilationUnit> workingCopies = Arrays.asList(JavaCore.getWorkingCopies(null));
        for (ICompilationUnit wc : workingCopies) {
            if (JDTUtils.isDefaultProject(wc) || !JDTUtils.isOnClassPath(wc)) {
                candidates.add(wc);
            }
        }
    } else {
        CompilationUnit unit = sharedASTProvider.getAST(target, CoreASTProvider.WAIT_YES, monitor);
        candidates.add((ICompilationUnit) unit.getTypeRoot());
    }
    return candidates;
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) CompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit) ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) ArrayList(java.util.ArrayList) CoreASTProvider(org.eclipse.jdt.core.manipulation.CoreASTProvider)

Example 3 with CoreASTProvider

use of org.eclipse.jdt.core.manipulation.CoreASTProvider in project eclipse.jdt.ls by eclipse.

the class DiagnosticHandlerTest method setup.

@Before
public void setup() throws Exception {
    CoreASTProvider sharedASTProvider = CoreASTProvider.getInstance();
    sharedASTProvider.disposeAST();
    // sharedASTProvider.clearASTCreationCount();
    javaClient = new JavaClientConnection(client);
}
Also used : CoreASTProvider(org.eclipse.jdt.core.manipulation.CoreASTProvider) JavaClientConnection(org.eclipse.jdt.ls.core.internal.JavaClientConnection) Before(org.junit.Before)

Aggregations

CoreASTProvider (org.eclipse.jdt.core.manipulation.CoreASTProvider)3 JavaClientConnection (org.eclipse.jdt.ls.core.internal.JavaClientConnection)2 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)1 CompilationUnit (org.eclipse.jdt.core.dom.CompilationUnit)1