KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > ToggleLinkWithEditorAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.pde.internal.ui.editor;
13
14 import org.eclipse.jface.action.Action;
15 import org.eclipse.pde.internal.ui.PDEPlugin;
16 import org.eclipse.pde.internal.ui.PDEPluginImages;
17 import org.eclipse.pde.internal.ui.PDEUIMessages;
18
19 /**
20  * This action toggles whether the Outline page links its selection to the
21  * active editor.
22  *
23  * @since 3.0
24  */

25 public class ToggleLinkWithEditorAction extends Action {
26
27     PDEFormEditor fEditor;
28
29     public ToggleLinkWithEditorAction(PDEFormEditor editor) {
30         super(PDEUIMessages.ToggleLinkWithEditorAction_label);
31         boolean isLinkingEnabled = PDEPlugin.getDefault().getPreferenceStore()
32                 .getBoolean("ToggleLinkWithEditorAction.isChecked"); //$NON-NLS-1$
33
setChecked(isLinkingEnabled);
34         fEditor = editor;
35         setToolTipText(PDEUIMessages.ToggleLinkWithEditorAction_toolTip);
36         setDescription(PDEUIMessages.ToggleLinkWithEditorAction_description);
37         setImageDescriptor(PDEPluginImages.DESC_LINK_WITH_EDITOR);
38         setDisabledImageDescriptor(PDEPluginImages.DESC_LINK_WITH_EDITOR_DISABLED);
39     }
40
41     public void run() {
42         PDEPlugin.getDefault().getPreferenceStore().setValue(
43                 "ToggleLinkWithEditorAction.isChecked", isChecked()); //$NON-NLS-1$
44
if (isChecked())
45             fEditor.synchronizeOutlinePage();
46     }
47 }
48
Popular Tags