public boolean canHandle(URI uri) { boolean result = delegate.canHandle(uri); return result; }
public boolean canHandle(final RenameChange change) { return this.resourceServiceProvider.canHandle(change.getTargetURI()); }
/** * @since 2.3 */ protected List<IResourceDescription.Delta> getRelevantDeltas(IBuildContext context) { List<IResourceDescription.Delta> result = newArrayList(); for (IResourceDescription.Delta delta : context.getDeltas()) { if (resourceServiceProvider.canHandle(delta.getUri())) result.add(delta); } return result; }
public boolean isValid(URI uri, IStorage storage) { if (uri==null) return false; IResourceServiceProvider resourceServiceProvider = registry.getResourceServiceProvider(uri); if (resourceServiceProvider!=null) { if (resourceServiceProvider instanceof IResourceUIServiceProvider) { return ((IResourceUIServiceProvider) resourceServiceProvider).canHandle(uri, storage); } else { return resourceServiceProvider.canHandle(uri); } } return false; }
/** * Compute whether the given storage is interesting in the context of Xtext. * By default, it will delegate to {@link #canHandle(URI)} and perform a subsequent * check to filter storages from Java target folders. * @return <code>true</code> if the <code>uri / storage</code> pair should be processed. */ public boolean canHandle(URI uri, IStorage storage) { if (delegate.canHandle(uri)) { if (isJavaCoreAvailable()) { return !isJavaTargetFolder(storage); } return true; } return false; }
public <T> T findService(URI uri, Class<T> serviceClazz) { if (thisLanguageServiceProvider.canHandle(uri)) return thisLanguageServiceProvider.get(serviceClazz); IResourceServiceProvider serviceProvider = registry.getResourceServiceProvider(uri); if (serviceProvider==null) return null; final T result = serviceProvider.get(serviceClazz); return result; }
public IRenameElementContext createRenameElementContext(EObject targetElement, final XtextEditor editor, final ITextSelection selection, XtextResource resource) { if(!resourceServiceProvider.canHandle(EcoreUtil2.getPlatformResourceOrNormalizedURI(targetElement))) { IRenameElementContext externalRenameElementContext = createExternalRenameElementContext(targetElement, editor, selection, resource); if (externalRenameElementContext != null) return externalRenameElementContext; } return createLocalRenameElementContext(targetElement, editor, selection, resource); }
protected IRenameElementContext createExternalRenameElementContext(EObject targetElement, XtextEditor editor, ITextSelection selection, XtextResource resource) { if (!resourceServiceProvider.canHandle(EcoreUtil2.getPlatformResourceOrNormalizedURI(targetElement))) { IRenameContextFactory contextFactory = globalServiceProvider.findService(targetElement, IRenameContextFactory.class); if (contextFactory != null) return contextFactory.createRenameElementContext(targetElement, editor, selection, resource); } return null; }
/** * @since 2.4 */ public boolean canBuild(URI uri, IStorage storage) { if (uri == null) return false; IResourceServiceProvider resourceServiceProvider = registry.getResourceServiceProvider(uri); if (resourceServiceProvider != null) { if (resourceServiceProvider instanceof IResourceUIServiceProviderExtension) { return ((IResourceUIServiceProviderExtension) resourceServiceProvider).canBuild(uri, storage); } else if (resourceServiceProvider instanceof IResourceUIServiceProvider) { return ((IResourceUIServiceProvider) resourceServiceProvider).canHandle(uri, storage); } else { return resourceServiceProvider.canHandle(uri); } } return false; }
protected void handleChangedContents(Delta delta, IBuildContext context, IFileSystemAccess fileSystemAccess) { if (!resourceServiceProvider.canHandle(delta.getUri())) return; Resource resource = context.getResourceSet().getResource(delta.getUri(), true); if (shouldGenerate(resource, context)) { generator.doGenerate(resource, fileSystemAccess); context.needRebuild(); } }