Search in sources :

Example 1 with MockJavaProjectProvider

use of org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider in project xtext-eclipse by eclipse.

the class XtextResourceSetBasedProjectProviderTest method setUp.

@Before
public void setUp() throws Exception {
    resourceSet = new XtextResourceSet();
    mockProjectProvider = new MockJavaProjectProvider();
    resourceSet.setClasspathURIContext(mockProjectProvider.getJavaProject(null));
    projectProvider = new XtextResourceSetBasedProjectProvider();
}
Also used : XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) MockJavaProjectProvider(org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider) XtextResourceSetBasedProjectProvider(org.eclipse.xtext.common.types.xtext.ui.XtextResourceSetBasedProjectProvider) Before(org.junit.Before)

Example 2 with MockJavaProjectProvider

use of org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider in project xtext-eclipse by eclipse.

the class JdtBasedConstructorScopeTest method setUp.

@Before
public void setUp() throws Exception {
    projectProvider = new MockJavaProjectProvider();
    factory = new JdtTypeProviderFactory(projectProvider);
    resourceSet = new ResourceSetImpl();
    typeScope = new JdtBasedSimpleTypeScope(factory.createTypeProvider(resourceSet), new IQualifiedNameConverter.DefaultImpl(), Predicates.<IEObjectDescription>alwaysTrue());
    constructorScope = new JdtBasedConstructorScope(typeScope);
}
Also used : JdtTypeProviderFactory(org.eclipse.xtext.common.types.access.jdt.JdtTypeProviderFactory) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) JdtBasedSimpleTypeScope(org.eclipse.xtext.common.types.xtext.ui.JdtBasedSimpleTypeScope) JdtBasedConstructorScope(org.eclipse.xtext.common.types.xtext.ui.JdtBasedConstructorScope) MockJavaProjectProvider(org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Before(org.junit.Before)

Example 3 with MockJavaProjectProvider

use of org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider in project xtext-eclipse by eclipse.

the class JdtBasedSimpleTypeScopeProviderTest method setUp.

@Before
public void setUp() throws Exception {
    projectProvider = new MockJavaProjectProvider();
    factory = new JdtTypeProviderFactory(projectProvider);
    IQualifiedNameConverter qualifiedNameConverter = new IQualifiedNameConverter.DefaultImpl();
    scopeProvider = new JdtBasedSimpleTypeScopeProvider(factory, qualifiedNameConverter);
    resourceSet = new ResourceSetImpl();
    resource = new ResourceImpl();
    resource.setURI(URI.createURI("http://does/not/exist.file"));
    emptyResource = new ResourceImpl();
    emptyResource.setURI(URI.createURI("http://does/not/exist.file2"));
    resourceSet.getResources().add(emptyResource);
    resourceSet.getResources().add(resource);
    field = TypesFactory.eINSTANCE.createJvmField();
    resource.getContents().add(field);
}
Also used : JdtTypeProviderFactory(org.eclipse.xtext.common.types.access.jdt.JdtTypeProviderFactory) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) ResourceImpl(org.eclipse.emf.ecore.resource.impl.ResourceImpl) JdtBasedSimpleTypeScopeProvider(org.eclipse.xtext.common.types.xtext.ui.JdtBasedSimpleTypeScopeProvider) IQualifiedNameConverter(org.eclipse.xtext.naming.IQualifiedNameConverter) MockJavaProjectProvider(org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider) Before(org.junit.Before)

Example 4 with MockJavaProjectProvider

use of org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider in project xtext-eclipse by eclipse.

the class JdtBasedSimpleTypeScopeTest method setUp.

@Before
public void setUp() throws Exception {
    projectProvider = new MockJavaProjectProvider();
    factory = new JdtTypeProviderFactory(projectProvider);
    resourceSet = new ResourceSetImpl();
    typeScope = new JdtBasedSimpleTypeScope(factory.createTypeProvider(resourceSet), new IQualifiedNameConverter.DefaultImpl(), Predicates.<IEObjectDescription>alwaysTrue());
}
Also used : JdtTypeProviderFactory(org.eclipse.xtext.common.types.access.jdt.JdtTypeProviderFactory) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) JdtBasedSimpleTypeScope(org.eclipse.xtext.common.types.xtext.ui.JdtBasedSimpleTypeScope) MockJavaProjectProvider(org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Before(org.junit.Before)

Example 5 with MockJavaProjectProvider

use of org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider in project xtext-eclipse by eclipse.

the class TypeResourceUnloaderTest method setUp.

@Before
public void setUp() throws Exception {
    eventBroker = AbstractActivator.getInstance().getInjector(DUMMY_LANG_NAME).getInstance(IStateChangeEventBroker.class);
    projectProvider = new MockJavaProjectProvider();
    projectProvider.setUseSource(true);
    project = projectProvider.getJavaProject(null);
    type = project.findType(NESTED_TYPES);
    compilationUnit = type.getCompilationUnit();
    compilationUnit.becomeWorkingCopy(null);
    // wait until the BackgroundThread for the reconciler was started
    editor = waitForElementChangedEvent(new Callable<IEditorPart>() {

        @Override
        public IEditorPart call() throws Exception {
            return JavaUI.openInEditor(compilationUnit);
        }
    }, true);
    eventBroker.addListener(this);
    document = getDocument();
    originalContent = document.get();
    subsequentEvents = Lists.newArrayList();
}
Also used : IStateChangeEventBroker(org.eclipse.xtext.ui.notification.IStateChangeEventBroker) MockJavaProjectProvider(org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider) Callable(java.util.concurrent.Callable) Before(org.junit.Before)

Aggregations

MockJavaProjectProvider (org.eclipse.xtext.common.types.access.jdt.MockJavaProjectProvider)6 Before (org.junit.Before)6 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)4 JdtTypeProviderFactory (org.eclipse.xtext.common.types.access.jdt.JdtTypeProviderFactory)3 JdtBasedSimpleTypeScope (org.eclipse.xtext.common.types.xtext.ui.JdtBasedSimpleTypeScope)2 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)2 Callable (java.util.concurrent.Callable)1 ResourceImpl (org.eclipse.emf.ecore.resource.impl.ResourceImpl)1 JdtTypeProvider (org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider)1 JdtBasedConstructorScope (org.eclipse.xtext.common.types.xtext.ui.JdtBasedConstructorScope)1 JdtBasedSimpleTypeScopeProvider (org.eclipse.xtext.common.types.xtext.ui.JdtBasedSimpleTypeScopeProvider)1 XtextResourceSetBasedProjectProvider (org.eclipse.xtext.common.types.xtext.ui.XtextResourceSetBasedProjectProvider)1 IQualifiedNameConverter (org.eclipse.xtext.naming.IQualifiedNameConverter)1 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)1 IStateChangeEventBroker (org.eclipse.xtext.ui.notification.IStateChangeEventBroker)1