本文整理汇总了Java中com.intellij.ui.speedSearch.SpeedSearchSupply.getSupply方法的典型用法代码示例。如果您正苦于以下问题:Java SpeedSearchSupply.getSupply方法的具体用法?Java SpeedSearchSupply.getSupply怎么用?Java SpeedSearchSupply.getSupply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.speedSearch.SpeedSearchSupply
的用法示例。
在下文中一共展示了SpeedSearchSupply.getSupply方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSpeedSearchEditing
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
private static boolean isSpeedSearchEditing(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_BACK_SPACE) {
Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (owner instanceof JComponent) {
SpeedSearchSupply supply = SpeedSearchSupply.getSupply((JComponent)owner);
return supply != null && supply.isPopupActive();
}
}
return false;
}
示例2: getInitialText
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
protected static Pair<String, Integer> getInitialText(boolean useEditorSelection, AnActionEvent e) {
final String predefined = e.getData(PlatformDataKeys.PREDEFINED_TEXT);
if (!StringUtil.isEmpty(predefined)) {
return Pair.create(predefined, 0);
}
if (useEditorSelection) {
final Editor editor = e.getData(CommonDataKeys.EDITOR);
if (editor != null) {
final String selectedText = editor.getSelectionModel().getSelectedText();
if (selectedText != null && !selectedText.contains("\n")) {
return Pair.create(selectedText, 0);
}
}
}
final String query = e.getData(SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY);
if (!StringUtil.isEmpty(query)) {
return Pair.create(query, 0);
}
final Component focusOwner = IdeFocusManager.getInstance(getEventProject(e)).getFocusOwner();
if (focusOwner instanceof JComponent) {
final SpeedSearchSupply supply = SpeedSearchSupply.getSupply((JComponent)focusOwner);
if (supply != null) {
return Pair.create(supply.getEnteredPrefix(), 0);
}
}
if (myInAction != null) {
final Pair<String, Integer> lastString = ourLastStrings.get(myInAction);
if (lastString != null) {
return lastString;
}
}
return Pair.create("", 0);
}
示例3: getInitialText
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
protected static Pair<String, Integer> getInitialText(boolean useEditorSelection, AnActionEvent e) {
final String predefined = e.getData(PlatformDataKeys.PREDEFINED_TEXT);
if (!StringUtil.isEmpty(predefined)) {
return Pair.create(predefined, 0);
}
if (useEditorSelection) {
final Editor editor = e.getData(PlatformDataKeys.EDITOR);
if (editor != null) {
final String selectedText = editor.getSelectionModel().getSelectedText();
if (selectedText != null && !selectedText.contains("\n")) {
return Pair.create(selectedText, 0);
}
}
}
final String query = e.getData(SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY);
if (!StringUtil.isEmpty(query)) {
return Pair.create(query, 0);
}
final Component focusOwner = IdeFocusManager.getInstance(getEventProject(e)).getFocusOwner();
if (focusOwner instanceof JComponent) {
final SpeedSearchSupply supply = SpeedSearchSupply.getSupply((JComponent)focusOwner);
if (supply != null) {
return Pair.create(supply.getEnteredPrefix(), 0);
}
}
if (myInAction != null) {
final Pair<String, Integer> lastString = ourLastStrings.get(myInAction);
if (lastString != null) {
return lastString;
}
}
return Pair.create("", 0);
}
示例4: getInitialText
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
protected static Pair<String, Integer> getInitialText(boolean useEditorSelection, AnActionEvent e) {
final String predefined = e.getData(PlatformDataKeys.PREDEFINED_TEXT);
if (!StringUtil.isEmpty(predefined)) {
return Pair.create(predefined, 0);
}
if (useEditorSelection) {
String selectedText = getInitialTextForNavigation(e.getData(CommonDataKeys.EDITOR));
if (selectedText != null) return new Pair<>(selectedText, 0);
}
final String query = e.getData(SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY);
if (!StringUtil.isEmpty(query)) {
return Pair.create(query, 0);
}
final Component focusOwner = IdeFocusManager.getInstance(getEventProject(e)).getFocusOwner();
if (focusOwner instanceof JComponent) {
final SpeedSearchSupply supply = SpeedSearchSupply.getSupply((JComponent)focusOwner);
if (supply != null) {
return Pair.create(supply.getEnteredPrefix(), 0);
}
}
if (myInAction != null) {
final Pair<String, Integer> lastString = ourLastStrings.get(myInAction);
if (lastString != null) {
return lastString;
}
}
return Pair.create("", 0);
}
示例5: isToggleEvent
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
private static boolean isToggleEvent(KeyEvent e, JComponent mainComponent) {
return e.getKeyCode() == KeyEvent.VK_SPACE && SpeedSearchSupply.getSupply(mainComponent) == null;
}
示例6: editCellAt
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
@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(new Runnable() {
@Override
public void run() {
focusManager.setTypeaheadEnabled(true);
}
});
}
setCellEditor(editor);
setEditingRow(row);
setEditingColumn(column);
editor.addCellEditorListener(this);
return true;
}
return false;
}
示例7: update
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
public void update(AnActionEvent event){
String place = event.getPlace();
Presentation presentation = event.getPresentation();
if (ActionPlaces.PROJECT_VIEW_POPUP.equals(place) || ActionPlaces.COMMANDER_POPUP.equals(place))
presentation.setText(IdeBundle.message("action.delete.ellipsis"));
else
presentation.setText(IdeBundle.message("action.delete"));
DataContext dataContext = event.getDataContext();
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
presentation.setEnabled(false);
return;
}
DeleteProvider provider = getDeleteProvider(dataContext);
if (event.getInputEvent() instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent)event.getInputEvent();
Object component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
if (component instanceof JTextComponent) provider = null; // Do not override text deletion
if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
// Do not override text deletion in speed search
if (component instanceof JComponent) {
SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent)component);
if (searchSupply != null) provider = null;
}
String activeSpeedSearchFilter = SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY.getData(dataContext);
if (!StringUtil.isEmpty(activeSpeedSearchFilter)) {
provider = null;
}
}
}
if (provider instanceof TitledHandler) {
presentation.setText(((TitledHandler)provider).getActionTitle());
}
final boolean canDelete = provider != null && provider.canDeleteElement(dataContext);
if (ActionPlaces.isPopupPlace(event.getPlace())) {
presentation.setVisible(canDelete);
}
else {
presentation.setEnabled(canDelete);
}
}
示例8: editCellAt
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
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 && UIUtil.isReallyTypedEvent((KeyEvent)e)) {
SpeedSearchSupply supply = SpeedSearchSupply.getSupply(this);
if (supply != null && supply.isPopupActive()) {
return false;
}
}
if (myEditorRemover == null) {
final KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
myEditorRemover = new MyCellEditorRemover();
//noinspection HardCodedStringLiteral
keyboardFocusManager.addPropertyChangeListener("focusOwner", myEditorRemover);
//noinspection HardCodedStringLiteral
keyboardFocusManager.addPropertyChangeListener("permanentFocusOwner", myEditorRemover);
}
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();
IdeFocusManager.findInstanceByComponent(this).requestFocus(editorComp, false);
setCellEditor(editor);
setEditingRow(row);
setEditingColumn(column);
editor.addCellEditorListener(this);
if (isTypeAhead) {
JTableCellEditorHelper.typeAhead(this, e, row, column);
}
return true;
}
return false;
}
示例9: update
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
public void update(AnActionEvent event){
String place = event.getPlace();
Presentation presentation = event.getPresentation();
if (ActionPlaces.PROJECT_VIEW_POPUP.equals(place) || ActionPlaces.COMMANDER_POPUP.equals(place))
presentation.setText(IdeBundle.message("action.delete.ellipsis"));
else
presentation.setText(IdeBundle.message("action.delete"));
DataContext dataContext = event.getDataContext();
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) {
presentation.setEnabled(false);
return;
}
DeleteProvider provider = getDeleteProvider(dataContext);
if (event.getInputEvent() instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent)event.getInputEvent();
Object component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
if (component instanceof JTextComponent) provider = null; // Do not override text deletion
if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
// Do not override text deletion in speed search
if (component instanceof JComponent) {
SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent)component);
if (searchSupply != null) provider = null;
}
String activeSpeedSearchFilter = SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY.getData(dataContext);
if (!StringUtil.isEmpty(activeSpeedSearchFilter)) {
provider = null;
}
}
}
if (provider instanceof TitledHandler) {
presentation.setText(((TitledHandler)provider).getActionTitle());
}
final boolean canDelete = provider != null && provider.canDeleteElement(dataContext);
if (ActionPlaces.isPopupPlace(event.getPlace())) {
presentation.setVisible(canDelete);
}
else {
presentation.setEnabled(canDelete);
}
}
示例10: editCellAt
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
@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;
}
示例11: update
import com.intellij.ui.speedSearch.SpeedSearchSupply; //导入方法依赖的package包/类
public void update(AnActionEvent event){
String place = event.getPlace();
Presentation presentation = event.getPresentation();
if (ActionPlaces.PROJECT_VIEW_POPUP.equals(place) || ActionPlaces.COMMANDER_POPUP.equals(place))
presentation.setText(IdeBundle.message("action.delete.ellipsis"));
else
presentation.setText(IdeBundle.message("action.delete"));
DataContext dataContext = event.getDataContext();
Project project = event.getData(CommonDataKeys.PROJECT);
if (project == null) {
presentation.setEnabled(false);
return;
}
DeleteProvider provider = getDeleteProvider(dataContext);
if (event.getInputEvent() instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent)event.getInputEvent();
Object component = event.getData(PlatformDataKeys.CONTEXT_COMPONENT);
if (component instanceof JTextComponent) provider = null; // Do not override text deletion
if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
// Do not override text deletion in speed search
if (component instanceof JComponent) {
SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent)component);
if (searchSupply != null) provider = null;
}
String activeSpeedSearchFilter = event.getData(SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY);
if (!StringUtil.isEmpty(activeSpeedSearchFilter)) {
provider = null;
}
}
}
if (provider instanceof TitledHandler) {
presentation.setText(((TitledHandler)provider).getActionTitle());
}
final boolean canDelete = provider != null && provider.canDeleteElement(dataContext);
if (ActionPlaces.isPopupPlace(event.getPlace())) {
presentation.setVisible(canDelete);
}
else {
presentation.setEnabled(canDelete);
}
}