1 | /* |
---|
2 | * generated by Xtext |
---|
3 | */ |
---|
4 | package com.framsticks.framclipse.ui; |
---|
5 | |
---|
6 | import org.eclipse.jface.text.templates.ContextTypeRegistry; |
---|
7 | import org.eclipse.jface.text.templates.Template; |
---|
8 | import org.eclipse.jface.text.templates.persistence.TemplateStore; |
---|
9 | import org.eclipse.swt.graphics.Image; |
---|
10 | import org.eclipse.ui.plugin.AbstractUIPlugin; |
---|
11 | import org.eclipse.xtext.service.SingletonBinding; |
---|
12 | import org.eclipse.xtext.ui.IImageHelper; |
---|
13 | import org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration; |
---|
14 | import org.eclipse.xtext.ui.editor.contentassist.ITemplateProposalProvider; |
---|
15 | import org.eclipse.xtext.ui.editor.templates.ContextTypeIdHelper; |
---|
16 | import org.eclipse.xtext.ui.editor.templates.DefaultTemplateProposalProvider; |
---|
17 | |
---|
18 | import com.framsticks.framclipse.ui.contentassist.DescriptorProvider; |
---|
19 | import com.framsticks.framclipse.ui.contentassist.HTMLDescriptorProvider; |
---|
20 | import com.google.inject.Inject; |
---|
21 | |
---|
22 | /** |
---|
23 | * Use this class to register components to be used within the IDE. |
---|
24 | */ |
---|
25 | public class FramScriptUiModule extends com.framsticks.framclipse.ui.AbstractFramScriptUiModule { |
---|
26 | |
---|
27 | public FramScriptUiModule(AbstractUIPlugin plugin) { |
---|
28 | super(plugin); |
---|
29 | } |
---|
30 | |
---|
31 | public Class<? extends XtextSourceViewerConfiguration> bindSourceViewerConfiguration() { |
---|
32 | return FramScriptSourceViewerConfiguration.class; |
---|
33 | } |
---|
34 | |
---|
35 | @SingletonBinding |
---|
36 | public Class<? extends DescriptorProvider> bindDescriptorProvider() { |
---|
37 | return HTMLDescriptorProvider.class; |
---|
38 | } |
---|
39 | |
---|
40 | @Override |
---|
41 | @SingletonBinding |
---|
42 | public Class<? extends ITemplateProposalProvider> bindITemplateProposalProvider() { |
---|
43 | return FramScriptTemplateProposalProvider.class; |
---|
44 | } |
---|
45 | |
---|
46 | public static class FramScriptTemplateProposalProvider extends DefaultTemplateProposalProvider { |
---|
47 | |
---|
48 | @Inject |
---|
49 | private IImageHelper imageHelper; |
---|
50 | |
---|
51 | @Inject |
---|
52 | public FramScriptTemplateProposalProvider(TemplateStore templateStore, |
---|
53 | ContextTypeRegistry registry, ContextTypeIdHelper helper) { |
---|
54 | super(templateStore, registry, helper); |
---|
55 | } |
---|
56 | |
---|
57 | @Override |
---|
58 | public Image getImage(Template template) { |
---|
59 | return imageHelper.getImage("template.gif"); |
---|
60 | } |
---|
61 | |
---|
62 | } |
---|
63 | |
---|
64 | } |
---|