blob: c8e24ba69d8f75b5831ae81218f7c61230ffe032 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005 The Regents of the University of California.
* This material was produced under U.S. Government contract W-7405-ENG-36
* for Los Alamos National Laboratory, which is operated by the University
* of California for the U.S. Department of Energy. The U.S. Government has
* rights to use, reproduce, and distribute this software. NEITHER THE
* GOVERNMENT NOR THE UNIVERSITY MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR
* ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified
* to produce derivative works, such modified software should be clearly marked,
* so as not to confuse it with the version available from LANL.
*
* Additionally, this program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* LA-CC 04-115
*******************************************************************************/
package org.eclipse.ptp.debug.internal.ui.views.signals;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.ptp.debug.internal.ui.PixelConverter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
/**
* @author Clement chu
*/
public class SignalsViewer extends TableViewer {
// String constants
protected static final String YES_VALUE = SignalsMessages.getString("SignalsViewer.8");
protected static final String NO_VALUE = SignalsMessages.getString("SignalsViewer.9");
// Column properties
private static final String CP_NAME = "name";
private static final String CP_PASS = "pass";
private static final String CP_SUSPEND = "suspend";
private static final String CP_DESCRIPTION = "description";
// Column labels
private static final String CL_NAME = SignalsMessages.getString("SignalsViewer.4");
private static final String CL_PASS = SignalsMessages.getString("SignalsViewer.5");
private static final String CL_SUSPEND = SignalsMessages.getString("SignalsViewer.6");
private static final String CL_DESCRIPTION = SignalsMessages.getString("SignalsViewer.7");
/**
* Constructor for SignalsViewer
*
* @param parent
* @param style
*/
public SignalsViewer(Composite parent, int style) {
super(parent, style);
Table table = getTable();
table.setLinesVisible(true);
table.setHeaderVisible(true);
table.setLayoutData(new GridData(GridData.FILL_BOTH));
// Create the table columns
new TableColumn(table, SWT.NULL);
new TableColumn(table, SWT.NULL);
new TableColumn(table, SWT.NULL);
new TableColumn(table, SWT.NULL);
TableColumn[] columns = table.getColumns();
columns[0].setResizable(true);
columns[1].setResizable(false);
columns[2].setResizable(false);
columns[3].setResizable(true);
columns[0].setText(CL_NAME);
columns[1].setText(CL_PASS);
columns[2].setText(CL_SUSPEND);
columns[3].setText(CL_DESCRIPTION);
PixelConverter pc = new PixelConverter(parent);
columns[0].setWidth(pc.convertWidthInCharsToPixels(20));
columns[1].setWidth(pc.convertWidthInCharsToPixels(15));
columns[2].setWidth(pc.convertWidthInCharsToPixels(15));
columns[3].setWidth(pc.convertWidthInCharsToPixels(50));
setColumnProperties(new String[]{ CP_NAME, CP_PASS, CP_SUSPEND, CP_DESCRIPTION });
}
}