org.eclipse.jface.viewers.DialogCellEditor Java Examples

The following examples show how to use org.eclipse.jface.viewers.DialogCellEditor. 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: AbstractConversionTable.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Create a cell editor that enables to select a class.
 *
 * @return the cell editor.
 */
protected CellEditor createClassCellEditor() {
	return new DialogCellEditor(getControl()) {
		@Override
		protected Object openDialogBox(Control cellEditorWindow) {
			final OpenTypeSelectionDialog dialog = new OpenTypeSelectionDialog(
					getControl().getShell(),
					false,
					PlatformUI.getWorkbench().getProgressService(),
					null,
					IJavaSearchConstants.TYPE);
			dialog.setTitle(JavaUIMessages.OpenTypeAction_dialogTitle);
			dialog.setMessage(JavaUIMessages.OpenTypeAction_dialogMessage);
			final int result = dialog.open();
			if (result != IDialogConstants.OK_ID) {
				return null;
			}
			final Object[] types = dialog.getResult();
			if (types == null || types.length != 1 || !(types[0] instanceof IType)) {
				return null;
			}
			final IType type = (IType) types[0];
			final String name = type.getFullyQualifiedName();
			return Strings.emptyIfNull(name);
		}
	};
}