Java 类org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider 实例源码

项目:xtext-extras    文件:BuilderIntegrationFragment.java   
@Override
public Set<Binding> getGuiceBindingsUi(Grammar grammar) {
    return new BindFactory()
        .addConfiguredBinding(
                IResourceDescriptions.class.getName() + "BuilderScope",
                "binder.bind(" + IResourceDescriptions.class.getName() + ".class"
                        + ").annotatedWith(com.google.inject.name.Names.named("
                        + ResourceDescriptionsProvider.class.getName() + ".NAMED_BUILDER_SCOPE)).to("
                        + "org.eclipse.xtext.builder.clustering.CurrentDescriptions.ResourceSetAware.class)")
        .addTypeToType("org.eclipse.xtext.ui.editor.IXtextEditorCallback", "org.eclipse.xtext.builder.nature.NatureAddingEditorCallback")
        .addTypeToType("org.eclipse.xtext.generator.IContextualOutputConfigurationProvider", "org.eclipse.xtext.builder.EclipseOutputConfigurationProvider")
        .addConfiguredBinding(
                IResourceDescriptions.class.getName() + "Persisted",
                "binder.bind("+ IResourceDescriptions.class.getName() + ".class"
                        + ").annotatedWith(com.google.inject.name.Names.named("
                        + "org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to("
                        + "org.eclipse.xtext.builder.builderState.IBuilderState.class)")
        .addTypeToType("org.eclipse.xtext.ui.editor.DocumentBasedDirtyResource", "org.eclipse.xtext.builder.impl.PersistentDataAwareDirtyResource")
        .getBindings();
}
项目:dsl-devkit    文件:ParallelResourceLoader.java   
public ParallelLoadOperation(final ResourceSet parent, final IProject project) {
  this.parent = parent;
  if (queueSize == -1) {
    this.resourceQueue = new LinkedBlockingQueue<Triple<URI, Resource, Throwable>>();
  } else if (queueSize == 0) {
    this.resourceQueue = new SynchronousQueue<Triple<URI, Resource, Throwable>>();
  } else {
    this.resourceQueue = new ArrayBlockingQueue<Triple<URI, Resource, Throwable>>(queueSize);
  }
  this.resourceSetProvider = new ThreadLocal<ResourceSet>() {
    @Override
    protected ResourceSet initialValue() {
      ResourceSet resourceSet = getResourceSetProvider().get(project);
      resourceSet.getLoadOptions().putAll(parent.getLoadOptions());
      // we are not loading as part of a build
      resourceSet.getLoadOptions().remove(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE);
      resourceSet.setURIConverter(parent.getURIConverter());
      return resourceSet;
    }
  };
  this.executor = Executors.newFixedThreadPool(nThreads);
  this.waitTime = getTimeout();
}
项目:smaccm    文件:SimulationLaunchConfigurationDelegate.java   
private ComponentImplementation findComponentImplementation(final IProject project, final String qualifiedNameStr) {
    final QualifiedName qualifiedName = QualifiedName.create(qualifiedNameStr.split("::"));

    final IPath projectPath = project == null ? null : project.getFullPath();
    final Injector injector = OsateCorePlugin.getDefault().getInjector("org.osate.xtext.aadl2.properties.Properties");
    final ResourceDescriptionsProvider resourceDescProvider = injector.getInstance(ResourceDescriptionsProvider.class);
    final IResourceDescriptions resDescriptions = resourceDescProvider.getResourceDescriptions(new XtextResourceSet());

    for(final IResourceDescription resDesc : resDescriptions.getAllResourceDescriptions()) {
        final IPath resPath = new Path(resDesc.getURI().toPlatformString(true));
        if(project == null || projectPath.isPrefixOf(resPath)) {
            for(IEObjectDescription eod : resDesc.getExportedObjects(componentImplementationEClass, qualifiedName, true)) {                 
                return (ComponentImplementation)eod.getEObjectOrProxy();
            }
        }
    }

    return null;
}
项目:xtext-extras    文件:StandaloneBuilderModule.java   
@Override
protected void configure() {
  this.<IResourceDescriptions>bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(ResourceSetBasedResourceDescriptions.class);
  this.<IResourceDescriptions>bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE)).to(ResourceSetBasedResourceDescriptions.class);
  this.<IResourceDescriptions>bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
  this.<IResourceDescriptions>bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
  this.<IIssueHandler>bind(IIssueHandler.class).to(this.bindIIssueHandler());
  this.<AbstractFileSystemAccess>bind(AbstractFileSystemAccess.class).to(this.bindJavaIoFileSystemAccess());
  this.<IJavaCompiler>bind(IJavaCompiler.class).to(this.bindIJavaCompiler());
  this.<IEncodingProvider>bind(IEncodingProvider.class).to(this.bindIEncodingProvider());
}
项目:xtext-core    文件:DefaultGlobalScopeProvider.java   
protected String getCacheKey(String base, ResourceSet context) {
    Map<Object, Object> loadOptions = context.getLoadOptions();
    if (loadOptions.containsKey(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)) {
        return base + "@" + ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE;
    } 
    return base + "@DEFAULT_SCOPE"; 
}
项目:xtext-core    文件:RenameService.java   
@Override
public WorkspaceEdit rename(final WorkspaceManager workspaceManager, final RenameParams renameParams, final CancelIndicator cancelIndicator) {
  WorkspaceEdit _xblockexpression = null;
  {
    final URI uri = this._uriExtensions.toUri(renameParams.getTextDocument().getUri());
    final ServerRefactoringIssueAcceptor issueAcceptor = this.issueProvider.get();
    final Function2<Document, XtextResource, WorkspaceEdit> _function = (Document document, XtextResource resource) -> {
      final ProjectManager projectManager = workspaceManager.getProjectManager(uri);
      final XtextResourceSet resourceSet = projectManager.createNewResourceSet(projectManager.getIndexState().getResourceDescriptions());
      resourceSet.getLoadOptions().put(ResourceDescriptionsProvider.LIVE_SCOPE, Boolean.valueOf(true));
      final int offset = document.getOffSet(renameParams.getPosition());
      final WorkspaceEdit workspaceEdit = new WorkspaceEdit();
      final Resource xtextResource = resourceSet.getResource(resource.getURI(), true);
      if ((xtextResource instanceof XtextResource)) {
        final EObject element = this._eObjectAtOffsetHelper.resolveElementAt(((XtextResource)xtextResource), offset);
        if (((element == null) || element.eIsProxy())) {
          StringConcatenation _builder = new StringConcatenation();
          _builder.append("No element found at position line:");
          int _line = renameParams.getPosition().getLine();
          _builder.append(_line);
          _builder.append(" column:");
          int _character = renameParams.getPosition().getCharacter();
          _builder.append(_character);
          issueAcceptor.add(RefactoringIssueAcceptor.Severity.FATAL, _builder.toString());
        } else {
          String _newName = renameParams.getNewName();
          URI _uRI = EcoreUtil.getURI(element);
          final RenameChange change = new RenameChange(_newName, _uRI);
          final IChangeSerializer changeSerializer = this.changeSerializerProvider.get();
          final RenameContext context = new RenameContext(Collections.<RenameChange>unmodifiableList(CollectionLiterals.<RenameChange>newArrayList(change)), resourceSet, changeSerializer, issueAcceptor);
          this.renameStrategy.applyRename(context);
          final ChangeConverter changeConverter = this.converterFactory.create(workspaceManager, workspaceEdit);
          changeSerializer.applyModifications(changeConverter);
        }
      } else {
        issueAcceptor.add(RefactoringIssueAcceptor.Severity.FATAL, "Loaded resource is not an XtextResource", resource.getURI());
      }
      return workspaceEdit;
    };
    _xblockexpression = workspaceManager.<WorkspaceEdit>doRead(uri, _function);
  }
  return _xblockexpression;
}
项目:dsl-devkit    文件:BuilderIntegrationFragment.java   
/** {@inheritDoc} */
@Override
public Set<Binding> getGuiceBindingsUi(final Grammar grammar) {
  final Set<Binding> bindings = super.getGuiceBindingsUi(grammar);
  final BindFactory factory = new BindFactory();
  factory.addConfiguredBinding(IResourceDescriptions.class.getName() + "BuilderScope", "binder.bind(" + IResourceDescriptions.class.getName() + ".class"
      + ").annotatedWith(com.google.inject.name.Names.named(" + ResourceDescriptionsProvider.class.getName() + ".NAMED_BUILDER_SCOPE)).to("
      + "com.avaloq.tools.ddk.xtext.builder.CurrentDescriptions2.ResourceSetAware.class)");
  final Set<Binding> result = factory.getBindings();
  result.addAll(bindings);
  return result;
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoUiModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
项目:n4js    文件:AbstractRegularExpressionRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:n4js    文件:AbstractN4JSUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
项目:n4js    文件:AbstractN4JSUiModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
项目:n4js    文件:ExternalLibraryBuilderHelper.java   
/**
 * Runs the operation in a blocking fashion.
 *
 * @param helper
 *            the build helper to get the injected services.
 * @param project
 *            the project to clean/build.
 * @param monitor
 *            monitor for the operation.
 */
private void run(final ExternalLibraryBuilderHelper helper, IProject project, IProgressMonitor monitor) {

    checkArgument(project instanceof ExternalProject, "Expected external project: " + project);

    final SubMonitor subMonitor = SubMonitor.convert(monitor, 2);
    final ToBeBuiltComputer computer = helper.builtComputer;
    final IProgressMonitor computeMonitor = subMonitor.newChild(1, SUPPRESS_BEGINTASK);
    monitor.setTaskName("Collecting resource for '" + project.getName() + "'...");
    final ToBeBuilt toBeBuilt = getToBeBuilt(computer, project, computeMonitor);

    if (toBeBuilt.getToBeDeleted().isEmpty() && toBeBuilt.getToBeUpdated().isEmpty()) {
        subMonitor.newChild(1, SUPPRESS_NONE).worked(1);
        return;
    }

    try {

        final IN4JSCore core = helper.core;
        final QueuedBuildData queuedBuildData = helper.queuedBuildData;
        final IBuilderState builderState = helper.builderState;

        final ExternalProject externalProject = (ExternalProject) project;
        final String path = externalProject.getExternalResource().getAbsolutePath();
        final URI uri = URI.createFileURI(path);
        final IN4JSProject n4Project = core.findProject(uri).orNull();

        ResourceSet resourceSet = null;

        try {

            resourceSet = core.createResourceSet(Optional.of(n4Project));
            if (!resourceSet.getLoadOptions().isEmpty()) {
                resourceSet.getLoadOptions().clear();
            }
            resourceSet.getLoadOptions().put(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE, Boolean.TRUE);
            if (resourceSet instanceof ResourceSetImpl) {
                ((ResourceSetImpl) resourceSet).setURIResourceMap(newHashMap());
            }

            final BuildData buildData = new BuildData(
                    project.getName(),
                    resourceSet,
                    toBeBuilt,
                    queuedBuildData,
                    true /* indexingOnly */);

            monitor.setTaskName("Building '" + project.getName() + "'...");
            final IProgressMonitor buildMonitor = subMonitor.newChild(1, SUPPRESS_BEGINTASK);
            builderState.update(buildData, buildMonitor);

        } finally {

            if (null != resourceSet) {
                resourceSet.getResources().clear();
                resourceSet.eAdapters().clear();
            }

        }

    } catch (Exception e) {
        final String message = "Error occurred while " + toString().toLowerCase() + "ing external library "
                + project.getName() + ".";
        LOGGER.error(message, e);
        throw new RuntimeException(message, e);
    }

}
项目:n4js    文件:AbstractRegularExpressionUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
项目:n4js    文件:AbstractRegularExpressionUiModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
项目:n4js    文件:AbstractN4JSRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:n4js    文件:AbstractN4MFUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
项目:n4js    文件:AbstractN4MFUiModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
项目:n4js    文件:AbstractN4MFRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:Xtext_Xtend_HTML_Generator    文件:AbstractMyDslUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
项目:Xtext_Xtend_HTML_Generator    文件:AbstractMyDslUiModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
项目:Xtext_Xtend_HTML_Generator    文件:AbstractMyDslRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:bromium    文件:AbstractBromiumUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
项目:bromium    文件:AbstractBromiumUiModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
项目:bromium    文件:AbstractBromiumRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:gw4e.project    文件:AbstractDSLPoliciesUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
项目:gw4e.project    文件:AbstractDSLPoliciesUiModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
项目:gw4e.project    文件:AbstractDSLPoliciesRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:lcdsl    文件:AbstractLcDslUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
项目:lcdsl    文件:AbstractLcDslUiModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
项目:lcdsl    文件:AbstractLcDslRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:gemoc-studio    文件:AbstractDslRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:gemoc-studio    文件:AbstractDslUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
项目:gemoc-studio    文件:AbstractDslUiModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
项目:org.xtext.dsl.restaurante    文件:AbstractRestauranteRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:org.xtext.dsl.restaurante    文件:AbstractRestauranteUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
项目:org.xtext.dsl.restaurante    文件:AbstractRestauranteUiModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
项目:OCCI-Studio    文件:AbstractOCCIRuntimeModule.java   
public void configureIResourceDescriptionsPersisted(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
项目:OCCI-Studio    文件:AbstractOCCIUiModule.java   
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
    binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}