KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.ui.IWorkbenchPage;
14 import org.eclipse.ui.IWorkbenchWindow;
15 import org.eclipse.ui.PartInitException;
16 import org.eclipse.ui.PlatformUI;
17 import org.eclipse.ui.console.ConsolePlugin;
18 import org.eclipse.ui.console.IConsoleConstants;
19 import org.eclipse.ui.console.IConsoleFactory;
20
21 public class ConsoleViewConsoleFactory implements IConsoleFactory {
22
23     int counter = 1;
24
25     /*
26      * (non-Javadoc)
27      *
28      * @see org.eclipse.ui.console.IConsoleFactory#openConsole()
29      */

30     public void openConsole() {
31         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
32         if (window != null) {
33             IWorkbenchPage page = window.getActivePage();
34             if (page != null) {
35                 try {
36                     String JavaDoc secondaryId = "Console View #" + counter; //$NON-NLS-1$
37
page.showView(IConsoleConstants.ID_CONSOLE_VIEW, secondaryId, 1);
38                     counter++;
39                 } catch (PartInitException e) {
40                     ConsolePlugin.log(e);
41                 }
42             }
43         }
44     }
45
46 }
47
Popular Tags