mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-185567 Server types not searchable in Settings
This commit is contained in:
@@ -112,6 +112,7 @@
|
||||
<projectService serviceImplementation="com.intellij.tasks.impl.TaskProjectConfiguration"/>
|
||||
<applicationService serviceImplementation="com.intellij.tasks.config.RecentTaskRepositories"/>
|
||||
<applicationService serviceImplementation="com.intellij.tasks.config.TaskSettings"/>
|
||||
<search.optionContributor implementation="com.intellij.tasks.config.TaskSearchableOptionContributor"/>
|
||||
|
||||
<lang.documentationProvider language="TEXT" implementationClass="com.intellij.tasks.doc.TaskDocumentationProvider"/>
|
||||
|
||||
|
||||
+18
-1
@@ -8,6 +8,7 @@ import com.intellij.openapi.actionSystem.Separator;
|
||||
import com.intellij.openapi.options.BaseConfigurable;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ui.configuration.actions.IconWithTextAction;
|
||||
@@ -40,9 +41,11 @@ import java.util.List;
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class TaskRepositoriesConfigurable extends BaseConfigurable implements Configurable.NoScroll {
|
||||
public class TaskRepositoriesConfigurable extends BaseConfigurable implements Configurable.NoScroll, SearchableConfigurable {
|
||||
|
||||
public static final String ID = "tasks.servers";
|
||||
private static final String EMPTY_PANEL = "empty.panel";
|
||||
|
||||
private JPanel myPanel;
|
||||
private JPanel myServersPanel;
|
||||
private final JBList myRepositoriesList;
|
||||
@@ -257,6 +260,20 @@ public class TaskRepositoriesConfigurable extends BaseConfigurable implements Co
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Runnable enableSearch(String option) {
|
||||
TaskRepository matched =
|
||||
myRepositories.stream().filter(repository -> repository.getRepositoryType().getName().contains(option)).findFirst().orElse(null);
|
||||
return matched == null ? null : () -> myRepositoriesList.setSelectedValue(matched, true);
|
||||
}
|
||||
|
||||
private abstract class AddServerAction extends IconWithTextAction implements DumbAware {
|
||||
|
||||
public AddServerAction(TaskRepositorySubtype subtype) {
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.tasks.config;
|
||||
|
||||
import com.intellij.ide.ui.search.SearchableOptionContributor;
|
||||
import com.intellij.ide.ui.search.SearchableOptionProcessor;
|
||||
import com.intellij.tasks.TaskRepositoryType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TaskSearchableOptionContributor extends SearchableOptionContributor {
|
||||
@Override
|
||||
public void processOptions(@NotNull SearchableOptionProcessor processor) {
|
||||
TaskRepositoryType[] types = TaskRepositoryType.getRepositoryTypes();
|
||||
for (TaskRepositoryType type : types) {
|
||||
processor.addOptions(type.getName(), null, null, TaskRepositoriesConfigurable.ID, null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user