KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2005, 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
12 package org.eclipse.debug.internal.ui.views.memory.renderings;
13
14 import org.eclipse.debug.internal.ui.DebugUIMessages;
15 import org.eclipse.debug.internal.ui.DebugUIPlugin;
16 import org.eclipse.debug.ui.IDebugUIConstants;
17 import org.eclipse.jface.action.Action;
18 import org.eclipse.ui.PlatformUI;
19
20 public class FormatTableRenderingAction extends Action {
21
22     private AbstractBaseTableRendering fRendering;
23     
24     int fColumnSize = -1;
25     int fRowSize = -1;
26     
27     public FormatTableRenderingAction(AbstractBaseTableRendering rendering)
28     {
29         fRendering = rendering;
30         setText(DebugUIMessages.FormatTableRenderingAction_16);
31         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".FormatTableRenderingAction_context"); //$NON-NLS-1$
32
}
33
34     public void run() {
35         FormatTableRenderingDialog dialog = new FormatTableRenderingDialog(fRendering, DebugUIPlugin.getShell());
36         dialog.open();
37         fColumnSize = dialog.getColumnSize();
38         fRowSize = dialog.getRowSize();
39         if (fColumnSize > 0 && fRowSize > 0)
40         {
41             int addressableSize = fRendering.getAddressableSize();
42             int columnSizeInBytes = addressableSize * fColumnSize;
43             int rowSizeInBytes = addressableSize * fRowSize;
44             fRendering.format(rowSizeInBytes, columnSizeInBytes);
45         }
46     }
47 }
48
Popular Tags