Community
Participate
Working Groups
Add custom widget extension point providing a widget class and an update model class to the Resource Manager org.eclipse.ptp.rm.jaxb.control.ui plugin. <extension-point id="widget" name="Widget and its Update Model" schema="schema/widget.exsd"/> The impact to the programming is primarily to the org.eclipse.ptp.rm.jaxb.control.ui.UpdateModelFactory class and its methods: private static Control createControl(final Composite parent, ControlDescriptor cd, IJAXBLaunchConfigurationTab tab) and public static IUpdateModel createModel(Composite parent, WidgetType widget, IJAXBLaunchConfigurationTab tab, IVariableMap rmVarMap, Map<String, Button> sources, Map<ControlStateType, Control> targets) Sample plugin usage: <extension point="org.eclipse.ptp.rm.jaxb.control.ui.widget"> <widget id="sample" name="Sample Widget and its Update Model" widgetClass="com.sample.SampleWidget" updateModelClass="com.sample.SampleUpdateModel"> </widget> </extension> Sample resource manager (RM) widget usage. The type="sample" matches the extension point's id="sample": <rm:widget type="sample" title="File Format" readOnly="true" style="SWT.LEFT" attribute="PERFSUITE_psrun.envvar.configuration_id_PS_HWPC_FORMAT"> ... </rm:widget>
Created attachment 226857 [details] Patch for org.eclipse.ptp.rm.jaxb.ui
Created attachment 226858 [details] Patch for org.eclipse.ptp.rm.jaxb.doc.isv
Created attachment 226860 [details] Patch for org.eclipse.ptp.rm.jaxb.core
Created attachment 226861 [details] Patch for org.eclipse.ptp.rm.jaxb.control.ui
Created attachment 226862 [details] Patch for org.eclipse.ptp.ems.ui
Created attachment 226864 [details] New plugin for org.eclipse.ptp.ems.control.ui
The Widget class must have the following constructor: public <WidgetClassName>(Composite parent, IWidgetDescriptor wd) ... The Update Model class must have the following constructor: public <UpdateModelClassName>(String name, ValueUpdateHandler handler, Control control) ... Note: In other words, there is no need for a zero-argument constructor.
Created attachment 226866 [details] [OPTIONAL] Example new plugin for com.sample.widget
Comment on attachment 226866 [details] [OPTIONAL] Example new plugin for com.sample.widget This provides a example plugin which mimics a type="text" builtin widget, but with a type="sample"
This is a first pass of providing the custom RM widget and its update model extension point. These changes still require that the custom widget plugin must be made a friend of the org.eclipse.ptp.rm.core, org.eclipse.ptp.rm.ui, and org.eclipse.ptp.rm.control.ui plugins. Further changes are coming from Greg Watson to reorganize these plugins so that custom RM widgets and their update models do not need to be made friends of them.
One final note: this extension assumes after the custom widget is created that the calling code sets the new widget's layout data, tool tip text, foreground color, background color and font. If the custom widget is a composite then it might be necessary for the custom widget to override the setLayoutData, setToolTipText, setForeground, setBackground and setFont so that it may delegate the call to some inner widget.
This has been committed to master with some changes: 1. The "name" field has been removed from the extension point as it is not used. 2. The type field enumeration for the widget type has been extended with a "custom" string, and a "typeId" attribute added. The "typeId" corresponds to the "id" field in the extension. The sample plugin usage is now: <extension point="org.eclipse.ptp.rm.jaxb.control.ui.widget"> <widget id="sample" widgetClass="com.sample.SampleWidget" updateModelClass="com.sample.SampleUpdateModel"> </widget> </extension> Sample resource manager (RM) widget usage. The type="sample" matches the extension point's id="sample": <rm:widget type="custom" typeId="sample" title="File Format" readOnly="true" style="SWT.LEFT" attribute="PERFSUITE_psrun.envvar.configuration_id_PS_HWPC_FORMAT"> ... </rm:widget> 3. The ems plugin has not been committed yet as it needs to be converted to the new extension format. Note there have also been significant changes to the jaxb plugins to reduce the number of new APIs.
Greg, I think the widget extension point "plugin ID" needs to be changed from org.eclipse.ptp.rm.jaxb.control.core.ui to org.eclipse.ptp.rm.jaxb.control.ui so that it matches the plugin that the extension point is defined in. Also, JAXBControlUIPlugin.PLUGIN_ID needs to be changed to match. Otherwise, I get a null point exception because extensionPoint is null on line 511 of UpdateModelFactory since there is a mismatch.
Actually, I think just JAXBControlUIPlugin.PLUGIN_ID needs to change to org.eclipse.ptp.rm.jaxb.control.ui so it checks the right plugin for the extension point.
Yes, there are still a few refactoring issues to sort out. About to commit them...
Fixed up remaining refactoring issues and converted EMS plugin over to use the new extension point. I was able to add the new widget definition to the existing org.eclipse.ptp.ems.ui plugin rather than a new plugin. I believe this work is now complete. Let me know if there are any problems.
One issue I am running into is after I press the apply button, any additional UI changes are not re-enabling the Apply button. I created a new Run Configuration (no profiling stuff, just the run dialog) and selected the trestles configuration and trestles as the host, clicked apply, made some changes and the apply button remains inactive. Can you let me know if you see this as well? Thanks.
It looks like the problem lies in AbstractUpdateModel's validate() method. When I step through, the validator object is not null, but validator.validate(...) seems to always throw an exception so error is never null and the validation fails. This then causes the lcMap to not updated so the apply button remain disabled since the change is disallowed.
Please update and try again.
That appears to have fixed it, thanks! Chris (In reply to comment #19) > Please update and try again.
Closing as resolved.
Closing.