当前位置: 首页>>代码示例>>Java>>正文


Java Table.getSelectionIndex方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Table.getSelectionIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getSelectionIndex方法的具体用法?Java Table.getSelectionIndex怎么用?Java Table.getSelectionIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.Table的用法示例。


在下文中一共展示了Table.getSelectionIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteRow

import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
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();
	
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:JoinMapDialog.java

示例2: deleteRow

import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
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();

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:27,代码来源:LookupMapDialog.java

示例3: selectionListenerAction

import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
@Override
	public void selectionListenerAction(
			PropertyDialogButtonBar propertyDialogButtonBar,
			ListenerHelper helpers, Widget... widgets) {

		ELTGridDetails gridDetails = (ELTGridDetails) helpers.get(HelperType.SCHEMA_GRID);
		Table table =gridDetails.getTableViewer().getTable();
		int temp = table.getSelectionIndex();
		int[] indexs=table.getSelectionIndices();
		if (temp == -1) {
			WidgetUtility.errorMessage("Please Select row to delete");
		} else {
			table.remove(indexs);
			ArrayList tempList= new ArrayList();
			for (int index :indexs) { 
//				PropertyField test =(PropertyField) gridDetails.getGrids().get(index);
//				tempList.add(test);
			}
			 gridDetails.getGrids().removeAll(tempList); 
			
		}		
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:ELTTransformDeleteSelectionListener.java

示例4: deleteRow

import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void deleteRow(TableViewer parameterTableViewer ){
	Table table = parameterTableViewer.getTable();
	int selectionIndex = table.getSelectionIndex();
	int[] indexs = table.getSelectionIndices();
	if (selectionIndex == -1) {
		WidgetUtility
				.errorMessage(ErrorMessages.SELECT_ROW_TO_DELETE);
	} else {
		table.remove(indexs);
		int itemsRemoved = 0;
		for (int index : indexs) {
			parameters.remove(index - itemsRemoved);
			itemsRemoved++;
		}
		parameterTableViewer.getTable().removeAll();
		parameterTableViewer.refresh();
	}
	
	if(indexs.length == 1 && parameters.size() > 0){//only one item is deleted
		if(parameters.size() == 1){//list contains only one element
			table.select(0);// select the first element
			parameterTableViewer.editElement(parameterTableViewer.getElementAt(0), 0);
		}
		else if(parameters.size() == indexs[0]){//deleted last item 
			table.select(parameters.size() - 1);//select the last element which now at the end of the list
			parameterTableViewer.editElement(parameterTableViewer.getElementAt(parameters.size() - 1), 0);
		}
		else if(parameters.size() > indexs[0]){//deleted element from middle of the list
			table.select( indexs[0] == 0 ? 0 : (indexs[0] - 1) );//select the element from at the previous location
			parameterTableViewer.editElement(parameterTableViewer.getElementAt(indexs[0] == 0 ? 0 : (indexs[0] - 1)), 0);
		}
	}
	else if(indexs.length >= 2){//multiple items are selected for deletion
		if(indexs[0] == 0){//delete from 0 to ...
			if(parameters.size() >= 1){//list contains only one element
				table.select(0);//select the remaining element
				parameterTableViewer.editElement(parameterTableViewer.getElementAt(0), 0);
			}
		}
		else{//delete started from element other than 0th element
			table.select((indexs[0])-1);//select element before the start of selection   
			parameterTableViewer.editElement(parameterTableViewer.getElementAt((indexs[0])-1), 0);
		}
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:46,代码来源:MultiParameterFileDialog.java

示例5: setCursorOnDeleteRow

import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
/**
 * Set the cursor on delete the row from table.
 * @param tableViewer
 * @param gridList
 */
public static void setCursorOnDeleteRow(TableViewer tableViewer, List<?> gridList){
	Table table = tableViewer.getTable();
	int[] indexes = table.getSelectionIndices();
	if (table.getSelectionIndex() == -1) {
		WidgetUtility.errorMessage(ERROR_MESSAGE);
	} else {
		table.remove(indexes);
		List listOfItemsToRemove= new ArrayList();
		for (int index : indexes) { 
			listOfItemsToRemove.add(gridList.get(index));
		}
		gridList.removeAll(listOfItemsToRemove);
		
	//highlight after deletion
	if(indexes.length == 1 && gridList.size() > 0){//only one item is deleted
		if(gridList.size() == 1){//list contains only one element
			table.select(0);// select the first element
			tableViewer.editElement(tableViewer.getElementAt(0), 0);
		}
		else if(gridList.size() == indexes[0]){//deleted last item 
			table.select(gridList.size() - 1);//select the last element which now at the end of the list
			tableViewer.editElement(tableViewer.getElementAt(gridList.size() - 1), 0);
		}
		else if(gridList.size() > indexes[0]){//deleted element from middle of the list
			table.select( indexes[0] == 0 ? 0 : (indexes[0] - 1) );//select the element from at the previous location
			tableViewer.editElement(tableViewer.getElementAt(indexes[0] == 0 ? 0 : (indexes[0] - 1)), 0);
		}
	}
	else if(indexes.length >= 2){//multiple items are selected for deletion
		if(indexes[0] == 0){//delete from 0 to ...
			if(gridList.size() >= 1){//list contains only one element
				table.select(0);//select the remaining element
				tableViewer.editElement(tableViewer.getElementAt(0), 0);
			}
		}
		else{//delete started from element other than 0th element
			table.select((indexes[0])-1);//select element before the start of selection   
			tableViewer.editElement(tableViewer.getElementAt((indexes[0])-1), 0);
		}
	}
  }
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:48,代码来源:WidgetUtility.java

示例6: selectionListenerAction

import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
@Override
public void selectionListenerAction(
		PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helpers, Widget... widgets) {
	propertyDialogButtonBar.enableApplyButton(true);
	ELTGridDetails gridDetails = (ELTGridDetails) helpers.get(HelperType.SCHEMA_GRID);
	
	TableViewer tableViewer = gridDetails.getTableViewer();
	Table table = tableViewer.getTable();
	int[] indexes=table.getSelectionIndices();
	if (table.getSelectionIndex() == -1) {
		WidgetUtility.errorMessage("Please Select row to delete");
	} else {
		table.remove(indexes);
		List listOfItemsToRemove= new ArrayList();
		for (int index : indexes) { 
			listOfItemsToRemove.add(gridDetails.getGrids().get(index));
		}
		List<GridRow> gridsList = gridDetails.getGrids();
		gridsList.removeAll(listOfItemsToRemove);
		
		
		//highlight after deletion
		if(indexes.length == 1 && gridsList.size() > 0){//only one item is deleted
			if(gridsList.size() == 1){//list contains only one element
				table.select(0);// select the first element
				tableViewer.editElement(tableViewer.getElementAt(0), 0);
			}
			else if(gridsList.size() == indexes[0]){//deleted last item 
				table.select(gridsList.size() - 1);//select the last element which now at the end of the list
				tableViewer.editElement(tableViewer.getElementAt(gridsList.size() - 1), 0);
			}
			else if(gridsList.size() > indexes[0]){//deleted element from middle of the list
				table.select( indexes[0] == 0 ? 0 : (indexes[0] - 1) );//select the element from at the previous location
				tableViewer.editElement(tableViewer.getElementAt(indexes[0] == 0 ? 0 : (indexes[0] - 1)), 0);
			}
		}
		else if(indexes.length >= 2){//multiple items are selected for deletion
			if(indexes[0] == 0){//delete from 0 to ...
				if(gridsList.size() >= 1){//list contains only one element
					table.select(0);//select the remaining element
					tableViewer.editElement(tableViewer.getElementAt(0), 0);
				}
			}
			else{//delete started from element other than 0th element
				table.select((indexes[0])-1);//select element before the start of selection   
				tableViewer.editElement(tableViewer.getElementAt((indexes[0])-1), 0);
			}
		}
	}
	
	if (gridDetails.getGrids().size() >= 1) {
		((Button) widgets[1]).setEnabled(true);
	} else {
		((Button) widgets[1]).setEnabled(false);
	}
	
	if (gridDetails.getGrids().size() >= 2) {
		((Button) widgets[2]).setEnabled(true);
		((Button) widgets[3]).setEnabled(true);
	} else {
		((Button) widgets[2]).setEnabled(false);
		((Button) widgets[3]).setEnabled(false);
	}
	((Component)helpers.get(HelperType.COMPONENT)).setLatestChangesInSchema(true);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:67,代码来源:ELTGridDeleteSelectionListener.java


注:本文中的org.eclipse.swt.widgets.Table.getSelectionIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。