KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.views.memory;
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.jface.action.Action;
18 import org.eclipse.jface.preference.IPreferenceStore;
19 import org.eclipse.ui.help.WorkbenchHelp;
20
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 {
29     private static final String JavaDoc PREFIX = "SetColumnSizeDefaultAction."; //$NON-NLS-1$
30
private static final String JavaDoc LABEL = PREFIX + "Set_as_default"; //$NON-NLS-1$
31

32     private ITableMemoryViewTab fViewTab;
33     
34     public SetColumnSizeDefaultAction(ITableMemoryViewTab viewTab)
35     {
36         super (DebugUIMessages.getString(LABEL));
37         fViewTab = viewTab;
38         WorkbenchHelp.setHelp(this, IDebugUIConstants.PLUGIN_ID + ".SetColumnSizeDefaultAction_context"); //$NON-NLS-1$
39
}
40     
41     /* (non-Javadoc)
42      * @see org.eclipse.jface.action.IAction#run()
43      */

44     public void run()
45     {
46         int colSize = fViewTab.getColumnSize();
47         
48         IPreferenceStore prefStore = DebugUIPlugin.getDefault().getPreferenceStore();
49         prefStore.setValue(IDebugPreferenceConstants.PREF_COLUMN_SIZE, colSize);
50     }
51
52 }
53
Popular Tags