comparison org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/MenuUpdater.d @ 85:6be48cf9f95c

Work on databinding
author Frank Benoit <benoit@tionex.de>
date Sat, 18 Apr 2009 13:54:50 +0200
parents 0a55d2d5a946
children
comparison
equal deleted inserted replaced
84:fcf926c91ca4 85:6be48cf9f95c
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/ 10 *******************************************************************************/
11 module org.eclipse.jface.internal.databinding.provisional.swt.MenuUpdater; 11 module org.eclipse.jface.internal.databinding.provisional.swt.MenuUpdater;
12 import org.eclipse.jface.internal.databinding.provisional.swt.SWTUtil;
12 13
13 import java.lang.all; 14 import java.lang.all;
14 15
15 import org.eclipse.core.databinding.observable.ChangeEvent; 16 import org.eclipse.core.databinding.observable.ChangeEvent;
16 import org.eclipse.core.databinding.observable.IChangeListener; 17 import org.eclipse.core.databinding.observable.IChangeListener;
86 updateIfNecessary(); 87 updateIfNecessary();
87 } 88 }
88 89
89 } 90 }
90 91
91 private Runnable updateRunnable = new class() Runnable { 92 private Runnable updateRunnable;
93 class UpdateRunnable : Runnable {
92 public void run() { 94 public void run() {
93 updateMenu(); 95 updateMenu();
94 } 96 }
95 }; 97 };
96 98
97 private PrivateInterface privateInterface = new PrivateInterface(); 99 private PrivateInterface privateInterface;
98 private Menu theMenu; 100 private Menu theMenu;
99 private IObservable[] dependencies = new IObservable[0]; 101 private IObservable[] dependencies;
100 private bool dirty = false; 102 private bool dirty = false;
101 103
102 /** 104 /**
103 * Creates an updator for the given menu. 105 * Creates an updator for the given menu.
104 * 106 *
105 * @param toUpdate menu to update 107 * @param toUpdate menu to update
106 */ 108 */
107 public this(Menu toUpdate) { 109 public this(Menu toUpdate) {
110 updateRunnable = new UpdateRunnable();
111 privateInterface = new PrivateInterface();
108 theMenu = toUpdate; 112 theMenu = toUpdate;
109 113
110 theMenu.addDisposeListener(privateInterface); 114 theMenu.addDisposeListener(privateInterface);
111 theMenu.addMenuListener(privateInterface); 115 theMenu.addMenuListener(privateInterface);
112 makeDirty(); 116 makeDirty();