X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=org.argeo.cms.jcr.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Feclipse%2Fforms%2Feditor%2FFormEditor.java;fp=org.argeo.cms.jcr.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Feclipse%2Fforms%2Feditor%2FFormEditor.java;h=484dae8420b63466c8c7f3f58aaf57124bb84171;hb=bce03099b0d2f1758e7a3d74fba339d0200924d5;hp=0000000000000000000000000000000000000000;hpb=0ea2992e5f3803cd98b5981f27274faa922bc199;p=gpl%2Fargeo-jcr.git diff --git a/org.argeo.cms.jcr.ui/src/org/argeo/cms/ui/eclipse/forms/editor/FormEditor.java b/org.argeo.cms.jcr.ui/src/org/argeo/cms/ui/eclipse/forms/editor/FormEditor.java new file mode 100644 index 0000000..484dae8 --- /dev/null +++ b/org.argeo.cms.jcr.ui/src/org/argeo/cms/ui/eclipse/forms/editor/FormEditor.java @@ -0,0 +1,85 @@ +package org.argeo.cms.ui.eclipse.forms.editor; + +import org.argeo.cms.ui.eclipse.forms.FormToolkit; +import org.eclipse.jface.dialogs.IPageChangeProvider; + +/** + * This class forms a base of multi-page form editors that typically use one or + * more pages with forms and one page for raw source of the editor input. + *

+ * Pages are added 'lazily' i.e. adding a page reserves a tab for it but does + * not cause the page control to be created. Page control is created when an + * attempt is made to select the page in question. This allows editors with + * several tabs and complex pages to open quickly. + *

+ * Subclasses should extend this class and implement addPages + * method. One of the two addPage methods should be called to + * contribute pages to the editor. One adds complete (standalone) editors as + * nested tabs. These editors will be created right away and will be hooked so + * that key bindings, selection service etc. is compatible with the one for the + * standalone case. The other method adds classes that implement + * IFormPage interface. These pages will be created lazily and + * they will share the common key binding and selection service. Since 3.1, + * FormEditor is a page change provider. It allows listeners to attach to it and + * get notified when pages are changed. This new API in JFace allows dynamic + * help to update on page changes. + * + * @since 1.0 + */ +// RAP [if] As RAP is still using workbench 3.4, the implementation of +// IPageChangeProvider is missing from MultiPageEditorPart. Remove this code +// with the adoption of workbench > 3.5 +//public abstract class FormEditor extends MultiPageEditorPart { +public abstract class FormEditor implements + IPageChangeProvider { + private FormToolkit formToolkit; + + +public FormToolkit getToolkit() { + return formToolkit; + } + +public void editorDirtyStateChanged() { + +} + +public FormPage getActivePageInstance() { + return null; +} + + // RAP [if] As RAP is still using workbench 3.4, the implementation of +// IPageChangeProvider is missing from MultiPageEditorPart. Remove this code +// with the adoption of workbench > 3.5 +// private ListenerList pageListeners = new ListenerList(); +// +// /* +// * (non-Javadoc) +// * +// * @see org.eclipse.jface.dialogs.IPageChangeProvider#addPageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) +// */ +// public void addPageChangedListener(IPageChangedListener listener) { +// pageListeners.add(listener); +// } +// +// /* +// * (non-Javadoc) +// * +// * @see org.eclipse.jface.dialogs.IPageChangeProvider#removePageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) +// */ +// public void removePageChangedListener(IPageChangedListener listener) { +// pageListeners.remove(listener); +// } +// +// private void firePageChanged(final PageChangedEvent event) { +// Object[] listeners = pageListeners.getListeners(); +// for (int i = 0; i < listeners.length; ++i) { +// final IPageChangedListener l = (IPageChangedListener) listeners[i]; +// SafeRunnable.run(new SafeRunnable() { +// public void run() { +// l.pageChanged(event); +// } +// }); +// } +// } +// RAPEND [if] +}