1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.ui.actions;
13 import org.eclipse.jface.action.IMenuManager;
14 import org.eclipse.jface.action.Separator;
16 import org.eclipse.ui.IViewPart;
17 import org.eclipse.ui.IWorkbenchWindow;
18 import org.eclipse.ui.actions.ActionGroup;
19 import org.eclipse.ui.actions.ExportResourcesAction;
20 import org.eclipse.ui.actions.ImportResourcesAction;
22 import org.eclipse.jdt.ui.IContextMenuConstants;
25 * Action group to add the Import and Export action to a view part's
29 * This class may be instantiated; it is not intended to be subclassed.
34 * @noextend This class is not intended to be subclassed by clients.
36 public class ImportActionGroup extends ActionGroup {
38 private static final String GROUP_IMPORT= "group.import"; //$NON-NLS-1$
40 private ImportResourcesAction fImportAction;
41 private ExportResourcesAction fExportAction;
44 * Creates a new <code>ImportActionGroup</code>. The group
45 * requires that the selection provided by the part's selection provider
46 * is of type <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
48 * @param part the view part that owns this action group
50 public ImportActionGroup(IViewPart part) {
51 IWorkbenchWindow workbenchWindow = part.getSite().getWorkbenchWindow();
52 fImportAction= new ImportResourcesAction(workbenchWindow);
53 fExportAction= new ExportResourcesAction(workbenchWindow);
57 * Method declared in ActionGroup
60 public void fillContextMenu(IMenuManager menu) {
61 menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, new Separator(GROUP_IMPORT));
62 menu.appendToGroup(GROUP_IMPORT, fImportAction);
63 menu.appendToGroup(GROUP_IMPORT, fExportAction);
64 super.fillContextMenu(menu);
71 public void dispose() {
72 fImportAction.dispose();
73 fExportAction.dispose();