blob: 8a32fc8c12095c641f9a6aedbdeaf19ee17ca8b7 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.internal.console;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsoleFactory;
public class ConsoleViewConsoleFactory implements IConsoleFactory {
int counter = 1;
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.console.IConsoleFactory#openConsole()
*/
public void openConsole() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
try {
String secondaryId = "Console View #" + counter; //$NON-NLS-1$
page.showView(IConsoleConstants.ID_CONSOLE_VIEW, secondaryId, 1);
counter++;
} catch (PartInitException e) {
ConsolePlugin.log(e);
}
}
}
}
}