### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.tests Index: Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestCellEditorCreation.java =================================================================== RCS file: Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestCellEditorCreation.java diff -N Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestCellEditorCreation.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestCellEditorCreation.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.jface.tests.viewers; + +import junit.framework.TestCase; + +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +/** + * @since 3.5 + * + */ +public class TestCellEditorCreation extends TestCase{ + + /** + * @param testName + */ + /*public TestCellEditorCreation(String testName) { + super(); + + }*/ + + protected void setUp() throws Exception { + super.setUp(); + + // ensure we've initialized a display for this thread + Display.getDefault(); + } + + + public void testCreation(){ + try{ + Shell shell=new Shell(Display.getDefault()); + shell.open(); + new FailingCellEditor(shell); + + }catch(Exception e){ + fail("TestCellEditorCreation.testCreation() failed: " +e); + } + } + + private class FailingCellEditor extends CellEditor{ + + private Object[] values; + + /** + * @param shell + */ + public FailingCellEditor(Shell shell) { + super(shell); + values=new Object[3]; + } + + /* + * Call initialise in supers const + */ + + /*protected void initialise(){ + + }*/ + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.CellEditor#createControl(org.eclipse.swt.widgets.Composite) + */ + protected Control createControl(Composite parent) { + getMyValue(); + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.CellEditor#doGetValue() + */ + protected Object doGetValue() { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.CellEditor#doSetFocus() + */ + protected void doSetFocus() { + + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.CellEditor#doSetValue(java.lang.Object) + */ + protected void doSetValue(Object value) { + + } + private Object getMyValue(){ + if(values[1]==null){ + values[1]=new Object(); + } + return values[1]; + } + } + + +}