Search in sources :

Example 1 with AllFileTemplatesConfigurable

use of com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable in project intellij-community by JetBrains.

the class TraverseUIStarter method startup.

public static void startup(String outputPath) throws IOException {
    Map<SearchableConfigurable, Set<OptionDescription>> options = new LinkedHashMap<>();
    try {
        SearchUtil.processProjectConfigurables(ProjectManager.getInstance().getDefaultProject(), options);
        Element root = new Element(OPTIONS);
        for (SearchableConfigurable option : options.keySet()) {
            SearchableConfigurable configurable = option;
            Element configurableElement = new Element(CONFIGURABLE);
            String id = configurable.getId();
            configurableElement.setAttribute(ID, id);
            configurableElement.setAttribute(CONFIGURABLE_NAME, configurable.getDisplayName());
            Set<OptionDescription> sortedOptions = options.get(configurable);
            writeOptions(configurableElement, sortedOptions);
            if (configurable instanceof ConfigurableWrapper) {
                UnnamedConfigurable wrapped = ((ConfigurableWrapper) configurable).getConfigurable();
                if (wrapped instanceof SearchableConfigurable) {
                    configurable = (SearchableConfigurable) wrapped;
                }
            }
            if (configurable instanceof KeymapPanel) {
                processKeymap(configurableElement);
            } else if (configurable instanceof OptionsContainingConfigurable) {
                processOptionsContainingConfigurable((OptionsContainingConfigurable) configurable, configurableElement);
            } else if (configurable instanceof PluginManagerConfigurable) {
                for (OptionDescription description : wordsToOptionDescriptors(Collections.singleton(AvailablePluginsManagerMain.MANAGE_REPOSITORIES))) {
                    append(null, AvailablePluginsManagerMain.MANAGE_REPOSITORIES, description.getOption(), configurableElement);
                }
            } else if (configurable instanceof AllFileTemplatesConfigurable) {
                processFileTemplates(configurableElement);
            }
            root.addContent(configurableElement);
        }
        FileUtil.ensureCanCreateFile(new File(outputPath));
        JDOMUtil.writeDocument(new Document(root), outputPath, "\n");
        System.out.println("Searchable options index builder completed");
    } finally {
        for (SearchableConfigurable configurable : options.keySet()) {
            configurable.disposeUIResources();
        }
    }
}
Also used : OptionsContainingConfigurable(com.intellij.application.options.OptionsContainingConfigurable) ConfigurableWrapper(com.intellij.openapi.options.ex.ConfigurableWrapper) KeymapPanel(com.intellij.openapi.keymap.impl.ui.KeymapPanel) Element(org.jdom.Element) UnnamedConfigurable(com.intellij.openapi.options.UnnamedConfigurable) Document(org.jdom.Document) PluginManagerConfigurable(com.intellij.ide.plugins.PluginManagerConfigurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) AllFileTemplatesConfigurable(com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable) File(java.io.File)

Example 2 with AllFileTemplatesConfigurable

use of com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable in project intellij-community by JetBrains.

the class SearchableOptionsTest method testFindCodeTemplates.

public void testFindCodeTemplates() {
    ConfigurableGroup[] groups = ShowSettingsUtilImpl.getConfigurableGroups(getProject(), false);
    ConfigurableHit configurables = SearchableOptionsRegistrar.getInstance().getConfigurables(groups, DocumentEvent.EventType.INSERT, null, "method", getProject());
    Set<Configurable> configurableSet = configurables.getAll();
    for (Configurable configurable : configurableSet) {
        if (configurable.getDisplayName().equals(new AllFileTemplatesConfigurable(getProject()).getDisplayName())) {
            return;
        }
    }
    fail("File Templates are not found");
}
Also used : ConfigurableHit(com.intellij.ide.ui.search.ConfigurableHit) ConfigurableGroup(com.intellij.openapi.options.ConfigurableGroup) AllFileTemplatesConfigurable(com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable) AllFileTemplatesConfigurable(com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable) Configurable(com.intellij.openapi.options.Configurable)

Aggregations

AllFileTemplatesConfigurable (com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable)2 OptionsContainingConfigurable (com.intellij.application.options.OptionsContainingConfigurable)1 PluginManagerConfigurable (com.intellij.ide.plugins.PluginManagerConfigurable)1 ConfigurableHit (com.intellij.ide.ui.search.ConfigurableHit)1 KeymapPanel (com.intellij.openapi.keymap.impl.ui.KeymapPanel)1 Configurable (com.intellij.openapi.options.Configurable)1 ConfigurableGroup (com.intellij.openapi.options.ConfigurableGroup)1 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)1 UnnamedConfigurable (com.intellij.openapi.options.UnnamedConfigurable)1 ConfigurableWrapper (com.intellij.openapi.options.ex.ConfigurableWrapper)1 File (java.io.File)1 Document (org.jdom.Document)1 Element (org.jdom.Element)1