use of com.intellij.ide.ui.search.SearchableOptionsRegistrar in project intellij-community by JetBrains.
the class IntentionManagerSettings method processMetaData.
private static synchronized void processMetaData(@NotNull final IntentionActionMetaData metaData) {
final Application app = ApplicationManager.getApplication();
if (app.isUnitTestMode() || app.isHeadlessEnvironment())
return;
final TextDescriptor description = metaData.getDescription();
app.executeOnPooledThread(() -> {
try {
SearchableOptionsRegistrar registrar = SearchableOptionsRegistrar.getInstance();
if (registrar == null)
return;
@NonNls String descriptionText = description.getText().toLowerCase();
descriptionText = HTML_PATTERN.matcher(descriptionText).replaceAll(" ");
final Set<String> words = registrar.getProcessedWordsWithoutStemming(descriptionText);
words.addAll(registrar.getProcessedWords(metaData.getFamily()));
for (String word : words) {
registrar.addOption(word, metaData.getFamily(), metaData.getFamily(), IntentionSettingsConfigurable.HELP_ID, IntentionSettingsConfigurable.DISPLAY_NAME);
}
} catch (IOException e) {
LOG.error(e);
}
});
}
use of com.intellij.ide.ui.search.SearchableOptionsRegistrar in project Perl5-IDEA by Camelcade.
the class PerlSearchableOptionsLoader method initComponent.
@Override
public void initComponent() {
SearchableOptionsRegistrar registrar = SearchableOptionsRegistrar.getInstance();
if (registrar == null) {
return;
}
try {
// index
final URL indexResource = ResourceUtil.getResource(PerlSearchableOptionsLoader.class, "/search/", "searchableOptions.xml");
if (indexResource == null) {
LOG.info("No /search/searchableOptions.xml found, settings search won't work!");
return;
}
Document document = JDOMUtil.loadDocument(indexResource);
Element root = document.getRootElement();
List configurables = root.getChildren("configurable");
for (final Object o : configurables) {
final Element configurable = (Element) o;
final String configurableId = configurable.getAttributeValue("id");
final String configurableDisplayName = configurable.getAttributeValue("configurable_name");
final List options = configurable.getChildren("option");
for (Object o1 : options) {
Element optionElement = (Element) o1;
final String option = optionElement.getAttributeValue("name");
final String path = optionElement.getAttributeValue("path");
final String hit = optionElement.getAttributeValue("hit");
registrar.addOption(option, path, hit, configurableId, configurableDisplayName);
}
}
} catch (Exception e) {
LOG.error(e);
}
}
Aggregations