public DeserializationConversionContext(XtextResource xr, String completeContent) throws IOException { this.grammarAccess = xr.getResourceServiceProvider().get(IGrammarAccess.class); this.idToEObjectMap = Lists.newArrayList(); this.completeContent = completeContent; this.hasErrors = false; fillIdToEObjectMap(xr); }
/** * @since 2.8 */ public List<Issue> validate(Resource resource) { IResourceValidator validator = ((XtextResource) resource).getResourceServiceProvider() .getResourceValidator(); return validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl); }
@Override public IResourceDescription getDescription() { return xtextResource.getResourceServiceProvider().getResourceDescriptionManager().getResourceDescription(xtextResource); }
protected void doValidation() { if (allErrorsAndWarnings == null) { doLinking(); allErrorsAndWarnings = newArrayList(); // validation for (Resource resource : sources) { if (resource instanceof XtextResource) { XtextResource xtextResource = (XtextResource) resource; List<Issue> issues = xtextResource.getResourceServiceProvider().getResourceValidator().validate(xtextResource, checkMode, CancelIndicator.NullImpl); for (Issue issue : issues) { allErrorsAndWarnings.add(issue); } } } } }
protected <T> T getService(Resource resource, Class<T> clazz) { if (resource instanceof XtextResource) { return ((XtextResource) resource).getResourceServiceProvider().get(clazz); } return getService(resource.getURI(), clazz); }
protected void initiallyProcessResource(XtextResource resource) { IResourceServiceProvider serviceProvider = resource.getResourceServiceProvider(); if (serviceProvider != null) { IResourceDescription.Manager descriptionManager = serviceProvider.getResourceDescriptionManager(); if (descriptionManager != null) { final IResourceDescription description = descriptionManager.getResourceDescription(resource); if (description != null) copyState(description); } } }
protected List<Issue> validate(EObject model) { IResourceValidator validator = ((XtextResource) model.eResource()).getResourceServiceProvider() .getResourceValidator(); return validator.validate(model.eResource(), CheckMode.ALL, CancelIndicator.NullImpl); }
public List<Issue> validate(EObject model) { IResourceValidator validator = ((XtextResource) model.eResource()).getResourceServiceProvider() .getResourceValidator(); return validator.validate(model.eResource(), CheckMode.ALL, CancelIndicator.NullImpl); }
public List<Issue> validate(EObject model) { IResourceValidator validator = ((XtextResource) model.eResource()).getResourceServiceProvider() .getResourceValidator(); return validator.validate(model.eResource(), CheckMode.ALL, CancelIndicator.NullImpl); }
@Override public Object execute() throws ScriptExecutionException { if (xExpression != null) { Resource resource = xExpression.eResource(); IEvaluationContext evaluationContext = null; if (resource instanceof XtextResource) { IResourceServiceProvider provider = ((XtextResource) resource).getResourceServiceProvider(); evaluationContext = provider.get(IEvaluationContext.class); } return execute(evaluationContext); } else { throw new ScriptExecutionException("Script does not contain any expression"); } }
protected void checkNoErrorsInValidator(final String model, XtextResource resource) { ResourceValidatorImpl validator = resourceValidatorProvider.get(); Assert.assertNotSame(validator, resource.getResourceServiceProvider().getResourceValidator()); validator.setDiagnosticConverter(new IDiagnosticConverter() { @Override
@Override public JvmTypeReference getTypeReference(/* @NonNull */ XComputedTypeReferenceImplCustom context) { Resource resource = context.eResource(); IResolvedTypes resolvedTypes = null; if (resource instanceof XtextResource) { IBatchTypeResolver typeResolver = ((XtextResource) resource).getResourceServiceProvider().get(IBatchTypeResolver.class); if (typeResolver == null) { throw new IllegalStateException("typeResolver may not be null"); } resolvedTypes = typeResolver.resolveTypes(context); } if (context.eIsSet(TypesPackage.Literals.JVM_SPECIALIZED_TYPE_REFERENCE__EQUIVALENT)) { return context.getEquivalent(); } if (expression != null && resolvedTypes != null) { LightweightTypeReference expressionType = resolvedTypes.getActualType(expression); if (expressionType != null) { JvmTypeReference result = expressionType.toJavaCompliantTypeReference(); return result; } } throw new IllegalStateException("equivalent could not be computed"); }
protected void doGenerate() { if (access == null) { doValidation(); access = fileSystemAccessProvider.get(); access.setOutputConfigurations(outputConfigurations); for (Resource resource : sources) { if (resource instanceof XtextResource) { access.setProjectName(PROJECT_NAME); XtextResource xtextResource = (XtextResource) resource; IResourceServiceProvider resourceServiceProvider = xtextResource.getResourceServiceProvider(); GeneratorDelegate generator = resourceServiceProvider.get(GeneratorDelegate.class); if (generator != null) { GeneratorContext context = new GeneratorContext(); context.setCancelIndicator(CancelIndicator.NullImpl); generator.generate(xtextResource, access, context); } } } generatedCode = newHashMap(); for (final GeneratedFile e : access.getGeneratedFiles()) { if (e.getJavaClassName() != null) { generatedCode.put(e.getJavaClassName(), e.getContents().toString()); } } } }
public Data exec(XtextResource state) throws Exception { IResourceServiceProvider provider = state.getResourceServiceProvider(); IStratumBreakpointSupport breakpointSupport = provider.get(IStratumBreakpointSupport.class); Data result = new Data(); result.name = state.getURI().lastSegment(); result.valid = breakpointSupport != null && breakpointSupport.isValidLineForBreakPoint(state, line); result.types = getClassNamePattern(state); result.lang = provider.get(LanguageInfo.class); return result; } });
CompilerPhases compilerPhases = xtextResource.getResourceServiceProvider().get(CompilerPhases.class); if (compilerPhases.isIndexing(xtextResource.getResourceSet())) { allNestedTypesByName = null;
IExpressionInterpreter interpreter = null; if (resource instanceof XtextResource) { IResourceServiceProvider provider = ((XtextResource) resource).getResourceServiceProvider(); interpreter = provider.get(IExpressionInterpreter.class);
protected boolean isReparseRequired(XtextResource resource, IResourceDescription.Event event) { IResourceDescription.Manager resourceDescriptionManager = resource.getResourceServiceProvider().getResourceDescriptionManager(); IResourceDescription description = resourceDescriptionManager.getResourceDescription(resource); if (resourceDescriptionManager.isAffected(event.getDeltas(), description, resourceDescriptions)) { return true; } if (!isDirty() && !dirtyStateManager.hasContent(resource.getURI())) { IResourceDescription originalDescription = resourceDescriptions.getResourceDescription(resource.getURI()); if (originalDescription != null && descriptionUtils != null) { Set<URI> outgoingReferences = descriptionUtils.collectOutgoingReferences(originalDescription); for(IResourceDescription.Delta delta: event.getDeltas()) { if (delta.haveEObjectDescriptionsChanged() && outgoingReferences.contains(delta.getUri())) return true; } } } return false; }
public void modelChanged(XtextResource resource) { if (resource == null || !dirtyResource.isInitialized()) return; if (isDirty || ((!resource.isTrackingModification() || resource.isModified()) && currentClient.isDirty() && dirtyStateManager.manageDirtyState(delegatingClientAwareResource))) { synchronized (dirtyStateManager) { IResourceDescription.Manager resourceDescriptionManager = resource.getResourceServiceProvider().getResourceDescriptionManager(); final IResourceDescription newDescription = resourceDescriptionManager.getResourceDescription(resource); if (haveEObjectDescriptionsChanged(newDescription, resourceDescriptionManager)) { dirtyResource.copyState(newDescription); dirtyStateManager.announceDirtyStateChanged(delegatingClientAwareResource); } } } }
IResourceServiceProvider _resourceServiceProvider = resource.getResourceServiceProvider(); ISemanticHighlightingCalculator _get = null; if (_resourceServiceProvider!=null) { IResourceServiceProvider _resourceServiceProvider_1 = resource.getResourceServiceProvider(); ISemanticHighlightingStyleToTokenMapper _get_1 = null; if (_resourceServiceProvider_1!=null) {