private EditablePart edited;
private ISelection selection = StructuredSelection.EMPTY;
+ // FIXME Added by BSinou to manage non-section Composite.
+ // Is it the correct method?
+ @Deprecated
+ protected AbstractPageViewer(Composite parent, int style,
+ CmsEditable cmsEditable) {
+ // read only at UI level
+ readOnly = SWT.READ_ONLY == (style & SWT.READ_ONLY);
+
+ this.cmsEditable = cmsEditable == null ? CmsEditable.NON_EDITABLE
+ : cmsEditable;
+ if (this.cmsEditable instanceof Observable)
+ ((Observable) this.cmsEditable).addObserver(this);
+
+ if (cmsEditable.canEdit()) {
+ mouseListener = createMouseListener();
+ }
+ page = findPage(parent);
+ }
+
protected AbstractPageViewer(Section parent, int style,
CmsEditable cmsEditable) {
// read only at UI level
page.layout(controls);
}
+ /**
+ * Find the first {@link EditablePart} in the parents hierarchy of this
+ * control
+ */
+ protected EditablePart findDataParent(Control parent) {
+ if (parent instanceof EditablePart) {
+ return (EditablePart) parent;
+ }
+ if (parent.getParent() != null)
+ return findDataParent(parent.getParent());
+ else
+ throw new CmsException("No data parent found");
+ }
+
// UTILITIES
/** Check whether the edited part is in a proper state */
protected void checkEdited() {