Home | History | Annotate | Download | only in controls
      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  *******************************************************************************/
     11 package org.eclipse.wb.internal.core.utils.binding.editors.controls;
     12 
     13 import org.eclipse.core.commands.AbstractHandler;
     14 import org.eclipse.core.commands.ExecutionEvent;
     15 import org.eclipse.core.commands.ExecutionException;
     16 import org.eclipse.core.commands.IHandler;
     17 import org.eclipse.swt.widgets.Control;
     18 import 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  */
     25 public 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