use of org.eclipse.xtext.ui.generator.trace.StorageAwareTrace in project xtext-eclipse by eclipse.
the class TraceEditor method updateText.
protected void updateText(EObject obj) {
DebugTraceRegion region = EcoreUtil2.getContainerOfType(obj, DebugTraceRegion.class);
if (region == null) {
text.setText("No " + DebugTraceRegion.class.getSimpleName() + " found for " + obj.eClass().getName());
return;
}
final DebugTraceBasedRegion trace = new DebugTraceBasedRegion(null, region);
SourceRelativeURI sourceURI = trace.getAssociatedSrcRelativePath();
if (sourceURI == null) {
text.setText("Could not find associated URI");
return;
}
Registry registry = IResourceServiceProvider.Registry.INSTANCE;
IResourceServiceProvider serviceProvider = registry.getResourceServiceProvider(sourceURI.getURI());
URI traceURI = obj.eResource().getURI();
IStorage localStorage = getLocalStorage(serviceProvider, traceURI);
StorageAwareTrace traceProvider = serviceProvider.get(StorageAwareTrace.class);
traceProvider.setLocalStorage(localStorage);
traceProvider.setTraceToSource(true);
traceProvider.setTraceRegionProvider(new ITraceRegionProvider() {
@Override
public AbstractTraceRegion getTraceRegion() throws TraceNotFoundException {
return trace;
}
});
String newText = traceProvider.toString();
text.setText(newText);
}
Aggregations