Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 292068 - [target] Target environment settings not persisted on Mac OS
Summary: [target] Target environment settings not persisted on Mac OS
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.5.2   Edit
Assignee: Chris Aniszczyk CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-12 13:52 EDT by Jeff McAffer CLA
Modified: 2010-01-12 12:36 EST (History)
4 users (show)

See Also:
curtis.windatt.public: review+


Attachments
Add selection listeners to environment combo boxes (4.28 KB, patch)
2009-10-21 10:32 EDT, Brian de Alwis CLA
caniszczyk: iplog+
Details | Diff
org.eclipse.pde.ui.patch (5.93 KB, patch)
2010-01-12 12:35 EST, Chris Aniszczyk CLA
no flags Details | Diff
mylyn/context/zip (12.07 KB, application/octet-stream)
2010-01-12 12:35 EST, Chris Aniszczyk CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff McAffer CLA 2009-10-12 13:52:44 EDT
in a target editor (or target editing dialog) if you set the window system to Carbon and then save and exit the editor/dialog and go back, the value is still blank.  This makes it real hard to develop for carbon while using cocoa. 

Note that I am using snow leopard but have backported 1.5 and 1.4 JREs installed that should support 32 bit and carbon.
Comment 1 Jeff McAffer CLA 2009-10-13 12:37:48 EDT
BTW, this is a regression from 3.5.0  

I started my 3.5.0 on the same workspace and was able to set the target envrionemnt.  Switched back to 3.5.0, set the ws to carbon and it saved fine.  Switched to 3.5.1 and the setting was still there but then I set the OS to macosx and saved and it did not stick.

I did notice that changing the Environment settings did not seems to cause the editor to be dirty so I changed an env setting AND the name of the target, saved and reopened.  That also did NOT persist the env setting.

Would be great to consider a fix in for 3.5.2 if it is not risky.
Comment 2 Curtis Windatt CLA 2009-10-13 15:30:05 EDT
Not reproducible in Windows.  Dirty state is updated correctly and the setting is saved correctly.
Comment 3 Brian de Alwis CLA 2009-10-21 10:30:48 EDT
I just hit this problem this morning.  The problem occurs when you select an item from the combo box rather than type in a definition.

Both org.eclipse.pde.internal.ui.wizards.target.TargetDefinitionContentPage and org.eclipse.pde.internal.ui.editor.targetdefinition.EnvironmentSection have appropriate listeners for only the Modify case of the combo boxes.  They both need similar listeners for the combo box selection cases.  

Perhaps combo boxes trigger modify on win32?  They don't on macosx-cocoa.
Comment 4 Brian de Alwis CLA 2009-10-21 10:32:21 EDT
Created attachment 150117 [details]
Add selection listeners to environment combo boxes
Comment 5 Curtis Windatt CLA 2009-10-21 10:49:40 EDT
Yes, the combo boxes trigger the listeners in windows.

Thanks for the patch, I'll try things out on MacOS this week.
Comment 6 Chris Aniszczyk CLA 2009-10-22 18:41:03 EDT
So on I20091020 things work for me on cocoa. I can't reproduce.

Kevin, is there something funky with selection listeners that was fixed recently in Cocoa?
Comment 7 Chris Aniszczyk CLA 2009-10-27 06:26:04 EDT
Kevin, ping?
Comment 8 Kevin Barnes CLA 2009-10-27 09:38:47 EDT
bug 285750
Comment 9 Chris Aniszczyk CLA 2009-10-27 10:04:32 EDT
This is fixed in 3.5.1

*** This bug has been marked as a duplicate of bug 285750 ***
Comment 10 Chris Aniszczyk CLA 2009-10-27 10:12:14 EDT
Thanks Kevin, you guys rock!
Comment 11 Chris Aniszczyk CLA 2009-10-30 06:40:20 EDT
This isn't working properly.

We aren't getting a selection event, looks like an SWT issue still.
Comment 12 Ken Keefe CLA 2009-12-01 13:46:42 EST
I can confirm that this bug is still there in 3.5.1 on OSX. As someone mentioned, the value persists if the user types it in, but not if it is selected from the drop down menu.
Comment 13 Kevin Barnes CLA 2009-12-01 15:14:35 EST
I see the selection event getting sent from Combo. Where is the code that's not receiving it?
Comment 14 Curtis Windatt CLA 2009-12-01 15:26:37 EST
In the target editor on the environment tab, first section where you can set the target's OS/WS/etc.

The code is in EnvironmentSection in org.eclipse.pde.ui.

We create the combos:

fOSCombo = new ComboPart();
fOSCombo.createControl(left, toolkit, SWT.SINGLE | SWT.BORDER);
fOSCombo.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fOSCombo.setItems((String[]) fOSChoices.toArray(new String[fOSChoices.size()]));
fOSCombo.setVisibleItemCount(30);

We add a modification listener:

fOSCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
markDirty();
getTarget().setOS(getText(fOSCombo));
}
});

Works for me on linux as well as Windows XP.
Comment 15 Kevin Barnes CLA 2009-12-01 15:32:51 EST
I found the code. It uses a modify listener instead of a Selection listener. We did not fix modify listeners in 3.5.1 because the changes were too scary. Instead we put a smaller patch into 3.5.1 that only fixed selection events.
Can you change TargetDefinitionContentPage to listen for Selection events on the combos? Note that it's fine to leave the moify listener there... it does work if someone types in the combo, it just isn't called when the selection changes.
Comment 16 Curtis Windatt CLA 2009-12-01 15:45:35 EST
We can add a selection listener for 3.5.2.  So we won't need to change anything to have it work in 3.6?
Comment 17 Kevin Barnes CLA 2009-12-01 16:01:33 EST
3.6 worksforme...
You could check/set the values when the apply button is clicked so I'm not sure why listeners are necessary at all.
Comment 18 Chris Aniszczyk CLA 2010-01-12 12:35:36 EST
Created attachment 155884 [details]
org.eclipse.pde.ui.patch
Comment 19 Chris Aniszczyk CLA 2010-01-12 12:35:40 EST
Created attachment 155885 [details]
mylyn/context/zip
Comment 20 Chris Aniszczyk CLA 2010-01-12 12:36:21 EST
done.

> 20100112

Thanks for your contribution Brian.