]> git.argeo.org Git - gpl/argeo-slc.git/blob - swt/org.argeo.tool.devops.e4/src/org/argeo/cms/ui/eclipse/forms/editor/FormEditor.java
Merge remote-tracking branch 'origin/unstable' into testing
[gpl/argeo-slc.git] / swt / org.argeo.tool.devops.e4 / src / org / argeo / cms / ui / eclipse / forms / editor / FormEditor.java
1 package org.argeo.cms.ui.eclipse.forms.editor;
2
3 import org.argeo.cms.ui.eclipse.forms.FormToolkit;
4 import org.eclipse.jface.dialogs.IPageChangeProvider;
5
6 /**
7 * This class forms a base of multi-page form editors that typically use one or
8 * more pages with forms and one page for raw source of the editor input.
9 * <p>
10 * Pages are added 'lazily' i.e. adding a page reserves a tab for it but does
11 * not cause the page control to be created. Page control is created when an
12 * attempt is made to select the page in question. This allows editors with
13 * several tabs and complex pages to open quickly.
14 * <p>
15 * Subclasses should extend this class and implement <code>addPages</code>
16 * method. One of the two <code>addPage</code> methods should be called to
17 * contribute pages to the editor. One adds complete (standalone) editors as
18 * nested tabs. These editors will be created right away and will be hooked so
19 * that key bindings, selection service etc. is compatible with the one for the
20 * standalone case. The other method adds classes that implement
21 * <code>IFormPage</code> interface. These pages will be created lazily and
22 * they will share the common key binding and selection service. Since 3.1,
23 * FormEditor is a page change provider. It allows listeners to attach to it and
24 * get notified when pages are changed. This new API in JFace allows dynamic
25 * help to update on page changes.
26 *
27 * @since 1.0
28 */
29 // RAP [if] As RAP is still using workbench 3.4, the implementation of
30 // IPageChangeProvider is missing from MultiPageEditorPart. Remove this code
31 // with the adoption of workbench > 3.5
32 //public abstract class FormEditor extends MultiPageEditorPart {
33 public abstract class FormEditor implements
34 IPageChangeProvider {
35 private FormToolkit formToolkit;
36
37
38 public FormToolkit getToolkit() {
39 return formToolkit;
40 }
41
42 public void editorDirtyStateChanged() {
43
44 }
45
46 public FormPage getActivePageInstance() {
47 return null;
48 }
49
50 // RAP [if] As RAP is still using workbench 3.4, the implementation of
51 // IPageChangeProvider is missing from MultiPageEditorPart. Remove this code
52 // with the adoption of workbench > 3.5
53 // private ListenerList pageListeners = new ListenerList();
54 //
55 // /*
56 // * (non-Javadoc)
57 // *
58 // * @see org.eclipse.jface.dialogs.IPageChangeProvider#addPageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener)
59 // */
60 // public void addPageChangedListener(IPageChangedListener listener) {
61 // pageListeners.add(listener);
62 // }
63 //
64 // /*
65 // * (non-Javadoc)
66 // *
67 // * @see org.eclipse.jface.dialogs.IPageChangeProvider#removePageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener)
68 // */
69 // public void removePageChangedListener(IPageChangedListener listener) {
70 // pageListeners.remove(listener);
71 // }
72 //
73 // private void firePageChanged(final PageChangedEvent event) {
74 // Object[] listeners = pageListeners.getListeners();
75 // for (int i = 0; i < listeners.length; ++i) {
76 // final IPageChangedListener l = (IPageChangedListener) listeners[i];
77 // SafeRunnable.run(new SafeRunnable() {
78 // public void run() {
79 // l.pageChanged(event);
80 // }
81 // });
82 // }
83 // }
84 // RAPEND [if]
85 }