01: /*******************************************************************************
02: * Copyright (c) 2004, 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.internal.presentations;
11:
12: import org.eclipse.jface.action.ActionContributionItem;
13:
14: /**
15: * @since 3.0
16: */
17: public class UpdatingActionContributionItem extends
18: ActionContributionItem {
19:
20: /**
21: * @param action
22: */
23: public UpdatingActionContributionItem(ISelfUpdatingAction action) {
24: super (action);
25: }
26:
27: /* (non-Javadoc)
28: * @see org.eclipse.jface.action.IContributionItem#isVisible()
29: */
30: public boolean isVisible() {
31: ISelfUpdatingAction action = (ISelfUpdatingAction) getAction();
32: return super .isVisible() && action.shouldBeVisible();
33: }
34:
35: /* (non-Javadoc)
36: * @see org.eclipse.jface.action.IContributionItem#update(java.lang.String)
37: */
38: public void update(String propertyName) {
39: ISelfUpdatingAction action = (ISelfUpdatingAction) getAction();
40: action.update();
41:
42: super .update(propertyName);
43: }
44:
45: /* (non-Javadoc)
46: * @see org.eclipse.jface.action.IContributionItem#isDynamic()
47: */
48: public boolean isDynamic() {
49: return true;
50: }
51: }
|