mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
[idea / trace] some smaller fixes and improvements
This commit is contained in:
parent
92f379602e
commit
5c79f9b407
1 changed files with 8 additions and 7 deletions
|
@ -144,8 +144,9 @@ public abstract class AbstractTraceForURIProvider<SomeFile, Trace extends Abstra
|
|||
* Instantiate a new instance of the trace and associate the locate information with the given file.
|
||||
*/
|
||||
protected abstract Trace newAbstractTrace(SomeFile file);
|
||||
|
||||
/**
|
||||
* Obtain the file represenation from the given URI.
|
||||
* Obtain the file representation from the given URI.
|
||||
*/
|
||||
protected SomeFile asFile(AbsoluteURI absoluteURI, IWorkspaceConfig context) {
|
||||
IProjectConfig project = context.findProjectContaining(absoluteURI.getURI());
|
||||
|
@ -153,7 +154,7 @@ public abstract class AbstractTraceForURIProvider<SomeFile, Trace extends Abstra
|
|||
}
|
||||
|
||||
/**
|
||||
* Obtain the file represenation from the given URI.
|
||||
* Obtain the file representation from the given URI.
|
||||
*/
|
||||
protected abstract SomeFile asFile(AbsoluteURI absoluteURI, IProjectConfig project);
|
||||
|
||||
|
@ -203,17 +204,17 @@ public abstract class AbstractTraceForURIProvider<SomeFile, Trace extends Abstra
|
|||
}
|
||||
|
||||
public Trace getTraceToSource(final SomeFile generatedFile) {
|
||||
final PersistedTrace persistedTrace = findPersistedTrace(generatedFile);
|
||||
if (persistedTrace == null || !persistedTrace.exists()) {
|
||||
return null;
|
||||
}
|
||||
Trace result = newAbstractTrace(generatedFile);
|
||||
result.setTraceToSource(true);
|
||||
result.setTraceRegionProvider(new ITraceRegionProvider() {
|
||||
|
||||
@Override
|
||||
public AbstractTraceRegion getTraceRegion() {
|
||||
PersistedTrace persistedTrace = findPersistedTrace(generatedFile);
|
||||
if (persistedTrace != null) {
|
||||
return cachedTraces.getTraceRegion(persistedTrace);
|
||||
}
|
||||
throw new TraceNotFoundException();
|
||||
return cachedTraces.getTraceRegion(persistedTrace);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue