Skip to content

Commit

Permalink
[FIXUP] use new Xtext methods to get-rid of all remaining Guava usages
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell committed Aug 14, 2024
1 parent c8a21e9 commit 3a77d49
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
<unit id="org.junit" version="0.0.0"/>
<unit id="org.apache.commons.cli" version="1.8.0"/>
<unit id="org.apache.commons.commons-logging" version="0.0.0"/>
<unit id="com.google.guava" version="33.2.1.jre"/>
<unit id="com.google.guava.failureaccess" version="1.0.2"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-09"/>
</location>
</locations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
<unit id="org.junit" version="0.0.0"/>
<unit id="org.apache.commons.cli" version="1.8.0"/>
<unit id="org.apache.commons.commons-logging" version="0.0.0"/>
<unit id="com.google.guava" version="33.2.1.jre"/>
<unit id="com.google.guava.failureaccess" version="1.0.2"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-09"/>
</location>
</locations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
Expand All @@ -34,12 +35,11 @@
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.util.SimpleAttributeResolver;

import com.google.common.base.Function;
import com.google.inject.Inject;
import com.google.inject.Provider;

/**
*
*
*/
public class Mwe2ScopeProvider extends AbstractDeclarativeScopeProvider {

Expand All @@ -48,7 +48,7 @@ public class Mwe2ScopeProvider extends AbstractDeclarativeScopeProvider {

@Inject
private FactorySupport factorySupport;

@Inject
private Provider<NameComputation> nameComputationProvider;

Expand Down Expand Up @@ -150,13 +150,13 @@ public IInjectableFeatureLookup getFeatureLookup() {
protected IScope createLocalScope(List<? extends EObject> elements) {
return Scopes.scopeFor(elements, nameComputationProvider.get(), IScope.NULLSCOPE);
}

protected static class NameComputation implements Function<EObject, QualifiedName> {
@Inject
private IQualifiedNameConverter qualifiedNameConverter;

private SimpleAttributeResolver<EObject, String> nameResolver = SimpleAttributeResolver.newResolver(String.class, "name");

@Override
public QualifiedName apply(EObject from) {
String name = nameResolver.apply(from);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.tests.container;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.mwe2.language.tests.Mwe2InjectorProvider;
import org.eclipse.emf.mwe2.language.mwe2.Module;
import org.eclipse.emf.mwe2.language.tests.Mwe2InjectorProvider;
import org.eclipse.xtext.mwe.ContainersStateFactory;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.resource.containers.DelegatingIAllContainerAdapter;
Expand All @@ -26,8 +27,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import com.google.common.collect.Multimaps;
import com.google.common.collect.SetMultimap;
import com.google.inject.Inject;

/**
Expand Down Expand Up @@ -56,9 +55,8 @@ public void testFileNotOnClasspath() throws Exception {

// configure container for this file
final String CONTAINER = "mycontainer";
SetMultimap<String, URI> mapped = Multimaps.forMap(Collections.singletonMap(CONTAINER, target));
List<String> containers = Collections.singletonList(CONTAINER);
IAllContainersState containersState = stateFactory.getContainersState(containers, mapped);
Map<String, Set<URI>> mapped = Map.of(CONTAINER, Set.of(target));
IAllContainersState containersState = stateFactory.getContainersState(List.of(CONTAINER), mapped);
rs.eAdapters().add(new DelegatingIAllContainerAdapter(containersState));

// assume we can link to the first file even though the new file is not contained in any container
Expand Down

0 comments on commit 3a77d49

Please sign in to comment.