| //------------------------------------------------------------------------------ |
| // Copyright (c) 2005, 2006 IBM Corporation and others. |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v1.0 |
| // which accompanies this distribution, and is available at |
| // http://www.eclipse.org/legal/epl-v10.html |
| // |
| // Contributors: |
| // IBM Corporation - initial implementation |
| //------------------------------------------------------------------------------ |
| package org.eclipse.epf.rcp.actions; |
| |
| import org.eclipse.epf.rcp.RCPResources; |
| import org.eclipse.ui.ISharedImages; |
| import org.eclipse.ui.IWorkbenchWindow; |
| import org.eclipse.ui.actions.ActionFactory; |
| import org.eclipse.ui.actions.RetargetAction; |
| |
| /** |
| * |
| * @author Bingxue Xu |
| * @since 1.0 |
| */ |
| |
| public abstract class TNGActionFactory extends ActionFactory { |
| |
| protected TNGActionFactory(String actionId) { |
| super(actionId); |
| } |
| |
| public static final ActionFactory TNG_INTRO = new ActionFactory("intro") { //$NON-NLS-1$ |
| public IWorkbenchAction create(IWorkbenchWindow window) { |
| if (window == null) { |
| throw new IllegalArgumentException(); |
| } |
| IWorkbenchAction action = new TNGIntroAction(window); |
| action.setId(getId()); |
| return action; |
| } |
| }; |
| |
| public static final ActionFactory OPEN_ELEMENT = new ActionFactory("edit") {//$NON-NLS-1$ |
| public IWorkbenchAction create(IWorkbenchWindow window) { |
| if (window == null) { |
| throw new IllegalArgumentException(); |
| } |
| RetargetAction action = new RetargetAction( |
| "TNGOpenElement", RCPResources.editMenuItem_text); |
| window.getPartService().addPartListener(action); |
| action.setActionDefinitionId("org.eclipse.epf.rcp.actions.openElement"); //$NON-NLS-1$ |
| ISharedImages sharedImages = window.getWorkbench() |
| .getSharedImages(); |
| action.setImageDescriptor(sharedImages |
| .getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); |
| action.setDisabledImageDescriptor(sharedImages |
| .getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); |
| |
| return action; |
| } |
| }; |
| } |