[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[wtp-dev] ComponentCore.createComponent(IProject)

My understanding is that during project import (and possibly during startup), some project resources may not be available even though they exist on the machine’s file system.

 

We suspect that this may be causing an early call to

ComponentCore.createComponent()

which calls into

ComponentImplManager.createComponent()

 

      public IVirtualComponent createComponent(IProject project) {

            try {

                  IComponentImplFactory factory = findFactoryForProject(project);

                  if(null != factory){

                        return factory.createComponent(project);

                  }

            } catch (Exception e) {

                  // Just return a default component

            }

            if (!ModuleCoreNature.isFlexibleProject(project)){

                  return null;

            }

            return new VirtualComponent(project, new Path("/")); //$NON-NLS-1$

      }

 

to swallow a null factory or exception and return a “default VirtualComponent”, for which any web project WebContent directory mappings will be invalid, etc.

 

My question is, what would be a preferred way to detect this situation?

 

Calling IVirtualComponent.exists() doesn’t seem to be what we want, since it just checks that the project exists and has the module core nature.  I’d hate to wrap my call to ComponentCore.createComponent() with a check for whether either “.settings/org.eclipse.wst.common.component” or “.settings/.component” (and deployment descriptors?) are synchronized, but is there no other way?

 

Seems like createComponent (or a variant) should be returning null or propagating the exception, but I assume this isn’t an option for 1.5.x…

 

Thanks, Ted

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.