mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Hide disabled and invisible actions from "Find Action..." result list
This commit is contained in:
@@ -55,6 +55,7 @@ import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
public class GotoActionAction extends GotoActionBase implements DumbAware {
|
||||
@@ -97,6 +98,20 @@ public class GotoActionAction extends GotoActionBase implements DumbAware {
|
||||
}
|
||||
final Disposable disposable = Disposer.newDisposable();
|
||||
final ChooseByNamePopup popup = new ChooseByNamePopup(project, model, new GotoActionItemProvider(model), oldPopup, initialText, false, initialIndex) {
|
||||
@Override
|
||||
protected void filterInEDT(Set<Object> elements) {
|
||||
for (Iterator<Object> iterator = elements.iterator(); iterator.hasNext(); ) {
|
||||
Object o = iterator.next();
|
||||
if (o instanceof GotoActionModel.MatchedValue) {
|
||||
Comparable value = ((GotoActionModel.MatchedValue)o).value;
|
||||
if (value instanceof GotoActionModel.ActionWrapper) {
|
||||
GotoActionModel.ActionWrapper wrapper = (GotoActionModel.ActionWrapper)value;
|
||||
if (!wrapper.getPresentation().isEnabled() || !wrapper.getPresentation().isVisible()) iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initUI(Callback callback, ModalityState modalityState, boolean allowMultipleSelection) {
|
||||
super.initUI(callback, modalityState, allowMultipleSelection);
|
||||
|
||||
@@ -1467,6 +1467,9 @@ public abstract class ChooseByNameBase {
|
||||
return panel;
|
||||
}
|
||||
|
||||
protected void filterInEDT(Set<Object> elements) {
|
||||
}
|
||||
|
||||
private class CalcElementsThread extends ReadTask {
|
||||
private final String myPattern;
|
||||
private final boolean myCheckboxState;
|
||||
@@ -1518,6 +1521,8 @@ public abstract class ChooseByNameBase {
|
||||
|
||||
showCard(cardToShow, 0);
|
||||
|
||||
filterInEDT(filtered);
|
||||
|
||||
myCallback.consume(filtered);
|
||||
}
|
||||
}, myModalityState);
|
||||
|
||||
Reference in New Issue
Block a user