Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 399550 - Add Custom Widget Extension Point to Resource Manager
Summary: Add Custom Widget Extension Point to Resource Manager
Status: CLOSED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: RM (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 7.0   Edit
Assignee: Greg Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 397685
  Show dependency tree
 
Reported: 2013-01-30 15:17 EST by Brian Watt CLA
Modified: 2013-06-11 13:35 EDT (History)
1 user (show)

See Also:


Attachments
Patch for org.eclipse.ptp.rm.jaxb.ui (1.47 KB, patch)
2013-02-11 13:40 EST, Brian Watt CLA
g.watson: iplog+
Details | Diff
Patch for org.eclipse.ptp.rm.jaxb.doc.isv (1.10 KB, patch)
2013-02-11 13:41 EST, Brian Watt CLA
g.watson: iplog+
Details | Diff
Patch for org.eclipse.ptp.rm.jaxb.core (3.22 KB, patch)
2013-02-11 13:41 EST, Brian Watt CLA
g.watson: iplog+
Details | Diff
Patch for org.eclipse.ptp.rm.jaxb.control.ui (27.76 KB, patch)
2013-02-11 13:42 EST, Brian Watt CLA
g.watson: iplog+
Details | Diff
Patch for org.eclipse.ptp.ems.ui (2.36 KB, patch)
2013-02-11 13:42 EST, Brian Watt CLA
g.watson: iplog+
Details | Diff
New plugin for org.eclipse.ptp.ems.control.ui (11.32 KB, application/x-tar)
2013-02-11 13:43 EST, Brian Watt CLA
g.watson: iplog+
Details
[OPTIONAL] Example new plugin for com.sample.widget (4.61 KB, application/x-tar)
2013-02-11 13:51 EST, Brian Watt CLA
g.watson: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Watt CLA 2013-01-30 15:17:18 EST
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>
Comment 1 Brian Watt CLA 2013-02-11 13:40:11 EST
Created attachment 226857 [details]
Patch for org.eclipse.ptp.rm.jaxb.ui
Comment 2 Brian Watt CLA 2013-02-11 13:41:00 EST
Created attachment 226858 [details]
Patch for org.eclipse.ptp.rm.jaxb.doc.isv
Comment 3 Brian Watt CLA 2013-02-11 13:41:32 EST
Created attachment 226860 [details]
Patch for org.eclipse.ptp.rm.jaxb.core
Comment 4 Brian Watt CLA 2013-02-11 13:42:06 EST
Created attachment 226861 [details]
Patch for org.eclipse.ptp.rm.jaxb.control.ui
Comment 5 Brian Watt CLA 2013-02-11 13:42:52 EST
Created attachment 226862 [details]
Patch for org.eclipse.ptp.ems.ui
Comment 6 Brian Watt CLA 2013-02-11 13:43:32 EST
Created attachment 226864 [details]
New plugin for org.eclipse.ptp.ems.control.ui
Comment 7 Brian Watt CLA 2013-02-11 13:49:59 EST
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.
Comment 8 Brian Watt CLA 2013-02-11 13:51:28 EST
Created attachment 226866 [details]
[OPTIONAL] Example new plugin for com.sample.widget
Comment 9 Brian Watt CLA 2013-02-11 13:54:04 EST
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"
Comment 10 Brian Watt CLA 2013-02-11 14:09:24 EST
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.
Comment 11 Brian Watt CLA 2013-02-11 14:19:53 EST
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.
Comment 12 Greg Watson CLA 2013-02-12 22:20:21 EST
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.
Comment 13 Chris Navarro CLA 2013-02-13 12:27:19 EST
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.
Comment 14 Chris Navarro CLA 2013-02-13 12:35:08 EST
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.
Comment 15 Greg Watson CLA 2013-02-13 12:37:12 EST
Yes, there are still a few refactoring issues to sort out. About to commit them...
Comment 16 Greg Watson CLA 2013-02-13 12:45:53 EST
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.
Comment 17 Chris Navarro CLA 2013-02-13 14:04:30 EST
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.
Comment 18 Chris Navarro CLA 2013-02-13 14:51:41 EST
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.
Comment 19 Greg Watson CLA 2013-02-13 15:06:00 EST
Please update and try again.
Comment 20 Chris Navarro CLA 2013-02-13 15:11:20 EST
That appears to have fixed it, thanks!

Chris

(In reply to comment #19)
> Please update and try again.
Comment 21 Greg Watson CLA 2013-02-15 09:51:56 EST
Closing as resolved.
Comment 22 Brian Watt CLA 2013-06-11 13:35:09 EDT
Closing.