Java 类org.eclipse.jface.text.templates.ContextTypeRegistry 实例源码

项目:KaiZen-OpenAPI-Editor    文件:JsonSourceViewerConfiguration.java   
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;
}};
 }
项目:Eclipse-Postfix-Code-Completion    文件:CodeTemplateContextType.java   
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));
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaPlugin.java   
/**
 * 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;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CodeTemplateContextType.java   
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));
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaPlugin.java   
/**
 * 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;
}
项目:eclipse-silverstripedt    文件:NewSilverStripeProjectCreator.java   
/**
 * 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);
}
项目:dsl-devkit    文件:ConfigurableTemplateStore.java   
@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);
  }
}
项目:fluentmark    文件:CustomTemplateAccess.java   
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;
}
项目:fluentmark    文件:FluentMkTemplateCompletionProcessor.java   
public FluentMkTemplateCompletionProcessor(ITextEditor editor, String partition) {
    ContextTypeRegistry contextTypeRegistry = CustomTemplateAccess.getInstance().getContextTypeRegistry();
    contextType = (SourceTemplateContextType) contextTypeRegistry.getContextType(SourceTemplateContextType.ID);
    if (contextType == null) {
        throw new IllegalStateException();
    }
}
项目:typescript.java    文件:JSDTTypeScriptUIPlugin.java   
/**
 * 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;
}
项目:bts    文件:XtextTemplateStore.java   
@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);
    }
}
项目:KaiZen-OpenAPI-Editor    文件:KaizenTemplatePreferences.java   
public KaizenTemplatePreferences(SourceViewerConfiguration sourceViewerConfiguration,
        IPreferenceStore preferenceStore, TemplateStore templateStore, ContextTypeRegistry contextTypeRegistry) {
    this.sourceViewerConfiguration = sourceViewerConfiguration;
    setPreferenceStore(preferenceStore);
    setTemplateStore(templateStore);
    setContextTypeRegistry(contextTypeRegistry);
}
项目:KaiZen-OpenAPI-Editor    文件:JsonContentAssistProcessor.java   
@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;
    }
}
项目:eclipse-templatevariables    文件:TemplateVariablesStartup.java   
/**
 * 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);
  }
}
项目:eclipse-templatevariables    文件:TemplateVariablesStartup.java   
/**
 * 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);
  }
}
项目:Eclipse-Postfix-Code-Completion    文件:SWTTemplateCompletionProposalComputer.java   
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());
}
项目:Eclipse-Postfix-Code-Completion    文件:TemplateCompletionProposalComputer.java   
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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SWTTemplateCompletionProposalComputer.java   
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());
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:TemplateCompletionProposalComputer.java   
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);
}
项目:eclipsensis    文件:EclipseNSISPlugin.java   
/**
 * Returns this plug-in's context type registry.
 *
 * @return the context type registry for this plug-in instance
 */
public ContextTypeRegistry getContextTypeRegistry()
{
    if (mContextTypeRegistry == null) {
        mContextTypeRegistry= new ContributionContextTypeRegistry();
        mContextTypeRegistry.addContextType(NSISTemplateContextType.NSIS_TEMPLATE_CONTEXT_TYPE);
    }
    return mContextTypeRegistry;
}
项目:saneclipse    文件:JFaceCompletionProposalComputer.java   
public JFaceCompletionProposalComputer() {
    final ContextTypeRegistry templateContextRegistry = JavaPlugin.getDefault().getTemplateContextRegistry();
    jFaceTemplateEngine = createTemplateEngine(templateContextRegistry, JFaceContextType.ID_ALL);
    jFaceMembersTemplateEngine = createTemplateEngine(templateContextRegistry, JFaceContextType.ID_MEMBERS);
    jFaceStatementsTemplateEngine = createTemplateEngine(templateContextRegistry, JFaceContextType.ID_STATEMENTS);

    JavaCore.addElementChangedListener(new BuildPathChangeListener());
}
项目:glassmaker    文件:GlassmakerUIPlugin.java   
/**
 * Returns the template context type registry for the html plugin.
 * 
 * @return the template context type registry for the html plugin
 */
public ContextTypeRegistry getTemplateContextRegistry() {
    if (fContextTypeRegistry == null) {
        ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();
        registry.addContextType(CardContextType.CONTEXT_TYPE);

        fContextTypeRegistry = registry;
    }

    return fContextTypeRegistry;
}
项目:eclipse-silverstripedt    文件:NewSilverStripeProjectCreator.java   
/**
 * 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
    Template pageTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.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=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.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);
}
项目:eclipse-silverstripedt    文件:NewSilverStripeProjectCreator.java   
/**
 * 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
    Template pageTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.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=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss23.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);
}
项目:eclipse-silverstripedt    文件:NewSilverStripeProjectCreator.java   
/**
 * 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.ss31.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);
    }


    //Create the config folder
    IPath ymlConfigPath = new Path("_config");
    if (ymlConfigPath.segmentCount() > 0) {
        IFolder folder=project.getFolder(ymlConfigPath);
        CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 10));
    } else {
        monitor.worked(10);
    }


    //Create config.yml
    Template ymlConfigTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.ymlconfig");
    PHPTemplateStore.CompiledTemplate ymlConfigTemplate=PHPTemplateStore.compileTemplate(templateRegistry, ymlConfigTemplateToCompile, project.getName()+"/_config", "config.yml");
    new SilverStripeFileCreator().createFile(wizard, project.getName()+"/_config", "config.yml", monitor, ymlConfigTemplate.string, ymlConfigTemplate.offset, true);


    //Generate the _config.php file
    Template configTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.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);
}
项目:eclipse-silverstripedt    文件:NewSilverStripeProjectCreator.java   
/**
 * 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.ss31.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);
    }


    //Create the config folder
    IPath ymlConfigPath = new Path("_config");
    if (ymlConfigPath.segmentCount() > 0) {
        IFolder folder=project.getFolder(ymlConfigPath);
        CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 10));
    } else {
        monitor.worked(10);
    }


    //Create config.yml
    Template ymlConfigTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.ymlconfig");
    PHPTemplateStore.CompiledTemplate ymlConfigTemplate=PHPTemplateStore.compileTemplate(templateRegistry, ymlConfigTemplateToCompile, project.getName()+"/_config", "config.yml");
    new SilverStripeFileCreator().createFile(wizard, project.getName()+"/_config", "config.yml", monitor, ymlConfigTemplate.string, ymlConfigTemplate.offset, true);


    //Generate the _config.php file
    Template configTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.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);
}
项目:eclipse-silverstripedt    文件:NewSilverStripeProjectCreator.java   
/**
 * 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.ss31.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);
    }


    //Create the config folder
    IPath ymlConfigPath = new Path("_config");
    if (ymlConfigPath.segmentCount() > 0) {
        IFolder folder=project.getFolder(ymlConfigPath);
        CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 10));
    } else {
        monitor.worked(10);
    }


    //Create config.yml
    Template ymlConfigTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.ymlconfig");
    PHPTemplateStore.CompiledTemplate ymlConfigTemplate=PHPTemplateStore.compileTemplate(templateRegistry, ymlConfigTemplateToCompile, project.getName()+"/_config", "config.yml");
    new SilverStripeFileCreator().createFile(wizard, project.getName()+"/_config", "config.yml", monitor, ymlConfigTemplate.string, ymlConfigTemplate.offset, true);


    //Generate the _config.php file
    Template configTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.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);
}
项目:eclipse-silverstripedt    文件:NewSilverStripeProjectCreator.java   
/**
 * 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.ss31.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);
    }


    //Create the config folder
    IPath ymlConfigPath = new Path("_config");
    if (ymlConfigPath.segmentCount() > 0) {
        IFolder folder=project.getFolder(ymlConfigPath);
        CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 10));
    } else {
        monitor.worked(10);
    }


    //Create config.yml
    Template ymlConfigTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.ymlconfig");
    PHPTemplateStore.CompiledTemplate ymlConfigTemplate=PHPTemplateStore.compileTemplate(templateRegistry, ymlConfigTemplateToCompile, project.getName()+"/_config", "config.yml");
    new SilverStripeFileCreator().createFile(wizard, project.getName()+"/_config", "config.yml", monitor, ymlConfigTemplate.string, ymlConfigTemplate.offset, true);


    //Generate the _config.php file
    Template configTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.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);
}
项目:eclipse-silverstripedt    文件:NewSilverStripeProjectCreator.java   
/**
 * 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.ss31.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);
    }


    //Create the config folder
    IPath ymlConfigPath = new Path("_config");
    if (ymlConfigPath.segmentCount() > 0) {
        IFolder folder=project.getFolder(ymlConfigPath);
        CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 10));
    } else {
        monitor.worked(10);
    }


    //Create config.yml
    Template ymlConfigTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.ymlconfig");
    PHPTemplateStore.CompiledTemplate ymlConfigTemplate=PHPTemplateStore.compileTemplate(templateRegistry, ymlConfigTemplateToCompile, project.getName()+"/_config", "config.yml");
    new SilverStripeFileCreator().createFile(wizard, project.getName()+"/_config", "config.yml", monitor, ymlConfigTemplate.string, ymlConfigTemplate.offset, true);


    //Generate the _config.php file
    Template configTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.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);
}
项目:eclipse-silverstripedt    文件:SilverStripePDTPlugin.java   
/**
 * Returns the template context type registry for creating SilverStripe classes.
 * @return the template context type registry for creating SilverStripe classes
 */
public ContextTypeRegistry getNewClassContextRegistry() {
    if (fClassContextTypeRegistry == null) {
        ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();

        registry.addContextType(new CodeTemplateContextType(NewSilverStripeClassWizardTemplatePage.NEW_CLASS_CONTEXTTYPE));

        fClassContextTypeRegistry = registry;
    }

    return fClassContextTypeRegistry;
}
项目:eclipse-silverstripedt    文件:SilverStripePDTPlugin.java   
/**
 * Returns the template context type registry for SilverStripe template files.
 * @return the template context type registry for SilverStripe template files
 */
public ContextTypeRegistry getTemplateContextRegistry() {
    if (fContextTypeRegistry == null) {
        ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();

        registry.addContextType(new CodeTemplateContextType(NewSilverStripeTemplatesWizardPage.NEW_SS_TEMPLATE_CONTEXTTYPE));
        registry.addContextType(new CodeTemplateContextType(NewSilverStripeTemplatesWizardPage.NEW_SS_30_TEMPLATE_CONTEXTTYPE));
        registry.addContextType(new CodeTemplateContextType(NewSilverStripeProjectWizard.NEW_SS_PROJECT_TEMPLATE_CONTEXTTYPE));

        fContextTypeRegistry = registry;
    }

    return fContextTypeRegistry;
}
项目:eclipse-silverstripedt    文件:SilverStripePDTPlugin.java   
/**
 * Returns the content assist template context type registry for the xml plugin.
 * 
 * @return the content assist template context type registry for the xml plugin
 */
public ContextTypeRegistry getCATemplateContextRegistry() {
    if (caContextTypeRegistry == null) {
        ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();

        registry.addContextType(new CodeTemplateContextType(SSTemplateCompletionProcessor.TEMPLATE_CONTEXT_ID));
        registry.addContextType(new CodeTemplateContextType(NewSilverStripeTemplatesWizardPage.NEW_SS_TEMPLATE_CONTEXTTYPE));
        registry.addContextType(new CodeTemplateContextType(NewSilverStripeTemplatesWizardPage.NEW_SS_30_TEMPLATE_CONTEXTTYPE));

        caContextTypeRegistry = registry;
    }

    return caContextTypeRegistry;
}
项目:eclipse-silverstripedt    文件:SSTemplateCompletionProcessor.java   
protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) {
    TemplateContextType type = null;

    ContextTypeRegistry registry = getTemplateContextRegistry();
    if (registry != null)
        type = registry.getContextType(fContextTypeId);

    return type;
}
项目:eclipse-silverstripedt    文件:RegisterResolvers.java   
/**
 * {@inheritDoc}
 * @see IStartup#earlyStartup()
 */
public void earlyStartup() {
    // check if plug-in org.eclipse.jdt.ui is already active
    final Bundle bundle = Platform.getBundle(SilverStripePDTPlugin.PLUGIN_ID);
    if (bundle != null && bundle.getState() == Bundle.ACTIVE) {
        // register resolvers
        registerResolvers();

        ContextTypeRegistry registry = PHPUiPlugin.getDefault().getCodeTemplateContextRegistry();
        registry.addContextType(new CodeTemplateContextType(NewSilverStripeTemplatesWizardPage.NEW_SS_TEMPLATE_CONTEXTTYPE));
        registry.addContextType(new CodeTemplateContextType(NewSilverStripeTemplatesWizardPage.NEW_SS_30_TEMPLATE_CONTEXTTYPE));
    } else {
        // register listener to get informed, when plug-in becomes active
        final BundleContext bundleContext = SilverStripePDTPlugin.getDefault().getBundle().getBundleContext();
        bundleContext.addBundleListener(new BundleListener() {
            public void bundleChanged(final BundleEvent pEvent) {
                final Bundle bundle2 = pEvent.getBundle();
                if (!bundle2.getSymbolicName().equals(SilverStripePDTPlugin.PLUGIN_ID)) {
                    return;
                }
                if (bundle2.getState() == Bundle.ACTIVE) {
                    registerResolvers();
                    bundleContext.removeBundleListener(this);
                }
            }
        });
    }
}
项目:eclipse-silverstripedt    文件:SilverStripeTemplatesPreferencePage.java   
public SSEditTemplateDialog(Shell parent, Template template, boolean edit, boolean isNameModifiable, ContextTypeRegistry registry) {
    super(parent, template, edit, isNameModifiable, registry);

    this.fNewTemplate=null;
    if(template instanceof SilverStripeTemplate) {
        this.fOriginalTemplate=(SilverStripeTemplate) template;
    }
}
项目:eclipse-silverstripedt    文件:SilverStripeCATemplatesPreferencePage.java   
public SSEditTemplateDialog(Shell parent, Template template, boolean edit, boolean isNameModifiable, ContextTypeRegistry registry) {
    super(parent, template, edit, isNameModifiable, registry);

    this.fNewTemplate=null;
    if(template instanceof SilverStripeTemplate) {
        this.fOriginalTemplate=(SilverStripeTemplate) template;
    }
}
项目:eclipse-silverstripedt    文件:NewSilverStripeTemplatesWizardPage.java   
protected String getTemplatesLocationMessage() {
    ContextTypeRegistry templateContextRegistry = getTemplatesContextTypeRegistry();
    if(this._languageProvider==null) {
        return "";
    }

    TemplateContextType templateContextType = templateContextRegistry.getContextType(this._languageProvider.getTemplateContext());

    String name = templateContextType.getName();
    return NLS.bind("Templates are \"{0}\" found in the <a>SilverStripe Templates</a> preference page.", name);
}
项目:eclipse-silverstripedt    文件:NewSilverStripeClassWizardTemplatePage.java   
protected String getTemplatesLocationMessage() {
    ContextTypeRegistry templateContextRegistry = getTemplatesContextTypeRegistry();
    TemplateContextType templateContextType = templateContextRegistry.getContextType(getTemplateContextTypeId());
    String name = templateContextType.getName();

    return NLS.bind("Templates are \"{0}\" found in the <a>SilverStripe Templates</a> preference page.", name);
}
项目:eclipse-silverstripedt    文件:NewSilverStripeProjectCreator.java   
/**
 * 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.ss31.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);
    }


    //Create the config folder
    IPath ymlConfigPath = new Path("_config");
    if (ymlConfigPath.segmentCount() > 0) {
        IFolder folder=project.getFolder(ymlConfigPath);
        CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 10));
    } else {
        monitor.worked(10);
    }


    //Create config.yml
    Template ymlConfigTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.ymlconfig");
    PHPTemplateStore.CompiledTemplate ymlConfigTemplate=PHPTemplateStore.compileTemplate(templateRegistry, ymlConfigTemplateToCompile, project.getName()+"/_config", "config.yml");
    new SilverStripeFileCreator().createFile(wizard, project.getName()+"/_config", "config.yml", monitor, ymlConfigTemplate.string, ymlConfigTemplate.offset, true);


    //Generate the _config.php file
    Template configTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss31.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);
}
项目:goclipse    文件:TemplateRegistry.java   
protected ContextTypeRegistry createContributionContextTypeRegistry() {
    final ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();
    for(String id : getRegisteredContextTypeIds()) {
        registry.addContextType(id);
    }
    return registry;
}