blob: b7408bf4b39da30af803a5045bf0a9c64b59b32b [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004-2008 Istvan Rath and Daniel Varro
* 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:
* Istvan Rath - initial API and implementation
*******************************************************************************/
package org.eclipse.viatra2.frameworkgui.views.code;
import org.eclipse.jface.action.Action;
import org.eclipse.viatra2.frameworkgui.FrameworkGUIPlugin;
public class ToggleAction extends Action {
public ToggleAction(CodeBufferView v)
{
cbv=v;
setChecked(cbv.isBuffering);
this.setToolTipText("Toggle buffering");
this.setImageDescriptor(FrameworkGUIPlugin.getImageDescriptor("icons/buffer_on.png"));
this.setDisabledImageDescriptor(FrameworkGUIPlugin.getImageDescriptor("icons/buffer_off.png"));
}
CodeBufferView cbv;
@Override
public void run()
{
cbv.isBuffering = !cbv.isBuffering;
if (cbv.isBuffering)
{
setChecked(true);
setToolTipText("Output is buffered.");
}
else
{
setChecked(false);
setToolTipText("Output is NOT buffered");
}
cbv.getViewSite().getActionBars().getToolBarManager().update(true);
}
}