/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
package com.intellij.debugger.actions;
+import com.intellij.icons.AllIcons;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiLambdaExpression;
+import com.intellij.psi.PsiSubstitutor;
+import com.intellij.psi.util.PsiFormatUtil;
import com.intellij.util.Range;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import javax.swing.*;
+
/**
* @author Eugene Zhuravlev
* Date: 10/25/13
return myOrdinal;
}
+ @Nullable
+ @Override
+ public Icon getIcon() {
+ return AllIcons.Nodes.Function;
+ }
+
+ @NotNull
+ @Override
+ public String getPresentation() {
+ String typeText = PsiFormatUtil.formatType(myLambda.getType(), 0, PsiSubstitutor.EMPTY);
+ String label = getLabel();
+ return label != null ? label + typeText : typeText;
+ }
+
public boolean equals(Object o) {
if (this == o) {
return true;
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiSubstitutor;
+import com.intellij.psi.util.PsiFormatUtil;
+import com.intellij.psi.util.PsiFormatUtilBase;
import com.intellij.util.Range;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import javax.swing.*;
+
/**
* @author Eugene Zhuravlev
* Date: 10/25/13
return myMethod;
}
+ @Override
+ public Icon getIcon() {
+ return myMethod.getIcon(0);
+ }
+
+ @NotNull
+ @Override
+ public String getPresentation() {
+ String label = getLabel();
+ String formatted = PsiFormatUtil.formatMethod(
+ myMethod,
+ PsiSubstitutor.EMPTY,
+ PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS,
+ PsiFormatUtilBase.SHOW_TYPE,
+ 999
+ );
+ return label != null? label + formatted : formatted;
+ }
+
public boolean equals(Object o) {
if (this == o) {
return true;
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import com.intellij.codeInsight.unwrap.ScopeHighlighter;
import com.intellij.debugger.DebuggerBundle;
-import com.intellij.icons.AllIcons;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.ui.popup.*;
-import com.intellij.psi.PsiLambdaExpression;
-import com.intellij.psi.PsiMethod;
-import com.intellij.psi.PsiSubstitutor;
-import com.intellij.psi.util.PsiFormatUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
return true;
}
- public Icon getIconFor(SmartStepTarget aValue) {
- if (aValue instanceof MethodSmartStepTarget) {
- return ((MethodSmartStepTarget)aValue).getMethod().getIcon(0);
- }
- if (aValue instanceof LambdaSmartStepTarget) {
- return AllIcons.Nodes.Function;
- }
- return null;
+ public Icon getIconFor(SmartStepTarget avalue) {
+ return avalue.getIcon();
}
@NotNull
- public String getTextFor(SmartStepTarget value) {
- final String label = value.getLabel();
- final String formatted;
- if (value instanceof MethodSmartStepTarget) {
- final PsiMethod method = ((MethodSmartStepTarget)value).getMethod();
- formatted = PsiFormatUtil.formatMethod(
- method,
- PsiSubstitutor.EMPTY,
- PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS,
- PsiFormatUtil.SHOW_TYPE,
- 999
- );
- }
- else if (value instanceof LambdaSmartStepTarget){
- final PsiLambdaExpression lambda = ((LambdaSmartStepTarget)value).getLambda();
- formatted = PsiFormatUtil.formatType(lambda.getType(), 0, PsiSubstitutor.EMPTY);
- }
- else {
- formatted = "";
- }
- return label != null? label + formatted : formatted;
+ public String getTextFor(SmartStepTarget value) {
+ return value.getPresentation();
}
public ListSeparator getSeparatorAbove(SmartStepTarget value) {
return false;
}
- public MnemonicNavigationFilter getMnemonicNavigationFilter() {
+ public MnemonicNavigationFilter<SmartStepTarget> getMnemonicNavigationFilter() {
return null;
}
return false;
}
- public SpeedSearchFilter getSpeedSearchFilter() {
+ public SpeedSearchFilter<SmartStepTarget> getSpeedSearchFilter() {
return null;
}
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
package com.intellij.debugger.actions;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.util.Range;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import javax.swing.*;
+
/**
* @author Eugene Zhuravlev
* Date: 10/25/13
public void setCallingExpressionLines(Range<Integer> expressionLines) {
myExpressionLines = expressionLines;
}
+
+ @Nullable
+ public Icon getIcon() {
+ return null;
+ }
+
+ @NotNull
+ public String getPresentation() {
+ return StringUtil.notNullize(getLabel());
+ }
}