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

The following are Jave code examples for showing how to use setSelection() 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: JoinMapDialog.java   View Source Code Vote up 6 votes
private void deleteRow(){

		Table table = mappingTableViewer.getTable();
		setValueForCellEditor();
		int selectionIndex = table.getSelectionIndex();
		int[] indexs = table.getSelectionIndices();
		if (selectionIndex == -1) {
			WidgetUtility.errorMessage("Select Rows to delete");
		} else {
			table.remove(indexs);
			int itemsRemoved=0;
			for (int index : indexs) {
				mappingTableItemList.remove(index-itemsRemoved);
				if(index-itemsRemoved-1 != -1){
					table.setSelection(index-itemsRemoved-1);
				}else{
					table.setSelection(0);
				}
				itemsRemoved++;
			}
			mappingTableViewer.refresh();
		}
		refreshButtonStatus();
	
	}
 
Example 2
Project: Hydrograph   File: LookupMapDialog.java   View Source Code Vote up 6 votes
private void deleteRow()
{
	Table table = mappingTableViewer.getTable();
	setValueForCellEditor();
	int selectionIndex = table.getSelectionIndex();
	int[] indexs = table.getSelectionIndices();
	if (selectionIndex == -1) {
		WidgetUtility.errorMessage("Select Rows to delete");
	} else {
		table.remove(indexs);
		int itemsRemoved=0;
		for (int index : indexs) {
			mappingTableItemList.remove(index-itemsRemoved);
			if(index-itemsRemoved-1 != -1){
				table.setSelection(index-itemsRemoved-1);
			}else{
				table.setSelection(0);
			}
			itemsRemoved++;
		}
		mappingTableViewer.refresh();
	}
	component.setLatestChangesInSchema(false);
	refreshButtonStatus();

}
 
Example 3
Project: eZooKeeper   File: ZnodeAclComposite.java   View Source Code Vote up 5 votes
private void addNewItem() {
    ACL acl = new ACL();
    acl.setId(ZooDefs.Ids.ANYONE_ID_UNSAFE);
    acl.setPerms(ZooDefs.Perms.ALL);

    TableItem newItem = addAclTableItem(acl);
    Table table = getTable();
    table.setSelection(newItem);
    tableSelectionChanged(newItem);

    fireOrchestrationChange();
}
 
Example 4
Project: convertigo-eclipse   File: EngineLogView.java   View Source Code Vote up 5 votes
private void searchInLogs(int side) {
	int searchIndex = currentFoundIndex + side;
	if (searchIndex < 0 || searchIndex > foundIndexes.size())
		return;
	
	currentFoundIndex = searchIndex;
	Table table = tableViewer.getTable();
	
	table.setSelection(foundIndexes.get(currentFoundIndex));
	table.setFocus();

	// Disable "previous" if is the beginning
	if (foundIndexes.get(currentFoundIndex) == foundIndexes.get(0))
		previousSearch.setEnabled(false);
	else
		previousSearch.setEnabled(true);

	// Disable "next" if is the end
	if (foundIndexes.get(currentFoundIndex) == foundIndexes.get(foundIndexes.size() - 1))
		nextSearch.setEnabled(false);
	else
		nextSearch.setEnabled(true);
	
	infoSearch.setText((currentFoundIndex + 1) + "/" + foundIndexes.size());

	// To force components resizing if needed
	compositeSearch.layout();
}
 
Example 5
Project: Hydrograph   File: MouseDownSchemaGridListener.java   View Source Code Vote up 5 votes
@Override
public void mouseAction(PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helpers, Event event, Widget... widgets) {
	 Table table=(Table)widgets[0];
	 Label label=(Label)event.widget;
	 Event e = new Event();
        e.item = (TableItem) label.getData("_TABLEITEM");
        table.setSelection(new TableItem[] { (TableItem) e.item });
        table.notifyListeners(SWT.Selection, e);
}