KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > console > ShowConsoleAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.console;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.ui.console.IConsole;
15 import org.eclipse.ui.console.IConsoleView;
16
17 /**
18  * Shows a specific console in the console view
19  */

20 public class ShowConsoleAction extends Action {
21     
22     private IConsole fConsole;
23     private IConsoleView fView;
24
25     /* (non-Javadoc)
26      * @see org.eclipse.jface.action.IAction#run()
27      */

28     public void run() {
29         if (!fConsole.equals(fView.getConsole())) {
30             boolean pinned = fView.isPinned();
31             if (pinned) {
32                 fView.setPinned(false);
33             }
34             fView.display(fConsole);
35             if (pinned) {
36                fView.setPinned(true);
37             }
38         }
39     }
40
41     /**
42      * Constructs an action to display the given console.
43      *
44      * @param view the console view in which the given console is contained
45      * @param console the console
46      */

47     public ShowConsoleAction(IConsoleView view, IConsole console) {
48         super(console.getName(), AS_RADIO_BUTTON);
49         fConsole = console;
50         fView = view;
51         setImageDescriptor(console.getImageDescriptor());
52     }
53 }
54
Popular Tags