1/*******************************************************************************
2 * Copyright (c) 2011 Google, Inc.
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 *    Google, Inc. - initial API and implementation
10 *******************************************************************************/
11package org.eclipse.wb.internal.core.utils.binding.editors.controls;
12
13import org.eclipse.core.commands.AbstractHandler;
14import org.eclipse.core.commands.ExecutionEvent;
15import org.eclipse.core.commands.ExecutionException;
16import org.eclipse.core.commands.IHandler;
17import org.eclipse.swt.widgets.Control;
18import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
19
20/**
21 * Default manager for installing/unistalling global handlers for {@link Control} actions commands.
22 *
23 * @author sablin_aa
24 */
25public class DefaultControlActionsManager extends AbstractControlActionsManager {
26  ////////////////////////////////////////////////////////////////////////////
27  //
28  // Constructor
29  //
30  ////////////////////////////////////////////////////////////////////////////
31  public DefaultControlActionsManager(final Control control) {
32    super(control);
33  }
34
35  ////////////////////////////////////////////////////////////////////////////
36  //
37  // Handlers
38  //
39  ////////////////////////////////////////////////////////////////////////////
40  @Override
41  protected IHandler getHandlerFor(String actionName) {
42    if (actionName.equalsIgnoreCase(IWorkbenchActionDefinitionIds.SELECT_ALL)) {
43      return SELECTALL_HANDLER;
44    }
45    return super.getHandlerFor(actionName);
46  }
47
48  /**
49   * Handler for process "Select all" action.
50   */
51  private final IHandler SELECTALL_HANDLER = new AbstractHandler() {
52    public Object execute(ExecutionEvent event) throws ExecutionException {
53      selectAllExecuted();
54      return null;
55    }
56
57    @Override
58    public boolean isEnabled() {
59      return true;
60    }
61
62    @Override
63    public boolean isHandled() {
64      return true;
65    }
66  };
67
68  protected void selectAllExecuted() {
69  }
70}
71