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


Java TableViewerEditor类代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.TableViewerEditor的典型用法代码示例。如果您正苦于以下问题:Java TableViewerEditor类的具体用法?Java TableViewerEditor怎么用?Java TableViewerEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setTableViewer

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
public TableViewer setTableViewer(TableViewer tableViewer, Composite composite, String[] prop,
		IStructuredContentProvider iStructuredContentProvider, ITableLabelProvider iTableLabelProvider) {

	tableViewer.setContentProvider(iStructuredContentProvider);

	tableViewer.setColumnProperties(prop);

	tableViewerTable = tableViewer.getTable();

	tableViewerTable.setVisible(true);
	tableViewerTable.setLinesVisible(true);
	tableViewerTable.setHeaderVisible(true);
	createTableColumns(tableViewerTable, prop);
	editors = createCellEditorList(tableViewerTable, prop.length);
	tableViewer.setCellEditors(editors);

	TableViewerEditor.create(tableViewer, new ColumnViewerEditorActivationStrategy(tableViewer),
			ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.TABBING_HORIZONTAL
					| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL);

	return tableViewer;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:ELTOperationClassDialog.java

示例2: setTableViewer

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
public TableViewer setTableViewer(TableViewer tableViewer, Composite composite, String[] prop,
		IStructuredContentProvider iStructuredContentProvider) {

	tableViewer.setContentProvider(iStructuredContentProvider);

	tableViewer.setColumnProperties(prop);

	tableViewerTable = tableViewer.getTable();

	tableViewerTable.setVisible(true);
	tableViewerTable.setLinesVisible(true);
	tableViewerTable.setHeaderVisible(true);
	createTableColumns(tableViewerTable, prop);
	editors = createCellEditorList(tableViewerTable, prop.length);
	tableViewer.setCellEditors(editors);

	TableViewerEditor.create(tableViewer, new ColumnViewerEditorActivationStrategy(tableViewer),
			ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.TABBING_HORIZONTAL
					| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL);

	return tableViewer;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:TransformDialog.java

示例3: setupAccessibleCellEditors

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
public static void setupAccessibleCellEditors(final TableViewer viewer, final int flags) {
    Check.notNull(viewer, "viewer"); //$NON-NLS-1$

    try {
        final MultiRowHighlighter cellHighlighter = new MultiRowHighlighter(viewer);

        final TableViewerFocusCellManager focusCellManager =
            new TableViewerFocusCellManager(viewer, cellHighlighter);

        final ColumnViewerEditorActivationStrategy activationStrategy =
            new ColumnViewerEditorActivationStrategy(viewer) {
                @Override
                protected boolean isEditorActivationEvent(final ColumnViewerEditorActivationEvent event) {
                    /*
                     * Deny any cell editor activation if there are multiple
                     * rows selected.
                     */
                    if (getViewer().getSelection() != null
                        && getViewer().getSelection() instanceof StructuredSelection
                        && ((StructuredSelection) getViewer().getSelection()).size() > 1) {
                        return false;
                    }

                    if (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED
                        && event.keyCode == SWT.CR) {
                        return true;
                    }

                    return super.isEditorActivationEvent(event);
                }
            };

        TableViewerEditor.create(viewer, focusCellManager, activationStrategy, flags);
    } catch (final Exception e) {
        log.warn("Could not configure cell editor accessibility", e); //$NON-NLS-1$
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:38,代码来源:CellEditorAccessibility.java

示例4: enableTabbing

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
private void enableTabbing(TableViewer tableViewer) {
	TableViewerEditor.create(tableViewer,
			new ColumnViewerEditorActivationStrategy(tableViewer),
			ColumnViewerEditor.KEYBOARD_ACTIVATION
					| ColumnViewerEditor.TABBING_HORIZONTAL
					| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
					| ColumnViewerEditor.TABBING_VERTICAL);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:9,代码来源:MultiParameterFileDialog.java

示例5: addTabFunctionalityInMappingTable

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
private void addTabFunctionalityInMappingTable() {
	TableViewerEditor.create(mappingTableViewer,
			new ColumnViewerEditorActivationStrategy(mappingTableViewer),
			ColumnViewerEditor.KEYBOARD_ACTIVATION
					| ColumnViewerEditor.TABBING_HORIZONTAL
					| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
					| ColumnViewerEditor.TABBING_VERTICAL);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:9,代码来源:JoinMapDialog.java

示例6: initEditBehaviour

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
private void initEditBehaviour(final int type) {
		TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(tableViewer, new FocusCellOwnerDrawHighlighter(tableViewer));
		ColumnViewerEditorActivationStrategy activationSupport = new ColumnViewerEditorActivationStrategy(tableViewer) {
		    @Override
			protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
		    	logger.debug(event.toString());
		    	
				boolean singleSelect = ((IStructuredSelection)tableViewer.getSelection()).size() == 1;
				
				int mouseActivationType= 
						type == 0 ? ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION : ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION;
				
				boolean isLeftMouseSelect = event.eventType == mouseActivationType && ((MouseEvent)event.sourceEvent).button == 1;

				return singleSelect && (isLeftMouseSelect
						|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC
						|| event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL);
		    	
		    	
		        // Enable editor only with mouse double click
//		        if (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION) {
//		            EventObject source = event.sourceEvent;
//		            if (source instanceof MouseEvent && ((MouseEvent)source).button == 3)
//		                return false;
//
//		            return true;
//		        }
//
//		        return false;
		    }
		};
		
		TableViewerEditor.create(tableViewer, focusCellManager, activationSupport, ColumnViewerEditor.TABBING_HORIZONTAL | 
			    ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | 
			    ColumnViewerEditor.TABBING_VERTICAL |
			    ColumnViewerEditor.KEYBOARD_ACTIVATION);
	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:38,代码来源:WordGraphEditor.java

示例7: setViewerCellEditingOnDblClick

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
/**
 * Setups the start of cell editing on a {@link TableViewer} when a {@link DoubleClickEvent} occurs.
 * 
 * @param tviewer
 *          the table viewer
 */
public static void setViewerCellEditingOnDblClick(TableViewer tviewer) {
	ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(tviewer) {
		protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
			return event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION;
		}
	};

	TableViewerEditor.create(tviewer, actSupport, ColumnViewerEditor.DEFAULT);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:16,代码来源:UIUtil.java

示例8: setCellEditSupport

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
/**
 * Initialize cell editing.
 * 
 * @param viewer
 */
public static void setCellEditSupport(final TableViewer viewer) {

	final TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(
			viewer,
			new FocusCellOwnerDrawHighlighter(viewer));

	final ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(viewer) {
		@Override
		protected boolean isEditorActivationEvent(final ColumnViewerEditorActivationEvent event) {

			return (event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL)
					|| (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION)
					|| ((event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED)
							&& (event.keyCode == SWT.CR))
					|| (event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC);
		}
	};

	TableViewerEditor.create(//
			viewer,
			focusCellManager,
			actSupport,
			ColumnViewerEditor.TABBING_HORIZONTAL //
					| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR //
					| ColumnViewerEditor.TABBING_VERTICAL
					| ColumnViewerEditor.KEYBOARD_ACTIVATION);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:33,代码来源:UI.java

示例9: makeEditable

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
/**
 * @param activationStrategy
 * @param feature
 */
public TableViewerBuilder makeEditable(ColumnViewerEditorActivationStrategy activationStrategy, int feature) {
	ColumnViewerEditorActivationStrategy defaultActivationStrategy = new ColumnViewerEditorActivationStrategy(
			viewer) {
		protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
			return event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
					|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
		}
	};
	TableViewerEditor.create(viewer, activationStrategy == null ? defaultActivationStrategy : activationStrategy,
			feature < 0 ? ColumnViewerEditor.DEFAULT : feature);
	return this;
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:17,代码来源:TableViewerBuilder.java

示例10: createTargetTable

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
private void createTargetTable(Composite container) {
	targetTableViewer = new TableViewer(container, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
	targetTable = targetTableViewer.getTable();
	GridData gd_table_1 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
	gd_table_1.heightHint = 401;
	
	if(OSValidator.isMac()){
		gd_table_1.widthHint = 363;
	}else{
		gd_table_1.widthHint = 352;
	}
	targetTable.setLayoutData(gd_table_1);

	attachTargetTableListeners();

	targetTableViewer.setContentProvider(new SecondaryColumnKeysContentProvider());
	targetTableViewer.setLabelProvider(new SecondaryColumnKeysLabelProvider());
	targetTableViewer.setInput(propertyList);

	TableColumn targetTableColumnFieldName = new TableColumn(targetTable, SWT.LEFT);
	targetTableColumnFieldName.setText(COLUMNNAME); //$NON-NLS-1$
	TableColumn targetTableColumnSortOrder = new TableColumn(targetTable, SWT.LEFT_TO_RIGHT);
	targetTableColumnSortOrder.setText(SORTORDER); //$NON-NLS-1$

	for (int i = 0, n = targetTable.getColumnCount(); i < n; i++) {
		targetTable.getColumn(i).pack();
	}
	targetTableColumnFieldName.setWidth(175);
	
	if(OSValidator.isMac()){
		targetTableColumnSortOrder.setWidth(128);
	}else{
		targetTableColumnSortOrder.setWidth(116);
	}
	
	targetTable.setHeaderVisible(true);
	targetTable.setLinesVisible(true);

	// enables the tab functionality
	TableViewerEditor.create(targetTableViewer, new ColumnViewerEditorActivationStrategy(targetTableViewer),
			ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.TABBING_HORIZONTAL
					| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL);

	final CellEditor propertyNameeditor = new TextCellEditor(targetTable);

	ComboBoxViewerCellEditor propertyValueeditor = new ComboBoxViewerCellEditor(targetTable, SWT.READ_ONLY);
	propertyValueeditor.setContentProvider(new ArrayContentProvider());
	propertyValueeditor.setLabelProvider(new LabelProvider());
	propertyValueeditor.setInput(new String[] { Constants.ASCENDING_SORT_ORDER, Constants.DESCENDING_SORT_ORDER, Constants.NONE_SORT_ORDER });

	CellEditor[] editors = new CellEditor[] { propertyNameeditor, propertyValueeditor };

	propertyNameeditor.setValidator(createNameEditorValidator(Messages.EmptyColumnNotification));
	propertyValueeditor.setValidator(createValueEditorValidator(Messages.EmptySortOrderNotification));

	targetTableViewer.setColumnProperties(PROPS);
	targetTableViewer.setCellModifier(new SecondaryColumnKeysWidgetCellModifier(targetTableViewer));
	targetTableViewer.setCellEditors(editors);

	loadProperties(targetTableViewer);
	
	if (propertyList.size() != 0) {
		deleteButton.setEnabled(true);
	}
	if (propertyList.size() >= 2) {
		upButton.setEnabled(true);
		downButton.setEnabled(true);
	}

	dropTarget = new DropTarget(targetTable, DND.DROP_MOVE);
	dropTarget.setTransfer(new Transfer[] { TextTransfer.getInstance() });
	dropTarget.addDropListener(new DropTargetAdapter() {
		public void drop(DropTargetEvent event) {
			for (String fieldName : getformatedData((String) event.data))
					addNewProperty(targetTableViewer, fieldName);
			enableControlButtons();
		}
	});

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

示例11: createCustomArea

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
@Override
protected Control createCustomArea(final Composite parent) {
	Composite body = new Composite(parent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(body);
	GridLayoutFactory.fillDefaults().numColumns(2).applyTo(body);

	ToolBar bar = new ToolBar(body, SWT.HORIZONTAL);
	ToolBarManager barMgr = new ToolBarManager(bar);
	barMgr.add(new AlignLeftAction());
	barMgr.add(new AlignCenterAction());
	barMgr.add(new AlignRightAction());
	barMgr.add(new InsColBeforeAction());
	barMgr.add(new InsColAfterAction());
	barMgr.add(new RmvColAction());
	barMgr.add(new InsRowAboveAction());
	barMgr.add(new InsRowBelowAction());
	barMgr.add(new RmvRowAction());
	barMgr.update(true);
	bar.pack();

	viewer = new TableViewer(body, style);
	GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(viewer.getControl());

	table = viewer.getTable();
	table.setHeaderVisible(true);
	table.setLinesVisible(true);

	cellMgr = new TableViewerFocusCellManager(viewer, new FocusCellOwnerDrawHighlighter(viewer));

	ColumnViewerEditorActivationStrategy activator = new ColumnViewerEditorActivationStrategy(viewer) {

		@Override
		protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
			return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
					|| event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
					|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
					|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
		}
	};

	TableViewerEditor.create(viewer, cellMgr, activator, features);

	MenuManager mgr = new MenuManager();
	mgr.add(new InsColBeforeAction());
	mgr.add(new InsColAfterAction());
	mgr.add(new RmvColAction());
	mgr.add(new Separator());
	mgr.add(new InsRowAboveAction());
	mgr.add(new InsRowBelowAction());
	mgr.add(new RmvRowAction());
	viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl()));

	tableModel = new TableModel();
	setInput(part);

	return body;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:58,代码来源:TableDialog.java

示例12: setGenericTable

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
@Override
public void setGenericTable(IGenericTable table) {
  this.table = table;

  setUseHashlookup(true);
  setContentProvider(table.getContentProvider());
  if (!(table.getContentProvider() instanceof IPageableStructeredContentProvider)) {
    this.comparator = new GenericComparator(table);
    setComparator(comparator);
  }

  ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(
      this) {

    @Override
    protected boolean isEditorActivationEvent(
        ColumnViewerEditorActivationEvent event) {
      return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
          || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
          || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
    }
  };

  TableViewerEditor.create(this, actSupport,
      ColumnViewerEditor.TABBING_HORIZONTAL
          | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
          | ColumnViewerEditor.TABBING_VERTICAL
          | ColumnViewerEditor.KEYBOARD_ACTIVATION);

  createColumns();
  // try {
  // getTable().setRedraw(false);
  // calculateSizes();
  // }
  // finally {
  // getTable().setRedraw(true);
  // }

  // setInput(null);
  getTable().setHeaderVisible(true);
  getTable().setLinesVisible(true);
  getTable().layout();

  for (final IGenericTableColumn c : table.getColumns()) {
    if (c.getCellActivateHandler() != null) {
      getTable().addMouseMoveListener(mouseMoveListener);
      getTable().addMouseListener(mouseListener);
      break;
    }
  }
}
 
开发者ID:incentivetoken,项目名称:offspring,代码行数:52,代码来源:GenerericTableViewer.java

示例13: createViewer

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
private void createViewer(Composite parent) {
	viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);

	TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(viewer,
			new FocusCellOwnerDrawHighlighter(viewer));

	ColumnViewerEditorActivationStrategy activationSupport = new ColumnViewerEditorActivationStrategy(viewer) {
		protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
			// Enable editor only with mouse double click
			if (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION) {
				EventObject source = event.sourceEvent;
				if (source instanceof MouseEvent && ((MouseEvent) source).button == 3)
					return false;

				return true;
			}

			return false;
		}
	};

	TableViewerEditor.create(viewer, focusCellManager, activationSupport,
			ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
					| ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);

	createColumns(parent, viewer);
	final Table table = viewer.getTable();
	table.setHeaderVisible(true);
	table.setLinesVisible(true);

	viewer.setContentProvider(new ArrayContentProvider());
	viewer.addSelectionChangedListener(new ISelectionChangedListener() {

		@Override
		public void selectionChanged(SelectionChangedEvent arg0) {
			if (null != viewer.getTable() && viewer.getTable().getSelectionIndex() > 0) {
				setPageComplete(true);
			}
		}
	});
	// get the content for the viewer, setInput will call getElements in the
	// contentProvider
	viewer.setInput(commits);
	// make the selection available to other views
	// define layout for the viewer
	GridData gridData = new GridData();
	gridData.verticalAlignment = GridData.FILL;
	gridData.horizontalSpan = 2;
	gridData.grabExcessHorizontalSpace = true;
	gridData.grabExcessVerticalSpace = true;
	gridData.horizontalAlignment = GridData.FILL;
	viewer.getControl().setLayoutData(gridData);
}
 
开发者ID:SEMERU-WM,项目名称:ChangeScribe,代码行数:54,代码来源:HistoryPage.java

示例14: customizeViewer

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
private void customizeViewer(TableViewer viewer) {
	// Name Id column
	TableViewerColumn idNameColViewer = new TableViewerColumn(viewer, SWT.NONE);
	idNameColViewer.setLabelProvider(new USLabelProvider(ID_NAME_COL_US_INDEX));
	idNameColViewer.setEditingSupport(new TextCellEditingSupport(viewer, ID_NAME_COL_US_INDEX));
	TableColumn idNameTblCol = idNameColViewer.getColumn();
	idNameTblCol.setWidth(80);
	idNameTblCol.setText(ID_NAME_COL_US_LABEL);

	// Name column
	TableViewerColumn nameCol = new TableViewerColumn(viewer, SWT.NONE);
	nameCol.setLabelProvider(new USLabelProvider(NAME_COL_US_INDEX));
	nameCol.setEditingSupport(new TextCellEditingSupport(viewer, NAME_COL_US_INDEX));
	TableColumn nameTblCol = nameCol.getColumn();
	nameTblCol.setWidth(280);
	nameTblCol.setText(NAME_COL_US_LABEL);

	// Plan Estimation column
	TableViewerColumn estimationColViewer = new TableViewerColumn(viewer, SWT.NONE);
	estimationColViewer.setLabelProvider(new USLabelProvider(ESTIMATION_COL_US_INDEX));
	estimationColViewer.setEditingSupport(new TextCellEditingSupport(viewer, ESTIMATION_COL_US_INDEX));
	TableColumn estimationTblCol = estimationColViewer.getColumn();
	estimationTblCol.setWidth(80);
	estimationTblCol.setText(ESTIMATION_COL_US_LABEL);

	// State column
	TableViewerColumn stateColViewer = new TableViewerColumn(viewer, SWT.NONE);
	stateColViewer.setLabelProvider(new USLabelProvider(STATE_COL_US_INDEX));

	stateColViewer.setEditingSupport(new ComboCellEditingSupport(viewer, userStoriesStates));

	TableColumn stateTblCol = stateColViewer.getColumn();
	stateTblCol.setWidth(140);
	stateTblCol.setText(STATE_COL_US_LABEL);

	// 
    TableViewerEditor.create(viewer,
    						 new TableViewerFocusCellManager(viewer,
    								 						 new FocusCellOwnerDrawHighlighter(viewer)),
    						 new EditorActivationStrategy(viewer),
    						 ColumnViewerEditor.TABBING_HORIZONTAL
  			                   | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR);
  	
}
 
开发者ID:jaloncad,项目名称:redmine.rap,代码行数:45,代码来源:PlanView.java

示例15: setUpCellEditor

import org.eclipse.jface.viewers.TableViewerEditor; //导入依赖的package包/类
protected void setUpCellEditor(ColumnViewer viewer){
	// set up validation of the cell editors
	textCellEditor = new TextCellEditor((Composite) viewer.getControl());

	textCellEditor.addListener(new ICellEditorListener() {
		@Override
		public void editorValueChanged(boolean oldValidState, boolean newValidState){
			if (newValidState) {
				textCellEditor.getControl().setBackground(
					Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
			} else {
				textCellEditor.getControl().setBackground(
					Display.getCurrent().getSystemColor(SWT.COLOR_RED));
			}
		}
		
		@Override
		public void cancelEditor(){
			textCellEditor.getControl().setBackground(
				Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		}
		
		@Override
		public void applyEditorValue(){
			textCellEditor.getControl().setBackground(
				Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		}
	});
	
	focusCell =
		new TableViewerFocusCellManager((TableViewer) viewer, new FocusCellHighlighter(viewer) {
		
	});
	
	ColumnViewerEditorActivationStrategy actSupport =
		new ColumnViewerEditorActivationStrategy(viewer) {
			@Override
			protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event){
				return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
					|| event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
					|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
					|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.KEYPAD_CR)
					|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
			}
		};
	
	TableViewerEditor.create((TableViewer) viewer, focusCell, actSupport,
		ColumnViewerEditor.TABBING_VERTICAL
			| ColumnViewerEditor.KEYBOARD_ACTIVATION);
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:51,代码来源:LabOrderEditingSupport.java


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