## org.eclipse.emf.ecoretools.tabbedproperties.sections.widgets
Class CSingleObjectChooser

    java.lang.Object
      org.eclipse.swt.widgets.Widget
          org.eclipse.swt.widgets.Control
              org.eclipse.swt.widgets.Scrollable
                  org.eclipse.swt.widgets.Composite
                      org.eclipse.emf.ecoretools.tabbedproperties.sections.widgets.CSingleObjectChooser

All Implemented Interfaces:
  org.eclipse.swt.graphics.Drawable

Direct Known Subclasses:
  GoToReferenceComposite

    public class CSingleObjectChooser

extends org.eclipse.swt.widgets.Composite

A field widget and a Button that allow you to retrieve an object contained in a list of objects Creation 6 avr. 2006

Field Summary

Fields inherited from class org.eclipse.swt.widgets.Composite
`embeddedHandle`

Fields inherited from class org.eclipse.swt.widgets.Widget
`handle`

Constructor Summary
`CSingleObjectChooser(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory factory, int style)` Constructor

Method Summary
`void` `addSelectionListener(org.eclipse.swt.events.SelectionListener listener)` Add a SelectionListener on both the CCombo and the Button
`protected void` `createContents(org.eclipse.swt.widgets.Composite parent)` Creates the UI.
`protected int` `getNumberOfColumns()` Returns the number of columns in this composite.
`java.lang.Object` `getSelection()` Returns the selected object
`protected org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory` `getWidgetFactory()`
`protected void` `hookListeners()` Adds the listeners on the choose button.
`void` `removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)` Remove the SelectionListener of the CCombo and the Button
`void` `setChangeable(boolean isChangeable)` Set whether the Choose button is enabled
`void` `setChoices(java.lang.Object[] objs)` Set the objects in which the user can choose.
`void` `setEditable(boolean isEditable)` Sets the editable state of the text field.
`void` `setEnabled(boolean enabled)` Enables/disables itself, and also its contained text and button
`void` `setLabelProvider(org.eclipse.jface.viewers.ILabelProvider provider)` Set the provider that displays the objects
`void` `setSection(AbstractTabbedPropertySection abstractTabbedPropertySection)`
`void` `setSelection(java.lang.Object selection)` Set the selection of the comboViewer

Methods inherited from class org.eclipse.swt.widgets.Composite
`changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList`

Methods inherited from class org.eclipse.swt.widgets.Scrollable
`computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar`

Methods inherited from class org.eclipse.swt.widgets.Control

`addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getData, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update`

Methods inherited from class org.eclipse.swt.widgets.Widget
`addDisposeListener, addListener, checkWidget, dispose, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CSingleObjectChooser

    public CSingleObjectChooser(org.eclipse.swt.widgets.Composite parent,
                                org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory factory,
                                int style)

  Constructor

  Parameters:
    `parent` - the parent Composite
    `factory` - the factory necessary to create the widget
    `style` -

Method Detail

### createContents

    protected void createContents(org.eclipse.swt.widgets.Composite parent)

  Creates the UI. User must call the super method to create the main widgets (buttons) to this composite.

  Parameters:
    `parent` - this widget

### getNumberOfColumns

    protected int getNumberOfColumns()

  Returns the number of columns in this composite. The default object is 2 because the main composite have 2 widgets. Returning a number less than 2 will be ingnored.

  Returns:
    The number of columns to set in this composite. It must be greater or equals than 2

### hookListeners

    protected void hookListeners()

  Adds the listeners on the choose button. If user overrides this method, he must call the super method to add the corresponding selection listener, otherwise disfunctions may occur

### setChoices

    public void setChoices(java.lang.Object[] objs)

  Set the objects in which the user can choose.

  Parameters:
    `objs` - the list of objects

### setEditable

    public void setEditable(boolean isEditable)

  Sets the editable state of the text field. The default value is READ-ONLY. However clients may set this value as true by calling this method

  Parameters:
    `isEditable` -

### setLabelProvider

    public void setLabelProvider(org.eclipse.jface.viewers.ILabelProvider provider)

  Set the provider that displays the objects

  Parameters:
    `provider` - the LabelProvider

### setChangeable

    public void setChangeable(boolean isChangeable)

  Set whether the Choose button is enabled

  Parameters:
    `isChangeable` -

### getSelection

    public java.lang.Object getSelection()

  Returns the selected object

  Returns:
    the selection

### setSelection

    public void setSelection(java.lang.Object selection)

  Set the selection of the comboViewer

  Parameters:
    `selection` - the selected object

### addSelectionListener

    public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)

  Add a SelectionListener on both the CCombo and the Button

  Parameters:
    `listener` -

### removeSelectionListener

    public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)

  Remove the SelectionListener of the CCombo and the Button

  Parameters:
    `listener` -

### getWidgetFactory

    protected org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory getWidgetFactory()

  Returns:
    the widgetFactory

### setEnabled

    public void setEnabled(boolean enabled)

  Enables/disables itself, and also its contained text and button

  Overrides:
    `setEnabled` in class `org.eclipse.swt.widgets.Control`
  See Also:
    `Control.setEnabled(boolean)`

### setSection

    public void setSection(AbstractTabbedPropertySection abstractTabbedPropertySection)

Copyright 2007 Anyware Technologies. All Rights Reserved.