01: /*******************************************************************************
02: * Copyright (c) 2007 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.internal.commands;
11:
12: import java.util.HashMap;
13: import java.util.Map;
14:
15: import org.eclipse.ui.commands.IElementReference;
16: import org.eclipse.ui.menus.UIElement;
17:
18: /**
19: * Our element reference that is used during element
20: * registration/unregistration.
21: *
22: * @since 3.3
23: */
24: public class ElementReference implements IElementReference {
25:
26: private String commandId;
27: private UIElement element;
28: private HashMap parameters;
29:
30: /**
31: * Construct the reference.
32: *
33: * @param id
34: * command id. Must not be <code>null</code>.
35: * @param adapt
36: * the element. Must not be <code>null</code>.
37: * @param parms.
38: * parameters used for filtering. Must not be <code>null</code>.
39: */
40: public ElementReference(String id, UIElement adapt, Map parms) {
41: commandId = id;
42: element = adapt;
43: if (parms == null) {
44: parameters = new HashMap();
45: } else {
46: parameters = new HashMap(parms);
47: }
48: }
49:
50: /*
51: * (non-Javadoc)
52: *
53: * @see org.eclipse.ui.commands.IElementReference#getElement()
54: */
55: public UIElement getElement() {
56: return element;
57: }
58:
59: /* (non-Javadoc)
60: * @see org.eclipse.ui.commands.IElementReference#getCommandId()
61: */
62: public String getCommandId() {
63: return commandId;
64: }
65:
66: /* (non-Javadoc)
67: * @see org.eclipse.ui.commands.IElementReference#getParameters()
68: */
69: public Map getParameters() {
70: return parameters;
71: }
72: }
|