This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 210425

Summary: Support for LookupProvider
Product: php Reporter: VuuRWerK
Component: ProjectAssignee: Tomas Mysik <tmysik>
Status: RESOLVED INCOMPLETE    
Severity: normal    
Priority: P3    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description VuuRWerK 2012-03-30 11:57:25 UTC
It would be nice to have the support for LookupProvider in the php.project module. For my implementation of a PhpFrameworkProvider I want to provide some additional nodes in the logical view of projects, but my implementation of LookupProvider will never get called since it's not supported in PhpProject. On the other side my implementation of the NodeFactory is working as expected.

// The implementation of my LookupProvider (based on http://platform.netbeans.org/tutorials/nbm-projectextension.html):

@LookupProvider.Registration( projectType = "org-netbeans-modules-php-project" )
public class LookupProviderImpl implements LookupProvider {
  @Override
  public Lookup createAdditionalLookup( Lookup lookup ) {
    if ( lookup.lookup( CakePhpFrameworkProvider.class ) != null ) {
      return Lookups.fixed( new ControllersLookupItem( lookup.lookup( PhpProject.class ) ) );
    }
    return Lookups.fixed();
  }
}

// The implementation of my NodeFactory

@NodeFactory.Registration( projectType = "org-netbeans-modules-php-project" )
public class ControllersNodeFactoryImpl implements NodeFactory {
  private PhpProject project;

  @Override
  public NodeList<?> createNodes( Project project ) {
    this.project = project.getLookup().lookup( PhpProject.class );
    ControllersLookupItem item = this.project.getLookup().lookup( ControllersLookupItem.class );  // Returns null, cause the LookupProvider wasn't called
    if ( item != null ) {
      try {
        return NodeFactorySupport.fixedNodeList(
          new ControllersNode( this.project ) );
      } catch ( DataObjectNotFoundException ex ) {
        Exceptions.printStackTrace( ex );
      }
    }
    return NodeFactorySupport.fixedNodeList();
  }
}
Comment 1 Tomas Mysik 2013-02-15 09:07:41 UTC
Is this issue still valid? Simply reopen this issue, thanks.