Search in sources :

Example 6 with UnnamedConfigurable

use of com.intellij.openapi.options.UnnamedConfigurable 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 7 with UnnamedConfigurable

use of com.intellij.openapi.options.UnnamedConfigurable in project intellij-community by JetBrains.

the class ExportToHTMLDialog method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    OptionGroup optionGroup = new OptionGroup(CodeEditorBundle.message("export.to.html.options.group"));
    myCbLineNumbers = new JCheckBox(CodeEditorBundle.message("export.to.html.options.show.line.numbers.checkbox"));
    optionGroup.add(myCbLineNumbers);
    for (UnnamedConfigurable printOption : myExtensions) {
        optionGroup.add(printOption.createComponent());
    }
    myCbOpenInBrowser = new JCheckBox(CodeEditorBundle.message("export.to.html.open.generated.html.checkbox"));
    optionGroup.add(myCbOpenInBrowser);
    return optionGroup.createPanel();
}
Also used : OptionGroup(com.intellij.ui.OptionGroup) UnnamedConfigurable(com.intellij.openapi.options.UnnamedConfigurable)

Example 8 with UnnamedConfigurable

use of com.intellij.openapi.options.UnnamedConfigurable in project intellij-community by JetBrains.

the class ExportToHTMLDialog method reset.

public void reset() {
    ExportToHTMLSettings exportToHTMLSettings = ExportToHTMLSettings.getInstance(myProject);
    myRbSelectedText.setEnabled(myIsSelectedTextEnabled);
    myRbSelectedText.setSelected(myIsSelectedTextEnabled);
    myRbCurrentFile.setEnabled(myFileName != null);
    myRbCurrentFile.setSelected(myFileName != null && !myIsSelectedTextEnabled);
    myRbCurrentPackage.setEnabled(myDirectoryName != null);
    myRbCurrentPackage.setSelected(myDirectoryName != null && !myIsSelectedTextEnabled && myFileName == null);
    myCbIncludeSubpackages.setSelected(exportToHTMLSettings.isIncludeSubdirectories());
    myCbIncludeSubpackages.setEnabled(myRbCurrentPackage.isSelected());
    myCbLineNumbers.setSelected(exportToHTMLSettings.PRINT_LINE_NUMBERS);
    myCbOpenInBrowser.setSelected(exportToHTMLSettings.OPEN_IN_BROWSER);
    myTargetDirectoryField.setText(exportToHTMLSettings.OUTPUT_DIRECTORY);
    for (UnnamedConfigurable printOption : myExtensions) {
        printOption.reset();
    }
}
Also used : UnnamedConfigurable(com.intellij.openapi.options.UnnamedConfigurable)

Example 9 with UnnamedConfigurable

use of com.intellij.openapi.options.UnnamedConfigurable in project intellij-community by JetBrains.

the class ExportToHTMLDialog method apply.

public void apply() throws ConfigurationException {
    ExportToHTMLSettings exportToHTMLSettings = ExportToHTMLSettings.getInstance(myProject);
    if (myRbCurrentFile.isSelected()) {
        exportToHTMLSettings.setPrintScope(PrintSettings.PRINT_FILE);
    } else if (myRbSelectedText.isSelected()) {
        exportToHTMLSettings.setPrintScope(PrintSettings.PRINT_SELECTED_TEXT);
    } else if (myRbCurrentPackage.isSelected()) {
        exportToHTMLSettings.setPrintScope(PrintSettings.PRINT_DIRECTORY);
    }
    exportToHTMLSettings.setIncludeSubpackages(myCbIncludeSubpackages.isSelected());
    exportToHTMLSettings.PRINT_LINE_NUMBERS = myCbLineNumbers.isSelected();
    exportToHTMLSettings.OPEN_IN_BROWSER = myCbOpenInBrowser.isSelected();
    exportToHTMLSettings.OUTPUT_DIRECTORY = myTargetDirectoryField.getText();
    for (UnnamedConfigurable printOption : myExtensions) {
        printOption.apply();
    }
}
Also used : UnnamedConfigurable(com.intellij.openapi.options.UnnamedConfigurable)

Example 10 with UnnamedConfigurable

use of com.intellij.openapi.options.UnnamedConfigurable in project intellij-community by JetBrains.

the class EqualsHashCodeTemplatesPanel method createConfigurable.

@Override
protected UnnamedConfigurable createConfigurable(Couple<TemplateResource> item) {
    final GenerateTemplateConfigurable equalsConfigurable = new GenerateTemplateConfigurable(item.first, GenerateEqualsHelper.getEqualsImplicitVars(myProject), myProject);
    final GenerateTemplateConfigurable hashCodeConfigurable = new GenerateTemplateConfigurable(item.second, GenerateEqualsHelper.getHashCodeImplicitVars(), myProject);
    return new UnnamedConfigurable() {

        @Nullable
        @Override
        public JComponent createComponent() {
            final Splitter splitter = new Splitter(true);
            final JPanel eqPanel = new JPanel(new BorderLayout());
            eqPanel.add(new TitledSeparator("Equals Template:"), BorderLayout.NORTH);
            final JComponent eqPane = equalsConfigurable.createComponent();
            eqPane.setPreferredSize(JBUI.size(300, 200));
            eqPanel.add(eqPane, BorderLayout.CENTER);
            splitter.setFirstComponent(eqPanel);
            final JPanel hcPanel = new JPanel(new BorderLayout());
            hcPanel.add(new TitledSeparator("HashCode Template:"), BorderLayout.NORTH);
            final JComponent hcPane = hashCodeConfigurable.createComponent();
            hcPane.setPreferredSize(JBUI.size(300, 200));
            hcPanel.add(hcPane, BorderLayout.CENTER);
            splitter.setSecondComponent(hcPanel);
            return splitter;
        }

        @Override
        public boolean isModified() {
            return equalsConfigurable.isModified() || hashCodeConfigurable.isModified();
        }

        @Override
        public void apply() throws ConfigurationException {
            equalsConfigurable.apply();
            hashCodeConfigurable.apply();
        }

        @Override
        public void reset() {
            equalsConfigurable.reset();
            hashCodeConfigurable.reset();
        }

        @Override
        public void disposeUIResources() {
            equalsConfigurable.disposeUIResources();
            hashCodeConfigurable.disposeUIResources();
        }
    };
}
Also used : Splitter(com.intellij.openapi.ui.Splitter) TitledSeparator(com.intellij.ui.TitledSeparator) UnnamedConfigurable(com.intellij.openapi.options.UnnamedConfigurable) GenerateTemplateConfigurable(org.jetbrains.java.generate.view.GenerateTemplateConfigurable)

Aggregations

UnnamedConfigurable (com.intellij.openapi.options.UnnamedConfigurable)13 VcsDescriptor (com.intellij.openapi.vcs.impl.VcsDescriptor)3 OptionsContainingConfigurable (com.intellij.application.options.OptionsContainingConfigurable)1 AllFileTemplatesConfigurable (com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable)1 PluginManagerConfigurable (com.intellij.ide.plugins.PluginManagerConfigurable)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 KeymapPanel (com.intellij.openapi.keymap.impl.ui.KeymapPanel)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)1 ConfigurableWrapper (com.intellij.openapi.options.ex.ConfigurableWrapper)1 Splitter (com.intellij.openapi.ui.Splitter)1 DocumentAdapter (com.intellij.ui.DocumentAdapter)1 OptionGroup (com.intellij.ui.OptionGroup)1 TitledSeparator (com.intellij.ui.TitledSeparator)1 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)1 GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)1 File (java.io.File)1 DocumentEvent (javax.swing.event.DocumentEvent)1 Document (org.jdom.Document)1 Element (org.jdom.Element)1