org.eclipse.emf.ecoretools.tabbedproperties.sections
Class AbstractTextPropertySection

java.lang.Object
  extended by org.eclipse.ui.views.properties.tabbed.AbstractPropertySection
      extended by org.eclipse.emf.ecoretools.tabbedproperties.sections.AbstractTabbedPropertySection
          extended by org.eclipse.emf.ecoretools.tabbedproperties.sections.AbstractTextPropertySection
All Implemented Interfaces:
org.eclipse.ui.views.properties.tabbed.ISection
Direct Known Subclasses:
AbstractDoublePropertySection, AbstractIntegerPropertySection, AbstractStringListPropertySection, AbstractStringPropertySection

public abstract class AbstractTextPropertySection
extends AbstractTabbedPropertySection

An abstract implementation of a section with a text field.
Creation 5 apr. 2006
Updated 7 aug. 2006


Field Summary
 
Fields inherited from class org.eclipse.ui.views.properties.tabbed.AbstractPropertySection
STANDARD_LABEL_WIDTH
 
Constructor Summary
AbstractTextPropertySection()
           
 
Method Summary
 void createControls(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage tabbedPropertySheetPage)
           
protected  void createWidgets(org.eclipse.swt.widgets.Composite composite)
          Section widgets should be created inside this method.
protected  void focusIn()
          Handle action when the focus is gained Default action is to do nothing.
protected  void focusOut()
          Handle action when the focus is lost.
protected abstract  java.lang.String getFeatureAsString()
          Get the value of the feature as text for the text field for the section.
protected  TextChangeListener getListener()
           
 org.eclipse.swt.custom.CLabel getNameLabel()
           
protected abstract  java.lang.Object getNewFeatureValue(java.lang.String newText)
          Get the new value of the feature from the text field of the section.
protected abstract  java.lang.Object getOldFeatureValue()
          Returns the feature value from the model as an object type.
protected  int getStyle()
          Get the style of the text widget.
protected  org.eclipse.swt.widgets.Text getText()
           
protected  void handleTextModified()
          Handle the text modified event.
protected  void hookListeners()
          Widgets created at AbstractTabbedPropertySection.createWidgets(Composite) may listen platform events.
protected  boolean isTextValid()
          Check whether the text entered is valid or not.
 void refresh()
           
protected  void setSectionData(org.eclipse.swt.widgets.Composite composite)
          This method should be implemented to set layout data to the widgets created at AbstractTabbedPropertySection.createWidgets(Composite).
protected abstract  void verifyField(org.eclipse.swt.widgets.Event e)
          Subclasses may provide their own checker on the text that is entered by the user and update the 'doit' flag of the Event in consequence.
 
Methods inherited from class org.eclipse.emf.ecoretools.tabbedproperties.sections.AbstractTabbedPropertySection
aboutToBeHidden, aboutToBeShown, adaptToEObject, addListener, clearDecorators, createCommand, getActivePage, getEditingDomain, getEObject, getEObjectList, getFeature, getLabelText, getMainComposite, getMessageManager, getModelListener, getSectionComposite, getStandardLabelWidth, getStatusLineManager, handleModelChanged, isReadOnly, makeContributions, removeListener, setDecorator, setErrorDecorator, setErrorMessage, setInfoDecorator, setInput, setMessage, setWarningDecorator
 
Methods inherited from class org.eclipse.ui.views.properties.tabbed.AbstractPropertySection
dispose, getMinimumHeight, getPart, getSelection, getWidgetFactory, shouldUseExtraSpace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTextPropertySection

public AbstractTextPropertySection()
Method Detail

createControls

public void createControls(org.eclipse.swt.widgets.Composite parent,
                           org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage tabbedPropertySheetPage)
Specified by:
createControls in interface org.eclipse.ui.views.properties.tabbed.ISection
Overrides:
createControls in class AbstractTabbedPropertySection
See Also:
AbstractTabbedPropertySection.createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)

createWidgets

protected void createWidgets(org.eclipse.swt.widgets.Composite composite)
Description copied from class: AbstractTabbedPropertySection
Section widgets should be created inside this method. To set the layout data please implement the AbstractTabbedPropertySection.setSectionData(Composite) If widgets has listeners implement the AbstractTabbedPropertySection.hookListeners().

Overrides:
createWidgets in class AbstractTabbedPropertySection
Parameters:
composite - the parent Composite
See Also:
AbstractTabbedPropertySection.createWidgets(org.eclipse.swt.widgets.Composite)

setSectionData

protected void setSectionData(org.eclipse.swt.widgets.Composite composite)
Description copied from class: AbstractTabbedPropertySection
This method should be implemented to set layout data to the widgets created at AbstractTabbedPropertySection.createWidgets(Composite). This improves visibility

Overrides:
setSectionData in class AbstractTabbedPropertySection
Parameters:
composite - Sometimes widgets will be set formDatas and position will depend on parent composite.
See Also:
AbstractTabbedPropertySection.setSectionData(org.eclipse.swt.widgets.Composite)

hookListeners

protected void hookListeners()
Description copied from class: AbstractTabbedPropertySection
Widgets created at AbstractTabbedPropertySection.createWidgets(Composite) may listen platform events. Set them here in order to improve visibility

Overrides:
hookListeners in class AbstractTabbedPropertySection
See Also:
AbstractTabbedPropertySection.hookListeners()

refresh

public void refresh()
Specified by:
refresh in interface org.eclipse.ui.views.properties.tabbed.ISection
Overrides:
refresh in class org.eclipse.ui.views.properties.tabbed.AbstractPropertySection
See Also:
AbstractPropertySection.refresh()

handleTextModified

protected void handleTextModified()
Handle the text modified event. When there is any problem while creating and executing the command, the view will be only refreshed


focusIn

protected void focusIn()
Handle action when the focus is gained Default action is to do nothing. Clients may override this method if they desire a particular action to be executed when the text control gain the focus.


focusOut

protected void focusOut()
Handle action when the focus is lost. Default action is to do nothing. Clients may override this method if they desire a particular action to be executed when the text control lost the focus.


getStyle

protected int getStyle()
Get the style of the text widget. By default, this is a single line text

Returns:
the style

getListener

protected TextChangeListener getListener()
Returns:
the listener

getText

protected org.eclipse.swt.widgets.Text getText()
Returns:
the text

getNameLabel

public org.eclipse.swt.custom.CLabel getNameLabel()
Returns:
the nameLabel

isTextValid

protected boolean isTextValid()
Check whether the text entered is valid or not. Subclasses should override this method to provide their own check. By default, return true.

Returns:
true if the text entered is valid

getFeatureAsString

protected abstract java.lang.String getFeatureAsString()
Get the value of the feature as text for the text field for the section.

Returns:
the value of the feature as text.

getNewFeatureValue

protected abstract java.lang.Object getNewFeatureValue(java.lang.String newText)
Get the new value of the feature from the text field of the section.

Parameters:
newText - the new value of the feature as a string.
Returns:
the new value of the feature.

getOldFeatureValue

protected abstract java.lang.Object getOldFeatureValue()
Returns the feature value from the model as an object type.

Returns:
the feature object

verifyField

protected abstract void verifyField(org.eclipse.swt.widgets.Event e)
Subclasses may provide their own checker on the text that is entered by the user and update the 'doit' flag of the Event in consequence.

Parameters:
e - the Event that is sent when the Text is modified

Copyright 2007 Anyware Technologies.
All Rights Reserved.