1 11 package org.eclipse.debug.internal.ui.views.console; 12 13 14 import org.eclipse.debug.internal.ui.DebugPluginImages; 15 import org.eclipse.debug.internal.ui.DebugUIPlugin; 16 import org.eclipse.debug.internal.ui.IDebugHelpContextIds; 17 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; 18 import org.eclipse.debug.internal.ui.actions.ActionMessages; 19 import org.eclipse.debug.ui.IDebugUIConstants; 20 import org.eclipse.jface.action.Action; 21 import org.eclipse.jface.preference.IPreferenceStore; 22 import org.eclipse.jface.util.IPropertyChangeListener; 23 import org.eclipse.jface.util.PropertyChangeEvent; 24 import org.eclipse.ui.help.WorkbenchHelp; 25 26 29 public class ScrollLockAction extends Action implements IPropertyChangeListener { 30 31 private IPreferenceStore fStore = DebugUIPlugin.getDefault().getPreferenceStore(); 32 33 public ScrollLockAction() { 34 super(ActionMessages.getString("ScrollLockAction.Scroll_Lock_1")); setToolTipText(ActionMessages.getString("ScrollLockAction.Scroll_Lock_1")); setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_LOCK)); 37 setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_LOCK)); 38 setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_LOCK)); 39 WorkbenchHelp.setHelp( 40 this, 41 IDebugHelpContextIds.CONSOLE_SCROLL_LOCK_ACTION); 42 setChecked(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_CONSOLE_SCROLL_LOCK)); 43 fStore.addPropertyChangeListener(this); 44 } 45 46 49 public void run() { 50 fStore.setValue(IInternalDebugUIConstants.PREF_CONSOLE_SCROLL_LOCK, isChecked()); 51 } 52 53 public void dispose() { 54 fStore.removePropertyChangeListener(this); 55 } 56 57 60 public void propertyChange(PropertyChangeEvent event) { 61 if (event.getProperty().equals(IInternalDebugUIConstants.PREF_CONSOLE_SCROLL_LOCK)) { 62 setChecked(fStore.getBoolean(IInternalDebugUIConstants.PREF_CONSOLE_SCROLL_LOCK)); 63 } 64 65 } 66 } 67 68 | Popular Tags |