use of com.intellij.ui.speedSearch.SpeedSearchSupply in project intellij-community by JetBrains.
the class DebuggerTreeWithHistoryPopup method updateContainer.
@Override
protected void updateContainer(final Tree tree, String title) {
if (myPopup != null) {
myPopup.cancel();
}
tree.getModel().addTreeModelListener(createTreeListener(tree));
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(createMainPanel(tree), tree).setRequestFocus(true).setTitle(title).setResizable(true).setMovable(true).setDimensionServiceKey(myProject, DIMENSION_SERVICE_KEY, false).setMayBeParent(true).setKeyEventHandler(event -> {
if (AbstractPopup.isCloseRequest(event)) {
SpeedSearchSupply supply = SpeedSearchSupply.getSupply(tree);
return supply != null && StringUtil.isEmpty(supply.getEnteredPrefix());
}
return false;
}).addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
if (myHideRunnable != null) {
myHideRunnable.run();
}
}
}).setCancelCallback(() -> {
Window parent = SwingUtilities.getWindowAncestor(tree);
if (parent != null) {
for (Window child : parent.getOwnedWindows()) {
if (child.isShowing()) {
return false;
}
}
}
return true;
}).createPopup();
registerTreeDisposable(myPopup, tree);
//Editor may be disposed before later invokator process this action
if (myEditor.getComponent().getRootPane() == null) {
myPopup.cancel();
return;
}
myPopup.show(new RelativePoint(myEditor.getContentComponent(), myPoint));
updateInitialBounds(tree);
}
use of com.intellij.ui.speedSearch.SpeedSearchSupply in project intellij-community by JetBrains.
the class JBTable method editCellAt.
@Override
public boolean editCellAt(final int row, final int column, final EventObject e) {
if (cellEditor != null && !cellEditor.stopCellEditing()) {
return false;
}
if (row < 0 || row >= getRowCount() || column < 0 || column >= getColumnCount()) {
return false;
}
if (!isCellEditable(row, column)) {
return false;
}
if (e instanceof KeyEvent) {
// do not start editing in autoStartsEdit mode on Ctrl-Z and other non-typed events
if (!UIUtil.isReallyTypedEvent((KeyEvent) e) || ((KeyEvent) e).getKeyChar() == KeyEvent.CHAR_UNDEFINED)
return false;
SpeedSearchSupply supply = SpeedSearchSupply.getSupply(this);
if (supply != null && supply.isPopupActive()) {
return false;
}
}
final TableCellEditor editor = getCellEditor(row, column);
if (editor != null && editor.isCellEditable(e)) {
editorComp = prepareEditor(editor, row, column);
//((JComponent)editorComp).setBorder(null);
if (editorComp == null) {
removeEditor();
return false;
}
editorComp.setBounds(getCellRect(row, column, false));
add(editorComp);
editorComp.validate();
if (surrendersFocusOnKeyStroke()) {
// this replaces focus request in JTable.processKeyBinding
final IdeFocusManager focusManager = IdeFocusManager.findInstanceByComponent(this);
focusManager.setTypeaheadEnabled(false);
focusManager.requestFocus(editorComp, true).doWhenProcessed(() -> focusManager.setTypeaheadEnabled(true));
}
setCellEditor(editor);
setEditingRow(row);
setEditingColumn(column);
editor.addCellEditorListener(this);
return true;
}
return false;
}
Aggregations