本文整理汇总了Java中com.intellij.debugger.engine.evaluation.TextWithImports类的典型用法代码示例。如果您正苦于以下问题:Java TextWithImports类的具体用法?Java TextWithImports怎么用?Java TextWithImports使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextWithImports类属于com.intellij.debugger.engine.evaluation包,在下文中一共展示了TextWithImports类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createExpressionCodeFragment
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的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: createDescriptorByNode
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public void createDescriptorByNode(Object node, final ResultConsumer<Pair<NodeDescriptorImpl, String>> resultConsumer) {
if (node instanceof DebuggerTreeNodeImpl) {
final DebuggerTreeNodeImpl debuggerTreeNode = (DebuggerTreeNodeImpl)node;
final DebuggerContextImpl context = DebuggerManagerEx.getInstanceEx(myProject).getContext();
context.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(context) {
@Override
public void threadAction() {
try {
final TextWithImports evaluationText = DebuggerTreeNodeExpression.createEvaluationText(debuggerTreeNode, context);
resultConsumer.onSuccess(Pair.create(debuggerTreeNode.getDescriptor(), evaluationText.getText()));
}
catch (EvaluateException e) {
resultConsumer.onFailure(e);
}
}
});
}
}
示例3: createEvaluationText
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
public static TextWithImports createEvaluationText(final DebuggerTreeNodeImpl node, final DebuggerContextImpl context) throws EvaluateException {
final EvaluateException[] ex = new EvaluateException[] {null};
final TextWithImports textWithImports = PsiDocumentManager.getInstance(context.getProject()).commitAndRunReadAction(new Computable<TextWithImports>() {
public TextWithImports compute() {
try {
final PsiExpression expressionText = getEvaluationExpression(node, context);
if (expressionText != null) {
return new TextWithImportsImpl(expressionText);
}
}
catch (EvaluateException e) {
ex[0] = e;
}
return null;
}
});
if (ex[0] != null) {
throw ex[0];
}
return textWithImports;
}
示例4: getEditorText
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public TextWithImports getEditorText(PsiElement elementAtCaret) {
String result = null;
PsiElement element = findExpression(elementAtCaret);
if (element == null) return null;
if (element instanceof PsiVariable) {
result = qualifyEnumConstant(element, ((PsiVariable)element).getName());
}
else if (element instanceof PsiMethod) {
result = ((PsiMethod)element).getName() + "()";
}
else if (element instanceof PsiReferenceExpression) {
PsiReferenceExpression reference = (PsiReferenceExpression)element;
result = qualifyEnumConstant(reference.resolve(), element.getText());
}
else {
result = element.getText();
}
return result != null? new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, result) : null;
}
示例5: getEditorText
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public TextWithImports getEditorText(PsiElement elementAtCaret) {
String result = "";
PsiElement element = findExpressionInner(elementAtCaret, true);
if (element != null) {
if (element instanceof GrReferenceExpression) {
final GrReferenceExpression reference = (GrReferenceExpression)element;
if (reference.getQualifier() == null) {
final PsiElement resolved = reference.resolve();
if (resolved instanceof PsiEnumConstant) {
final PsiEnumConstant enumConstant = (PsiEnumConstant)resolved;
final PsiClass enumClass = enumConstant.getContainingClass();
if (enumClass != null) {
result = enumClass.getName() + "." + enumConstant.getName();
}
}
}
}
if (result.isEmpty()) {
result = element.getText();
}
}
return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, result);
}
示例6: setNodeAsRoot
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
protected void setNodeAsRoot(final Object node) {
if (node instanceof DebuggerTreeNodeImpl) {
myValueHint.shiftLocation();
final DebuggerTreeNodeImpl debuggerTreeNode = (DebuggerTreeNodeImpl)node;
final DebuggerContextImpl context = (DebuggerManagerEx.getInstanceEx(myValueHint.getProject())).getContext();
context.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(context) {
public void threadAction() {
try {
final NodeDescriptorImpl descriptor = debuggerTreeNode.getDescriptor();
final TextWithImports evaluationText = DebuggerTreeNodeExpression.createEvaluationText(debuggerTreeNode, context);
final String title = evaluationText.getText();
addToHistory(Pair.create(descriptor, title));
myTree.setInspectDescriptor(descriptor);
myValueHint.showTreePopup(myTree, context, title, ValueHintTreeComponent.this);
}
catch (final EvaluateException e1) {
LOG.debug(e1);
}
}
});
}
}
示例7: getEditorText
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public TextWithImports getEditorText(PsiElement elementAtCaret) {
String result = "";
PsiElement element = findExpressionInner(elementAtCaret, true);
if (element != null) {
if (element instanceof GrReferenceExpression) {
final GrReferenceExpression reference = (GrReferenceExpression)element;
if (reference.getQualifier() == null) {
final PsiElement resolved = reference.resolve();
if (resolved instanceof PsiEnumConstant) {
final PsiEnumConstant enumConstant = (PsiEnumConstant)resolved;
final PsiClass enumClass = enumConstant.getContainingClass();
if (enumClass != null) {
result = enumClass.getName() + "." + enumConstant.getName();
}
}
}
}
if (result.length() == 0) {
result = element.getText();
}
}
return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, result);
}
示例8: createExpressionCodeFragment
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的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);
}
}
示例9: readExternal
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public void readExternal(Element element) throws InvalidDataException
{
super.readExternal(element);
myChildren.clear();
myAppendDefaultChildren = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, APPEND_DEFAULT_NAME));
List<Element> children = element.getChildren(CHILDREN_EXPRESSION);
for(Element item : children)
{
String name = item.getAttributeValue(CHILD_NAME);
TextWithImports text = DebuggerUtils.getInstance().readTextWithImports(item.getChildren().get(0));
boolean onDemand = Boolean.parseBoolean(item.getAttributeValue(CHILD_ONDEMAND));
myChildren.add(new ChildInfo(name, text, onDemand));
}
}
示例10: readExternal
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
public void readExternal(Element element) throws InvalidDataException
{
super.readExternal(element);
DefaultJDOMExternalizer.readExternal(this, element);
TextWithImports childrenExpression = DebuggerUtils.getInstance().readTextWithImports(element, "CHILDREN_EXPRESSION");
if(childrenExpression != null)
{
setChildrenExpression(childrenExpression);
}
TextWithImports childrenExpandable = DebuggerUtils.getInstance().readTextWithImports(element, "CHILDREN_EXPANDABLE");
if(childrenExpandable != null)
{
myChildrenExpandable.setReferenceExpression(childrenExpandable);
}
}
示例11: cacheOrGet
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Nullable
static ExpressionEvaluator cacheOrGet(String propertyName,
EventRequest request,
PsiElement context,
TextWithImports text,
EvaluatingComputable<ExpressionEvaluator> supplier) throws EvaluateException
{
EvaluatorCache cache = (EvaluatorCache) request.getProperty(propertyName);
if(cache != null && Objects.equals(cache.myContext, context) && Objects.equals(cache.myTextWithImports, text))
{
return cache.myEvaluator;
}
ExpressionEvaluator evaluator = supplier.compute();
request.putProperty(propertyName, new EvaluatorCache(context, text, evaluator));
return evaluator;
}
示例12: createExpressionEvaluator
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
private static ExpressionEvaluator createExpressionEvaluator(Project project,
PsiElement contextPsiElement,
SourcePosition contextSourcePosition,
TextWithImports text,
Function<PsiElement, PsiCodeFragment> fragmentFactory) throws EvaluateException
{
try
{
return EvaluatorBuilderImpl.build(text, contextPsiElement, contextSourcePosition, project);
}
catch(UnsupportedExpressionException ex)
{
ExpressionEvaluator eval = CompilingEvaluatorImpl.create(project, contextPsiElement, fragmentFactory);
if(eval != null)
{
return eval;
}
throw ex;
}
}
示例13: getColumnClass
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@NotNull
@Override
public Class getColumnClass(int columnIndex)
{
switch(columnIndex)
{
case NAME_TABLE_COLUMN:
return String.class;
case EXPRESSION_TABLE_COLUMN:
return TextWithImports.class;
case ONDEMAND_TABLE_COLUMN:
return Boolean.class;
default:
return super.getColumnClass(columnIndex);
}
}
示例14: setValueAt
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
{
if(rowIndex >= getRowCount())
{
return;
}
final EnumerationChildrenRenderer.ChildInfo row = myData.get(rowIndex);
switch(columnIndex)
{
case NAME_TABLE_COLUMN:
row.myName = (String) aValue;
break;
case EXPRESSION_TABLE_COLUMN:
row.myExpression = (TextWithImports) aValue;
break;
case ONDEMAND_TABLE_COLUMN:
row.myOnDemand = (Boolean) aValue;
break;
}
}
示例15: readTextWithImports
import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
@SuppressWarnings({"HardCodedStringLiteral"})
public TextWithImports readTextWithImports(Element element)
{
LOG.assertTrue("TextWithImports".equals(element.getName()));
String text = element.getAttributeValue("text");
if("expression".equals(element.getAttributeValue("type")))
{
return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, text);
}
else
{
return new TextWithImportsImpl(CodeFragmentKind.CODE_BLOCK, text);
}
}