org.eclipse.jface.viewers.ICellEditorListener Java Examples

The following examples show how to use org.eclipse.jface.viewers.ICellEditorListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReportPropertySheetPage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new cell editor listener.
 */
private void createEditorListener( )
{
	editorListener = new ICellEditorListener( ) {

		public void cancelEditor( )
		{
			deactivateCellEditor( );
		}

		public void editorValueChanged( boolean oldValidState,
				boolean newValidState )
		{
		}

		public void applyEditorValue( )
		{
			applyValue( );
			if ( changed )
				refresh( );
		}
	};
}
 
Example #2
Source File: AdvancePropertyDescriptor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new cell editor listener.
 */
private void createEditorListener( )
{
	editorListener = new ICellEditorListener( ) {

		public void cancelEditor( )
		{
			deactivateCellEditor( );
		}

		public void editorValueChanged( boolean oldValidState,
				boolean newValidState )
		{

		}

		public void applyEditorValue( )
		{
			applyValue( );
			if ( changed )
				refresh( );
		}
	};
}
 
Example #3
Source File: ProcessTextNonResizableEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void showPrimarySelection() {
	if (getHostFigure() instanceof WrappingLabel) {
		final GraphicalEditPart ep = (GraphicalEditPart) getHost();
		if (ep.resolveSemanticElement() instanceof Activity) {
			final CustomTextDirectEditManager manager = new CustomTextDirectEditManager(ep,
					CustomTextDirectEditManager.getTextCellEditorClass(ep),
					ProcessEditPartFactory.getTextCellEditorLocator((ITextAwareEditPart) ep));
			manager.show();
			manager.getCellEditor().addListener(new ICellEditorListener() {

				@Override
				public void editorValueChanged(boolean oldValidState, boolean newValidState) {
				}

				@Override
				public void cancelEditor() {
					ep.getViewer().select(getHost().getParent());
				}

				@Override
				public void applyEditorValue() {
					ep.getViewer().select(getHost().getParent());
				}
			});
		} else {
			((WrappingLabel) getHostFigure()).setSelected(true);
		}
	} else {
		showSelection();
		showFocus();
	}
}
 
Example #4
Source File: ProcessTextSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void showPrimarySelection() {
	if (getHostFigure() instanceof WrappingLabel) {
		final GraphicalEditPart ep = (GraphicalEditPart) getHost();
		if (ep.resolveSemanticElement() instanceof Activity) {
			final CustomTextDirectEditManager manager = new CustomTextDirectEditManager(ep,
					CustomTextDirectEditManager.getTextCellEditorClass(ep),
					ProcessEditPartFactory.getTextCellEditorLocator((ITextAwareEditPart) ep));
			manager.show();
			manager.getCellEditor().addListener(new ICellEditorListener() {

				@Override
				public void editorValueChanged(boolean oldValidState, boolean newValidState) {
				}

				@Override
				public void cancelEditor() {
					ep.getViewer().select(getHost().getParent());
				}

				@Override
				public void applyEditorValue() {
					ep.getViewer().select(getHost().getParent());
				}
			});
		} else {
			((WrappingLabel) getHostFigure()).setSelected(true);
		}
	} else {
		showSelection();
		showFocus();
	}
}
 
Example #5
Source File: ReflectiveEditingSupport.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public ReflectiveEditingSupport(TableViewer columnViewer, String field,
	ICellEditorValidator validator, boolean markValidationFailed){
	super(columnViewer);
	this.field = field;
	this.editor = new TextCellEditor(columnViewer.getTable());
	if (validator != null)
	{
		editor.setValidator(validator);
		
		if (markValidationFailed)
		{
			editor.addListener(new ICellEditorListener() {
				@Override
				public void editorValueChanged(boolean oldValidState, boolean newValidState){
					if (newValidState) {
						editor.getControl().setBackground(
							Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
					} else {
						editor.getControl().setBackground(
							Display.getCurrent().getSystemColor(SWT.COLOR_RED));
					}
				}
				
				@Override
				public void cancelEditor(){
					editor.getControl().setBackground(
						Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
				}
				
				@Override
				public void applyEditorValue(){
					editor.getControl().setBackground(
						Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
				}
			});
		}
	}
}
 
Example #6
Source File: LabOrderEditingSupport.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
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);
}
 
Example #7
Source File: LabResultEditingSupport.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
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 TreeViewerFocusCellManager((TreeViewer) 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;
			}
		};
	
	TreeViewerEditor.create((TreeViewer) viewer, focusCell, actSupport,
		ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);
}