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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) voidCall to apply the cell editor value in the editing bean.<U> UcreatePartControl(U ancestor) Called to create the part control.voiddispose()Call to dispose<U> UGet the underlying Control which the UI system is using.getModel()The model which we are editingorg.eclipse.jface.viewers.ISelectionbooleanisValid()Check model for validitybooleanbooleanisValidationError(FieldValue field) voidrefresh()Refresh the table or UI itemsvoidremoveSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) voidselectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) voidsetFocus()Make the viewer take focus to its main control.voidThe model which we are editingvoidsetSelection(org.eclipse.jface.viewers.ISelection selection) voidsetValidationError(boolean validationError) voidsetValidator(IValidator<?> v) Set a validator to be run when the model is changed<V> voidsetViewSite(V site) If this viewer is linked to an e3 part with an IViewSite, it may be provided here.voidupdateModel(T model) The model for some providers may be updated but be warned that others throw an IllegalArgumentException.
-
Constructor Details
-
ModelViewer
public ModelViewer()
-
-
Method Details
-
setViewSite
public <V> void setViewSite(V site) Description copied from interface:IModelViewerIf this viewer is linked to an e3 part with an IViewSite, it may be provided here.- Specified by:
setViewSitein interfaceIModelViewer<T>- Parameters:
site-
-
dispose
public void dispose()Description copied from interface:IModelViewerCall to dispose- Specified by:
disposein interfaceIModelViewer<T>
-
createPartControl
public <U> U createPartControl(U ancestor) Description copied from interface:IModelViewerCalled to create the part control. The type U is usually Composite but may be parameterised for non-SWT- Specified by:
createPartControlin interfaceIModelViewer<T>- Parameters:
ancestor-- Returns:
-
getControl
public <U> U getControl()Description copied from interface:IModelViewerGet the underlying Control which the UI system is using.- Specified by:
getControlin interfaceIModelViewer<T>- Returns:
-
setFocus
public void setFocus()Description copied from interface:IModelViewerMake the viewer take focus to its main control.- Specified by:
setFocusin interfaceIModelViewer<T>
-
refresh
public void refresh()Description copied from interface:IModelViewerRefresh the table or UI items- Specified by:
refreshin interfaceIModelViewer<T>
-
updateModel
Description copied from interface:IModelProviderThe model for some providers may be updated but be warned that others throw an IllegalArgumentException.- Specified by:
updateModelin interfaceIModelProvider<T>- Parameters:
model-
-
isValid
public boolean isValid()Description copied from interface:IModelViewerCheck model for validity- Specified by:
isValidin interfaceIModelViewer<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:
selectionChangedin interfaceorg.eclipse.ui.ISelectionListener
-
setValidator
Description copied from interface:IModelViewerSet a validator to be run when the model is changed- Specified by:
setValidatorin interfaceIModelViewer<T>- Parameters:
v- The validator to be applied
-
setModel
Description copied from interface:IModelViewerThe model which we are editing- Specified by:
setModelin interfaceIModelProvider<T>- Specified by:
setModelin interfaceIModelViewer<T>- Parameters:
model-- Throws:
Exception
-
getModel
Description copied from interface:IModelViewerThe model which we are editing- Specified by:
getModelin interfaceIModelProvider<T>- Specified by:
getModelin interfaceIModelViewer<T>- Returns:
- the model that we are providing
-
addSelectionChangedListener
public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) - Specified by:
addSelectionChangedListenerin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
getSelection
public org.eclipse.jface.viewers.ISelection getSelection()- Specified by:
getSelectionin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
removeSelectionChangedListener
public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) - Specified by:
removeSelectionChangedListenerin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
setSelection
public void setSelection(org.eclipse.jface.viewers.ISelection selection) - Specified by:
setSelectionin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
isValidationError
public boolean isValidationError() -
isValidationError
-
setValidationError
public void setValidationError(boolean validationError) -
applyEditorValue
public void applyEditorValue()Description copied from interface:IModelViewerCall to apply the cell editor value in the editing bean.- Specified by:
applyEditorValuein interfaceIModelViewer<T>
-