blob: 8257391a3eb92b38ddec4736e37959b04e4921df [file] [log] [blame]
/*********************************************************************
* Copyright (c) 2011, 2019 SAP SE
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* Felix Velasco (mwenz) - Bug 323351 - Enable to suppress/reactivate the speed buttons
* Bug 336488 - DiagramEditor API
* pjpaulin - Bug 352120 - Now uses IDiagramContainerUI interface
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
package org.eclipse.graphiti.ui.internal.action;
import org.eclipse.graphiti.ui.editor.DiagramBehavior;
import org.eclipse.graphiti.ui.internal.Messages;
import org.eclipse.graphiti.ui.internal.contextbuttons.IContextButtonManager;
import org.eclipse.jface.action.Action;
/**
* @noinstantiate This class is not intended to be instantiated by clients.
* @noextend This class is not intended to be subclassed by clients.
*/
public class ToggleContextButtonPadAction extends Action {
private DiagramBehavior diagramBehavior;
public static final String TOOL_TIP = Messages.ToggleContextButtonPadAction_0_xmsg;
public static final String TEXT = Messages.ToggleContextButtonPadAction_1_xfld;
public static final String ACTION_ID = "toggle_context_button_pad"; //$NON-NLS-1$
public ToggleContextButtonPadAction(DiagramBehavior diagramBehavior) {
super();
this.diagramBehavior = diagramBehavior;
setText(TEXT);
setToolTipText(TOOL_TIP);
setId(ACTION_ID);
}
@Override
public void run() {
IContextButtonManager contextButtonManager = (IContextButtonManager) diagramBehavior
.getAdapter(IContextButtonManager.class);
contextButtonManager.setContextButtonShowing(!isChecked());
}
}