org.eclipse.xtext.ui.codetemplates.ui.partialEditing.IPartialEditingContentAssistContextFactory Java Examples

The following examples show how to use org.eclipse.xtext.ui.codetemplates.ui.partialEditing.IPartialEditingContentAssistContextFactory. 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: CodetemplatesProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void complete_Literal(EObject model, RuleCall ruleCall, final ContentAssistContext context,
		final ICompletionProposalAcceptor acceptor) {
	if ((mode & NESTED) != 0) {
		final TemplateData data = new TemplateData(model);
		if (data.doCreateProposals()) {
			final EvaluatedTemplate evaluatedTemplate = new EvaluatedTemplate(data.template);
			temporaryResourceProvider.useTemporaryResource(data.template.eResource().getResourceSet(), 
					data.language, data.rule, evaluatedTemplate.getMappedString(), new IUnitOfWork.Void<XtextResource>() {
				@Override
				public void process(XtextResource resource) throws Exception {
					IPartialEditingContentAssistContextFactory delegateFactory = languageRegistry.getPartialContentAssistContextFactory(data.language);
					delegateFactory.initializeFor(data.rule);
					String mappedInput = evaluatedTemplate.getMappedString();
					int mappedOffset = Math.min(mappedInput.length(), evaluatedTemplate.getMappedOffset(context.getOffset()));
					DummyDocument document = new DummyDocument(mappedInput);
					DummyTextViewer dummyViewer = new DummyTextViewer(TextSelection.emptySelection(), document);
					ContentAssistContext[] contexts = delegateFactory.create(dummyViewer, mappedOffset, resource);
					ICompletionProposalAcceptor mappingAcceptor = new ProjectionAwareProposalAcceptor(acceptor, evaluatedTemplate);
					createNestedProposals(contexts, context.getViewer(), mappingAcceptor, data);
				}
			});
		}
	}
}
 
Example #2
Source File: LanguageAcceptor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public void accept(Grammar grammar, 
		Provider<TemplateBodyHighlighter> highlighter, 
		ContextTypeRegistry registry, 
		ContextTypeIdHelper helper,
		Provider<IPartialEditingContentAssistContextFactory> contentAssistContextFactory,
		String primaryFileExtension) {
	this.registry.register(grammar, highlighter, registry, helper, contentAssistContextFactory, primaryFileExtension);
}
 
Example #3
Source File: LanguageRegistry.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
void register(Grammar grammar, 
		Provider<TemplateBodyHighlighter> highlighter, 
		ContextTypeRegistry registry, 
		ContextTypeIdHelper helper,
		Provider<IPartialEditingContentAssistContextFactory> partialContentAssistContextFactory,
		String primaryFileExtension) {
	Language language = new Language();
	language.contextTypeRegistry = registry;
	language.templateBodyHighlighter = highlighter;
	language.helper = helper;
	language.partialContentAssistContextFactory = partialContentAssistContextFactory;
	language.primaryFileExtension = primaryFileExtension;
	registeredLanguages.put(grammar.getName(), language);
}
 
Example #4
Source File: AbstractSARLUiModule.java    From sarl with Apache License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #5
Source File: AbstractN4JSUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #6
Source File: AbstractGamlUiModule.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #7
Source File: AbstractHelloWorldUiModule.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #8
Source File: AbstractXtendUiModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #9
Source File: AbstractPureXbaseUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #10
Source File: AbstractBuilderTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #11
Source File: AbstractArithmeticsUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #12
Source File: AbstractRuleEngineUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #13
Source File: AbstractStatemachineUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #14
Source File: AbstractDomainmodelUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #15
Source File: AbstractEcore2XtextTestUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #16
Source File: AbstractXtextUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #17
Source File: LanguageRegistry.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public IPartialEditingContentAssistContextFactory getPartialContentAssistContextFactory(Grammar grammar) {
	Language language = registeredLanguages.get(grammar.getName());
	if (language == null)
		return null;
	return language.partialContentAssistContextFactory.get();
}
 
Example #18
Source File: AbstractCodetemplatesUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #19
Source File: AbstractXmlUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #20
Source File: AbstractNestedRefsTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #21
Source File: AbstractNoJdtTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #22
Source File: AbstractXtextGrammarTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #23
Source File: AbstractFileAwareTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #24
Source File: AbstractMyDslUiModule.java    From M2Doc with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #25
Source File: AbstractBromiumUiModule.java    From bromium with MIT License 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #26
Source File: AbstractTypesUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #27
Source File: AbstractJSONUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}
 
Example #28
Source File: AbstractRegularExpressionUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IPartialEditingContentAssistContextFactory> bindIPartialEditingContentAssistContextFactory() {
	return PartialEditingContentAssistContextFactory.class;
}