Problem using setDerived - how to clear derived mark from memory? [message #515891] |
Mon, 22 February 2010 01:41  |
Eclipse User |
|
|
|
Eclipse 3.5
Programmatically generating a series of ICompilationUnit's. Save and marking as derived works
fine.
Problem occurs when trying to save a subsequent re-generation of the file: get the standard popup
asking whether to save to a derived file.
Have tried first unsetting derived without success:
cu.getCorrespondingResource().setDerived(false);
cu.save(new NullProgressMonitor(), true);
cu.getCorrespondingResource().setDerived(true);
According to the setDerived JavaDoc, the derived mark is maintained in memory. Apparently, the
setDerived(false) is not effective/flushed to disk until the project is closed or entire workspace
is saved. Closing and reopening the project is not a practical option.
So, how do I silently save a cu to a prior saved, derive-marked file?
Thanks...
|
|
|
|
Re: Problem using setDerived - how to clear derived mark from memory? [message #517433 is a reply to message #516984] |
Sat, 27 February 2010 17:03  |
Eclipse User |
|
|
|
In article <hm69su$h3v$1@build.eclipse.org>, daniel_megert@ch.ibm.com
says...
>
> Gerald Rosenberg wrote:
> > Eclipse 3.5
> >
> > Programmatically generating a series of ICompilationUnit's. Save and marking as derived works
> > fine.
> >
> > Problem occurs when trying to save a subsequent re-generation of the file: get the standard popup
> > asking whether to save to a derived file.
> >
> I assume you have the file open in an editor right? If so, it might be a
> bug.
It was a bug, just not in Eclipse. Turned out that a method call
executed shortly before ".setDerived(false)" was, as a very obscure side
effect, touching the file. Bottom line, setDerived works as (I)
expected.
>
> HTH
> Dani
>
Thanks much,
Gerald
|
|
|
Powered by
FUDForum. Page generated in 0.04168 seconds