WTP team suggested the way to create VirtualComponent, so should I get
the changes applied to CR1 branch?
It seems that they would not like to recover the behavior
"ComponentCore.createComponent(project)" method.
Denny
bugzilla-daemon(a)eclipse.org wrote:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=257470
Product/Component: WTP Common Tools / wst.common
--- Comment #12 from Carl Anderson <ccc(a)us.ibm.com> 2008-12-18 16:30:58 -0400 ---
As per Max's comment #4, in the scenario where developers wish to call
VirtualComponent.create(int, IProgressMonitor) to create the appropriate
component file, the following code is acceptable:
VirtualComponent c = ComponentCore.createComponent(project);
if(c==null) {
c = ComponentCore.createComponent(project, false);
}
c.create(0, null);
This code should work properly if it is compiled against WTP 3.0.3 (or later),
and should run properly against all WTP 3.0.x versions.
Now, what would not be advisable would be for developers to replace every
previous instance of:
VirtualComponent c = ComponentCore.createComponent(project);
with:
VirtualComponent c = ComponentCore.createComponent(project);
if(c==null) {
c = ComponentCore.createComponent(project, false);
}
as that would once again open up the same hole for possible component
corruption that was closed down by bug 250004. The problem that was occurring,
as stated in comment #5, was that, in some scenarios, access to the
VirtualComponent through ComponentCore.createComponent(project), (which come
from many adopters as well as WTP code) where it was not checking for the
existance of the component file was causing the creation of an empty component
model , thus causing the appearance of an inconsistent files dialog and
component corruption. Therefore, in all scenarios other than the initial
component creation scenario (which is the only scenario broken by the change in
bug 250004), WTP code and adopters should call either
ComponentCore.createComponent(project) or
ComponentCore.createComponent(project, true).