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();
}
}
}
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();
}
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();
}
}
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();
}
}
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();
}
};
}
Aggregations