KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > commands > actions > UpdateActionsRequest


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.commands.actions;
12
13 import org.eclipse.debug.core.commands.IEnabledStateRequest;
14 import org.eclipse.debug.internal.core.commands.DebugCommandRequest;
15 import org.eclipse.jface.action.IAction;
16
17 /**
18  * Boolean collector that collects boolean results from a number of voters.
19  * Request is cancelled when one voter votes false.
20  *
21  * @since 3.3
22  *
23  */

24 public class UpdateActionsRequest extends DebugCommandRequest implements IEnabledStateRequest {
25     
26     private IAction[] fActions;
27     private boolean fEnabled = false;
28     
29     public UpdateActionsRequest(Object JavaDoc[] elements, IAction[] actions) {
30         super(elements);
31         fActions = actions;
32     }
33
34     /* (non-Javadoc)
35      * @see org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor#setResult(boolean)
36      */

37     public synchronized void setEnabled(boolean result) {
38         fEnabled = result;
39     }
40
41     /* (non-Javadoc)
42      * @see org.eclipse.core.runtime.IProgressMonitor#done()
43      */

44     public synchronized void done() {
45         for (int i = 0; i < fActions.length; i++) {
46             fActions[i].setEnabled(fEnabled);
47         }
48     }
49
50 }
51
Popular Tags