Class ModelViewer<T>

java.lang.Object
org.eclipse.scanning.device.ui.model.ModelViewer<T>
All Implemented Interfaces:
EventListener, org.eclipse.jface.viewers.ISelectionProvider, IModelProvider<T>, IModelViewer<T>, org.eclipse.ui.ISelectionListener

public class ModelViewer<T> extends Object implements IModelViewer<T>, org.eclipse.ui.ISelectionListener, org.eclipse.jface.viewers.ISelectionProvider
Class for editing an operation model. Shows a table or other relevant GUI for editing the model. This class simply listens to the current selection and shows a GUI for editing it if the selection is an IOperation. You can also call setOperation(...) to programmatically set the editing operation.
  • Constructor Details

    • ModelViewer

      public ModelViewer()
  • Method Details

    • setViewSite

      public <V> void setViewSite(V site)
      Description copied from interface: IModelViewer
      If this viewer is linked to an e3 part with an IViewSite, it may be provided here.
      Specified by:
      setViewSite in interface IModelViewer<T>
      Parameters:
      site -
    • dispose

      public void dispose()
      Description copied from interface: IModelViewer
      Call to dispose
      Specified by:
      dispose in interface IModelViewer<T>
    • createPartControl

      public <U> U createPartControl(U ancestor)
      Description copied from interface: IModelViewer
      Called to create the part control. The type U is usually Composite but may be parameterised for non-SWT
      Specified by:
      createPartControl in interface IModelViewer<T>
      Parameters:
      ancestor -
      Returns:
    • getControl

      public <U> U getControl()
      Description copied from interface: IModelViewer
      Get the underlying Control which the UI system is using.
      Specified by:
      getControl in interface IModelViewer<T>
      Returns:
    • setFocus

      public void setFocus()
      Description copied from interface: IModelViewer
      Make the viewer take focus to its main control.
      Specified by:
      setFocus in interface IModelViewer<T>
    • refresh

      public void refresh()
      Description copied from interface: IModelViewer
      Refresh the table or UI items
      Specified by:
      refresh in interface IModelViewer<T>
    • updateModel

      public void updateModel(T model)
      Description copied from interface: IModelProvider
      The model for some providers may be updated but be warned that others throw an IllegalArgumentException.
      Specified by:
      updateModel in interface IModelProvider<T>
      Parameters:
      model -
    • isValid

      public boolean isValid()
      Description copied from interface: IModelViewer
      Check model for validity
      Specified by:
      isValid in interface IModelViewer<T>
      Returns:
      true if the model is valid false otherwise
    • selectionChanged

      public void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection)
      Specified by:
      selectionChanged in interface org.eclipse.ui.ISelectionListener
    • setValidator

      public void setValidator(IValidator<?> v)
      Description copied from interface: IModelViewer
      Set a validator to be run when the model is changed
      Specified by:
      setValidator in interface IModelViewer<T>
      Parameters:
      v - The validator to be applied
    • setModel

      public void setModel(T model) throws Exception
      Description copied from interface: IModelViewer
      The model which we are editing
      Specified by:
      setModel in interface IModelProvider<T>
      Specified by:
      setModel in interface IModelViewer<T>
      Parameters:
      model -
      Throws:
      Exception
    • getModel

      public T getModel()
      Description copied from interface: IModelViewer
      The model which we are editing
      Specified by:
      getModel in interface IModelProvider<T>
      Specified by:
      getModel in interface IModelViewer<T>
      Returns:
      the model that we are providing
    • addSelectionChangedListener

      public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
      Specified by:
      addSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider
    • getSelection

      public org.eclipse.jface.viewers.ISelection getSelection()
      Specified by:
      getSelection in interface org.eclipse.jface.viewers.ISelectionProvider
    • removeSelectionChangedListener

      public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
      Specified by:
      removeSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider
    • setSelection

      public void setSelection(org.eclipse.jface.viewers.ISelection selection)
      Specified by:
      setSelection in interface org.eclipse.jface.viewers.ISelectionProvider
    • isValidationError

      public boolean isValidationError()
    • isValidationError

      public boolean isValidationError(FieldValue field)
    • setValidationError

      public void setValidationError(boolean validationError)
    • applyEditorValue

      public void applyEditorValue()
      Description copied from interface: IModelViewer
      Call to apply the cell editor value in the editing bean.
      Specified by:
      applyEditorValue in interface IModelViewer<T>