/**
* This file is protected by Copyright.
* Please refer to the COPYRIGHT file distributed with this source distribution.
*
* This file is part of REDHAWK IDE.
*
* 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
*/
package gov.redhawk.logging.ui.eventconsole;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleManager;
/**
* Provides a stop action for the event console
*/
public class StopEventConsoleAction extends Action {
private IConsole console;
public StopEventConsoleAction(IConsole console) {
this.console = console;
setText(Messages.StopEventConsoleAction_0);
setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_STOP));
}
@Override
public void run() {
// Remove the console to trigger its disposal
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
consoleManager.removeConsoles(new IConsole[] { console });
}
}