1 11 12 package org.eclipse.ui.internal.menus; 13 14 import org.eclipse.core.commands.common.NotDefinedException; 15 import org.eclipse.jface.util.PropertyChangeEvent; 16 import org.eclipse.jface.util.Util; 17 18 41 public abstract class MenuContainer extends MenuElement { 42 43 47 public static final String PROPERTY_DYNAMIC = "DYNAMIC"; 49 53 protected IDynamicMenu dynamic; 54 55 62 protected MenuContainer(final String id) { 63 super(id); 64 } 65 66 75 public final IDynamicMenu getDynamic() throws NotDefinedException { 76 if (!isDefined()) { 77 throw new NotDefinedException( 78 "Cannot get the dynamic class from an undefined menu container"); } 80 81 return dynamic; 82 } 83 84 protected final void setDynamic(final IDynamicMenu dynamic) { 85 if (!Util.equals(this.dynamic, dynamic)) { 86 PropertyChangeEvent event = null; 87 if (isListenerAttached()) { 88 event = new PropertyChangeEvent(this, PROPERTY_DYNAMIC, 89 this.dynamic, dynamic); 90 } 91 this.dynamic = dynamic; 92 firePropertyChangeEvent(event); 93 } 94 } 95 } 96 | Popular Tags |