2 * Copyright 2000-2015 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.debugger.actions;
18 import com.intellij.psi.PsiElement;
19 import com.intellij.psi.PsiLambdaExpression;
20 import com.intellij.psi.PsiSubstitutor;
21 import com.intellij.psi.util.PsiFormatUtil;
22 import com.intellij.util.Range;
23 import org.jetbrains.annotations.NotNull;
24 import org.jetbrains.annotations.Nullable;
29 * @author Eugene Zhuravlev
32 public class LambdaSmartStepTarget extends SmartStepTarget{
33 private final PsiLambdaExpression myLambda;
34 private final int myOrdinal;
36 public LambdaSmartStepTarget(@NotNull PsiLambdaExpression lambda, @Nullable String label, @Nullable PsiElement highlightElement, int ordinal, Range<Integer> lines) {
37 super(label, highlightElement, true, lines);
42 public PsiLambdaExpression getLambda() {
46 public int getOrdinal() {
52 public Icon getIcon() {
53 return myLambda.getIcon(0);
58 public String getPresentation() {
59 String typeText = PsiFormatUtil.formatType(myLambda.getType(), 0, PsiSubstitutor.EMPTY);
60 String label = getLabel();
61 return label != null ? label + typeText : typeText;
64 public boolean equals(Object o) {
68 if (o == null || getClass() != o.getClass()) {
72 final LambdaSmartStepTarget that = (LambdaSmartStepTarget)o;
74 if (myOrdinal != that.myOrdinal) {
77 if (!myLambda.equals(that.myLambda)) {
84 public int hashCode() {
85 int result = myLambda.hashCode();
86 result = 31 * result + myOrdinal;