Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ability to see all registry keys in search everywhere and edit them
  • Loading branch information
bulenkov committed Feb 22, 2017
1 parent 501c1bc commit a15ff5b
Show file tree
Hide file tree
Showing 19 changed files with 170 additions and 55 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@

import com.intellij.ide.ui.OptionsTopHitProvider;
import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -36,7 +37,7 @@ public String getId() {

@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
public Collection<OptionDescription> getOptions(@Nullable Project project) {
IntentionManagerSettings settings = IntentionManagerSettings.getInstance();
if (settings == null) {
return Collections.emptyList();
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@

import com.intellij.ide.ui.OptionsTopHitProvider;
import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -36,7 +37,7 @@ public String getId() {

@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
public Collection<OptionDescription> getOptions(@Nullable Project project) {
TemplateSettings settings = TemplateSettings.getInstance();
if (settings == null) {
return Collections.emptyList();
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -291,9 +291,15 @@ public static void openOptionOrPerformAction(@NotNull Object element,
Component component,
@Nullable AnActionEvent e) {
if (element instanceof OptionDescription) {
final String configurableId = ((OptionDescription)element).getConfigurableId();
TransactionGuard.getInstance().submitTransactionLater(project != null ? project : ApplicationManager.getApplication(), () ->
ShowSettingsUtilImpl.showSettingsDialog(project, configurableId, enteredText));
OptionDescription optionDescription = (OptionDescription)element;
final String configurableId = optionDescription.getConfigurableId();
Disposable disposable = project != null ? project : ApplicationManager.getApplication();
TransactionGuard guard = TransactionGuard.getInstance();
if (optionDescription.hasExternalEditor()) {
guard.submitTransactionLater(disposable, () -> optionDescription.invokeInternalEditor());
} else {
guard.submitTransactionLater(disposable, () -> ShowSettingsUtilImpl.showSettingsDialog(project, configurableId, enteredText));
}
}
else {
ApplicationManager.getApplication().invokeLater(() -> IdeFocusManager.getInstance(project).doWhenFocusSettlesDown(
Expand Down
Expand Up @@ -1225,9 +1225,10 @@ else if (isSetting(value)) {
}
append(text, attrs);
final String id = ((OptionDescription)value).getConfigurableId();
final String name1 = myConfigurables.get(id);
if (name1 != null) {
setLocationString(name1);
String location = myConfigurables.get(id);
if (location == null) location = ((OptionDescription)value).getValue();
if (location != null) {
setLocationString(location);
}
}
else if (value instanceof OptionsTopHitProvider) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,7 @@
import com.intellij.ide.ui.PublicMethodBasedOptionDescription;
import com.intellij.ide.ui.UISettings;
import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.openapi.project.Project;
import com.intellij.ui.FileColorManager;
import org.jetbrains.annotations.NotNull;
Expand All @@ -40,7 +41,7 @@ public String getId() {

@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
public Collection<OptionDescription> getOptions(@Nullable Project project) {
if (project != null) {
FileColorManager manager = FileColorManager.getInstance(project);
if (manager != null) {
Expand Down
Expand Up @@ -16,6 +16,7 @@
package com.intellij.ide.ui;

import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.notification.impl.NotificationsConfigurationImpl;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
Expand All @@ -31,7 +32,7 @@
public class AppearanceOptionsTopHitProvider extends OptionsTopHitProvider {
public static final String ID = "appearance";

private static final Collection<BooleanOptionDescription> ourOptions = ContainerUtil.immutableList(
private static final Collection<OptionDescription> ourOptions = ContainerUtil.immutableList(
appearance2("UI: " + messageIde("checkboox.cyclic.scrolling.in.lists"), "cycleScrolling"),
appearance("UI: " + messageIde("checkbox.show.icons.in.quick.navigation"), "SHOW_ICONS_IN_QUICK_NAVIGATION"),
appearance("UI: " + messageIde("checkbox.position.cursor.on.default.button"), "MOVE_MOUSE_ON_DEFAULT_BUTTON"),
Expand All @@ -54,7 +55,7 @@ public class AppearanceOptionsTopHitProvider extends OptionsTopHitProvider {

@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
public Collection<OptionDescription> getOptions(@Nullable Project project) {
return ourOptions;
}

Expand Down Expand Up @@ -105,7 +106,7 @@ public Object getInstance() {
}

public static class Ex extends OptionsTopHitProvider implements CoveredByToggleActions {
private static final Collection<BooleanOptionDescription> ourOptions = ContainerUtil.immutableList(
private static final Collection<OptionDescription> ourOptions = ContainerUtil.immutableList(
appearance("Window: " + "Hide Tool Window Bars", "HIDE_TOOL_STRIPES"),
appearance("View: Show Main Toolbar", "SHOW_MAIN_TOOLBAR"),
appearance("View: Show Status Bar", "SHOW_STATUS_BAR"),
Expand All @@ -114,7 +115,7 @@ public static class Ex extends OptionsTopHitProvider implements CoveredByToggleA

@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
public Collection<OptionDescription> getOptions(@Nullable Project project) {
return ourOptions;
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@
package com.intellij.ide.ui;

import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
Expand Down Expand Up @@ -120,7 +121,7 @@ else if (component instanceof Container) {

@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
public Collection<OptionDescription> getOptions(@Nullable Project project) {
try {
Configurable configurable = getConfigurable(project);
Component component = configurable.createComponent();
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@
package com.intellij.ide.ui;

import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.openapi.project.Project;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
Expand All @@ -29,7 +30,7 @@
public class EditorOptionsTopHitProvider extends OptionsTopHitProvider {
private static final String ID = "editor";

private static final Collection<BooleanOptionDescription> ourOptions = ContainerUtil.immutableList(
private static final Collection<OptionDescription> ourOptions = ContainerUtil.immutableList(
editorUI("Appearance: " + messageIde("checkbox.use.antialiased.font.in.editor"), "ANTIALIASING_IN_EDITOR"),
editorUI("Appearance: " + messageIde("checkbox.use.lcd.rendered.font.in.editor"), "USE_LCD_RENDERING_IN_EDITOR"),
editorApp("Appearance: Caret blinking", "IS_CARET_BLINKING"),
Expand All @@ -49,7 +50,7 @@ public class EditorOptionsTopHitProvider extends OptionsTopHitProvider {

@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
public Collection<OptionDescription> getOptions(@Nullable Project project) {
return ourOptions;
}

Expand Down Expand Up @@ -83,14 +84,14 @@ static BooleanOptionDescription editorCode(String option, String field) {
}

public static class Ex extends OptionsTopHitProvider implements CoveredByToggleActions {
private static final Collection<BooleanOptionDescription> ourOptions = ContainerUtil.immutableList(
private static final Collection<OptionDescription> ourOptions = ContainerUtil.immutableList(
editorApp("Appearance: " + messageApp("checkbox.show.line.numbers"), "ARE_LINE_NUMBERS_SHOWN"),
editorApp("Appearance: " + messageApp("checkbox.show.gutter.icons"), "ARE_GUTTER_ICONS_SHOWN")
);

@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
public Collection<OptionDescription> getOptions(@Nullable Project project) {
return ourOptions;
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
package com.intellij.ide.ui;

import com.intellij.codeInspection.ex.Tools;
import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.openapi.project.Project;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.util.containers.ContainerUtil;
Expand All @@ -37,9 +37,9 @@ public String getId() {

@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
public Collection<OptionDescription> getOptions(@Nullable Project project) {
if (project == null) return ContainerUtil.emptyList();
List<BooleanOptionDescription> result = ContainerUtil.newArrayList();
List<OptionDescription> result = ContainerUtil.newArrayList();
List<Tools> tools = InspectionProjectProfileManager.getInstance(project).getCurrentProfile().getAllEnabledInspectionTools(project);
for (Tools tool : tools) {
result.add(new ToolOptionDescription(tool, project));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@

import com.intellij.ide.IdeBundle;
import com.intellij.ide.SearchTopHitProvider;
import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.openapi.application.ApplicationBundle;
import com.intellij.openapi.keymap.KeyMapBundle;
import com.intellij.openapi.project.Project;
Expand All @@ -37,7 +37,7 @@
*/
public abstract class OptionsTopHitProvider implements SearchTopHitProvider {
@NotNull
public abstract Collection<BooleanOptionDescription> getOptions(@Nullable Project project);
public abstract Collection<OptionDescription> getOptions(@Nullable Project project);

@Override
public final void consumeTopHits(@NonNls String pattern, Consumer<Object> collector, Project project) {
Expand All @@ -57,7 +57,7 @@ public final void consumeTopHits(@NonNls String pattern, Consumer<Object> collec
pattern = pattern.substring(id.length()).trim().toLowerCase();
}
final MinusculeMatcher matcher = NameUtil.buildMatcher("*" + pattern, NameUtil.MatchingCaseSensitivity.NONE);
for (BooleanOptionDescription option : getOptions(project)) {
for (OptionDescription option : getOptions(project)) {
if (matcher.matches(option.getOption())) {
collector.consume(option);
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@

import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManagerCore;
import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
Expand All @@ -32,8 +32,8 @@
public class PluginOptionsTopHitProvider extends OptionsTopHitProvider {
@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
ArrayList<BooleanOptionDescription> options = new ArrayList<>();
public Collection<OptionDescription> getOptions(@Nullable Project project) {
ArrayList<OptionDescription> options = new ArrayList<>();
ApplicationInfoEx applicationInfo = ApplicationInfoEx.getInstanceEx();
for (IdeaPluginDescriptor pluginDescriptor : PluginManagerCore.getPlugins()) {
if (applicationInfo.isEssentialPlugin(pluginDescriptor.getPluginId().getIdString())) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
*/
package com.intellij.ide.ui;

import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
Expand All @@ -33,7 +33,7 @@
public class RegistryOptionsTopHitProvider extends OptionsTopHitProvider {
@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
public Collection<OptionDescription> getOptions(@Nullable Project project) {
return Holder.ourValues;
}

Expand All @@ -48,10 +48,10 @@ public String getId() {
}

private static class Holder {
private static final List<BooleanOptionDescription> ourValues = initValues();
private static final List<OptionDescription> ourValues = initValues();

private static List<BooleanOptionDescription> initValues() {
final List<BooleanOptionDescription> result = new ArrayList<>();
private static List<OptionDescription> initValues() {
final List<OptionDescription> result = new ArrayList<>();
for (RegistryValue value : Registry.getAll()) {
if (value.isBoolean()) {
final String key = value.getKey();
Expand All @@ -61,6 +61,8 @@ private static List<BooleanOptionDescription> initValues() {
} else {
result.add(optionDescriptor);
}
} else {
result.add(new RegistryTextOptionDescriptor(value));
}
}
return result;
Expand Down

0 comments on commit a15ff5b

Please sign in to comment.