Rendering a label or text field in a toolbar is incorrect in defining over fragment.e4xmi [message #1744207] |
Fri, 23 September 2016 11:20 |
Joerg Specht Messages: 2 Registered: September 2016 |
Junior Member |
|
|
I have a simple e4 RPC application, based on e4 model. To create a label or a text field in a toolbar, you need a ToolControl model element (see Lars Vogel www.vogella.com/tutorials/EclipseRCP/article.html#toolcontrols). This works fine when the ToolControl is defined in Application.e4xmi, but not when is defined in fragment.e4xmi.
Definition of a label and a text field in Application.e4xmi
<trimBars xmi:id="_MX9UBV73EeamgZGnnlIVZQ" elementId="toolbar:org.eclipse.ui.main.toolbar">
<children xsi:type="menu:ToolBar" xmi:id="_MX9UBl73EeamgZGnnlIVZQ" elementId="e4.application.toolcontrol.label.1">
<children xsi:type="menu:ToolControl" xmi:id="_FjpsAIAIEeaaRZl6bNljkA" elementId="e4.application.toolcontrol.0" contributionURI="bundleclass://e4.application/e4.simple.dynamic.toolbar.LabelToolControl"/>
<children xsi:type="menu:ToolControl" xmi:id="_ECTZgIDCEeabCK5EUzMndQ" elementId="e4.application.toolcontrol.1" contributionURI="bundleclass://e4.application/e4.simple.dynamic.toolbar.TextToolControl"/>
</children>
</trimBars>
Definition of a label and a text field in fragment.e4xmi
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_quycAH__EeaaRZl6bNljkA" featurename="trimContributions" parentElementId="org.eclipse.e4.ide.application">
<elements xsi:type="menu:TrimContribution" xmi:id="_4VGgsH__EeaaRZl6bNljkA" elementId="e4.application.trimcontribution.0" parentId="toolbar:org.eclipse.ui.main.toolbar">
<children xsi:type="menu:ToolBar" xmi:id="_6-GjQH__EeaaRZl6bNljkA" elementId="e4.application.toolcontrol.label.2">
<children xsi:type="menu:ToolControl" xmi:id="_9q-ZMH__EeaaRZl6bNljkA" elementId="e4.application.toolcontrol.label" contributionURI="bundleclass://e4.application/e4.simple.dynamic.toolbar.LabelToolControl"/>
<children xsi:type="menu:ToolControl" xmi:id="_JV9EcIDCEeabCK5EUzMndQ" elementId="e4.application.toolcontrol.text" contributionURI="bundleclass://e4.application/e4.simple.dynamic.toolbar.TextToolControl"/>
</children>
</elements>
</fragments>
LablelToolControl class
public class LabelToolControl {
@PostConstruct
public void createControls(Composite parent) {
createLabel(parent, "OneLabel");
}
private Control createLabel(Composite parent, String labelText) {
final Label label = new Label(parent, SWT.LEFT);
label.setText(labelText);
label.setVisible(true);
return label;
}
}
TextToolControl class
public class TextToolControl {
@PostConstruct
public void createControls(Composite parent) {
createTextbox(parent, "OneTooltip");
}
private Control createTextbox(Composite parent, String toolTipText) {
final Text textBox = new Text(parent, SWT.SINGLE | SWT.BORDER);
textBox.setToolTipText(toolTipText);
textBox.setVisible(true);
return textBox;
}
}
I use in both cases the same classes. Has anyone an idea?
I have appended an sample project.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03882 seconds