/******************************************************************************* * 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 net.sourceforge.c4jplugin.internal.ui.contracthierarchy.actions; import net.sourceforge.c4jplugin.internal.ui.contracthierarchy.ContractHierarchyMessages; import net.sourceforge.c4jplugin.internal.ui.contracthierarchy.ContractHierarchyViewPart; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jface.action.Action; import org.eclipse.ui.PlatformUI; /** * This action toggles whether the type hierarchy links its selection to the active * editor. * * @since 2.1 */ public class ToggleLinkingAction extends Action { private ContractHierarchyViewPart fHierarchyViewPart; public ToggleLinkingAction() { super(ContractHierarchyMessages.ToggleLinkingAction_label); setDescription(ContractHierarchyMessages.ToggleLinkingAction_description); setToolTipText(ContractHierarchyMessages.ToggleLinkingAction_tooltip); JavaPluginImages.setLocalImageDescriptors(this, "synced.gif"); //$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.LINK_EDITOR_ACTION); } /** * Constructs a new action. */ public ToggleLinkingAction(ContractHierarchyViewPart part) { setChecked(part.isLinkingEnabled()); fHierarchyViewPart= part; } /** * Runs the action. */ public void run() { fHierarchyViewPart.setLinkingEnabled(isChecked()); } }