KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > actions > variables > details > DetailPaneWordWrapAction


1 /*******************************************************************************
2  * Copyright (c) 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 package org.eclipse.debug.internal.ui.actions.variables.details;
12
13 import org.eclipse.debug.internal.ui.DebugUIPlugin;
14 import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
15 import org.eclipse.debug.internal.ui.actions.ActionMessages;
16 import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
17 import org.eclipse.jface.action.Action;
18 import org.eclipse.jface.action.IAction;
19 import org.eclipse.jface.text.ITextViewer;
20 import org.eclipse.ui.PlatformUI;
21
22 /**
23  * An check box action that allows the word wrap property to be set, determining if the detail pane
24  * should wrap text.
25  */

26 public class DetailPaneWordWrapAction extends Action {
27
28     ITextViewer fTextViewer;
29     
30     public DetailPaneWordWrapAction(ITextViewer textViewer) {
31         super(ActionMessages.DetailPaneWordWrapAction_0,IAction.AS_CHECK_BOX);
32         
33         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DETAIL_PANE_WORD_WRAP_ACTION);
34         
35         fTextViewer = textViewer;
36         setEnabled(true);
37         
38         boolean prefSetting = DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP);
39         fTextViewer.getTextWidget().setWordWrap(prefSetting);
40         setChecked(prefSetting);
41         
42
43     }
44         
45     /* (non-Javadoc)
46      * @see org.eclipse.jface.action.IAction#run()
47      */

48     public void run() {
49         fTextViewer.getTextWidget().setWordWrap(isChecked());
50         DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP,isChecked());
51         DebugUIPlugin.getDefault().savePluginPreferences();
52     }
53     
54 }
55
Popular Tags