View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7    * You may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: ExitAction.java
13   * Created: 2007-00-00
14   * Author: cast
15   * $Id: ExitAction.java 2300 2009-01-12 17:24:04Z tmilos $
16   */
17  
18  package pl.edu.agh.cast.action;
19  
20  import org.eclipse.jface.action.IAction;
21  import org.eclipse.jface.viewers.ISelection;
22  import org.eclipse.ui.IWorkbenchWindow;
23  import org.eclipse.ui.IWorkbenchWindowActionDelegate;
24  
25  /**
26   * Action for exiting the workbench.
27   *
28   * @author AGH CAST Team
29   */
30  public class ExitAction implements IWorkbenchWindowActionDelegate {
31  
32  	private IWorkbenchWindow window;
33  
34  	/**
35  	 * {@inheritDoc}
36  	 *
37  	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
38  	 */
39  	public void dispose() {
40  		window = null;
41  	}
42  
43  	/**
44  	 * {@inheritDoc}
45  	 *
46  	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
47  	 */
48  	public void init(IWorkbenchWindow win) {
49  		this.window = win;
50  	}
51  
52  	/**
53  	 * {@inheritDoc}
54  	 *
55  	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
56  	 */
57  	public void run(IAction action) {
58  		window.getWorkbench().close();
59  	}
60  
61  	/**
62  	 * {@inheritDoc}
63  	 *
64  	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
65  	 *      org.eclipse.jface.viewers.ISelection)
66  	 */
67  	public void selectionChanged(IAction action, ISelection selection) {
68  	}
69  
70  }