org.eclipse.xtext.builder.clustering.CurrentDescriptions Java Examples

The following examples show how to use org.eclipse.xtext.builder.clustering.CurrentDescriptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DoUpdateImplementation.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
public DoUpdateImplementation(N4ClusteringBuilderState state, BuildData buildData,
		ResourceDescriptionsData newData, IProgressMonitor monitor, IBuildLogger buildLogger,
		IResourceLoader crossLinkingResourceLoader, IResourceClusteringPolicy clusteringPolicy) {
	this.clusteringPolicy = clusteringPolicy;
	this.crossLinkingResourceLoader = crossLinkingResourceLoader;
	this.buildLogger = buildLogger;
	this.state = state;
	this.buildData = buildData;
	this.newData = newData;
	this.progress = SubMonitor.convert(monitor);
	this.cancelMonitor = new MonitorBasedCancelIndicator(progress);
	this.toBeDeleted = buildData.getAndRemoveToBeDeleted();
	this.resourceSet = buildData.getResourceSet();
	this.newState = new CurrentDescriptions(resourceSet, newData, buildData);
	this.currentProject = state.getBuiltProject(buildData);
	this.queue = buildData.getURIQueue();
}
 
Example #2
Source File: WriteNewResourceDescriptionsImplementation.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
public WriteNewResourceDescriptionsImplementation(N4ClusteringBuilderState state, BuildData buildData,
		IResourceDescriptions oldState,
		CurrentDescriptions newState, IProgressMonitor monitor,
		IBuildLogger buildLogger,
		IResourceLoader globalIndexResourceLoader,
		IResourceClusteringPolicy clusteringPolicy, CompilerPhases compilerPhases) {
	this.compilerPhases = compilerPhases;
	this.clusteringPolicy = clusteringPolicy;
	this.globalIndexResourceLoader = globalIndexResourceLoader;
	this.state = state;
	this.buildData = buildData;
	this.oldState = oldState;
	this.newState = newState;
	this.progress = SubMonitor.convert(monitor, buildData.getToBeUpdated().size());
	this.buildLogger = buildLogger;
	this.resourceSet = buildData.getResourceSet();
	this.currentProject = state.getBuiltProject(buildData);
}
 
Example #3
Source File: MonitoredClusteringBuilderState.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void writeNewResourceDescriptions(final BuildData buildData, final IResourceDescriptions oldState, final CurrentDescriptions newState, final ResourceDescriptionsData newData, final IProgressMonitor monitor) {
  final List<List<URI>> toWriteGroups = phaseOneBuildSorter.sort(buildData.getToBeUpdated());
  final List<URI> toBuild = Lists.newLinkedList();
  ResourceSet resourceSet = buildData.getResourceSet();
  BuildPhases.setIndexing(resourceSet, true);
  int totalSize = 0;
  for (List<URI> group : toWriteGroups) {
    totalSize = totalSize + group.size();
  }
  final SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.MonitoredClusteringBuilderState_WRITE_DESCRIPTIONS, totalSize);

  try {
    traceSet.started(BuildIndexingEvent.class);
    /*
     * We handle one group at a time to enforce strict ordering between some specific source types.
     * I.e. We start processing a source type (or a set of them) only after all occurrences of another source on which the depend has been written into the
     * index.
     * One list sorted by source type would not be enough to enforce such ordering in a parallel loading scenario.
     * In fact, in this case we might start processing sources before the ones they depend on are still being handled.
     */
    for (Collection<URI> fileExtensionBuildGroup : toWriteGroups) {
      toBuild.addAll(writeResources(fileExtensionBuildGroup, buildData, oldState, newState, subMonitor));
    }
    flushChanges(newData);
  } finally {
    // Clear the flags
    BuildPhases.setIndexing(resourceSet, false);
    resourceSet.getLoadOptions().remove(ILazyLinkingResource2.MARK_UNRESOLVABLE_XREFS);
    phaseTwoBuildSorter.sort(toBuild).stream().flatMap(List::stream).forEach(buildData::queueURI);
    traceSet.ended(BuildIndexingEvent.class);
  }

}
 
Example #4
Source File: CurrentDescriptions2.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Set the context.
 * 
 * @param ctx
 *          The context
 */
@Override
public void setContext(final Notifier ctx) {
  super.setContext(ctx);
  final ResourceSet resourceSet = EcoreUtil2.getResourceSet(ctx);
  IResourceDescriptions adapter = (IResourceDescriptions) EcoreUtil2.getAdapter(resourceSet.eAdapters(), CurrentDescriptions.class);
  if (adapter instanceof IResourceDescriptions2) {
    delegate = (IResourceDescriptions2) adapter;
  } else {
    delegate = new ResourceDescriptions2(adapter);
  }
}
 
Example #5
Source File: SharedStateModule.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.8
 */
public void configureResourceDescriptionsProvider(Binder binder) {
	if (Activator.isJavaEnabled()) {
		binder.install(new ResourceDescriptionsProviderModule());
	} else {
		binder.bind(ResourceDescriptionsProvider.class).in(Scopes.SINGLETON);
	}
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE))
		.to(LiveShadowedResourceDescriptions.class);
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE))
		.to(CurrentDescriptions.ResourceSetAware.class);
	binder.bind(org.eclipse.xtext.resource.IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class);
}
 
Example #6
Source File: SharedCommonTypesModule.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public void configure(Binder binder) {
	binder.bind(IEObjectHoverProvider.class).to(JdtHoverProvider.class);
	binder.bind(IEObjectHoverDocumentationProvider.class).to(JdtHoverDocumentationProvider.class);
	binder.bind(IResourceServiceProvider.class).to(SharedCommonTypesResourceServiceProvider.class);
	binder.bind(IResourceSetProvider.class).to(XtextResourceSetProvider.class);
	binder.bindConstant().annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).to("java");

	binder.bind(IQualifiedNameProvider.class).to(JvmIdentifiableQualifiedNameProvider.class);
	binder.bind(ICopyQualifiedNameService.class).to(DefaultCopyQualifiedNameService.class);
	binder.bind(IJvmTypeProvider.Factory.class).to(JdtTypeProviderFactory.class);
	binder.bind(IRenameRefactoringProvider.class).to(DefaultRenameRefactoringProvider.class);
	binder.bind(AbstractRenameProcessor.class).to(JvmMemberRenameProcessor.class);
	binder.bind(IRenameStrategy.Provider.class).to(JvmMemberRenameStrategy.Provider.class);
	binder.bind(RefactoringResourceSetProvider.class).to(JvmRefactoringResourceSetProvider.class);
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("Java");

	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE))
			.to(LiveShadowedResourceDescriptions.class);
	binder.bind(IResourceDescriptions.class)
			.annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE))
			.to(CurrentDescriptions.ResourceSetAware.class);
	binder.bind(IResourceDescriptions.class)
			.annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS))
			.to(IBuilderState.class);

	binder.bind(IWorkspaceRoot.class).toInstance(ResourcesPlugin.getWorkspace().getRoot());
	binder.bind(ITraceForStorageProvider.class).to(TraceForStorageProvider.class);

	binder.bind(IReferenceUpdater.class).to(NullReferenceUpdater.class);
}
 
Example #7
Source File: AbstractPureXbaseUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #8
Source File: XtextUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(com.google.inject.Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #9
Source File: AbstractEcore2XtextTestUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #10
Source File: AbstractDomainmodelUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #11
Source File: AbstractStatemachineUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #12
Source File: AbstractRuleEngineUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #13
Source File: AbstractArithmeticsUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #14
Source File: AbstractBuilderTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #15
Source File: AbstractXbaseUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #16
Source File: AbstractXbaseWithAnnotationsUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #17
Source File: AbstractCodetemplatesUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #18
Source File: AbstractBug462047LangUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #19
Source File: AbstractXImportSectionTestLangUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #20
Source File: AbstractContentAssistFragmentTestLangUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #21
Source File: AbstractXtendUiModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #22
Source File: AbstractHelloWorldUiModule.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #23
Source File: AbstractGamlUiModule.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #24
Source File: AbstractSARLUiModule.java    From sarl with Apache License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #25
Source File: AbstractN4JSUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #26
Source File: N4ClusteringBuilderState.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Put all resources that depend on some changes onto the queue of resources to be processed. Updates notInDelta by
 * removing all URIs put into the queue.
 *
 * @param allRemainingURIs
 *            URIs that were not considered by prior operations.
 * @param oldState
 *            State before the build
 * @param newState
 *            The current state
 * @param changedDeltas
 *            the deltas that have changed {@link IEObjectDescription}s
 * @param allDeltas
 *            All deltas
 * @param buildData
 *            the underlying data for this build run.
 * @param monitor
 *            The progress monitor used for user feedback
 */
protected void queueAffectedResources(
		Set<URI> allRemainingURIs,
		IResourceDescriptions oldState,
		CurrentDescriptions newState,
		Collection<Delta> changedDeltas,
		Collection<Delta> allDeltas,
		BuildData buildData,
		final IProgressMonitor monitor) {
	if (allDeltas.isEmpty()) {
		return;
	}
	final SubMonitor progress = SubMonitor.convert(monitor, allRemainingURIs.size());
	Iterator<URI> iter = allRemainingURIs.iterator();
	while (iter.hasNext()) {
		if (progress.isCanceled()) {
			throw new OperationCanceledException();
		}
		final URI candidateURI = iter.next();
		final IResourceDescription candidateDescription = oldState.getResourceDescription(candidateURI);
		final IResourceDescription.Manager manager = getResourceDescriptionManager(candidateURI);
		if (candidateDescription == null || manager == null) {
			// If there is no description in the old state, there's no need to re-check this over and over.
			iter.remove();
		} else {
			boolean affected;
			if ((manager instanceof IResourceDescription.Manager.AllChangeAware)) {
				affected = ((AllChangeAware) manager).isAffectedByAny(allDeltas, candidateDescription, newState);
			} else {
				if (changedDeltas.isEmpty()) {
					affected = false;
				} else {
					affected = manager.isAffected(changedDeltas, candidateDescription, newState);
				}
			}
			if (affected) {
				buildData.queueURI(candidateURI);
				// since the candidate is affected by any of the currently changed resources, we disable
				// the module data of the candidate to ensure that no code will see it later on by accident
				// Related tests:
				// - IncrementalBuilderCornerCasesPluginTest#testMissingReloadBug()
				// - ReproduceInvalidIndexPluginTest
				if (!N4JSGlobals.PACKAGE_JSON.equals(candidateURI.lastSegment())) {
					ResourceDescriptionWithoutModuleUserData noModuleData = new ResourceDescriptionWithoutModuleUserData(
							candidateDescription);
					newState.register(manager.createDelta(candidateDescription, noModuleData));
					// also we ensure that we do run a subsequent build.
					buildData.requestRebuild();
				}
				iter.remove();
			}
		}
		progress.worked(1);
	}
}
 
Example #27
Source File: AbstractRegularExpressionUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #28
Source File: AbstractBromiumUiModule.java    From bromium with MIT License 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #29
Source File: AbstractMyDslUiModule.java    From M2Doc with Eclipse Public License 1.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}
 
Example #30
Source File: AbstractFileAwareTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsBuilderScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class);
}