Java tutorial
/* * Copyright (c) 2012 Diamond Light Source Ltd. * * All rights reserved. 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 */ package org.dawnsci.plotting.tools; import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.jface.window.ToolTip; import org.eclipse.swt.SWT; public class InfoPixelTool1D extends InfoPixelTool { public final static String INFOPIXELTOOL1D_ID = "org.dawb.workbench.plotting.tools.InfoPixel1D"; @Override public ToolPageRole getToolPageRole() { return ToolPageRole.ROLE_1D; } protected void createColumns(final TableViewer viewer) { ColumnViewerToolTipSupport.enableFor(viewer, ToolTip.NO_RECREATE); TableViewerColumn var = new TableViewerColumn(viewer, SWT.CENTER, 0); var.getColumn().setText("Point ID"); var.getColumn().setWidth(120); var.setLabelProvider(new InfoPixelLabelProvider(this, 0)); var = new TableViewerColumn(viewer, SWT.CENTER, 1); var.getColumn().setText("X position"); var.getColumn().setWidth(120); var.setLabelProvider(new InfoPixelLabelProvider(this, 1)); var = new TableViewerColumn(viewer, SWT.CENTER, 2); var.getColumn().setText("Y position"); var.getColumn().setWidth(100); var.setLabelProvider(new InfoPixelLabelProvider(this, 2)); } }