Package com.iizigo.prop
Class PropertyEditor
- java.lang.Object
- org.eclipse.swt.widgets.Widget
- org.eclipse.swt.widgets.Control
- org.eclipse.swt.widgets.Scrollable
- org.eclipse.swt.widgets.Composite
- com.iizigo.prop.PropertyEditor
- All Implemented Interfaces:
IFilterListener
,org.eclipse.swt.graphics.Drawable
,org.eclipse.ui.IPersistable
,org.eclipse.ui.IPersistableEditor
public class PropertyEditor extends org.eclipse.swt.widgets.Composite implements IFilterListener, org.eclipse.ui.IPersistableEditor
The Property Editor implemented as an SWT composite.- Author:
- Christopher Mindus
Nested Class Summary
Nested Classes Modifier and Type Class Description class
PropertyEditor.Node
Node class.
Constructor Summary
Constructors Constructor Description PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes)
Creates the properties composite.PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes, boolean useFilter)
Creates the properties composite.PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes, boolean useFilter, boolean enableGroups, org.eclipse.ui.IMemento propsMemento)
Creates the properties composite.PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes, boolean useFilter, boolean enableGroups, org.eclipse.ui.IMemento propsMemento, int style)
Creates the properties composite.PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes, boolean useFilter, boolean enableGroups, org.eclipse.ui.IMemento propsMemento, int style, int scrollStyle)
Creates the properties composite.PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes, boolean useFilter, org.eclipse.ui.IMemento propsMemento)
Creates the properties composite.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFocusInfo(org.eclipse.swt.widgets.Control c)
Adds focus info at creation time of controls in the edited part.IPropertyEditorController
getController()
Gets the controller.PropCnr[]
getEditedProperties()
Gets the edited property containers.BaseEditor<?,?>
getFocusedBaseEditor()
Finds the base editor that has focus.IzMenu
getHeaderContextMenu()
Gets the context menu for the header.KStringInfoProviderAdapter
getKStringInfoProviderAdapter()
Gets or creates the KStringInfoProviderAdapter used to resolve KString's and others containing KString's (e.g.void
onFilter(java.lang.String text)
Called when a filter text has been applied.void
redrawProperties()
Causes redraw of properties after collapse/expand/filter/multi-edit.void
restoreState(org.eclipse.ui.IMemento memento)
Called with a memento for this editor.void
saveState(org.eclipse.ui.IMemento memento)
Saves the state of the object in the given memento.void
setEditedProperties(PropCnr[] pcs)
Sets a new content to the editor.void
setEditedProperties(PropCnr pc, java.util.ArrayList<PropertyEditorInfo> infos)
Sets a new content to the editor.void
setFixedTooltips()
Enables fixed tooltips that are not removed.boolean
setFocus(Atom atom)
Attempts to set focus to a property item with a specific atom.boolean
setFocus(Atom atom, int index)
Attempts to set focus to a property item with a specific atom.boolean
setFocus(GProp<?> property, int index, java.lang.String childName)
Attempts to set focus to a property currently being edited.boolean
setFocus(java.lang.String name)
Attempts to set focus to a property item with a specific atom.boolean
setFocus(java.lang.String name, int index)
Attempts to set focus to a property item with a specific atom.void
setTitle(org.eclipse.swt.graphics.Image image, java.lang.String title)
Sets the image and title for the property editor, default is "Properties".PropCnr[]
setViewerEditedProperties(org.eclipse.jface.viewers.TreeViewer viewer)
Sets the edited properties from a viewer.void
verifySeverity()
Scans the edited property containers for max error level and assigns it to the properties icon.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
Constructor Detail
PropertyEditor
public PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes)
Creates the properties composite.- Parameters:
controller
- The property controller.parent
- The parent composite.
PropertyEditor
public PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes, boolean useFilter)
Creates the properties composite.- Parameters:
controller
- The property controller.parent
- The parent composite.useFilter
- Use the filtering mechanism/control.
PropertyEditor
public PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes, boolean useFilter, org.eclipse.ui.IMemento propsMemento)
Creates the properties composite.- Parameters:
controller
- The property controller.parent
- The parent composite.useFilter
- Use the filtering mechanism/control.propsMemento
- A memento for initialization or null for none.
PropertyEditor
public PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes, boolean useFilter, boolean enableGroups, org.eclipse.ui.IMemento propsMemento)
Creates the properties composite.- Parameters:
controller
- The property controller.parent
- The parent composite.pes
- The property editor setup.useFilter
- Use the filtering mechanism/control.enableGroups
- Enable groups flag.propsMemento
- A memento for initialization or null for none.
PropertyEditor
public PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes, boolean useFilter, boolean enableGroups, org.eclipse.ui.IMemento propsMemento, int style)
Creates the properties composite.- Parameters:
controller
- The property controller.parent
- The parent composite.pes
- The property editor setup.useFilter
- Use the filtering mechanism/control.enableGroups
- Enable groups flag.propsMemento
- A memento for initialization or null for none.style
- Style of the container.
PropertyEditor
public PropertyEditor(IPropertyEditorController controller, org.eclipse.swt.widgets.Composite parent, PropertyEditorSetup pes, boolean useFilter, boolean enableGroups, org.eclipse.ui.IMemento propsMemento, int style, int scrollStyle)
Creates the properties composite.- Parameters:
controller
- The property controller.parent
- The parent composite.pes
- The property editor setup.useFilter
- Use the filtering mechanism/control.enableGroups
- Flag to enable groups.propsMemento
- A memento for initialization or null for none.style
- Style of the container.scrollStyle
- Style for the scrolled container: SWT.H_SCROLL|SWT.V_SCROLL by default, set to SWT.NONE for no scrollbars.
Method Detail
onFilter
public void onFilter(java.lang.String text)
Called when a filter text has been applied.- Specified by:
onFilter
in interfaceIFilterListener
- Parameters:
text
- The filter text to apply, null for none (never empty string).
redrawProperties
public void redrawProperties()
Causes redraw of properties after collapse/expand/filter/multi-edit.
setTitle
public void setTitle(org.eclipse.swt.graphics.Image image, java.lang.String title)
Sets the image and title for the property editor, default is "Properties".- Parameters:
image
- The image to use or null for none.title
- The title to use or null for none.
setFixedTooltips
public void setFixedTooltips()
Enables fixed tooltips that are not removed.
getHeaderContextMenu
public IzMenu getHeaderContextMenu()
Gets the context menu for the header.
restoreState
public void restoreState(org.eclipse.ui.IMemento memento)
Called with a memento for this editor. The editor can parse the data or save the memento. This method may not be called.- Specified by:
restoreState
in interfaceorg.eclipse.ui.IPersistableEditor
- Parameters:
memento
- the saved state for this editor. May benull
.
saveState
public void saveState(org.eclipse.ui.IMemento memento)
Saves the state of the object in the given memento.- Specified by:
saveState
in interfaceorg.eclipse.ui.IPersistable
- Parameters:
memento
- The storage area for object's state.
getEditedProperties
public PropCnr[] getEditedProperties()
Gets the edited property containers.- Returns:
- The edited properties if previously edited and displayed, null otherwise.
getController
public IPropertyEditorController getController()
Gets the controller.
setViewerEditedProperties
public PropCnr[] setViewerEditedProperties(org.eclipse.jface.viewers.TreeViewer viewer)
Sets the edited properties from a viewer. The selection must be inside the editor owning this property editor. This method selects all properties really selected in the tree for editing, as opposed toActivator.getSelected...
that strips children.
setEditedProperties
public void setEditedProperties(PropCnr[] pcs)
Sets a new content to the editor.
setEditedProperties
public void setEditedProperties(PropCnr pc, java.util.ArrayList<PropertyEditorInfo> infos)
Sets a new content to the editor.
addFocusInfo
public void addFocusInfo(org.eclipse.swt.widgets.Control c)
Adds focus info at creation time of controls in the edited part.- Parameters:
c
- Control to get focus.
setFocus
public boolean setFocus(GProp<?> property, int index, java.lang.String childName)
Attempts to set focus to a property currently being edited.- Parameters:
property
- The property to focus.index
- Index in multi-property, -1 for none.childName
- Name of a child property when it doesn't exist in the parent.- Returns:
- true For success, false for failure.
setFocus
public boolean setFocus(java.lang.String name)
Attempts to set focus to a property item with a specific atom.- Parameters:
name
- Name of property to focus.- Returns:
- true For success, false for failure.
setFocus
public boolean setFocus(java.lang.String name, int index)
Attempts to set focus to a property item with a specific atom.- Parameters:
name
- Name of property to focus.index
- Index in multi-property, -1 for none.- Returns:
- true For success, false for failure.
setFocus
public boolean setFocus(Atom atom)
Attempts to set focus to a property item with a specific atom.- Parameters:
atom
- The property atom to focus, null for name.- Returns:
- true For success, false for failure.
setFocus
public boolean setFocus(Atom atom, int index)
Attempts to set focus to a property item with a specific atom.- Parameters:
atom
- The property atom to focus, null for name.index
- Index in multi-property, -1 for none.- Returns:
- true For success, false for failure.
verifySeverity
public void verifySeverity()
Scans the edited property containers for max error level and assigns it to the properties icon. This method scans the edited nodes and not the property errors in order to reflect the same state as the edited properties.
getFocusedBaseEditor
public BaseEditor<?,?> getFocusedBaseEditor()
Finds the base editor that has focus.- Returns:
- The BaseEditor having focus, null for none.
getKStringInfoProviderAdapter
public KStringInfoProviderAdapter getKStringInfoProviderAdapter()
Gets or creates the KStringInfoProviderAdapter used to resolve KString's and others containing KString's (e.g. tooltips, badge).This method expects to be called from the SWT thread.
- Returns:
- The KStringInfoProviderAdapter instance.