org.eclipse.xtext.common.types.access.jdt.JdtTypeProviderFactory Java Examples

The following examples show how to use org.eclipse.xtext.common.types.access.jdt.JdtTypeProviderFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JdtBasedSimpleTypeScopeProviderTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@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);
}
 
Example #2
Source File: CrySLParser.java    From CogniCrypt with Eclipse Public License 2.0 5 votes vote down vote up
public CrySLParser(IProject iProject) throws CoreException, IOException {
	final Injector injector = CrySLActivator.getInstance().getInjector(CrySLActivator.DE_DARMSTADT_TU_CROSSING_CRYSL);
	resourceSet = injector.getInstance(XtextResourceSet.class);

	if (iProject == null) {
		// if no project selected abort with error message
		iProject = Utils.complileListOfJavaProjectsInWorkspace().get(0);
	}
	if (iProject.isOpen()) {
		resourceSet.setClasspathURIContext(JavaCore.create(iProject));
	}
	new JdtTypeProviderFactory(injector.getInstance(IJavaProjectProvider.class)).createTypeProvider(resourceSet);

	resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
}
 
Example #3
Source File: JdtBasedSimpleTypeScopeTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@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());
}
 
Example #4
Source File: JdtBasedConstructorScopeTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@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);
}
 
Example #5
Source File: AbstractXbaseContentAssistTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected final XtextResourceSet getResourceSet() {
	XtextResourceSet resourceSet = get(XtextResourceSet.class);
	IJvmTypeProvider.Factory typeProviderFactory = new JdtTypeProviderFactory(this);
	typeProviderFactory.findOrCreateTypeProvider(resourceSet);
	resourceSet.setClasspathURIContext(getJavaProject(resourceSet));
	return resourceSet;
}
 
Example #6
Source File: SharedCommonTypesModule.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public void configure(Binder binder) {
	binder.bind(IEObjectHoverProvider.class).to(JdtHoverProvider.class);
	binder.bind(IEObjectHoverDocumentationProvider.class).to(JdtHoverDocumentationProvider.class);
	binder.bind(IResourceServiceProvider.class).to(SharedCommonTypesResourceServiceProvider.class);
	binder.bind(IResourceSetProvider.class).to(XtextResourceSetProvider.class);
	binder.bindConstant().annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).to("java");

	binder.bind(IQualifiedNameProvider.class).to(JvmIdentifiableQualifiedNameProvider.class);
	binder.bind(ICopyQualifiedNameService.class).to(DefaultCopyQualifiedNameService.class);
	binder.bind(IJvmTypeProvider.Factory.class).to(JdtTypeProviderFactory.class);
	binder.bind(IRenameRefactoringProvider.class).to(DefaultRenameRefactoringProvider.class);
	binder.bind(AbstractRenameProcessor.class).to(JvmMemberRenameProcessor.class);
	binder.bind(IRenameStrategy.Provider.class).to(JvmMemberRenameStrategy.Provider.class);
	binder.bind(RefactoringResourceSetProvider.class).to(JvmRefactoringResourceSetProvider.class);
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("Java");

	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE))
			.to(LiveShadowedResourceDescriptions.class);
	binder.bind(IResourceDescriptions.class)
			.annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE))
			.to(CurrentDescriptions.ResourceSetAware.class);
	binder.bind(IResourceDescriptions.class)
			.annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS))
			.to(IBuilderState.class);

	binder.bind(IWorkspaceRoot.class).toInstance(ResourcesPlugin.getWorkspace().getRoot());
	binder.bind(ITraceForStorageProvider.class).to(TraceForStorageProvider.class);

	binder.bind(IReferenceUpdater.class).to(NullReferenceUpdater.class);
}
 
Example #7
Source File: AbstractXbaseContentAssistTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected final XtextResourceSet getResourceSet() {
	XtextResourceSet resourceSet = get(XtextResourceSet.class);
	IJvmTypeProvider.Factory typeProviderFactory = new JdtTypeProviderFactory(this);
	typeProviderFactory.findOrCreateTypeProvider(resourceSet);
	resourceSet.setClasspathURIContext(getJavaProject(resourceSet));
	return resourceSet;
}
 
Example #8
Source File: AbstractXbaseContentAssistTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected final XtextResourceSet getResourceSet() {
	XtextResourceSet resourceSet = get(XtextResourceSet.class);
	IJvmTypeProvider.Factory typeProviderFactory = new JdtTypeProviderFactory(this);
	typeProviderFactory.findOrCreateTypeProvider(resourceSet);
	resourceSet.setClasspathURIContext(getJavaProject(resourceSet));
	return resourceSet;
}
 
Example #9
Source File: Bug287941Test.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void initializeTypeProvider(XtextResourceSet set) {
	IJvmTypeProvider.Factory typeProviderFactory = new JdtTypeProviderFactory(this);
	typeProviderFactory.findOrCreateTypeProvider(set);
	set.setClasspathURIContext(this);
}
 
Example #10
Source File: AbstractXtendContentAssistBugTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
protected void initializeTypeProvider(XtextResource result) {
	XtextResourceSet resourceSet = (XtextResourceSet) result.getResourceSet();
	IJvmTypeProvider.Factory typeProviderFactory = new JdtTypeProviderFactory(this);
	typeProviderFactory.findOrCreateTypeProvider(resourceSet);
	resourceSet.setClasspathURIContext(getJavaProject(resourceSet));
}
 
Example #11
Source File: AbstractContentAssistTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void initializeTypeProvider(final XtextResourceSet set) {
	final JdtTypeProviderFactory typeProviderFactory = new JdtTypeProviderFactory(this);
	typeProviderFactory.findOrCreateTypeProvider(set);
	set.setClasspathURIContext(getJavaProject(set));
}
 
Example #12
Source File: JdtBasedSimpleTypeScopeProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public JdtTypeProviderFactory getTypeProviderFactory() {
	return typeProviderFactory;
}
 
Example #13
Source File: JdtBasedSimpleTypeScopeProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public JdtBasedSimpleTypeScopeProvider(JdtTypeProviderFactory typeProviderFactory, IQualifiedNameConverter qualifiedNameConverter) {
	this.typeProviderFactory = typeProviderFactory;
	this.qualifiedNameConverter = qualifiedNameConverter;
}
 
Example #14
Source File: AbstractContentAssistTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void initializeTypeProvider(XtextResourceSet resourceSet) {
	JdtTypeProviderFactory typeProviderFactory = new JdtTypeProviderFactory(this);
	typeProviderFactory.findOrCreateTypeProvider(resourceSet);
	resourceSet.setClasspathURIContext(getJavaProject(resourceSet));
}
 
Example #15
Source File: AbstractHyperlinkingTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void initializeTypeProvider(XtextResourceSet set) {
	JdtTypeProviderFactory typeProviderFactory = new JdtTypeProviderFactory(this);
	typeProviderFactory.findOrCreateTypeProvider(set);
	set.setClasspathURIContext(getJavaProject(set));
}
 
Example #16
Source File: AbstractXbaseContentAssistBugTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void initializeTypeProvider(XtextResource result) {
	XtextResourceSet resourceSet = (XtextResourceSet) result.getResourceSet();
	JdtTypeProviderFactory typeProviderFactory = new JdtTypeProviderFactory(this);
	typeProviderFactory.findOrCreateTypeProvider(resourceSet);
	resourceSet.setClasspathURIContext(getJavaProject(resourceSet));
}
 
Example #17
Source File: JdtBasedModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Class<? extends Factory> bindIJvmTypeProvider$Factory() {
	return JdtTypeProviderFactory.class;
}
 
Example #18
Source File: AbstractCheckContentAssistBugTest.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Initializes the type provider used for accessing JvmTypes.
 *
 * @param set
 *          the resource set
 */
protected void initializeTypeProvider(final XtextResourceSet set) {
  IJvmTypeProvider.Factory typeProviderFactory = new JdtTypeProviderFactory(this);
  typeProviderFactory.findOrCreateTypeProvider(set);
  set.setClasspathURIContext(getJavaProject(set));
}
 
Example #19
Source File: CheckUiModule.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Binds a JDT type provider factory capable of creating bundle aware type providers.
 *
 * @return the JDT type provider factory
 */
public Class<? extends JdtTypeProviderFactory> bindJdtTypeProviderFactory() {
  return JdtFallbackTypeProviderFactory.class;
}