Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 363890

Summary: [EMF Runtime Extensions] Exception when trying to extend already deleted variables in Linked Folder creation wizard
Product: [Automotive] Sphinx Reporter: Phong Le <phonglt>
Component: CoreAssignee: Project Inbox <sphinx-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: dao.hoang.gate, idydieng, phonglt, quoclan, r.sezestre
Version: 0.7.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Phong Le CLA 2011-11-15 22:33:41 EST
Build Identifier: 0.7.0.20111007-0146

Try to create an wizard extension point that using org.eclipse.sphinx.emf.workspace.ui.wizards.LinkedFolderWizard and I got the problem as bellow:

Reproducible: Always

Steps to Reproduce:
1. Open Linked Folder creation wizard
2. Click [Varibale...]button to open  'Select Path Varibale' wizard
3. In 'Select Path Variable' wizard, click [New..]-> 'New Variable' wizard open
4. Input a name and indicate a target folder, click [OK]
-> New Variable is created and shown in the list  of path variables
5. Select the newly created variable 
-> Edit... Remove, Extend.. button is enabled
6. Select [Remove] 

Actual result : 
- the variable is removed
- The selection is lost 
- Extend...button is still enable-> Click [Extend..] button -> an error appears
in error log

Expected: 
When the selected variable is removed, 
the selection is lost, 
[Extend..] button is disabled as well.
Comment 1 Phong Le CLA 2011-11-15 22:34:38 EST
Error message 

java.lang.ArrayIndexOutOfBoundsException: 0
    at
org.eclipse.ui.ide.dialogs.PathVariableSelectionDialog.buttonPressed(PathVariableSelectionDialog.java:101)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
    at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
    at org.eclipse.jface.window.Window.open(Window.java:801)
...
Comment 2 Phong Le CLA 2011-11-15 23:18:12 EST
As I debugged deeply in PathVariableSelectionDialog. I see that the [Extend..] button is not updated every [Add] / [Edit] or [Remove] button is clicked (except variableTable selection changed).

Currently, these buttons call PathVariablesGroup#updateWidgetState() after adding /editing or removing an variable to update their enable status. So that, I think we must modified PathVariablesGroup#updateWidgetState() to raise an event for PathVariableSelectionDialog can update the [Extend..] button as well as variableTable do with selection changed.