IDEA-117143 quick search in settings does not search in "Notifications"

This commit is contained in:
peter
2015-01-19 17:51:12 +01:00
parent a3fe80e2d1
commit b8ab7e2bc7
4 changed files with 47 additions and 2 deletions
@@ -0,0 +1,32 @@
/*
* Copyright 2000-2015 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.notification.impl;
import com.intellij.ide.ui.search.SearchableOptionContributor;
import com.intellij.ide.ui.search.SearchableOptionProcessor;
import org.jetbrains.annotations.NotNull;
/**
* @author peter
*/
public class NotificationSearchableOptionContributor extends SearchableOptionContributor {
@Override
public void processOptions(@NotNull SearchableOptionProcessor processor) {
for (NotificationSettings settings : NotificationsConfigurationImpl.getInstanceImpl().getAllSettings()) {
processor.addOptions(settings.getGroupId(), null, settings.getGroupId() + " notifications", NotificationsConfigurable.ID, NotificationsConfigurable.DISPLAY_NAME, true);
}
}
}
@@ -30,6 +30,7 @@ import javax.swing.*;
*/
public class NotificationsConfigurable implements Configurable, SearchableConfigurable, Configurable.NoScroll {
public static final String DISPLAY_NAME = "Notifications";
static final String ID = "reference.settings.ide.settings.notifications";
private NotificationsConfigurablePanel myComponent;
@Override
@@ -41,7 +42,7 @@ public class NotificationsConfigurable implements Configurable, SearchableConfig
@Override
@NotNull
public String getHelpTopic() {
return "reference.settings.ide.settings.notifications";
return ID;
}
@Override
@@ -82,6 +83,11 @@ public class NotificationsConfigurable implements Configurable, SearchableConfig
@Override
public Runnable enableSearch(final String option) {
return null;
return new Runnable() {
@Override
public void run() {
myComponent.selectGroup(option);
}
};
}
}
@@ -23,6 +23,8 @@ import com.intellij.openapi.ui.ComboBoxTableRenderer;
import com.intellij.openapi.ui.StripeTable;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.*;
import com.intellij.ui.speedSearch.SpeedSearchSupply;
import com.intellij.util.ObjectUtils;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -427,4 +429,8 @@ public class NotificationsConfigurablePanel extends JPanel implements Disposable
return result;
}
}
public void selectGroup(String searchQuery) {
ObjectUtils.assertNotNull(SpeedSearchSupply.getSupply(myTable, true)).findAndSelectElement(searchQuery);
}
}
@@ -241,6 +241,7 @@
displayName="Notifications"
id="reference.settings.ide.settings.notifications"
provider="com.intellij.notification.impl.NotificationsConfigurableProvider"/>
<search.optionContributor implementation="com.intellij.notification.impl.NotificationSearchableOptionContributor"/>
<!-- Plugins -->
<applicationConfigurable groupId="root" groupWeight="55" instance="com.intellij.ide.plugins.PluginManagerConfigurable" id="preferences.pluginManager"