|
Lines 54-59
Link Here
|
| 54 |
private boolean enableAccelerator = true; |
54 |
private boolean enableAccelerator = true; |
| 55 |
|
55 |
|
| 56 |
private IAction handler; |
56 |
private IAction handler; |
|
|
57 |
|
| 58 |
private IAction defaultHandler; |
| 57 |
|
59 |
|
| 58 |
private IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() { |
60 |
private IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() { |
| 59 |
public void propertyChange(PropertyChangeEvent event) { |
61 |
public void propertyChange(PropertyChangeEvent event) { |
|
Lines 230-237
Link Here
|
| 230 |
* Sets the action handler. |
232 |
* Sets the action handler. |
| 231 |
*/ |
233 |
*/ |
| 232 |
protected void setActionHandler(IAction newHandler) { |
234 |
protected void setActionHandler(IAction newHandler) { |
| 233 |
// Optimize. |
235 |
if (newHandler == null) |
| 234 |
if (newHandler == handler) |
236 |
newHandler = defaultHandler; |
|
|
237 |
// Optimize for the same handler |
| 238 |
// Don't optimize for default handler because it may need enablement update |
| 239 |
if (newHandler == handler && newHandler != defaultHandler) |
| 235 |
return; |
240 |
return; |
| 236 |
|
241 |
|
| 237 |
// Clear old action. |
242 |
// Clear old action. |
|
Lines 273-278
Link Here
|
| 273 |
handler.setChecked(checked); |
278 |
handler.setChecked(checked); |
| 274 |
} |
279 |
} |
| 275 |
|
280 |
|
|
|
281 |
/** |
| 282 |
* Sets the default handler for this retarget action. If a default |
| 283 |
* handler is supplied, it will be used whenever the part-specified |
| 284 |
* handler is <code>null</code> |
| 285 |
* @param action The default handler, or <code>null</code> to remove |
| 286 |
* the default handler |
| 287 |
* @since 3.1 |
| 288 |
*/ |
| 289 |
public void setDefaultHandler(IAction action) { |
| 290 |
this.defaultHandler = action; |
| 291 |
//update the handler if we don't have one |
| 292 |
if (handler == null) |
| 293 |
setActionHandler(action); |
| 294 |
} |
| 276 |
/** |
295 |
/** |
| 277 |
* The <code>RetargetAction</code> implementation of this method declared on |
296 |
* The <code>RetargetAction</code> implementation of this method declared on |
| 278 |
* <code>IAction</code> stores the help listener in a local field. The |
297 |
* <code>IAction</code> stores the help listener in a local field. The |