本文整理汇总了Java中com.intellij.xdebugger.XExpression类的典型用法代码示例。如果您正苦于以下问题:Java XExpression类的具体用法?Java XExpression怎么用?Java XExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XExpression类属于com.intellij.xdebugger包,在下文中一共展示了XExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createExpressionCodeFragment
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
@Override
protected PsiFile createExpressionCodeFragment(@NotNull Project project,
@NotNull XExpression expression,
@Nullable PsiElement context,
boolean isPhysical) {
TextWithImports text = TextWithImportsImpl.fromXExpression(expression);
if (text != null && context != null) {
CodeFragmentFactory factory = DebuggerUtilsEx.findAppropriateCodeFragmentFactory(text, context);
JavaCodeFragment codeFragment = factory.createPresentationCodeFragment(text, context, project);
codeFragment.forceResolveScope(GlobalSearchScope.allScope(project));
final PsiClass contextClass = PsiTreeUtil.getNonStrictParentOfType(context, PsiClass.class);
if (contextClass != null) {
final PsiClassType contextType =
JavaPsiFacade.getInstance(codeFragment.getProject()).getElementFactory().createType(contextClass);
codeFragment.setThisType(contextType);
}
return codeFragment;
}
else {
return super.createExpressionCodeFragment(project, expression, context, isPhysical);
}
}
示例2: getRecents
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
@Nullable
private List<TextWithImports> getRecents() {
final String recentsId = getRecentsId();
if (recentsId != null) {
final List<TextWithImports> result = new ArrayList<TextWithImports>();
List<XExpression> recents = XDebuggerHistoryManager.getInstance(getProject()).getRecentExpressions(getRecentsId());
for (XExpression expression : recents) {
if (expression.getExpression().indexOf('\n') == -1) {
result.add(TextWithImportsImpl.fromXExpression(expression));
}
}
return result;
}
return null;
}
示例3: createDocument
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
@NotNull
@Override
public Document createDocument(@NotNull Project project,
@NotNull XExpression expression,
@Nullable XSourcePosition sourcePosition,
@NotNull EvaluationMode mode) {
PsiElement context = null;
if (sourcePosition != null) {
context = getContextElement(sourcePosition.getFile(), sourcePosition.getOffset(), project);
}
PsiFile codeFragment = createExpressionCodeFragment(project, expression, context, true);
Document document = PsiDocumentManager.getInstance(project).getDocument(codeFragment);
assert document != null;
return document;
}
示例4: addRecentExpression
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
public boolean addRecentExpression(@NotNull @NonNls String id, @Nullable XExpression expression) {
if (XDebuggerUtilImpl.isEmptyExpression(expression)) {
return false;
}
LinkedList<XExpression> list = myRecentExpressions.get(id);
if (list == null) {
list = new LinkedList<XExpression>();
myRecentExpressions.put(id, list);
}
if (list.size() == MAX_RECENT_EXPRESSIONS) {
list.removeLast();
}
XExpression trimmedExpression = new XExpressionImpl(expression.getExpression().trim(), expression.getLanguage(), expression.getCustomInfo(), expression.getMode());
list.remove(trimmedExpression);
list.addFirst(trimmedExpression);
return true;
}
示例5: CodeFragmentInputComponent
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
public CodeFragmentInputComponent(final @NotNull Project project,
@NotNull XDebuggerEditorsProvider editorsProvider,
final @Nullable XSourcePosition sourcePosition,
@Nullable XExpression statements,
String splitterProportionKey,
Disposable parentDisposable) {
super(XDebuggerBundle.message("dialog.title.evaluate.code.fragment"));
myMultilineEditor = new XDebuggerExpressionEditor(project, editorsProvider, "evaluateCodeFragment", sourcePosition,
statements != null ? statements : XExpressionImpl.EMPTY_CODE_FRAGMENT, true);
myMainPanel = new JPanel(new BorderLayout());
JPanel editorPanel = new JPanel(new BorderLayout());
editorPanel.add(myMultilineEditor.getComponent(), BorderLayout.CENTER);
DefaultActionGroup group = new DefaultActionGroup();
group.add(new HistoryNavigationAction(false, IdeActions.ACTION_PREVIOUS_OCCURENCE, parentDisposable));
group.add(new HistoryNavigationAction(true, IdeActions.ACTION_NEXT_OCCURENCE, parentDisposable));
editorPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false).getComponent(), BorderLayout.EAST);
//myMainPanel.add(new JLabel(XDebuggerBundle.message("xdebugger.label.text.code.fragment")), BorderLayout.NORTH);
myMainPanel.add(editorPanel, BorderLayout.CENTER);
if (statements != null) {
myMultilineEditor.setExpression(statements);
}
mySplitterProportionKey = splitterProportionKey;
}
示例6: showHistory
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
private void showHistory() {
List<XExpression> expressions = myExpressionEditor.getRecentExpressions();
if (!expressions.isEmpty()) {
ListPopupImpl popup = new ListPopupImpl(new BaseListPopupStep<XExpression>(null, expressions) {
@Override
public PopupStep onChosen(XExpression selectedValue, boolean finalChoice) {
myExpressionEditor.setExpression(selectedValue);
myExpressionEditor.requestFocusInEditor();
return FINAL_CHOICE;
}
}) {
@Override
protected ListCellRenderer getListElementRenderer() {
return new ColoredListCellRenderer<XExpression>() {
@Override
protected void customizeCellRenderer(JList list, XExpression value, int index, boolean selected, boolean hasFocus) {
append(value.getExpression());
}
};
}
};
popup.getList().setFont(EditorUtil.getEditorFont());
popup.showUnderneathOf(myExpressionEditor.getEditorComponent());
}
}
示例7: handle
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
@Override
protected void handle(final Project project, final String value, XDebuggerTree tree) {
if (tree == null) return;
List<? extends WatchNode> watchNodes = XWatchesTreeActionBase.getSelectedNodes(tree, WatchNode.class);
if (watchNodes.isEmpty()) {
CopyPasteManager.getInstance().setContents(new StringSelection(value));
}
else {
CopyPasteManager.getInstance().setContents(
new XWatchTransferable(value, ContainerUtil.map(watchNodes,
new Function<WatchNode, XExpression>() {
@Override
public XExpression fun(WatchNode node) {
return node.getExpression();
}
})));
}
}
示例8: addWatchExpression
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
public void addWatchExpression(final @Nullable XDebuggerEvaluator evaluator,
final @NotNull XExpression expression,
int index, final boolean navigateToWatchNode) {
WatchMessageNode message = evaluator != null ? WatchMessageNode.createEvaluatingNode(myTree, this, expression) : WatchMessageNode.createMessageNode(myTree, this, expression);
if (index == -1) {
myChildren.add(message);
index = myChildren.size() - 1;
}
else {
myChildren.add(index, message);
}
fireNodeInserted(index);
if (navigateToWatchNode) {
myTree.scrollPathToVisible(message.getPath());
}
if (evaluator != null) {
evaluator.evaluate(expression, new MyEvaluationCallback(message), null);
}
}
示例9: startComputingChildren
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
@Override
public void startComputingChildren() {
if (Registry.is("debugger.watches.in.variables")) {
XDebugSession session = XDebugView.getSession(getTree());
XDebuggerEvaluator evaluator = getValueContainer().getEvaluator();
if (session != null && evaluator != null) {
XDebugSessionData data = ((XDebugSessionImpl)session).getSessionData();
XExpression[] expressions = data.getWatchExpressions();
for (final XExpression expression : expressions) {
evaluator.evaluate(expression, new XDebuggerEvaluator.XEvaluationCallback() {
@Override
public void evaluated(@NotNull XValue result) {
addChildren(XValueChildrenList.singleton(expression.getExpression(), result), false);
}
@Override
public void errorOccurred(@NotNull String errorMessage) {
// do not add anything
}
}, getValueContainer().getSourcePosition());
}
}
}
super.startComputingChildren();
}
示例10: initEditor
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
private void initEditor() {
myEditor = new EditorComboBoxEditor(getProject(), getEditorsProvider().getFileType()) {
@Override
public void setItem(Object anObject) {
if (anObject == null) {
anObject = XExpressionImpl.EMPTY_EXPRESSION;
}
super.setItem(createDocument(((XExpression)anObject)));
}
@Override
protected void onEditorCreate(EditorEx editor) {
editor.putUserData(DebuggerCopyPastePreprocessor.REMOVE_NEWLINES_ON_PASTE, true);
editor.getColorsScheme().setEditorFontSize(myComboBox.getFont().getSize());
}
};
myEditor.getEditorComponent().setFontInheritedFromLAF(false);
myComboBox.setEditor(myEditor);
//myEditor.setItem(myExpression);
myComboBox.setRenderer(new EditorComboBoxRenderer(myEditor));
myComboBox.setMaximumRowCount(XDebuggerHistoryManager.MAX_RECENT_EXPRESSIONS);
}
示例11: createLanguagePopup
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
private ListPopup createLanguagePopup() {
DefaultActionGroup actions = new DefaultActionGroup();
for (final Language language : getEditorsProvider().getSupportedLanguages(myProject, mySourcePosition)) {
//noinspection ConstantConditions
actions.add(new AnAction(language.getDisplayName(), null, language.getAssociatedFileType().getIcon()) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
XExpression currentExpression = getExpression();
setExpression(new XExpressionImpl(currentExpression.getExpression(), language, currentExpression.getCustomInfo()));
requestFocusInEditor();
}
});
}
DataContext dataContext = DataManager.getInstance().getDataContext(getComponent());
return JBPopupFactory.getInstance().createActionGroupPopup("Choose language", actions, dataContext,
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
false);
}
示例12: saveProperties
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
@Override
void saveProperties() {
myBreakpoint.setLogMessage(myLogMessageCheckBox.isSelected());
if (myBreakpoint instanceof XLineBreakpoint) {
((XLineBreakpoint)myBreakpoint).setTemporary(myTemporaryCheckBox.isSelected());
}
if (myLogExpressionComboBox != null) {
XExpression expression = myLogExpressionComboBox.getExpression();
XExpression logExpression = !XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null;
myBreakpoint.setLogExpressionEnabled(logExpression == null || myLogExpressionCheckBox.isSelected());
myBreakpoint.setLogExpressionObject(logExpression);
myLogExpressionComboBox.saveTextInHistory();
}
}
示例13: saveProperties
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
public void saveProperties() {
for (XBreakpointPropertiesSubPanel<B> panel : mySubPanels) {
panel.saveProperties();
}
if (myConditionComboBox != null) {
XExpression expression = myConditionComboBox.getExpression();
XExpression condition = !XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null;
myBreakpoint.setConditionEnabled(condition == null || myConditionEnabledCheckbox.isSelected());
myBreakpoint.setConditionExpression(condition);
myConditionComboBox.saveTextInHistory();
}
for (XBreakpointCustomPropertiesPanel<B> customPanel : myCustomPanels) {
customPanel.saveTo(myBreakpoint);
}
myBreakpoint.setEnabled(myEnabledCheckbox.isSelected());
}
示例14: updateSessionData
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
public void updateSessionData() {
List<XExpression> watchExpressions = new ArrayList<XExpression>();
final List<? extends WatchNode> children = myRootNode.getAllChildren();
if (children != null) {
for (WatchNode child : children) {
watchExpressions.add(child.getExpression());
}
}
XDebugSession session = getSession(getTree());
XExpression[] expressions = watchExpressions.toArray(new XExpression[watchExpressions.size()]);
if (session != null) {
((XDebugSessionImpl)session).setWatchExpressions(expressions);
}
else {
XDebugSessionData data = getData(XDebugSessionData.DATA_KEY, getTree());
if (data != null) {
data.setWatchExpressions(expressions);
}
}
}
示例15: drop
import com.intellij.xdebugger.XExpression; //导入依赖的package包/类
@Override
public void drop(DnDEvent aEvent) {
Object object = aEvent.getAttachedObject();
if (object instanceof XValueNodeImpl[]) {
final XValueNodeImpl[] nodes = (XValueNodeImpl[])object;
for (XValueNodeImpl node : nodes) {
node.getValueContainer().calculateEvaluationExpression().done(new Consumer<XExpression>() {
@Override
public void consume(XExpression expression) {
if (expression != null) {
//noinspection ConstantConditions
addWatchExpression(expression, -1, false);
}
}
});
}
}
else if (object instanceof EventInfo) {
String text = ((EventInfo)object).getTextForFlavor(DataFlavor.stringFlavor);
if (text != null) {
//noinspection ConstantConditions
addWatchExpression(XExpressionImpl.fromText(text), -1, false);
}
}
}