1 11 12 package org.eclipse.ant.internal.ui.editor.outline; 13 14 import org.eclipse.ant.internal.ui.AntUIImages; 15 import org.eclipse.ant.internal.ui.AntUIPlugin; 16 import org.eclipse.ant.internal.ui.IAntUIConstants; 17 import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants; 18 import org.eclipse.ant.internal.ui.editor.AntEditor; 19 import org.eclipse.jface.action.Action; 20 21 27 public class ToggleLinkWithEditorAction extends Action { 28 29 AntEditor fEditor; 30 31 public ToggleLinkWithEditorAction(AntEditor editor) { 32 super(AntOutlineMessages.ToggleLinkWithEditorAction_0); 33 boolean isLinkingEnabled = AntUIPlugin.getDefault().getPreferenceStore().getBoolean(IAntUIPreferenceConstants.OUTLINE_LINK_WITH_EDITOR); 34 setChecked(isLinkingEnabled); 35 fEditor = editor; 36 setToolTipText(AntOutlineMessages.ToggleLinkWithEditorAction_1); 37 setDescription(AntOutlineMessages.ToggleLinkWithEditorAction_2); 38 setImageDescriptor(AntUIImages.getImageDescriptor(IAntUIConstants.IMG_LINK_WITH_EDITOR)); 39 } 40 41 public void run() { 42 AntUIPlugin.getDefault().getPreferenceStore().setValue(IAntUIPreferenceConstants.OUTLINE_LINK_WITH_EDITOR, isChecked()); 43 if (isChecked()) 44 fEditor.synchronizeOutlinePage(false); 45 } 46 } 47 | Popular Tags |