1 11 package org.eclipse.jdt.internal.debug.ui.console; 12 13 import org.eclipse.jdt.internal.debug.ui.IJDIPreferencesConstants; 14 import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds; 15 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; 16 import org.eclipse.jdt.internal.debug.ui.JavaDebugImages; 17 import org.eclipse.jface.action.Action; 18 import org.eclipse.jface.preference.IPreferenceStore; 19 import org.eclipse.swt.SWT; 20 import org.eclipse.ui.PlatformUI; 21 22 public class AutoFormatSettingAction extends Action { 23 private JavaStackTraceConsolePage fPage; 24 private IPreferenceStore fPreferenceStore; 25 26 public AutoFormatSettingAction(JavaStackTraceConsolePage page) { 27 super(ConsoleMessages.AutoFormatSettingAction_0, SWT.TOGGLE); 28 fPage = page; 29 30 setToolTipText(ConsoleMessages.AutoFormatSettingAction_1); 31 setImageDescriptor(JavaDebugImages.getImageDescriptor(JavaDebugImages.IMG_ELCL_AUTO_FORMAT)); 32 setHoverImageDescriptor(JavaDebugImages.getImageDescriptor(JavaDebugImages.IMG_ELCL_AUTO_FORMAT)); 33 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaDebugHelpContextIds.CONSOLE_AUTOFORMAT_STACKTRACES_ACTION); 34 35 fPreferenceStore = JDIDebugUIPlugin.getDefault().getPreferenceStore(); 36 boolean checked = fPreferenceStore.getBoolean(IJDIPreferencesConstants.PREF_AUTO_FORMAT_JSTCONSOLE); 37 setChecked(checked); 38 } 39 40 public void run() { 41 boolean checked = isChecked(); 42 JavaStackTraceConsoleViewer viewer = (JavaStackTraceConsoleViewer) fPage.getViewer(); 43 viewer.setAutoFormat(checked); 44 fPreferenceStore.setValue(IJDIPreferencesConstants.PREF_AUTO_FORMAT_JSTCONSOLE, checked); 45 } 46 } 47 | Popular Tags |