Bug 572881 - It is not possible to set the testflag from a IClasspathContainerPage
Summary: It is not possible to set the testflag from a IClasspathContainerPage
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-15 09:19 EDT by Christoph Laeubrich CLA
Modified: 2023-04-06 12:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Laeubrich CLA 2021-04-15 09:19:51 EDT
I have a IClasspathContainerPage [1] that allows to set the test-flag of the claspathcontainer beforehand (instead of using the dialog and hit the "toggle" button). I can see in the debugger that the IClasspathEntry contains the test-flag, but if I finish the wizard the flag is not taken into account.
Also if I instantly hot "edit" afterwards the flag is lost. When I use the Toggle button everything works. So it seems to me that somewhere the flag is discarded when returning from the wizard.


[1] https://github.com/laeubisoft/osgi-toolbox/blob/main/plugins/de.laeubisoft.osgitoolbox.ui/src/de/laeubisoft/osgitoolbox/ui/container/OSGiClasspathContainerPage.java#L138
Comment 1 Jeff Johnston CLA 2021-04-15 11:37:28 EDT
(In reply to Christoph Laeubrich from comment #0)
> I have a IClasspathContainerPage [1] that allows to set the test-flag of the
> claspathcontainer beforehand (instead of using the dialog and hit the
> "toggle" button). I can see in the debugger that the IClasspathEntry
> contains the test-flag, but if I finish the wizard the flag is not taken
> into account.
> Also if I instantly hot "edit" afterwards the flag is lost. When I use the
> Toggle button everything works. So it seems to me that somewhere the flag is
> discarded when returning from the wizard.
> 
> 
> [1]
> https://github.com/laeubisoft/osgi-toolbox/blob/main/plugins/de.laeubisoft.
> osgitoolbox.ui/src/de/laeubisoft/osgitoolbox/ui/container/
> OSGiClasspathContainerPage.java#L138

Looking at the code [1], you never set the flag isTest unless through the toggle button.  In getSelection(), you always create a new entry to return and set the TEST property using the value of the isTest flag.  Am I missing something?
Comment 2 Christoph Laeubrich CLA 2021-04-15 12:37:13 EDT
is initialized in setSelection

isTest = containerEntry.isTest();

and toggled via the button.

I also checked ClasspathContainerDefaultPage and its also returning a new entry every time, as IClasspathEntry is modifiable, if I start with debugger I see that the flag is toggled as expected

extraAttributes	IClasspathAttribute[1]  (id=276)	
[test=false]

and

extraAttributes	IClasspathAttribute[1]  (id=298)	
[test=true]

so I would assume that this works, or do I get your question wrong?
If I toggle the flag with the toggle button in the Libraries tab this is reflected in my dialog as well so I assume that this also works.
Comment 3 Eclipse Genie CLA 2023-04-06 12:20:03 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.