KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > commands > ElementReference


1 /*******************************************************************************
2  * Copyright (c) 2007 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
12 package org.eclipse.ui.internal.commands;
13
14 import java.util.HashMap JavaDoc;
15 import java.util.Map JavaDoc;
16
17 import org.eclipse.ui.commands.IElementReference;
18 import org.eclipse.ui.menus.UIElement;
19
20 /**
21  * Our element reference that is used during element
22  * registration/unregistration.
23  *
24  * @since 3.3
25  */

26 public class ElementReference implements IElementReference {
27
28     private String JavaDoc commandId;
29     private UIElement element;
30     private HashMap JavaDoc parameters;
31
32     /**
33      * Construct the reference.
34      *
35      * @param id
36      * command id. Must not be <code>null</code>.
37      * @param adapt
38      * the element. Must not be <code>null</code>.
39      * @param parms.
40      * parameters used for filtering. Must not be <code>null</code>.
41      */

42     public ElementReference(String JavaDoc id, UIElement adapt, Map JavaDoc parms) {
43         commandId = id;
44         element = adapt;
45         if (parms == null) {
46             parameters = new HashMap JavaDoc();
47         } else {
48             parameters = new HashMap JavaDoc(parms);
49         }
50     }
51
52     /*
53      * (non-Javadoc)
54      *
55      * @see org.eclipse.ui.commands.IElementReference#getElement()
56      */

57     public UIElement getElement() {
58         return element;
59     }
60
61     /* (non-Javadoc)
62      * @see org.eclipse.ui.commands.IElementReference#getCommandId()
63      */

64     public String JavaDoc getCommandId() {
65         return commandId;
66     }
67
68     /* (non-Javadoc)
69      * @see org.eclipse.ui.commands.IElementReference#getParameters()
70      */

71     public Map JavaDoc getParameters() {
72         return parameters;
73     }
74 }
75
Popular Tags