KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > memory > renderings > SetColumnSizeDefaultAction


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 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.views.memory.renderings;
12
13 import org.eclipse.debug.internal.ui.DebugUIMessages;
14 import org.eclipse.debug.internal.ui.DebugUIPlugin;
15 import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
16 import org.eclipse.debug.ui.IDebugUIConstants;
17 import org.eclipse.debug.ui.memory.AbstractTableRendering;
18 import org.eclipse.jface.action.Action;
19 import org.eclipse.jface.preference.IPreferenceStore;
20 import org.eclipse.ui.PlatformUI;
21
22 /**
23  * Set column size of current view tab as the default column size
24  *
25  * @since 3.0
26  */

27 public class SetColumnSizeDefaultAction extends Action {
28     private AbstractTableRendering fRendering;
29
30     public SetColumnSizeDefaultAction(AbstractTableRendering rendering) {
31         super(DebugUIMessages.SetColumnSizeDefaultAction_Set_as_default);
32         fRendering = rendering;
33         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".SetColumnSizeDefaultAction_context"); //$NON-NLS-1$
34
}
35
36     /*
37      * (non-Javadoc)
38      *
39      * @see org.eclipse.jface.action.IAction#run()
40      */

41     public void run() {
42         int numUnits = fRendering.getAddressableUnitPerColumn();
43
44         IPreferenceStore prefStore = DebugUIPlugin.getDefault().getPreferenceStore();
45         prefStore.setValue(IDebugPreferenceConstants.PREF_COLUMN_SIZE, numUnits);
46     }
47
48 }
49
Popular Tags