本文整理汇总了Java中org.eclipse.swt.widgets.Table.getSelectionIndices方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getSelectionIndices方法的具体用法?Java Table.getSelectionIndices怎么用?Java Table.getSelectionIndices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Table
的用法示例。
在下文中一共展示了Table.getSelectionIndices方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: moveRowUp
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void moveRowUp(){
Table table = mappingTableViewer.getTable();
setValueForCellEditor();
int[] indexes = table.getSelectionIndices();
for (int index : indexes) {
if (index > 0) {
Collections.swap(
(List<LookupMapProperty>) mappingTableItemList,
index, index - 1);
mappingTableViewer.refresh();
}
}
refreshButtonStatus();
}
示例3: moveRowDown
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void moveRowDown(){
Table table = mappingTableViewer.getTable();
setValueForCellEditor();
int[] indexes = table.getSelectionIndices();
for (int i = indexes.length - 1; i > -1; i--) {
if (indexes[i] < mappingTableItemList.size() - 1) {
Collections.swap(
(List<LookupMapProperty>) mappingTableItemList,
indexes[i], indexes[i] + 1);
mappingTableViewer.refresh();
}
}
refreshButtonStatus();
}
示例4: moveRowDown
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void moveRowDown()
{
Table table = mappingTableViewer.getTable();
setValueForCellEditor();
int[] indexes = table.getSelectionIndices();
for (int i = indexes.length - 1; i > -1; i--) {
if (indexes[i] < mappingTableItemList.size() - 1) {
Collections.swap(
(List<LookupMapProperty>) mappingTableItemList,
indexes[i], indexes[i] + 1);
mappingTableViewer.refresh();
}
}
refreshButtonStatus();
}
示例5: moveRowUp
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void moveRowUp()
{
Table table = mappingTableViewer.getTable();
setValueForCellEditor();
int[] indexes = table.getSelectionIndices();
for (int index : indexes) {
if (index > 0) {
Collections.swap(
(List<LookupMapProperty>) mappingTableItemList,
index, index - 1);
mappingTableViewer.refresh();
}
}
refreshButtonStatus();
}
示例6: 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();
}
示例7: 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);
}
}
示例8: moveRowUp
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void moveRowUp( TableViewer parameterTableViewer ){
Table table = parameterTableViewer.getTable();
int[] indexes = table.getSelectionIndices();
for (int index : indexes) {
if (index > 0) {
Collections.swap((List<Parameter>) parameters, index,
index - 1);
parameterTableViewer.refresh();
}
}
}
示例9: moveRowDown
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void moveRowDown(TableViewer parameterTableViewer){
Table table = parameterTableViewer.getTable();
int[] indexes = table.getSelectionIndices();
for (int i = indexes.length - 1; i > -1; i--) {
if (indexes[i] < parameters.size() - 1) {
Collections.swap((List<Parameter>) parameters,
indexes[i], indexes[i] + 1);
parameterTableViewer.refresh();
}
}
}
示例10: moveRowUp
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void moveRowUp(TableViewer nameValueTableViewer){
Table table = nameValueTableViewer.getTable();
int[] indexes = table.getSelectionIndices();
for (int index : indexes) {
if (index > 0) {
Collections.swap(operationClassProperty.getNameValuePropertyList(), index, index - 1);
nameValueTableViewer.refresh();
applyButton.setEnabled(true);
}
}
}
示例11: moveRowDown
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void moveRowDown(TableViewer nameValueTableViewer){
Table table = nameValueTableViewer.getTable();
int[] indexes = table.getSelectionIndices();
for (int i = indexes.length - 1; i > -1; i--) {
if (indexes[i] < operationClassProperty.getNameValuePropertyList().size() - 1) {
Collections.swap(operationClassProperty.getNameValuePropertyList(), indexes[i], indexes[i] + 1);
nameValueTableViewer.refresh();
applyButton.setEnabled(true);
}
}
}
示例12: moveRowUp
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void moveRowUp(TableViewer nameValueTableViewer)
{
Table table = nameValueTableViewer.getTable();
int[] indexes = table.getSelectionIndices();
for (int index : indexes) {
if (index > 0) {
Collections.swap(mappingSheetRow.getNameValueProperty(), index, index - 1);
nameValueTableViewer.refresh();
applyButton.setEnabled(true);
}
}
}
示例13: moveRowDown
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void moveRowDown(TableViewer nameValueTableViewer)
{
Table table = nameValueTableViewer.getTable();
int[] indexes = table.getSelectionIndices();
for (int i = indexes.length - 1; i > -1; i--) {
if (indexes[i] < mappingSheetRow.getNameValueProperty().size() - 1) {
Collections.swap(mappingSheetRow.getNameValueProperty(), indexes[i], indexes[i] + 1);
nameValueTableViewer.refresh();
applyButton.setEnabled(true);
}
}
}
示例14: 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);
}
}
}
示例15: 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);
}
}
}
}