Как получить хранилище шаблонов кода Eclipse через плагин? - PullRequest
0 голосов
/ 16 июня 2020

Так я реализовал, но добавленный шаблон не отражается на странице настроек шаблонов кода

        private static final String TEMPLATE_STORE_KEY = "java-statements";

        IPreferenceStore prefs = myPlugin.getDefault().getPreferenceStore();

        templateStore = new ContributionTemplateStore(null, prefs, TEMPLATE_STORE_KEY);


        try {
            templateStore.load();
        } catch (final IOException ioex) {
            //
        }
        templateStore.startListeningForPreferenceChanges();
    }
      Template newTemplate = new Template("testSysout", "testSysout", "java",
            "System.out.println(${word_selection}${});${cursor}",false);

     TemplatePersistenceData myTemplate = new TemplatePersistenceData(newTemplate, true , "testSysout");
    templateStore.add(myTemplate);

    templateStore.save();
...