Java Code Examples for org.eclipse.swt.widgets.Table#setHeaderVisible()

The following examples show how to use org.eclipse.swt.widgets.Table#setHeaderVisible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UsersWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createGeneralDataTable(final Composite tables) {
    final Composite generalDataTableComposite = new Composite(tables, SWT.NONE);
    generalDataTableComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
    generalDataTableComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final Table generalDataTable = new Table(generalDataTableComposite, SWT.BORDER);
    generalDataTable.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    generalDataTable.setLinesVisible(true);
    generalDataTable.setHeaderVisible(true);

    final String[] generalDataItems = getGeneralDataItems();
    final TableColumn generalData = new TableColumn(generalDataTable, SWT.NONE);
    generalData.setText(Messages.defaultInformationGroupGeneralDataTableTitle);
    generalData.setResizable(false);

    for (int i = 0; i < generalDataItems.length; i++) {
        final TableItem item = new TableItem(generalDataTable, SWT.NONE | SWT.FILL);
        item.setText(generalDataItems[i]);
    }

    addTableColumLayout(generalDataTable);
}
 
Example 2
Source File: ProcessSearchPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createResultSection(Composite container) {
	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new GridLayout(1, false));
	UI.gridData(composite, true, true);
	Table table = new Table(composite, SWT.MULTI | SWT.H_SCROLL
			| SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
	UI.gridData(table, true, true);
	table.setHeaderVisible(true);
	table.setLinesVisible(false);
	viewer = new SearchResultViewer(table);
	viewer.addSelectionChangedListener((event) -> {
		ISelection selection = event.getSelection();
		if (selection == null || selection.isEmpty()) {
			setPageComplete(false);
		} else {
			setPageComplete(true);
		}
	});
}
 
Example 3
Source File: RelationByExistingColumnsDialog.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
private void createComparisonTable(final Composite composite) {
    final GridData tableGridData = new GridData();
    tableGridData.horizontalSpan = 2;
    tableGridData.heightHint = 100;
    tableGridData.horizontalAlignment = GridData.FILL;
    tableGridData.grabExcessHorizontalSpace = true;

    comparisonTable = new Table(composite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    comparisonTable.setLayoutData(tableGridData);
    comparisonTable.setHeaderVisible(true);
    comparisonTable.setLinesVisible(true);

    composite.pack();

    final int width = comparisonTable.getBounds().width;

    final TableColumn referencedColumn = new TableColumn(comparisonTable, SWT.NONE);
    referencedColumn.setWidth(width / 2);
    referencedColumn.setText(ResourceString.getResourceString("label.reference.column"));

    final TableColumn foreignKeyColumn = new TableColumn(comparisonTable, SWT.NONE);
    foreignKeyColumn.setWidth(width / 2);
    foreignKeyColumn.setText(ResourceString.getResourceString("label.foreign.key"));
}
 
Example 4
Source File: DefinesViewer.java    From cmake4eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private TableViewer createViewer(Composite parent) {
    TableViewer viewer = new TableViewer(parent, SWT.BORDER | SWT.H_SCROLL
        | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);

    createColumns(parent, viewer);

    final Table table = viewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    viewer.setContentProvider(new CmakeDefineTableContentProvider());
    viewer.setLabelProvider(new CmakeVariableLabelProvider());

    // Layout the viewer
    GridData gridData = new GridData();
    gridData.verticalAlignment = GridData.FILL;
//    gridData.horizontalSpan = 2;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    viewer.getControl().setLayoutData(gridData);
    return viewer;
  }
 
Example 5
Source File: TestDataDialog.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private void createSelectedTableTable(final Composite composite) {
    final GridData gridData = new GridData();
    gridData.verticalSpan = 2;
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.FILL;

    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;

    final Group group = new Group(composite, SWT.NONE);
    group.setText(ResourceString.getResourceString("label.testdata.table.list"));
    group.setLayout(gridLayout);
    group.setLayoutData(gridData);

    final GridData tableGridData = new GridData();
    tableGridData.grabExcessVerticalSpace = true;
    tableGridData.verticalAlignment = GridData.FILL;
    tableGridData.widthHint = 300;
    tableGridData.verticalSpan = 2;

    selectedTableTable = new Table(group, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI);
    selectedTableTable.setHeaderVisible(false);
    selectedTableTable.setLayoutData(tableGridData);
    selectedTableTable.setLinesVisible(false);

    final TableColumn tableColumn = new TableColumn(selectedTableTable, SWT.CENTER);
    tableColumn.setWidth(200);
    tableColumn.setText(ResourceString.getResourceString("label.testdata.table.name"));

    final TableColumn numColumn = new TableColumn(selectedTableTable, SWT.CENTER);
    numColumn.setWidth(80);
    numColumn.setText(ResourceString.getResourceString("label.testdata.table.test.num"));
}
 
Example 6
Source File: TasksPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param parent
 */
private void createTaskTableArea(Composite parent)
{
	fTasksTableViewer = new TableViewer(parent, SWT.BORDER | SWT.SINGLE);
	Table table = fTasksTableViewer.getTable();
	table.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
	table.setHeaderVisible(true);
	table.setLinesVisible(true);
	table.setFont(parent.getFont());

	TableColumn tagNameColumn = new TableColumn(table, SWT.NONE);
	tagNameColumn.setText(Messages.TasksPreferencePage_TagNameColumnHeader);
	tagNameColumn.setWidth(100);
	TableColumn tagPriorityColumn = new TableColumn(table, SWT.NONE);
	tagPriorityColumn.setText(Messages.TasksPreferencePage_PriorityColumnHeader);
	tagPriorityColumn.setWidth(100);

	fTasksTableViewer.setContentProvider(ArrayContentProvider.getInstance());
	fTasksTableViewer.setLabelProvider(new TaskLabelProvider());
	fTasksTableViewer.setComparator(new ViewerComparator());
	fTasksTableViewer.setInput(getTaskTags());

	fTasksTableViewer.addSelectionChangedListener(new ISelectionChangedListener()
	{
		public void selectionChanged(SelectionChangedEvent event)
		{
			// Enable/disable buttons
			updateButtonStates();
		}
	});

	createTaskButtons(parent);
}
 
Example 7
Source File: MaplayerTableViewer.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor.
 *
 * <p>
 * <b>Note</b> that after the object is built and before actually using it, the has to be set through the method.
 * </p>
 *
 * @param parent
 * @param style
 */
public MaplayerTableViewer(final Composite parent, final int style) {
	super(parent, style);

	this.setContentProvider(new ArrayContentProvider());
	this.addSelectionChangedListener(this);

	createColumns(parent, this);
	final Table table = this.getTable();
	table.setHeaderVisible(true);
	// table.setLinesVisible(true);

	this.setInput(layersList);
}
 
Example 8
Source File: DualList.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @return a table that will contain data
 */
private Table createTable() {
	final Table table = new Table(this, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
	table.setLinesVisible(false);
	table.setHeaderVisible(false);
	final GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 1, 4);
	gd.widthHint = 200;
	table.setLayoutData(gd);
	new TableColumn(table, SWT.CENTER);
	new TableColumn(table, SWT.LEFT);
	table.setData(-1);
	return table;
}
 
Example 9
Source File: ModelSortPageableTableExample.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static void main(String[] args) {

		Display display = new Display();
		Shell shell = new Shell(display);
		GridLayout layout = new GridLayout(1, false);
		shell.setLayout(layout);

		final List<Person> items = createList();

		// 1) Create pageable table with 10 items per page
		// This SWT Component create internally a SWT Table+JFace TreeViewer
		int pageSize = 10;
		PageableTable pageableTable = new PageableTable(shell, SWT.BORDER,
				SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, pageSize);
		pageableTable.setLayoutData(new GridData(GridData.FILL_BOTH));

		// 2) Initialize the table viewer + SWT Table
		TableViewer viewer = pageableTable.getViewer();
		viewer.setContentProvider(ArrayContentProvider.getInstance());
		viewer.setLabelProvider(new LabelProvider());

		Table table = viewer.getTable();
		table.setHeaderVisible(true);
		table.setLinesVisible(true);

		// 3) Create Table columns with sort of paginated list.
		createColumns(viewer);

		// 3) Set current page to 0 to refresh the table
		pageableTable.setPageLoader(new PageResultLoaderList<Person>(items));
		pageableTable.setCurrentPage(0);

		shell.setSize(400, 250);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
 
Example 10
Source File: PreMachineTranslationResultDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));

	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(1, false);
	gl_composite.verticalSpacing = 0;
	gl_composite.marginWidth = 0;
	gl_composite.marginHeight = 0;
	composite.setLayout(gl_composite);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

	tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
	Table table = tableViewer.getTable();

	GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	tableGd.heightHint = 220;
	table.setLayoutData(tableGd);

	table.setLinesVisible(true);
	table.setHeaderVisible(true);

	String[] clmnTitles = new String[] { Messages.getString("dialog.PreTranslationResultDialog.clmnTitles1"),
			Messages.getString("dialog.PreTranslationResultDialog.clmnTitles2"),
			Messages.getString("dialog.PreTranslationResultDialog.clmnTitles3"),
			Messages.getString("dialog.PreTranslationResultDialog.clmnTitles4"),
			Messages.getString("dialog.PreTranslationResultDialog.clmnTitles5"),
			Messages.getString("dialog.PreTranslationResultDialog.clmnTitles6") };
	int[] clmnBounds = { 60, 200, 100, 110, 110, 110 };
	for (int i = 0; i < clmnTitles.length; i++) {
		createTableViewerColumn(tableViewer, clmnTitles[i], clmnBounds[i], i);
	}

	tableViewer.setLabelProvider(new TableViewerLabelProvider());
	tableViewer.setContentProvider(new ArrayContentProvider());
	tableViewer.setInput(this.getTableViewerInput());
	return container;
}
 
Example 11
Source File: MOOSETreePropertySection.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the table that displays properties for viewing and editing.
 * 
 * @param client
 *            The client <code>Composite</code> that should contain the
 *            table of properties.
 * @return The <code>TableViewer</code> for the table of properties.
 */
@Override
protected TableViewer createTableViewer(Composite client) {

	CheckboxTableViewer tableViewer = null;

	if (client != null) {
		Table table;

		// Create the TableViewer and the underlying Table Control.
		tableViewer = CheckboxTableViewer.newCheckList(client,
				SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
		// Set some properties for the table.
		table = tableViewer.getTable();
		table.setHeaderVisible(true);
		table.setLinesVisible(true);

		// Set up the content provider for the table viewer. Now the table
		// viewer's input can be set.
		tableViewer.setContentProvider(new TreePropertyContentProvider());

		// Enable tool tips for the Table's cells.
		ColumnViewerToolTipSupport.enableFor(tableViewer,
				ToolTip.NO_RECREATE);

		// Populate the TableViewer with its columns.
		addTableViewerColumns(tableViewer);
	}

	return tableViewer;
}
 
Example 12
Source File: TableAndButtonsWidget.java    From tm4e with Eclipse Public License 1.0 5 votes vote down vote up
private void createTable(Composite parent) {
	Table table = new Table(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
	table.setHeaderVisible(false);
	table.setLinesVisible(false);

	viewer = new TableViewer(table);
	table.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
}
 
Example 13
Source File: MetricDisplay.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {

	setTitleImage(null);
	setTitle("Metric informations");
	Composite area = (Composite) super.createDialogArea(parent);
	area.setLayout(new GridLayout(1, false));

	Composite textContainer = new Composite(area, SWT.NONE);
	textContainer.setLayout(new FillLayout(SWT.HORIZONTAL));
	textContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));

	table = new Table(textContainer, SWT.BORDER | SWT.FULL_SELECTION);
	table.setLinesVisible(true);
	table.setHeaderVisible(true);

	TableColumn tblclmnNewColumn = new TableColumn(table, SWT.NONE);
	tblclmnNewColumn.setWidth(300);
	tblclmnNewColumn.setText("ID");

	TableColumn tblclmnNewColumn_1 = new TableColumn(table, SWT.NONE);
	tblclmnNewColumn_1.setWidth(100);
	tblclmnNewColumn_1.setText("Value");
	
	TableColumn tblclmnNewColumn_2 = new TableColumn(table, SWT.NONE);
	tblclmnNewColumn_2.setWidth(300);
	tblclmnNewColumn_2.setText("Description");
	

	progressBar = new ProgressBar(area, SWT.SMOOTH);
	progressBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

	refreshMetrics();

	return area;
}
 
Example 14
Source File: AbstractOrganizationWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected StructuredViewer createViewer(final Composite parent) {
    final Composite viewerComposite = new Composite(parent, SWT.NONE);
    viewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    viewerComposite.setLayout(
            GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(true).margins(0, 0).spacing(0, 5).create());

    final Text searchBox = new Text(viewerComposite, SWT.SEARCH | SWT.ICON_SEARCH | SWT.BORDER | SWT.CANCEL);
    searchBox.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    searchBox.setMessage(Messages.search);

    final Composite tableViewerComposite = new Composite(viewerComposite, SWT.NONE);
    tableViewerComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
    tableViewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final TableViewer tableViewer = new TableViewer(tableViewerComposite,
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    final Table table = tableViewer.getTable();
    table.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 270).create());
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.addFilter(new ViewerFilter() {

        @Override
        public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
            return viewerSelect(element, searchQuery);
        }
    });

    searchBox.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            searchQuery = searchBox.getText();
            tableViewer.refresh();
        }

    });

    return tableViewer;
}
 
Example 15
Source File: EditAllAttributesDialog.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
/**
 * This method initializes composite2
 */
private void createTable(final Composite composite) {
    final GridData tableGridData = new GridData();
    tableGridData.horizontalSpan = 3;
    tableGridData.heightHint = 400;
    tableGridData.horizontalAlignment = GridData.FILL;
    tableGridData.grabExcessHorizontalSpace = true;

    attributeTable = new Table(composite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    attributeTable.setLayoutData(tableGridData);
    attributeTable.setHeaderVisible(true);
    attributeTable.setLinesVisible(true);

    final TableColumn columnLogicalName = new TableColumn(attributeTable, SWT.NONE);
    columnLogicalName.setWidth(NAME_WIDTH);
    columnLogicalName.setText(ResourceString.getResourceString("label.column.logical.name"));

    final TableColumn columnPhysicalName = new TableColumn(attributeTable, SWT.NONE);
    columnPhysicalName.setWidth(NAME_WIDTH);
    columnPhysicalName.setText(ResourceString.getResourceString("label.column.physical.name"));

    final TableColumn tableLogicalName = new TableColumn(attributeTable, SWT.NONE);
    tableLogicalName.setWidth(NAME_WIDTH);
    tableLogicalName.setText(ResourceString.getResourceString("label.table.logical.name"));

    final TableColumn tablePhysicalName = new TableColumn(attributeTable, SWT.NONE);
    tablePhysicalName.setWidth(NAME_WIDTH);
    tablePhysicalName.setText(ResourceString.getResourceString("label.table.physical.name"));

    final TableColumn tableWord = new TableColumn(attributeTable, SWT.NONE);
    tableWord.setWidth(NAME_WIDTH);
    tableWord.setText(ResourceString.getResourceString("label.word"));

    final TableColumn columnType = new TableColumn(attributeTable, SWT.NONE);
    columnType.setWidth(TYPE_WIDTH);
    columnType.setText(ResourceString.getResourceString("label.column.type"));

    final TableColumn columnLength = new TableColumn(attributeTable, SWT.RIGHT);
    columnLength.setWidth(TYPE_WIDTH);
    columnLength.setText(ResourceString.getResourceString("label.column.length"));

    final TableColumn columnDecimal = new TableColumn(attributeTable, SWT.RIGHT);
    columnDecimal.setWidth(TYPE_WIDTH);
    columnDecimal.setText(ResourceString.getResourceString("label.column.decimal"));

    final TableColumn columnKey = new TableColumn(attributeTable, SWT.CENTER);
    columnKey.setText("PK");
    columnKey.setWidth(KEY_WIDTH);
    new CenteredContentCellPaint(attributeTable, 8);

    final TableColumn columnForeignKey = new TableColumn(attributeTable, SWT.CENTER);
    columnForeignKey.setText("FK");
    columnForeignKey.setWidth(KEY_WIDTH);
    new CenteredContentCellPaint(attributeTable, 9);

    final TableColumn columnNotNull = new TableColumn(attributeTable, SWT.CENTER);
    columnNotNull.setWidth(NOT_NULL_WIDTH);
    columnNotNull.setText(ResourceString.getResourceString("label.not.null"));
    new CenteredContentCellPaint(attributeTable, 10);

    final TableColumn columnUnique = new TableColumn(attributeTable, SWT.CENTER);
    columnUnique.setWidth(UNIQUE_KEY_WIDTH);
    columnUnique.setText(ResourceString.getResourceString("label.unique.key"));
    new CenteredContentCellPaint(attributeTable, 11);

    tableEditor = new TableEditor(attributeTable);
    tableEditor.grabHorizontal = true;

    ListenerAppender.addTableEditListener(attributeTable, tableEditor, this);
}
 
Example 16
Source File: ModelPropertiesDialog.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
/**
 * This method initializes composite1
 * 
 */
private void createTableComposite(Composite parent) {
	GridLayout gridLayout = new GridLayout();
	gridLayout.numColumns = 3;

	GridData gridData = new GridData();
	gridData.heightHint = 320;

	GridData tableGridData = new GridData();
	tableGridData.horizontalSpan = 3;
	tableGridData.heightHint = 185;

	Composite composite = new Composite(parent, SWT.BORDER);
	composite.setLayout(gridLayout);
	composite.setLayoutData(gridData);

	table = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION);
	table.setHeaderVisible(true);
	table.setLayoutData(tableGridData);
	table.setLinesVisible(true);

	TableColumn tableColumn0 = new TableColumn(table, SWT.NONE);
	tableColumn0.setWidth(200);
	tableColumn0.setText(ResourceString
			.getResourceString("label.property.name"));
	TableColumn tableColumn1 = new TableColumn(table, SWT.NONE);
	tableColumn1.setWidth(200);
	tableColumn1.setText(ResourceString
			.getResourceString("label.property.value"));

	this.tableEditor = new TableEditor(table);
	this.tableEditor.grabHorizontal = true;

	this.table.addMouseListener(new MouseAdapter() {

		@Override
		public void mouseDown(MouseEvent event) {
			int index = table.getSelectionIndex();
			if (index == -1) {
				return;
			}

			TableItem item = table.getItem(index);
			Point selectedPoint = new Point(event.x, event.y);

			targetColumn = -1;

			for (int i = 0; i < table.getColumnCount(); i++) {
				Rectangle rect = item.getBounds(i);
				if (rect.contains(selectedPoint)) {
					targetColumn = i;
					break;
				}
			}

			if (targetColumn == -1) {
				return;
			}

			edit(item, tableEditor);
		}

	});
}
 
Example 17
Source File: ResultSetPreviewPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Control createPageControl( Composite parent )
{
	Composite resultSetComposite = new Composite( parent, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.verticalSpacing = 15;
	resultSetComposite.setLayout( layout );
	resultSetComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	resultSetTable = new Table( resultSetComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.VIRTUAL | SWT.BORDER );
	resultSetTable.setHeaderVisible( true );
	resultSetTable.setLinesVisible( true );
	resultSetTable.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	( (DataSetHandle) getContainer( ).getModel( ) ).addListener( this );

	resultSetTable.addMouseListener( new MouseAdapter( ) {

		public void mouseUp( MouseEvent e )
		{
			// if not mouse left button
			if ( e.button != 1 )
			{
				MenuManager menuManager = new MenuManager( );

				ResultSetTableAction copyAction = ResultSetTableActionFactory.createResultSetTableAction( resultSetTable,
						ResultSetTableActionFactory.COPY_ACTION );
				ResultSetTableAction selectAllAction = ResultSetTableActionFactory.createResultSetTableAction( resultSetTable,
						ResultSetTableActionFactory.SELECTALL_ACTION );
				menuManager.add( copyAction );
				menuManager.add( selectAllAction );

				menuManager.update( );

				copyAction.update( );
				selectAllAction.update( );

				Menu contextMenu = menuManager.createContextMenu( resultSetTable );

				contextMenu.setEnabled( true );
				contextMenu.setVisible( true );
			}
		}
	} );

	createResultSetTableViewer( );
	promptLabel = new CLabel( resultSetComposite, SWT.WRAP );
	GridData labelData = new GridData( GridData.FILL_HORIZONTAL );
	promptLabel.setLayoutData( labelData );
	
	return resultSetComposite;
}
 
Example 18
Source File: DetectorConfigurationTab.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Build rule table viewer
 */
private Table createDetectorsTableViewer(Composite parent, IProject project) {
    final BugPatternTableSorter sorter = new BugPatternTableSorter(this);

    int tableStyle = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.CHECK;
    availableFactoriesTableViewer = CheckboxTableViewer.newCheckList(parent, tableStyle);
    availableFactoriesTableViewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            syncUserPreferencesWithTable();
        }
    });

    int currentColumnIdx = 0;
    Table factoriesTable = availableFactoriesTableViewer.getTable();

    TableColumn factoryNameColumn = createColumn(currentColumnIdx, factoriesTable, getMessage("property.detectorName"), 230,
            COLUMN.DETECTOR_NAME);
    addColumnSelectionListener(sorter, factoryNameColumn, COLUMN.DETECTOR_NAME);

    currentColumnIdx++;
    TableColumn bugsAbbrevColumn = createColumn(currentColumnIdx, factoriesTable, getMessage("property.bugCodes"), 75,
            COLUMN.BUG_CODES);
    addColumnSelectionListener(sorter, bugsAbbrevColumn, COLUMN.BUG_CODES);

    currentColumnIdx++;
    TableColumn speedColumn = createColumn(currentColumnIdx, factoriesTable, getMessage("property.speed"), 70,
            COLUMN.DETECTOR_SPEED);
    addColumnSelectionListener(sorter, speedColumn, COLUMN.DETECTOR_SPEED);

    currentColumnIdx++;
    TableColumn pluginColumn = createColumn(currentColumnIdx, factoriesTable, getMessage("property.provider"), 100,
            COLUMN.PLUGIN);
    addColumnSelectionListener(sorter, pluginColumn, COLUMN.PLUGIN);

    currentColumnIdx++;
    TableColumn categoryColumn = createColumn(currentColumnIdx, factoriesTable, getMessage("property.category"), 75,
            COLUMN.BUG_CATEGORIES);
    addColumnSelectionListener(sorter, categoryColumn, COLUMN.BUG_CATEGORIES);

    factoriesTable.setLinesVisible(true);
    factoriesTable.setHeaderVisible(true);
    // initial sort indicator
    factoriesTable.setSortDirection(sorter.revertOrder ? SWT.UP : SWT.DOWN);
    factoriesTable.setSortColumn(factoryNameColumn);
    sorter.setSortColumnIndex(COLUMN.DETECTOR_NAME);

    availableFactoriesTableViewer.setContentProvider(new DetectorFactoriesContentProvider());
    availableFactoriesTableViewer.setLabelProvider(new DetectorFactoryLabelProvider(this));

    availableFactoriesTableViewer.setSorter(sorter);

    populateAvailableRulesTable(project);
    factoriesTable.setEnabled(true);

    return factoriesTable;
}
 
Example 19
Source File: TablespaceSizeCaluculatorDialog.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
@Override
protected void initialize(final Composite composite) {
    CompositeFactory.createLabel(composite, "label.tablespace.size.calculate.1", 3);

    restoreDefaultButton1 = new Button(composite, SWT.NONE);
    restoreDefaultButton1.setText(ResourceString.getResourceString("label.restore.default"));

    CompositeFactory.filler(composite, 1, INDENT);
    kcbhText = CompositeFactory.createNumText(this, composite, "KCBH", 1, NUM_WIDTH);
    CompositeFactory.filler(composite, 1);

    CompositeFactory.filler(composite, 1, INDENT);
    ub4Text = CompositeFactory.createNumText(this, composite, "UB4", 1, NUM_WIDTH);
    CompositeFactory.filler(composite, 1);

    CompositeFactory.filler(composite, 1, INDENT);
    ktbbhText = CompositeFactory.createNumText(this, composite, "KTBBH", 1, NUM_WIDTH);
    CompositeFactory.filler(composite, 1);

    CompositeFactory.filler(composite, 1, INDENT);
    ktbitText = CompositeFactory.createNumText(this, composite, "KTBIT", 1, NUM_WIDTH);
    CompositeFactory.filler(composite, 1);

    CompositeFactory.filler(composite, 1);
    kdbhText = CompositeFactory.createNumText(this, composite, "KDBH", 1, NUM_WIDTH);
    CompositeFactory.filler(composite, 1);

    CompositeFactory.filler(composite, 1, INDENT);
    kdbtText = CompositeFactory.createNumText(this, composite, "KDBT", 1, NUM_WIDTH);
    CompositeFactory.filler(composite, 1);

    CompositeFactory.filler(composite, 1);
    ub1Text = CompositeFactory.createNumText(this, composite, "UB1", 1, NUM_WIDTH);
    CompositeFactory.filler(composite, 1);

    CompositeFactory.filler(composite, 1, INDENT);
    sb2Text = CompositeFactory.createNumText(this, composite, "SB2", 1, NUM_WIDTH);
    CompositeFactory.filler(composite, 1);

    CompositeFactory.filler(composite, 4);

    CompositeFactory.createLabel(composite, "label.tablespace.size.calculate.2", 3);
    restoreDefaultButton2 = new Button(composite, SWT.NONE);
    restoreDefaultButton2.setText(ResourceString.getResourceString("label.restore.default"));

    CompositeFactory.filler(composite, 1, INDENT);
    dbBlockSizeText = CompositeFactory.createNumText(this, composite, "DB_BLOCK_SIZE", 1, NUM_WIDTH);
    CompositeFactory.filler(composite, 1);

    CompositeFactory.filler(composite, 4);

    CompositeFactory.createLabel(composite, "label.tablespace.size.calculate.3", 4);

    CompositeFactory.filler(composite, 4);

    final GridData tableGridData = new GridData();
    tableGridData.horizontalSpan = 4;
    tableGridData.horizontalAlignment = GridData.FILL;
    tableGridData.grabExcessHorizontalSpace = true;
    tableGridData.heightHint = 100;

    tableTable = new Table(composite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    tableTable.setLayoutData(tableGridData);
    tableTable.setHeaderVisible(true);
    tableTable.setLinesVisible(true);

    final TableColumn tableLogicalName = new TableColumn(tableTable, SWT.NONE);
    tableLogicalName.setWidth(NAME_WIDTH);
    tableLogicalName.setText(ResourceString.getResourceString("label.table.logical.name"));

    final TableColumn num = new TableColumn(tableTable, SWT.RIGHT);
    num.setWidth(TABLE_NUM_WIDTH);
    num.setText(ResourceString.getResourceString("label.record.num"));

    tableEditor = new TableEditor(tableTable);
    tableEditor.grabHorizontal = true;

    CompositeFactory.createLabel(composite, "label.tablespace.size.calculated", 2);

    tablespaceSizeText = new Text(composite, SWT.BORDER | SWT.READ_ONLY | SWT.RIGHT);
    final GridData textGridData = new GridData();
    textGridData.horizontalAlignment = GridData.FILL;
    textGridData.grabExcessHorizontalSpace = true;
    tablespaceSizeText.setLayoutData(textGridData);

    CompositeFactory.filler(composite, 1);
}
 
Example 20
Source File: ExtendedPropertyEditorComposite.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void placeComponents( )
{
	GridLayout glContent = new GridLayout( );
	glContent.horizontalSpacing = 5;
	glContent.verticalSpacing = 5;
	glContent.marginHeight = 7;
	glContent.marginWidth = 7;

	this.setLayout( glContent );

	table = new Table( this, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER );
	GridData gdTable = new GridData( GridData.FILL_BOTH );
	table.setLayoutData( gdTable );
	table.setHeaderVisible( true );
	table.setLinesVisible( true );

	TableColumn tcKey = new TableColumn( table, SWT.CENTER );
	tcKey.setWidth( 186 );
	tcKey.setText( Messages.getString( "PropertyEditorDialog.Lbl.Key" ) ); //$NON-NLS-1$

	TableColumn tcValue = new TableColumn( table, SWT.LEFT );
	tcValue.setWidth( 186 );
	tcValue.setText( Messages.getString( "PropertyEditorDialog.Lbl.Value" ) ); //$NON-NLS-1$

	editorValue = new TableEditor( table );
	editorValue.setColumn( 1 );
	editorValue.grabHorizontal = true;
	editorValue.minimumWidth = 30;

	table.addSelectionListener( this );

	// Layout for buttons panel
	GridLayout glButtons = new GridLayout( );
	glButtons.numColumns = 3;
	glButtons.horizontalSpacing = 5;
	glButtons.verticalSpacing = 5;
	glButtons.marginWidth = 0;
	glButtons.marginHeight = 0;

	Composite cmpButtons = new Composite( this, SWT.NONE );
	GridData gdCMPButtons = new GridData( GridData.FILL_HORIZONTAL );
	cmpButtons.setLayoutData( gdCMPButtons );
	cmpButtons.setLayout( glButtons );

	txtNewKey = new Text( cmpButtons, SWT.SINGLE | SWT.BORDER );
	GridData gdTXTNewKey = new GridData( GridData.FILL_HORIZONTAL );
	gdTXTNewKey.grabExcessHorizontalSpace = true;
	txtNewKey.setLayoutData( gdTXTNewKey );

	btnAdd = new Button( cmpButtons, SWT.PUSH );
	GridData gdBTNAdd = new GridData( GridData.HORIZONTAL_ALIGN_END );
	gdBTNAdd.grabExcessHorizontalSpace = false;
	btnAdd.setLayoutData( gdBTNAdd );
	btnAdd.setText( Messages.getString( "PropertyEditorDialog.Lbl.Add" ) ); //$NON-NLS-1$
	btnAdd.addSelectionListener( this );

	btnRemove = new Button( cmpButtons, SWT.PUSH );
	GridData gdBTNRemove = new GridData( GridData.HORIZONTAL_ALIGN_END );
	gdBTNRemove.grabExcessHorizontalSpace = false;
	btnRemove.setLayoutData( gdBTNRemove );
	btnRemove.setText( Messages.getString( "PropertyEditorDialog.Lbl.Remove" ) ); //$NON-NLS-1$
	btnRemove.addSelectionListener( this );

	populateTable( );
}