01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.actions;
11:
12: import org.eclipse.jface.viewers.ISelection;
13:
14: /**
15: * An <code>ActionContext</code> represents the context used to determine
16: * which actions are added by an <code>ActionGroup</code>, and what their
17: * enabled state should be.
18: * <p>
19: * This class encapsulates a selection and an input element.
20: * Clients may subclass this class to add more information to the context.
21: * </p>
22: */
23: public class ActionContext {
24:
25: /**
26: * The selection.
27: */
28: private ISelection selection;
29:
30: /**
31: * The input element.
32: */
33: private Object input;
34:
35: /**
36: * Creates a new action context with the given selection.
37: */
38: public ActionContext(ISelection selection) {
39: setSelection(selection);
40: }
41:
42: /**
43: * Returns the selection.
44: */
45: public ISelection getSelection() {
46: return selection;
47: }
48:
49: /**
50: * Sets the selection.
51: */
52: public void setSelection(ISelection selection) {
53: this .selection = selection;
54: }
55:
56: /**
57: * Returns the input element.
58: */
59: public Object getInput() {
60: return input;
61: }
62:
63: /**
64: * Sets the input element.
65: *
66: * @param input
67: */
68: public void setInput(Object input) {
69: this.input = input;
70: }
71: }
|