本文整理汇总了Java中org.eclipse.jface.text.templates.ContextTypeRegistry类的典型用法代码示例。如果您正苦于以下问题:Java ContextTypeRegistry类的具体用法?Java ContextTypeRegistry怎么用?Java ContextTypeRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContextTypeRegistry类属于org.eclipse.jface.text.templates包,在下文中一共展示了ContextTypeRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContentAssistProcessor
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
protected JsonContentAssistProcessor createContentAssistProcessor(ContentAssistant ca) {
return new JsonContentAssistProcessor(ca, null){
@Override
protected TemplateStore getTemplateStore() {
return null;
}
@Override
protected ContextTypeRegistry getContextTypeRegistry() {
return null;
}
@Override
protected String getContextTypeId(Model model, String path) {
return null;
}};
}
示例2: registerContextTypes
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
public static void registerContextTypes(ContextTypeRegistry registry) {
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.CATCHBLOCK_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.METHODBODY_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.CONSTRUCTORBODY_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.GETTERBODY_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.SETTERBODY_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.NEWTYPE_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.CLASSBODY_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.INTERFACEBODY_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.ENUMBODY_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.ANNOTATIONBODY_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.FILECOMMENT_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.TYPECOMMENT_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.FIELDCOMMENT_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.METHODCOMMENT_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.CONSTRUCTORCOMMENT_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.OVERRIDECOMMENT_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.DELEGATECOMMENT_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.GETTERCOMMENT_CONTEXTTYPE));
registry.addContextType(new CodeTemplateContextType(CodeTemplateContextType.SETTERCOMMENT_CONTEXTTYPE));
}
示例3: getTemplateContextRegistry
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
/**
* Returns the template context type registry for the java plug-in.
*
* @return the template context type registry for the java plug-in
* @since 3.0
*/
public synchronized ContextTypeRegistry getTemplateContextRegistry() {
if (fContextTypeRegistry == null) {
ContributionContextTypeRegistry registry= new ContributionContextTypeRegistry(JavaUI.ID_CU_EDITOR);
TemplateContextType all_contextType= registry.getContextType(JavaContextType.ID_ALL);
((AbstractJavaContextType) all_contextType).initializeContextTypeResolvers();
registerJavaContext(registry, JavaContextType.ID_MEMBERS, all_contextType);
registerJavaContext(registry, JavaContextType.ID_STATEMENTS, all_contextType);
registerJavaContext(registry, SWTContextType.ID_ALL, all_contextType);
all_contextType= registry.getContextType(SWTContextType.ID_ALL);
registerJavaContext(registry, SWTContextType.ID_MEMBERS, all_contextType);
registerJavaContext(registry, SWTContextType.ID_STATEMENTS, all_contextType);
fContextTypeRegistry= registry;
}
return fContextTypeRegistry;
}
示例4: createProjectLayout
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
/**
* Performs the SilverStripe version specific tasks when creating new project layout project
* @param project Destination project
* @param monitor Monitor to update when creating the layout
* @param templateRegistry Template registry to look through
* @param isFrameworkLayout If the project is a framework only project this is set to true
* @throws CoreException
*/
public void createProjectLayout(Wizard wizard, IProject project, IProgressMonitor monitor, ContextTypeRegistry templateRegistry, TemplateStore templateStore, boolean isFrameworkLayout) throws CoreException {
//Generate the Page.php file
if(isFrameworkLayout==false) {
Template pageTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss30.defaultpage");
PHPTemplateStore.CompiledTemplate pageTemplate=PHPTemplateStore.compileTemplate(templateRegistry, pageTemplateToCompile, project.getName()+"/code", "Page.php");
new SilverStripeFileCreator().createFile(wizard, project.getName()+"/code", "Page.php", monitor, pageTemplate.string, pageTemplate.offset);
}
//Generate the _config.php file
Template configTemplateToCompile;
if(isFrameworkLayout) {
configTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss30.framework.config");
}else {
configTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss30.config");
}
PHPTemplateStore.CompiledTemplate configTemplate=PHPTemplateStore.compileTemplate(templateRegistry, configTemplateToCompile, project.getName(), "_config.php");
new SilverStripeFileCreator().createFile(wizard, project.getName(), "_config.php", monitor, configTemplate.string, configTemplate.offset, true);
}
示例5: ConfigurableTemplateStore
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
@SuppressWarnings("PMD.ConstructorCallsOverridableMethod")
@Inject
public ConfigurableTemplateStore(final ContextTypeRegistry registry, final IPreferenceStore store, @Named(Constants.LANGUAGE_NAME) final String key, final AbstractUIPlugin plugin) {
super(registry, store, key + ".templates"); //$NON-NLS-1$
this.res = getTemplateFileURL(plugin);
this.preferenceStore = store;
this.key = key + ".sharedTemplates"; //$NON-NLS-1$
try {
load();
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}
}
示例6: getContextTypeRegistry
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
public ContextTypeRegistry getContextTypeRegistry() {
if (registry == null) {
if (FluentMkUI.getDefault() != null) {
ContributionContextTypeRegistry contributionRegistry = new ContributionContextTypeRegistry();
contributionRegistry.addContextType(SourceTemplateContextType.ID);
registry = contributionRegistry;
} else {
ContextTypeRegistry contextTypeRegistry = new ContextTypeRegistry();
contextTypeRegistry.addContextType(new SourceTemplateContextType());
registry = contextTypeRegistry;
}
}
return registry;
}
示例7: FluentMkTemplateCompletionProcessor
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
public FluentMkTemplateCompletionProcessor(ITextEditor editor, String partition) {
ContextTypeRegistry contextTypeRegistry = CustomTemplateAccess.getInstance().getContextTypeRegistry();
contextType = (SourceTemplateContextType) contextTypeRegistry.getContextType(SourceTemplateContextType.ID);
if (contextType == null) {
throw new IllegalStateException();
}
}
示例8: getTemplateContextRegistry
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
/**
* Returns the template context type registry for the java plug-in.
*
* @return the template context type registry for the java plug-in
*
*/
public ContextTypeRegistry getTemplateContextRegistry() {
if (fContextTypeRegistry == null) {
ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry(CONTEXT_TYPE_REGISTRY_ID);
fContextTypeRegistry = registry;
}
return fContextTypeRegistry;
}
示例9: XtextTemplateStore
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
@Inject
public XtextTemplateStore(ContextTypeRegistry registry, IPreferenceStore store, @Named(Constants.LANGUAGE_NAME) String key,
AbstractUIPlugin plugin) {
super(registry, store, key + ".templates");
res = getTemplateFileURL(plugin);
try {
load();
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
示例10: KaizenTemplatePreferences
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
public KaizenTemplatePreferences(SourceViewerConfiguration sourceViewerConfiguration,
IPreferenceStore preferenceStore, TemplateStore templateStore, ContextTypeRegistry contextTypeRegistry) {
this.sourceViewerConfiguration = sourceViewerConfiguration;
setPreferenceStore(preferenceStore);
setTemplateStore(templateStore);
setContextTypeRegistry(contextTypeRegistry);
}
示例11: getContextType
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
@Override
protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) {
Model model = null;
if (viewer.getDocument() instanceof JsonDocument) {
model = ((JsonDocument)viewer.getDocument()).getModel();
}
String contextType = getContextTypeId(model, currentPath.toString());
ContextTypeRegistry registry = getContextTypeRegistry();
if (registry != null) {
return registry.getContextType(contextType);
} else {
return null;
}
}
示例12: addResolver
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
/**
* This method adds the given {@link TemplateVariableResolver} to each registered
* {@link TemplateContextType}.
*
* @param javaPlugin is the {@link JavaPlugin}.
* @param resolver is the {@link TemplateVariableResolver} to add.
*/
@SuppressWarnings({ "rawtypes" })
private void addResolver(JavaPlugin javaPlugin, TemplateVariableResolver resolver) {
Assert.isNotNull(javaPlugin);
Assert.isNotNull(resolver);
ContextTypeRegistry codeTemplateContextRegistry = javaPlugin.getCodeTemplateContextRegistry();
Assert.isNotNull(codeTemplateContextRegistry);
Iterator ctIter = codeTemplateContextRegistry.contextTypes();
while (ctIter.hasNext()) {
TemplateContextType contextType = (TemplateContextType) ctIter.next();
contextType.addResolver(resolver);
}
}
示例13: removeResolver
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
/**
* This method removes the given {@link TemplateVariableResolver} to each registered
* {@link TemplateContextType}.
*
* @param javaPlugin is the {@link JavaPlugin}.
* @param resolver is the {@link TemplateVariableResolver} to remove.
*/
@SuppressWarnings({ "rawtypes" })
private void removeResolver(JavaPlugin javaPlugin, TemplateVariableResolver resolver) {
Assert.isNotNull(javaPlugin);
Assert.isNotNull(resolver);
ContextTypeRegistry codeTemplateContextRegistry = javaPlugin.getCodeTemplateContextRegistry();
Assert.isNotNull(codeTemplateContextRegistry);
Iterator ctIter = codeTemplateContextRegistry.contextTypes();
while (ctIter.hasNext()) {
TemplateContextType contextType = (TemplateContextType) ctIter.next();
contextType.removeResolver(resolver);
}
}
示例14: SWTTemplateCompletionProposalComputer
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
public SWTTemplateCompletionProposalComputer() {
ContextTypeRegistry templateContextRegistry= JavaPlugin.getDefault().getTemplateContextRegistry();
fSWTTemplateEngine= createTemplateEngine(templateContextRegistry, SWTContextType.ID_ALL);
fSWTMembersTemplateEngine= createTemplateEngine(templateContextRegistry, SWTContextType.ID_MEMBERS);
fSWTStatementsTemplateEngine= createTemplateEngine(templateContextRegistry, SWTContextType.ID_STATEMENTS);
JavaCore.addElementChangedListener(new BuildPathChangeListener());
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:SWTTemplateCompletionProposalComputer.java
示例15: TemplateCompletionProposalComputer
import org.eclipse.jface.text.templates.ContextTypeRegistry; //导入依赖的package包/类
public TemplateCompletionProposalComputer() {
ContextTypeRegistry templateContextRegistry= JavaPlugin.getDefault().getTemplateContextRegistry();
fJavaTemplateEngine= createTemplateEngine(templateContextRegistry, JavaContextType.ID_ALL);
fJavaMembersTemplateEngine= createTemplateEngine(templateContextRegistry, JavaContextType.ID_MEMBERS);
fJavaStatementsTemplateEngine= createTemplateEngine(templateContextRegistry, JavaContextType.ID_STATEMENTS);
fJavadocTemplateEngine= createTemplateEngine(templateContextRegistry, JavaDocContextType.ID);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:TemplateCompletionProposalComputer.java