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

The following are Jave code examples for showing how to use addMouseListener() of the org.eclipse.swt.widgets.Table class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Hydrograph   File: SecondaryColumnKeysDialog.java   View Source Code Vote up 5 votes
private void createSourceTable(Composite composite_2) {
	sourceTable = new Table(composite_2, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
	sourceTable.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseDoubleClick(MouseEvent e) {
			if(sourceTable.getSelection().length==1){
				addNewProperty(targetTableViewer, sourceTable.getSelection()[0].getText());
				enableControlButtons();
			}
		}
	});
	GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
	gd_table.widthHint = 221;
	gd_table.heightHint = 407;
	sourceTable.setLayoutData(gd_table);
	sourceTable.setHeaderVisible(true);
	sourceTable.setLinesVisible(true);

	TableColumn sourceTableColumnFieldName = new TableColumn(sourceTable, SWT.LEFT);
	if(OSValidator.isMac()){
		sourceTableColumnFieldName.setWidth(212);
	}else{
		sourceTableColumnFieldName.setWidth(202);
	}
	
	sourceTableColumnFieldName.setText(Messages.AVAILABLE_FIELDS_HEADER);
	getSourceFieldsFromPropagatedSchema(sourceTable);
	dragSource = new DragSource(sourceTable, DND.DROP_MOVE);
	dragSource.setTransfer(new Transfer[] { TextTransfer.getInstance() });
	dragSource.addDragListener(new DragSourceAdapter() {
		public void dragSetData(DragSourceEvent event) {
			// Set the data to be the first selected item's text
			event.data = formatDataToTransfer(sourceTable.getSelection());
		}

	});
}
 
Example 2
Project: eZooKeeper   File: ZnodeModelChildrenFormPage.java   View Source Code Vote up 3 votes
@Override
protected Table createTable(IManagedForm managedForm, Composite client) {

    final Table table = super.createTable(managedForm, client);
    table.setLinesVisible(false);
    ElementTypes elementTypes = new ElementTypes();

    elementTypes.add(ZnodeModel.class, _ZnodeModelElementType);

    _TableViewer = ViewerFactory.createDataModelTableViewer(table, elementTypes, null);

    makeTableActions();
    hookTableContextMenu();

    table.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent e) {

            getSite().getWorkbenchWindow().getActivePage().activate(getEditor());

            // if (table.getItem(new Point(e.x, e.y)) == null) {
            // _TableViewer.setSelection(null);
            // }
        }

    });

    return table;
}