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

The following are Jave code examples for showing how to use setFocus() 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: 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();
}