KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > common > ui > action > WorkbenchWindowActionDelegate


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: WorkbenchWindowActionDelegate.java,v 1.2 2005/06/08 06:24:33 nickb Exp $
16  */

17 package org.eclipse.emf.common.ui.action;
18
19 import org.eclipse.jface.action.IAction;
20 import org.eclipse.jface.viewers.ISelection;
21 import org.eclipse.ui.IWorkbenchWindow;
22 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
23
24 /**
25  * Simple implementation of {@link IWorkbenchWindowActionDelegate}.
26  */

27 public abstract class WorkbenchWindowActionDelegate implements IWorkbenchWindowActionDelegate
28 {
29   private IWorkbenchWindow window;
30   private ISelection selection;
31
32   /**
33    * @return the {@link IWorkbenchWindow} associated with this instance.
34    */

35   protected IWorkbenchWindow getWindow()
36   {
37     return window;
38   }
39
40   /**
41    * @return the {@link ISelection}.
42    */

43   protected ISelection getSelection()
44   {
45     return selection;
46   }
47
48   /* (non-Javadoc)
49    * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
50    */

51   public void init(IWorkbenchWindow window)
52   {
53     this.window = window;
54   }
55
56   /* (non-Javadoc)
57    * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
58    */

59   public void selectionChanged(IAction action, ISelection selection)
60   {
61     this.selection = selection;
62   }
63   
64   /* (non-Javadoc)
65    * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
66    */

67   public void dispose()
68   {
69     window = null;
70     selection = null;
71   }
72 }
73
Popular Tags