use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.
the class SettingsEditor method checkModified.
void checkModified(Configurable configurable) {
Configurable parent = myFilter.myContext.getParentConfigurable(configurable);
if (ConfigurableWrapper.hasOwnContent(parent)) {
checkModifiedForItem(parent);
for (Configurable child : myFilter.myContext.getChildren(parent)) {
checkModifiedForItem(child);
}
} else if (configurable != null) {
checkModifiedForItem(configurable);
}
updateStatus(configurable);
}
use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.
the class SettingsFilter method update.
private ActionCallback update(@NotNull DocumentEvent.EventType type, boolean adjustSelection, boolean now) {
if (myUpdateRejected) {
return ActionCallback.REJECTED;
}
String text = getFilterText();
if (text.isEmpty()) {
myContext.setHoldingFilter(false);
myFiltered = null;
} else {
myContext.setHoldingFilter(true);
myHits = myRegistrar.getConfigurables(myGroups, type, myFiltered, text, myProject);
myFiltered = myHits.getAll();
}
mySearch.getTextEditor().setBackground(myFiltered != null && myFiltered.isEmpty() ? LightColors.RED : UIUtil.getTextFieldBackground());
Configurable current = myContext.getCurrentConfigurable();
boolean shouldMoveSelection = myHits == null || (!myHits.getNameFullHits().contains(current) && !myHits.getContentHits().contains(current));
if (shouldMoveSelection && type != DocumentEvent.EventType.INSERT && (myFiltered == null || myFiltered.contains(current))) {
shouldMoveSelection = false;
}
Configurable candidate = adjustSelection ? current : null;
if (shouldMoveSelection && myHits != null) {
if (!myHits.getNameHits().isEmpty()) {
candidate = findConfigurable(myHits.getNameHits(), myHits.getNameFullHits());
} else if (!myHits.getContentHits().isEmpty()) {
candidate = findConfigurable(myHits.getContentHits(), null);
}
}
updateSpotlight(false);
if ((myFiltered == null || !myFiltered.isEmpty()) && candidate == null && myLastSelected != null) {
candidate = myLastSelected;
myLastSelected = null;
}
if (candidate == null && current != null) {
myLastSelected = current;
}
SimpleNode node = !adjustSelection ? null : findNode(candidate);
ActionCallback callback = fireUpdate(node, adjustSelection, now);
myDocumentWasChanged = true;
return callback;
}
use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.
the class SettingsFilter method shouldBeShowing.
@Override
public boolean shouldBeShowing(SimpleNode node) {
if (myFiltered != null) {
Configurable configurable = getConfigurable(node);
if (configurable != null) {
if (!myFiltered.contains(configurable)) {
if (myHits != null) {
Set<Configurable> configurables = myHits.getNameFullHits();
while (node != null) {
if (configurable != null) {
if (configurables.contains(configurable)) {
return true;
}
}
node = node.getParent();
configurable = getConfigurable(node);
}
}
return false;
}
}
}
return true;
}
use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.
the class GeneralSettingsConfigurable method createComponent.
@Override
public JComponent createComponent() {
if (myComponent == null) {
myComponent = new MyComponent();
}
myComponent.myChkAutoSaveIfInactive.addChangeListener(e -> myComponent.myTfInactiveTimeout.setEditable(myComponent.myChkAutoSaveIfInactive.isSelected()));
List<SearchableConfigurable> list = getConfigurables();
if (!list.isEmpty()) {
myComponent.myPluginOptionsPanel.setLayout(new GridLayout(list.size(), 1));
for (Configurable c : list) {
myComponent.myPluginOptionsPanel.add(c.createComponent());
}
}
return myComponent.myPanel;
}
use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.
the class ShowSettingsUtilImpl method showSettingsDialog.
public <T extends Configurable> void showSettingsDialog(@Nullable Project project, @NotNull Class<T> configurableClass, @Nullable Consumer<T> additionalConfiguration) {
assert Configurable.class.isAssignableFrom(configurableClass) : "Not a configurable: " + configurableClass.getName();
ConfigurableGroup[] groups = getConfigurableGroups(project, true);
Configurable config = new ConfigurableVisitor.ByType(configurableClass).find(groups);
assert config != null : "Cannot find configurable: " + configurableClass.getName();
if (additionalConfiguration != null) {
T toConfigure = ConfigurableWrapper.cast(configurableClass, config);
assert toConfigure != null : "Wrong configurable found: " + config.getClass();
additionalConfiguration.accept(toConfigure);
}
getDialog(project, groups, config).show();
}
Aggregations