org.eclipse.jface.text.templates.persistence.TemplateStore Java Examples

The following examples show how to use org.eclipse.jface.text.templates.persistence.TemplateStore. 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: CompatibilityTemplateStore.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Removes any duplicates from a template store. Duplicate user added templates
 * are copied over their contributed siblings. If isCodeTemplates is true,
 * any user added templates are then removed.
 *
 * @param store
 * @param isCodeTemplates
 */
public static void pruneDuplicates(TemplateStore store, boolean isCodeTemplates) {
	TemplatePersistenceData[] datas= store.getTemplateData(true);
	for (int i= datas.length - 1; i >= 0; i--) {
		TemplatePersistenceData data= datas[i];
		if (data.isUserAdded()) {
			// find a contributed template that is similar and check it
			TemplatePersistenceData similar= findSimilarTemplate(datas, data.getTemplate(), isCodeTemplates);
			if (similar != data && !similar.isUserAdded()) {
				similar.setTemplate(data.getTemplate());
				store.delete(data);
			}
		}
	}

	if (isCodeTemplates) {
		datas= store.getTemplateData(true);
		for (int i= datas.length - 1; i >= 0; i--) {
			if (datas[i].isUserAdded())
				store.delete(datas[i]);
		}
	}
}
 
Example #2
Source File: NewElementWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void warnAboutTypeCommentDeprecation() {
	String key= IUIConstants.DIALOGSTORE_TYPECOMMENT_DEPRECATED;
	if (OptionalMessageDialog.isDialogEnabled(key)) {
		TemplateStore templates= JavaPlugin.getDefault().getTemplateStore();
		boolean isOldWorkspace= templates.findTemplate("filecomment") != null && templates.findTemplate("typecomment") != null; //$NON-NLS-1$ //$NON-NLS-2$
		if (!isOldWorkspace) {
			OptionalMessageDialog.setDialogEnabled(key, false);
		}
		String title= NewWizardMessages.NewElementWizard_typecomment_deprecated_title;
		String message= NewWizardMessages.NewElementWizard_typecomment_deprecated_message;
		OptionalMessageDialog.open(key, getShell(), title, null, message, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
	}
}
 
Example #3
Source File: StubUtility.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Only to be used by tests
 * 
 * @param templateId the template id
 * @param pattern the new pattern
 * @param project not used
 */
public static void setCodeTemplate(String templateId, String pattern, IJavaProject project) {
	TemplateStore codeTemplateStore= JavaPlugin.getDefault().getCodeTemplateStore();
	TemplatePersistenceData data= codeTemplateStore.getTemplateData(templateId);
	Template orig= data.getTemplate();
	Template copy= new Template(orig.getName(), orig.getDescription(), orig.getContextTypeId(), pattern, true);
	data.setTemplate(copy);
}
 
Example #4
Source File: KaizenTemplatePreferences.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
public KaizenTemplatePreferences(SourceViewerConfiguration sourceViewerConfiguration,
        IPreferenceStore preferenceStore, TemplateStore templateStore, ContextTypeRegistry contextTypeRegistry) {
    this.sourceViewerConfiguration = sourceViewerConfiguration;
    setPreferenceStore(preferenceStore);
    setTemplateStore(templateStore);
    setContextTypeRegistry(contextTypeRegistry);
}
 
Example #5
Source File: SwaggerContentAssistProcessor.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected TemplateStore getTemplateStore() {
	return Activator.getDefault().getTemplateStore();
}
 
Example #6
Source File: LangUIPlugin.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public TemplateStore getTemplateStore() {
	return getTemplateRegistry().getTemplateStore();
}
 
Example #7
Source File: JavaTemplatesPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public TemplateStore getTemplateStore() {
	return TEMPLATE_STORE;
}
 
Example #8
Source File: GamlUiModule.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
@SingletonBinding
public Class<? extends TemplateStore> bindTemplateStore() {
	return GamlTemplateStore.class;
}
 
Example #9
Source File: GamlTemplateProposalProvider.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Inject
public GamlTemplateProposalProvider(final TemplateStore templateStore, final ContextTypeRegistry registry,
		final ContextTypeIdHelper helper) {
	super(templateStore, registry, helper);
}
 
Example #10
Source File: OpenApi3ContentAssistProcessor.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected TemplateStore getTemplateStore() {
       return Activator.getDefault().getTemplateStore();
}
 
Example #11
Source File: ContentAssistCustomizingTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public TestableTemplateProposalProvider(TemplateStore templateStore, ContextTypeRegistry registry, ContextTypeIdHelper helper) {
	super(templateStore, registry, helper);
}
 
Example #12
Source File: SGenTemplateProposalProvider.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public SGenTemplateProposalProvider(TemplateStore templateStore, ContextTypeRegistry registry,
		ContextTypeIdHelper helper) {
	super(templateStore, registry, helper);
	this.helper = helper;
}
 
Example #13
Source File: CheckCfgTemplateProposalProvider.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public CheckCfgTemplateProposalProvider(final TemplateStore templateStore, final ContextTypeRegistry registry, final ContextTypeIdHelper helper) {
  super(templateStore, registry, helper);
  this.templateStore = templateStore;
}
 
Example #14
Source File: CheckTemplateProposalProvider.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public CheckTemplateProposalProvider(final TemplateStore templateStore, final ContextTypeRegistry registry, final ContextTypeIdHelper helper) {
  super(templateStore, registry, helper);
}
 
Example #15
Source File: TemplateProposalProvider.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public TemplateProposalProvider(TemplateStore templateStore, ContextTypeRegistry registry,
		ContextTypeIdHelper helper) {
	super(templateStore, registry, helper);
}
 
Example #16
Source File: DotTemplateProposalProvider.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public DotTemplateProposalProvider(TemplateStore templateStore,
		ContextTypeRegistry registry, ContextTypeIdHelper helper) {
	super(templateStore, registry, helper);
}
 
Example #17
Source File: XbaseTemplateProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public XbaseTemplateProposalProvider(TemplateStore templateStore, ContextTypeRegistry registry,
		ContextTypeIdHelper helper) {
	super(templateStore, registry, helper);
}
 
Example #18
Source File: XtextTemplatePreferencePage.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public XtextTemplatePreferencePage(IPreferenceStore preferenceStore, ContextTypeRegistry registry, TemplateStore templateStore) {
	setPreferenceStore(preferenceStore);
	setContextTypeRegistry(registry);
	setTemplateStore(templateStore);
}
 
Example #19
Source File: DefaultTemplateProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public DefaultTemplateProposalProvider(TemplateStore templateStore, ContextTypeRegistry registry, ContextTypeIdHelper helper) {
	this.templateStore = templateStore;
	this.registry = registry;
	this.helper = helper;
}
 
Example #20
Source File: DefaultUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends TemplateStore> bindTemplateStore() {
	return XtextTemplateStore.class;
}
 
Example #21
Source File: AdvancedTemplatesPreferencePage.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public AdvancedTemplatesPreferencePage(IPreferenceStore preferenceStore,
		ContextTypeRegistry registry, TemplateStore templateStore) {
	super(preferenceStore, registry, templateStore);
}
 
Example #22
Source File: SARLTemplateProposalProvider.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** Construct the provider.
 *
 * @param templateStore the store of templates.
 * @param registry the template context registry.
 * @param helper the context helper.
 */
@Inject
public SARLTemplateProposalProvider(TemplateStore templateStore, ContextTypeRegistry registry,
		ContextTypeIdHelper helper) {
	super(templateStore, registry, helper);
}
 
Example #23
Source File: JsonContentAssistProcessor.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 votes vote down vote up
protected abstract TemplateStore getTemplateStore();