mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
more functionality in platform-api
This commit is contained in:
@@ -23,21 +23,44 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* User: spLeaner
|
||||
* @author spLeaner
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public abstract class SpeedSearchSupply {
|
||||
protected static final Key SPEED_SEARCH_COMPONENT_MARKER = new Key("SPEED_SEARCH_COMPONENT_MARKER");
|
||||
private static final Key SPEED_SEARCH_COMPONENT_MARKER = new Key("SPEED_SEARCH_COMPONENT_MARKER");
|
||||
|
||||
@Nullable
|
||||
public static SpeedSearchSupply getSupply(@NotNull final JComponent speedSearchEnabledComponent) {
|
||||
SpeedSearchSupply speedSearch = (SpeedSearchSupply) speedSearchEnabledComponent.getClientProperty(SPEED_SEARCH_COMPONENT_MARKER);
|
||||
return speedSearch != null && speedSearch.isPopupActive() ? speedSearch : null;
|
||||
public static SpeedSearchSupply getSupply(@NotNull final JComponent component) {
|
||||
return getSupply(component, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static SpeedSearchSupply getSupply(@NotNull final JComponent component, boolean evenIfInactive) {
|
||||
SpeedSearchSupply speedSearch = (SpeedSearchSupply)component.getClientProperty(SPEED_SEARCH_COMPONENT_MARKER);
|
||||
|
||||
if (evenIfInactive) {
|
||||
return speedSearch;
|
||||
}
|
||||
|
||||
return speedSearch != null && speedSearch.isPopupActive() ? speedSearch : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public abstract Iterable<TextRange> matchingFragments(@NotNull final String text);
|
||||
|
||||
/**
|
||||
* Selects element according to search criteria changes
|
||||
*/
|
||||
public abstract void refreshSelection();
|
||||
|
||||
public abstract boolean isPopupActive();
|
||||
|
||||
@Nullable
|
||||
public abstract Iterable<TextRange> matchingFragments(@NotNull final String text);
|
||||
public String getEnteredPrefix() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void installSupplyTo(JComponent component) {
|
||||
component.putClientProperty(SPEED_SEARCH_COMPONENT_MARKER, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,12 +78,11 @@ public abstract class SpeedSearchBase<Comp extends JComponent> extends SpeedSear
|
||||
}
|
||||
});
|
||||
|
||||
component.putClientProperty(SPEED_SEARCH_COMPONENT_MARKER, this);
|
||||
installSupplyTo(component);
|
||||
}
|
||||
|
||||
public static boolean hasActiveSpeedSearch(JComponent component) {
|
||||
SpeedSearchBase speedSearch = (SpeedSearchBase)component.getClientProperty(SPEED_SEARCH_COMPONENT_MARKER);
|
||||
return speedSearch != null && speedSearch.mySearchPopup != null && speedSearch.mySearchPopup.isVisible();
|
||||
return getSupply(component) != null;
|
||||
}
|
||||
|
||||
public void setClearSearchOnNavigateNoMatch(boolean clearSearchOnNavigateNoMatch) {
|
||||
|
||||
Reference in New Issue
Block a user