|
Lines 8-18
Link Here
|
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* Konstantin Komissarchik - initial implementation and ongoing maintenance |
9 |
* Konstantin Komissarchik - initial implementation and ongoing maintenance |
| 10 |
* Ling Hao - [bugzilla 329114] rewrite context help binding feature |
10 |
* Ling Hao - [bugzilla 329114] rewrite context help binding feature |
|
|
11 |
* Greg Amerson - [bugzilla 343972] - Add support for setting the masterDetails formPage header image |
| 11 |
******************************************************************************/ |
12 |
******************************************************************************/ |
| 12 |
|
13 |
|
| 13 |
package org.eclipse.sapphire.ui; |
14 |
package org.eclipse.sapphire.ui; |
| 14 |
|
15 |
|
|
|
16 |
import static org.eclipse.sapphire.ui.renderers.swt.SwtRendererUtil.toImageDescriptor; |
| 17 |
|
| 15 |
import org.eclipse.sapphire.modeling.IModelElement; |
18 |
import org.eclipse.sapphire.modeling.IModelElement; |
|
|
19 |
import org.eclipse.sapphire.ui.SapphirePart.ImageChangedEvent; |
| 20 |
import org.eclipse.swt.widgets.Composite; |
| 16 |
import org.eclipse.ui.forms.editor.FormPage; |
21 |
import org.eclipse.ui.forms.editor.FormPage; |
| 17 |
|
22 |
|
| 18 |
/** |
23 |
/** |
|
Lines 26-31
Link Here
|
| 26 |
{ |
31 |
{ |
| 27 |
private final SapphireEditor editor; |
32 |
private final SapphireEditor editor; |
| 28 |
private final SapphireEditorPagePart part; |
33 |
private final SapphireEditorPagePart part; |
|
|
34 |
private final SapphirePartListener listener; |
| 29 |
|
35 |
|
| 30 |
public SapphireEditorFormPage( final SapphireEditor editor, |
36 |
public SapphireEditorFormPage( final SapphireEditor editor, |
| 31 |
final SapphireEditorPagePart editorPagePart ) |
37 |
final SapphireEditorPagePart editorPagePart ) |
|
Lines 34-39
Link Here
|
| 34 |
|
40 |
|
| 35 |
this.editor = editor; |
41 |
this.editor = editor; |
| 36 |
this.part = editorPagePart; |
42 |
this.part = editorPagePart; |
|
|
43 |
|
| 44 |
this.listener = new SapphirePartListener() |
| 45 |
{ |
| 46 |
@Override |
| 47 |
public void handleEvent( final SapphirePartEvent event ) |
| 48 |
{ |
| 49 |
if( event instanceof ImageChangedEvent ) |
| 50 |
{ |
| 51 |
refreshImage(); |
| 52 |
} |
| 53 |
} |
| 54 |
}; |
| 55 |
|
| 56 |
this.part.addListener( this.listener ); |
| 37 |
} |
57 |
} |
| 38 |
|
58 |
|
| 39 |
public final SapphireEditor getEditor() |
59 |
public final SapphireEditor getEditor() |
|
Lines 51-56
Link Here
|
| 51 |
return this.part.getModelElement(); |
71 |
return this.part.getModelElement(); |
| 52 |
} |
72 |
} |
| 53 |
|
73 |
|
|
|
74 |
@Override |
| 75 |
public void createPartControl(Composite parent) { |
| 76 |
super.createPartControl(parent); |
| 77 |
|
| 78 |
refreshImage(); |
| 79 |
} |
| 80 |
|
| 81 |
private final void refreshImage() |
| 82 |
{ |
| 83 |
if (this.getManagedForm() != null) |
| 84 |
{ |
| 85 |
this.getManagedForm().getForm().setImage( toImageDescriptor( this.part.getPageHeaderImage() ).createImage() ); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
@Override |
| 90 |
public void dispose() |
| 91 |
{ |
| 92 |
super.dispose(); |
| 93 |
|
| 94 |
this.part.removeListener( this.listener ); |
| 95 |
} |
| 96 |
|
| 54 |
public abstract String getId(); |
97 |
public abstract String getId(); |
| 55 |
|
98 |
|
| 56 |
} |
99 |
} |