use of org.eclipse.xtext.ide.editor.hierarchy.IHierarchyBuilder in project xtext-eclipse by eclipse.
the class AbstractHierarchyBuilderTest method testBuildHierarchy.
protected void testBuildHierarchy(final Procedure1<? super AbstractHierarchyBuilderTest.HierarchyBuilderTestConfiguration> configurator) {
@Extension final AbstractHierarchyBuilderTest.HierarchyBuilderTestConfiguration configuration = new AbstractHierarchyBuilderTest.HierarchyBuilderTestConfiguration();
configurator.apply(configuration);
final ResourceSet resourceSet = this.createResourceSet(configuration);
final IHierarchyBuilder hierarchyBuilder = configuration.hierarchyBuilderProvider.apply(resourceSet);
String _xifexpression = null;
if ((configuration.resourceURI == null)) {
_xifexpression = IterableExtensions.<Pair<String, String>>last(configuration.models).getKey();
} else {
_xifexpression = configuration.resourceURI;
}
final String resourceURI = _xifexpression;
Resource _resource = resourceSet.getResource(URI.createURI(resourceURI), false);
final XtextResource resource = ((XtextResource) _resource);
final URI rootURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(this._eObjectAtOffsetHelper.resolveElementAt(resource, configuration.index));
final String actualHierarchy = this.toExpectation(rootURI, hierarchyBuilder);
Assert.assertEquals(configuration.expectedHierarchy, actualHierarchy);
}
use of org.eclipse.xtext.ide.editor.hierarchy.IHierarchyBuilder in project xtext-eclipse by eclipse.
the class AbstractHierarchyViewPart method getBuilder.
protected <T extends IHierarchyBuilder> T getBuilder(final Class<T> clazz) {
boolean _isInstance = clazz.isInstance(this.builder);
if (_isInstance) {
return ((T) this.builder);
}
if ((this.builder instanceof DeferredHierarchyBuilder)) {
final IHierarchyBuilder wrappedBuilder = ((DeferredHierarchyBuilder) this.builder).getHierarchyBuilder();
boolean _isInstance_1 = clazz.isInstance(wrappedBuilder);
if (_isInstance_1) {
return ((T) wrappedBuilder);
}
}
return null;
}
use of org.eclipse.xtext.ide.editor.hierarchy.IHierarchyBuilder in project xtext-eclipse by eclipse.
the class AbstractHierarchyBuilderTest method testBuildHierarchy.
protected void testBuildHierarchy(Procedure1<? super HierarchyBuilderTestConfiguration> configurator) {
HierarchyBuilderTestConfiguration configuration = new HierarchyBuilderTestConfiguration();
configurator.apply(configuration);
ResourceSet resourceSet = createResourceSet(configuration);
IHierarchyBuilder hierarchyBuilder = configuration.hierarchyBuilderProvider.apply(resourceSet);
String resourceURI = null;
if (configuration.resourceURI == null) {
resourceURI = Iterables.getLast(configuration.models, null).getKey();
} else {
resourceURI = configuration.resourceURI;
}
XtextResource resource = (XtextResource) resourceSet.getResource(URI.createURI(resourceURI), false);
URI rootURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(eObjectAtOffsetHelper.resolveElementAt(resource, configuration.index));
String actualHierarchy = toExpectation(rootURI, hierarchyBuilder);
Assert.assertEquals(configuration.expectedHierarchy, actualHierarchy);
}
Aggregations