Skip to main content
summaryrefslogtreecommitdiffstats
blob: 0fd2f6f23c1e3061bc82224c55bed568f9773c40 (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
/*******************************************************************************
 *  Copyright (c) 2009, 2010 Wind River Systems 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:
 *      Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.dsf.debug.ui.viewmodel.expression;

import java.util.Arrays;
import java.util.Set;

import org.eclipse.debug.core.model.IExpression;

/**
 * Object representing a change in configured expressions.  This event is 
 * object is used when generating a model delta.
 */
public class ExpressionsChangedEvent {

    /**
     * Enumeration for the type of change in expressions. 
     * @since 2.2
     */
    public enum Type {ADDED, CHANGED, REMOVED, MOVED, INSERTED}

    private final Set<Object> fExpressionManagerElements;
    private final ExpressionsChangedEvent.Type fType;
    private final IExpression[] fExpressions;
    private final int fIndex;
    
    public ExpressionsChangedEvent(ExpressionsChangedEvent.Type type, Set<Object> expressionManagerElements, 
        IExpression[] expressions, int index) 
    {
        fExpressionManagerElements = expressionManagerElements;
        fType = type;
        fExpressions = expressions; 
        fIndex = index;
    }
    
    /**
     * The set of root elements of the expressions view model.
     */
    public Set<Object> getExpressionManagerElements() { return fExpressionManagerElements; }
    
    /**
     * Returns the type of change.
     */
    public ExpressionsChangedEvent.Type getType() { return fType; }
    
    /**
     * Returns expressions affected by the change.
     */
    public IExpression[] getExpressions() { return fExpressions; }
    
    /**
     * Returns index of the affected expression.
     */
    public int getIndex() { return fIndex; }
    
    @Override
    public String toString() {
        return Arrays.asList(fExpressions).toString() + " " + fType + "@" + fIndex; //$NON-NLS-1$ //$NON-NLS-2$
    }
}

Back to the top