List of usage examples for com.intellij.openapi.actionSystem PlatformDataKeys PREDEFINED_TEXT
DataKey PREDEFINED_TEXT
To view the source code for com.intellij.openapi.actionSystem PlatformDataKeys PREDEFINED_TEXT.
Click Source Link
From source file:com.intellij.ide.actions.GotoActionBase.java
License:Apache License
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); }// ww w.j ava2 s . c o m 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); }
From source file:com.intellij.xdebugger.impl.ui.tree.XDebuggerTree.java
License:Apache License
@Override @Nullable//from ww w .j a v a2 s . c om public Object getData(@NonNls final String dataId) { if (XDEBUGGER_TREE_KEY.is(dataId)) { return this; } if (PlatformDataKeys.PREDEFINED_TEXT.is(dataId)) { XValueNodeImpl[] selectedNodes = getSelectedNodes(XValueNodeImpl.class, null); if (selectedNodes.length == 1 && selectedNodes[0].getFullValueEvaluator() == null) { return DebuggerUIUtil.getNodeRawValue(selectedNodes[0]); } } return null; }
From source file:io.flutter.inspector.InspectorTree.java
License:Open Source License
@Nullable @Override// w ww.j a v a2 s . co m public Object getData(String dataId) { if (InspectorTree.INSPECTOR_KEY.is(dataId)) { return this; } if (PlatformDataKeys.PREDEFINED_TEXT.is(dataId)) { final XValueNodeImpl[] selectedNodes = getSelectedNodes(XValueNodeImpl.class, null); if (selectedNodes.length == 1 && selectedNodes[0].getFullValueEvaluator() == null) { return DebuggerUIUtil.getNodeRawValue(selectedNodes[0]); } } return null; }