use of com.intellij.openapi.options.ex.ConfigurableWrapper 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.ex.ConfigurableWrapper in project intellij-community by JetBrains.
the class SettingsTreeView method findConfigurableProject.
@Nullable
private static Project findConfigurableProject(@NotNull MyNode node, boolean checkProjectLevel) {
Configurable configurable = node.myConfigurable;
Project project = node.getProject();
if (checkProjectLevel) {
Configurable.VariableProjectAppLevel wrapped = ConfigurableWrapper.cast(Configurable.VariableProjectAppLevel.class, configurable);
if (wrapped != null)
return wrapped.isProjectLevel() ? project : null;
}
if (configurable instanceof ConfigurableWrapper)
return project;
if (configurable instanceof SortedConfigurableGroup)
return project;
SimpleNode parent = node.getParent();
return parent instanceof MyNode ? findConfigurableProject((MyNode) parent, checkProjectLevel) : null;
}
use of com.intellij.openapi.options.ex.ConfigurableWrapper in project intellij-community by JetBrains.
the class SettingsTreeView method fireSelected.
private void fireSelected(Configurable configurable, ActionCallback callback) {
ConfigurableWrapper wrapper = myConfigurableToWrapperMap.get(configurable);
myFilter.myContext.fireSelected(wrapper != null ? wrapper : configurable, this).doWhenProcessed(callback.createSetDoneRunnable());
}
use of com.intellij.openapi.options.ex.ConfigurableWrapper in project intellij-community by JetBrains.
the class SettingsTreeView method findConfigurable.
@Nullable
<T extends UnnamedConfigurable> T findConfigurable(@NotNull Class<T> type) {
for (UnnamedConfigurable configurable : myConfigurableToNodeMap.keySet()) {
if (configurable instanceof ConfigurableWrapper) {
ConfigurableWrapper wrapper = (ConfigurableWrapper) configurable;
configurable = wrapper.getConfigurable();
myConfigurableToWrapperMap.put(configurable, wrapper);
}
if (type.isInstance(configurable)) {
return type.cast(configurable);
}
}
return null;
}
use of com.intellij.openapi.options.ex.ConfigurableWrapper in project intellij-community by JetBrains.
the class SettingsTreeView method prepareProject.
@Nullable
private static Project prepareProject(CachingSimpleNode parent, Configurable configurable) {
if (configurable instanceof ConfigurableWrapper) {
ConfigurableWrapper wrapper = (ConfigurableWrapper) configurable;
return wrapper.getExtensionPoint().getProject();
}
if (configurable instanceof SortedConfigurableGroup) {
SortedConfigurableGroup group = (SortedConfigurableGroup) configurable;
Configurable[] configurables = group.getConfigurables();
if (configurables != null && configurables.length != 0) {
Project project = prepareProject(parent, configurables[0]);
if (project != null) {
for (int i = 1; i < configurables.length; i++) {
if (project != prepareProject(parent, configurables[i])) {
return null;
}
}
}
return project;
}
}
return parent == null ? null : parent.getProject();
}
Aggregations