|
Lines 8-13
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.form.editors.masterdetails; |
14 |
package org.eclipse.sapphire.ui.form.editors.masterdetails; |
|
Lines 57-63
Link Here
|
| 57 |
import org.eclipse.jface.viewers.Viewer; |
58 |
import org.eclipse.jface.viewers.Viewer; |
| 58 |
import org.eclipse.sapphire.modeling.CapitalizationType; |
59 |
import org.eclipse.sapphire.modeling.CapitalizationType; |
| 59 |
import org.eclipse.sapphire.modeling.IModelElement; |
60 |
import org.eclipse.sapphire.modeling.IModelElement; |
|
|
61 |
import org.eclipse.sapphire.modeling.ImageData; |
| 60 |
import org.eclipse.sapphire.modeling.ResourceStoreException; |
62 |
import org.eclipse.sapphire.modeling.ResourceStoreException; |
|
|
63 |
import org.eclipse.sapphire.modeling.el.FailSafeFunction; |
| 64 |
import org.eclipse.sapphire.modeling.el.Function; |
| 65 |
import org.eclipse.sapphire.modeling.el.FunctionContext; |
| 66 |
import org.eclipse.sapphire.modeling.el.FunctionResult; |
| 67 |
import org.eclipse.sapphire.modeling.el.Literal; |
| 61 |
import org.eclipse.sapphire.modeling.util.MutableReference; |
68 |
import org.eclipse.sapphire.modeling.util.MutableReference; |
| 62 |
import org.eclipse.sapphire.modeling.xml.RootXmlResource; |
69 |
import org.eclipse.sapphire.modeling.xml.RootXmlResource; |
| 63 |
import org.eclipse.sapphire.modeling.xml.XmlResourceStore; |
70 |
import org.eclipse.sapphire.modeling.xml.XmlResourceStore; |
|
Lines 82-87
Link Here
|
| 82 |
import org.eclipse.sapphire.ui.form.editors.masterdetails.def.IMasterDetailsEditorPageDef; |
89 |
import org.eclipse.sapphire.ui.form.editors.masterdetails.def.IMasterDetailsEditorPageDef; |
| 83 |
import org.eclipse.sapphire.ui.form.editors.masterdetails.state.IMasterDetailsEditorPageState; |
90 |
import org.eclipse.sapphire.ui.form.editors.masterdetails.state.IMasterDetailsEditorPageState; |
| 84 |
import org.eclipse.sapphire.ui.internal.SapphireUiFrameworkPlugin; |
91 |
import org.eclipse.sapphire.ui.internal.SapphireUiFrameworkPlugin; |
|
|
92 |
import org.eclipse.sapphire.ui.renderers.swt.SwtRendererUtil; |
| 85 |
import org.eclipse.sapphire.ui.swt.renderer.SapphireActionPresentationManager; |
93 |
import org.eclipse.sapphire.ui.swt.renderer.SapphireActionPresentationManager; |
| 86 |
import org.eclipse.sapphire.ui.swt.renderer.SapphireKeyboardActionPresentation; |
94 |
import org.eclipse.sapphire.ui.swt.renderer.SapphireKeyboardActionPresentation; |
| 87 |
import org.eclipse.sapphire.ui.swt.renderer.SapphireMenuActionPresentation; |
95 |
import org.eclipse.sapphire.ui.swt.renderer.SapphireMenuActionPresentation; |
|
Lines 151-156
Link Here
|
| 151 |
private ContentOutline contentOutlinePage; |
159 |
private ContentOutline contentOutlinePage; |
| 152 |
private IPartListener2 partListener; |
160 |
private IPartListener2 partListener; |
| 153 |
private SapphirePartListener editorPagePartListener; |
161 |
private SapphirePartListener editorPagePartListener; |
|
|
162 |
private final FunctionContext functionContext; |
| 154 |
|
163 |
|
| 155 |
public MasterDetailsEditorPage( final SapphireEditor editor, |
164 |
public MasterDetailsEditorPage( final SapphireEditor editor, |
| 156 |
final IModelElement rootModelElement, |
165 |
final IModelElement rootModelElement, |
|
Lines 210-215
Link Here
|
| 210 |
outlineHideActionHandler.init( outlineHideAction, null ); |
219 |
outlineHideActionHandler.init( outlineHideAction, null ); |
| 211 |
outlineHideActionHandler.setChecked( isDetailsMaximized() ); |
220 |
outlineHideActionHandler.setChecked( isDetailsMaximized() ); |
| 212 |
outlineHideAction.addHandler( outlineHideActionHandler ); |
221 |
outlineHideAction.addHandler( outlineHideActionHandler ); |
|
|
222 |
|
| 223 |
this.functionContext = initFunctionContext(); |
| 213 |
} |
224 |
} |
| 214 |
|
225 |
|
| 215 |
private static MasterDetailsEditorPagePart createEditorPagePart( final SapphireEditor editor, |
226 |
private static MasterDetailsEditorPagePart createEditorPagePart( final SapphireEditor editor, |
|
Lines 273-278
Link Here
|
| 273 |
|
284 |
|
| 274 |
form.setText( this.definition.getPageHeaderText().getLocalizedText( CapitalizationType.TITLE_STYLE, false ) ); |
285 |
form.setText( this.definition.getPageHeaderText().getLocalizedText( CapitalizationType.TITLE_STYLE, false ) ); |
| 275 |
|
286 |
|
|
|
287 |
final Function imageFunction = FailSafeFunction.create( this.definition.getImage().getContent(), Literal.create( ImageData.class ) ); |
| 288 |
final FunctionResult imageFunctionResult = imageFunction.evaluate( this.functionContext ); |
| 289 |
final ImageData data = (ImageData) imageFunctionResult.value(); |
| 290 |
|
| 291 |
if (data != null) |
| 292 |
{ |
| 293 |
form.setImage(SwtRendererUtil.toImageDescriptor(data).createImage()); |
| 294 |
} |
| 295 |
|
| 276 |
this.mainSection = new RootSection(); |
296 |
this.mainSection = new RootSection(); |
| 277 |
this.mainSection.createContent( managedForm ); |
297 |
this.mainSection.createContent( managedForm ); |
| 278 |
|
298 |
|
|
Lines 810-815
Link Here
|
| 810 |
return filteredTree; |
830 |
return filteredTree; |
| 811 |
} |
831 |
} |
| 812 |
|
832 |
|
|
|
833 |
protected FunctionContext initFunctionContext() |
| 834 |
{ |
| 835 |
return new FunctionContext(); |
| 836 |
} |
| 837 |
|
| 813 |
private static void updateExpandedState( final MasterDetailsContentOutline contentTree, |
838 |
private static void updateExpandedState( final MasterDetailsContentOutline contentTree, |
| 814 |
final Tree tree ) |
839 |
final Tree tree ) |
| 815 |
{ |
840 |
{ |