01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.examples.propertysheet;
11:
12: import org.eclipse.jface.action.IAction;
13: import org.eclipse.jface.dialogs.MessageDialog;
14: import org.eclipse.jface.viewers.ISelection;
15: import org.eclipse.ui.IObjectActionDelegate;
16: import org.eclipse.ui.IWorkbenchPart;
17:
18: /**
19: * Action delegate for handling popup menu actions.
20: */
21: public class PopupMenuActionDelegate implements IObjectActionDelegate {
22:
23: private IWorkbenchPart part;
24:
25: /** (non-Javadoc)
26: * Method declared on IDropActionDelegate
27: */
28: public void run(IAction action) {
29: MessageDialog.openInformation(this .part.getSite().getShell(),
30: MessageUtil.getString("Property_Sheet_Example"), //$NON-NLS-1$
31: MessageUtil.getString("Popup_Menu_Action_executed")); //$NON-NLS-1$
32: }
33:
34: /** (non-Javadoc)
35: * Method declared on IActionDelegate
36: */
37: public void selectionChanged(IAction action, ISelection selection) {
38: //Ignored for this example
39: }
40:
41: /** (non-Javadoc)
42: * Method declared on IObjectActionDelegate
43: */
44: public void setActivePart(IAction action, IWorkbenchPart targetPart) {
45: this.part = targetPart;
46: }
47: }
|