Search in sources :

Example 6 with IProjectConfig

use of org.eclipse.xtext.workspace.IProjectConfig in project xtext-core by eclipse.

the class CharSequenceTraceWrapper method wrapWithTraceData.

public CharSequence wrapWithTraceData(CharSequence sequence, EObject origin) {
    ITextRegionWithLineInformation location = (ITextRegionWithLineInformation) locationInFileProvider.getSignificantTextRegion(origin);
    AbsoluteURI absoluteURI = new AbsoluteURI(origin.eResource().getURI());
    IProjectConfig projectConfig = projectConfigProvider.getProjectConfig(EcoreUtil2.getResourceSet(origin));
    SourceRelativeURI sourceRelativeURI = absoluteURI.deresolve(projectConfig);
    return wrapWithTraceData(sequence, sourceRelativeURI, location.getOffset(), location.getLength(), location.getLineNumber(), location.getEndLineNumber());
}
Also used : ITextRegionWithLineInformation(org.eclipse.xtext.util.ITextRegionWithLineInformation) IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig)

Example 7 with IProjectConfig

use of org.eclipse.xtext.workspace.IProjectConfig in project xtext-core by eclipse.

the class AbstractTrace method getBestAssociatedLocation.

@Override
public ILocationInResource getBestAssociatedLocation(ITextRegion localRegion, AbsoluteURI uri) {
    IProjectConfig projectConfig = getLocalProjectConfig();
    AbstractTraceRegion left = findTraceRegionAtLeftOffset(localRegion.getOffset());
    left = findParentByURI(left, uri, projectConfig);
    AbstractTraceRegion right = findTraceRegionAtRightOffset(localRegion.getOffset() + localRegion.getLength());
    right = findParentByURI(right, uri, projectConfig);
    return mergeRegions(left, right);
}
Also used : AbstractTraceRegion(org.eclipse.xtext.generator.trace.AbstractTraceRegion) IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig)

Example 8 with IProjectConfig

use of org.eclipse.xtext.workspace.IProjectConfig in project xtext-core by eclipse.

the class LiveShadowedChunkedContainer method isContained.

protected boolean isContained(final URI uri) {
    boolean _or = false;
    IResourceDescription _resourceDescription = this.getChunk().getResourceDescription(uri);
    boolean _tripleNotEquals = (_resourceDescription != null);
    if (_tripleNotEquals) {
        _or = true;
    } else {
        IProjectConfig _projectConfig = this.getProjectConfig();
        ISourceFolder _findSourceFolderContaining = null;
        if (_projectConfig != null) {
            _findSourceFolderContaining = _projectConfig.findSourceFolderContaining(uri);
        }
        boolean _tripleNotEquals_1 = (_findSourceFolderContaining != null);
        _or = _tripleNotEquals_1;
    }
    return _or;
}
Also used : IResourceDescription(org.eclipse.xtext.resource.IResourceDescription) ISourceFolder(org.eclipse.xtext.workspace.ISourceFolder) IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig)

Example 9 with IProjectConfig

use of org.eclipse.xtext.workspace.IProjectConfig in project xtext-core by eclipse.

the class LiveShadowedChunkedContainer method getProjectConfig.

protected IProjectConfig getProjectConfig() {
    if ((!this.isProjectConfigSet)) {
        IWorkspaceConfig _workspaceConfig = this.descriptions.getWorkspaceConfig();
        IProjectConfig _findProjectByName = null;
        if (_workspaceConfig != null) {
            _findProjectByName = _workspaceConfig.findProjectByName(this.containerName);
        }
        this.projectConfig = _findProjectByName;
        this.isProjectConfigSet = true;
    }
    return this.projectConfig;
}
Also used : IWorkspaceConfig(org.eclipse.xtext.workspace.IWorkspaceConfig) IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig)

Example 10 with IProjectConfig

use of org.eclipse.xtext.workspace.IProjectConfig in project xtext-core by eclipse.

the class LiveShadowedChunkedResourceDescriptions method setContext.

@Override
public void setContext(final Notifier ctx) {
    IResourceDescriptions _localDescriptions = this.getLocalDescriptions();
    final Procedure1<ResourceSetBasedResourceDescriptions> _function = (ResourceSetBasedResourceDescriptions it) -> {
        it.setContext(ctx);
        it.setData(null);
    };
    ObjectExtensions.<ResourceSetBasedResourceDescriptions>operator_doubleArrow(((ResourceSetBasedResourceDescriptions) _localDescriptions), _function);
    final ResourceSet resourceSet = EcoreUtil2.getResourceSet(ctx);
    this.setGlobalDescriptions(ChunkedResourceDescriptions.findInEmfObject(resourceSet));
    IProjectConfig _projectConfig = null;
    if (this.projectConfigProvider != null) {
        _projectConfig = this.projectConfigProvider.getProjectConfig(resourceSet);
    }
    IWorkspaceConfig _workspaceConfig = null;
    if (_projectConfig != null) {
        _workspaceConfig = _projectConfig.getWorkspaceConfig();
    }
    this.workspaceConfig = _workspaceConfig;
}
Also used : ResourceSetBasedResourceDescriptions(org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions) IResourceDescriptions(org.eclipse.xtext.resource.IResourceDescriptions) IWorkspaceConfig(org.eclipse.xtext.workspace.IWorkspaceConfig) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig)

Aggregations

IProjectConfig (org.eclipse.xtext.workspace.IProjectConfig)10 URI (org.eclipse.emf.common.util.URI)2 IWorkspaceConfig (org.eclipse.xtext.workspace.IWorkspaceConfig)2 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 AbstractTraceRegion (org.eclipse.xtext.generator.trace.AbstractTraceRegion)1 IResourceDescription (org.eclipse.xtext.resource.IResourceDescription)1 IResourceDescriptions (org.eclipse.xtext.resource.IResourceDescriptions)1 ResourceSetBasedResourceDescriptions (org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions)1 ITextRegionWithLineInformation (org.eclipse.xtext.util.ITextRegionWithLineInformation)1 ISourceFolder (org.eclipse.xtext.workspace.ISourceFolder)1 ProjectConfigAdapter (org.eclipse.xtext.workspace.ProjectConfigAdapter)1