Skip to main content
summaryrefslogtreecommitdiffstats
blob: 541e8d8a04aa5d52a1fbdd5d4736c93ba4834ecd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************************************
 * Copyright (c) 2005, 2006 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.debug.internal.ui.views.memory.renderings;

import org.eclipse.debug.internal.ui.DebugUIMessages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.PlatformUI;

public class FormatTableRenderingAction extends Action {

	private AbstractBaseTableRendering fRendering;

	int fColumnSize = -1;
	int fRowSize = -1;

	public FormatTableRenderingAction(AbstractBaseTableRendering rendering)
	{
		fRendering = rendering;
		setText(DebugUIMessages.FormatTableRenderingAction_16);
		PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".FormatTableRenderingAction_context"); //$NON-NLS-1$
	}

	@Override
	public void run() {
		FormatTableRenderingDialog dialog = new FormatTableRenderingDialog(fRendering, DebugUIPlugin.getShell());
		dialog.open();
		fColumnSize = dialog.getColumnSize();
		fRowSize = dialog.getRowSize();
		if (fColumnSize > 0 && fRowSize > 0)
		{
			int addressableSize = fRendering.getAddressableSize();
			int columnSizeInBytes = addressableSize * fColumnSize;
			int rowSizeInBytes = addressableSize * fRowSize;
			fRendering.format(rowSizeInBytes, columnSizeInBytes);
		}
	}
}

Back to the top