Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 7aafe1c40124a191bbfce6bd17fced9fbc85ddc7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*****************************************************************
 * Copyright (c) 2009, 2010 Texas Instruments and others
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 238956)
 *     Wind River Systems - ongoing enhancements and bug fixing
 *****************************************************************/
package org.eclipse.debug.internal.ui.elements.adapters;

import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;

/**
 * The default breakpoints view input populates the view with content
 * from the default breakpoint manager.
 *
 * @since 3.6
 */
public class DefaultBreakpointsViewInput {

	/**
	 * The presentation context of the breakpoints view.
	 */
	final private IPresentationContext fContext;

	/**
	 * Constructor.
	 *
	 * @param context the presentation context for this input
	 */
	public DefaultBreakpointsViewInput(IPresentationContext context) {
		fContext = context;
	}

	/**
	 * Returns the presentation context for this input.
	 *
	 * @return the presentation context
	 */
	public IPresentationContext getContext() {
		return fContext;
	}

	/*
     * (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
	public int hashCode() {
        if (getContext() != null) {
            return getContext().hashCode();
        } else {
            return 1;
        }
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
	public boolean equals(Object arg0) {
        if ( (arg0 != null) && arg0.getClass().equals(this.getClass()) ) {

            IPresentationContext context = ((DefaultBreakpointsViewInput) arg0).getContext();
            if (getContext() != null && context != null)
                return getContext().equals(context);
        }

        return super.equals(arg0);
    }

}

Back to the top