KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > actions > ActionContext


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.actions;
12
13 import org.eclipse.jface.viewers.ISelection;
14
15 /**
16  * An <code>ActionContext</code> represents the context used to determine
17  * which actions are added by an <code>ActionGroup</code>, and what their
18  * enabled state should be.
19  * <p>
20  * This class encapsulates a selection and an input element.
21  * Clients may subclass this class to add more information to the context.
22  * </p>
23  */

24 public class ActionContext {
25
26     /**
27      * The selection.
28      */

29     private ISelection selection;
30
31     /**
32      * The input element.
33      */

34     private Object JavaDoc input;
35
36     /**
37      * Creates a new action context with the given selection.
38      */

39     public ActionContext(ISelection selection) {
40         setSelection(selection);
41     }
42
43     /**
44      * Returns the selection.
45      */

46     public ISelection getSelection() {
47         return selection;
48     }
49
50     /**
51      * Sets the selection.
52      */

53     public void setSelection(ISelection selection) {
54         this.selection = selection;
55     }
56
57     /**
58      * Returns the input element.
59      */

60     public Object JavaDoc getInput() {
61         return input;
62     }
63
64     /**
65      * Sets the input element.
66      *
67      * @param input
68      */

69     public void setInput(Object JavaDoc input) {
70         this.input = input;
71     }
72 }
73
Popular Tags