1 | /******************************************************************************* |
---|---|
2 | * Copyright (c) 2000, 2007 IBM Corporation and others. |
3 | * |
4 | * This program and the accompanying materials |
5 | * are made available under the terms of the Eclipse Public License 2.0 |
6 | * which accompanies this distribution, and is available at |
7 | * https://www.eclipse.org/legal/epl-2.0/ |
8 | * |
9 | * SPDX-License-Identifier: EPL-2.0 |
10 | * |
11 | * Contributors: |
12 | * IBM Corporation - initial API and implementation |
13 | *******************************************************************************/ |
14 | |
15 | package org.eclipse.jdt.astview.views; |
16 | |
17 | import java.util.Objects; |
18 | |
19 | import org.eclipse.swt.graphics.Image; |
20 | |
21 | |
22 | public class Error extends ExceptionAttribute { |
23 | |
24 | private final Object fParent; |
25 | private final String fLabel; |
26 | |
27 | public Error(Object parent, String label, Throwable thrownException) { |
28 | fParent= parent; |
29 | fLabel= label; |
30 | fException= thrownException; |
31 | } |
32 | |
33 | @Override |
34 | public Object[] getChildren() { |
35 | return EMPTY; |
36 | } |
37 | |
38 | @Override |
39 | public Image getImage() { |
40 | return null; |
41 | } |
42 | |
43 | @Override |
44 | public String getLabel() { |
45 | return fLabel; |
46 | } |
47 | |
48 | @Override |
49 | public Object getParent() { |
50 | return fParent; |
51 | } |
52 | |
53 | /* |
54 | * @see java.lang.Object#equals(java.lang.Object) |
55 | */ |
56 | @Override |
57 | public boolean equals(Object obj) { |
58 | if (this == obj) |
59 | return true; |
60 | if (obj == null || !obj.getClass().equals(getClass())) { |
61 | return false; |
62 | } |
63 | |
64 | Error other= (Error) obj; |
65 | if (!Objects.equals(fParent, other.fParent)) { |
66 | return false; |
67 | } |
68 | |
69 | if (!Objects.equals(fLabel, other.fLabel)) { |
70 | return false; |
71 | } |
72 | |
73 | return true; |
74 | } |
75 | |
76 | /* |
77 | * @see java.lang.Object#hashCode() |
78 | */ |
79 | @Override |
80 | public int hashCode() { |
81 | return (fParent != null ? fParent.hashCode() : 0) |
82 | + (fLabel != null ? fLabel.hashCode() : 0); |
83 | } |
84 | |
85 | } |
86 |
Members