Package tool.action.cdf

Source Code of tool.action.cdf.ClassActionProvider

package tool.action.cdf;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.navigator.CommonActionProvider;
import org.eclipse.ui.navigator.ICommonActionConstants;
import org.eclipse.ui.navigator.ICommonActionExtensionSite;
import org.eclipse.ui.navigator.ICommonMenuConstants;
import org.eclipse.ui.navigator.ICommonViewerSite;
import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;

public class ClassActionProvider extends CommonActionProvider {
 
  private OpenClassComponentAction openAction;

  /**
   * Construct Property Action provider.
   */
  public ClassActionProvider() {    
  }
 
  /* (non-Javadoc)
   * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite)
   */
  public void init(ICommonActionExtensionSite aSite) {
 
    ICommonViewerSite viewSite = aSite.getViewSite();
    if(viewSite instanceof ICommonViewerWorkbenchSite) {
      ICommonViewerWorkbenchSite workbenchSite =
        (ICommonViewerWorkbenchSite) viewSite;
      openAction =
        new OpenClassComponentAction(workbenchSite.getPage(),
                    workbenchSite.getSelectionProvider());
    }
  } 

  /* (non-Javadoc)
   * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
   */
  public void fillActionBars(IActionBars actionBars) {
    /* Set up the property open action when enabled. */
    if(openAction.isEnabled())
      actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openAction);
  }
 
  /* (non-Javadoc)
   * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
   */
  public void fillContextMenu(IMenuManager menu) {
    if(openAction.isEnabled())
      menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, openAction);   
  }
 
 
}
TOP

Related Classes of tool.action.cdf.ClassActionProvider

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.