01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.editor;
11:
12: import org.eclipse.jface.action.Action;
13: import org.eclipse.pde.internal.ui.PDEPlugin;
14: import org.eclipse.pde.internal.ui.PDEPluginImages;
15: import org.eclipse.pde.internal.ui.PDEUIMessages;
16:
17: /**
18: * This action toggles whether the Outline page links its selection to the
19: * active editor.
20: *
21: * @since 3.0
22: */
23: public class ToggleLinkWithEditorAction extends Action {
24:
25: PDEFormEditor fEditor;
26:
27: public ToggleLinkWithEditorAction(PDEFormEditor editor) {
28: super (PDEUIMessages.ToggleLinkWithEditorAction_label);
29: boolean isLinkingEnabled = PDEPlugin.getDefault()
30: .getPreferenceStore().getBoolean(
31: "ToggleLinkWithEditorAction.isChecked"); //$NON-NLS-1$
32: setChecked(isLinkingEnabled);
33: fEditor = editor;
34: setToolTipText(PDEUIMessages.ToggleLinkWithEditorAction_toolTip);
35: setDescription(PDEUIMessages.ToggleLinkWithEditorAction_description);
36: setImageDescriptor(PDEPluginImages.DESC_LINK_WITH_EDITOR);
37: setDisabledImageDescriptor(PDEPluginImages.DESC_LINK_WITH_EDITOR_DISABLED);
38: }
39:
40: public void run() {
41: PDEPlugin.getDefault().getPreferenceStore().setValue(
42: "ToggleLinkWithEditorAction.isChecked", isChecked()); //$NON-NLS-1$
43: if (isChecked())
44: fEditor.synchronizeOutlinePage();
45: }
46: }
|