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.
Summary: | Design and implement support for graceful handling of Creator 2 projects | ||
---|---|---|---|
Product: | javaee | Reporter: | Petr Jiricka <pjiricka> |
Component: | Web Project | Assignee: | Pavel Buzek <pbuzek> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | markdey, pbuzek, potingwu |
Priority: | P2 | Keywords: | API_REVIEW_FAST |
Version: | 5.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 78597 | ||
Attachments: | sources and jar file for testing |
Description
Petr Jiricka
2006-06-20 14:28:39 UTC
Created attachment 33081 [details]
sources and jar file for testing
Here is a proposal how the import should work: 1. NetBeans will recognize creator 2 project. If creator pack is not installed NetBeans will display a warning asking the user to get and install Creator pack and try again, but the project will still be open. Creator 2 project uses the same format as NetBeans web project. Creator project will be recognized by presence of property "jsf.pagebean.package" in project.properties. 2. If Creator pack is installed then the project will be converted to a creator project and open. The first part seems easy and a prototype is implemented in the attached jar file (we need a better message). For the second part I first thought that Creator pack would use a different project type and we would be able to change project type on fly when opening a project. It turned out that changing project type on fly is not supported by project infrastructure. There may be a different solution which I tried to prototype in the attachment: Creator pack will use the same metadata as netbeans project, netbeans will delegate creation of Project instance to Creator in its AntBasedProjectType.createProject(). This way creator has full control over the project implementation and we do not need to design APIs for individual extension points (like project UI, lookup, wizard, etc) which was the main reason why we wanted to have a seprate project type. It will be possible to open project created in Creator pack in netbeans (w/o the pack) like it was for creator 2 project, at least there will be the warning. I have attached a zip file with sources and module jar file for testing. Creator needs to implement org.netbeans.modules.web.project.api.WebProjectImplementationFactory and put its instance into default lookup. There is a trivial example of this in the attached sources (org.netbeans.modules.web.project.TestWebProjectFactory). Assigning to Po-Ting for testing. Assign back to me if you find issues or when it is ready for integration. Thanks. The approach that is described above requires the following friend API. I am asking for review and comments. Thanks. package org.netbeans.modules.web.project.api; /** The purpose of this interface is to allow a module to provide an alternative * implementation of web project support on top of the standard NetBeans web * project metadata format. Web project implementation of AntBasedProjectType * will look for instances of this interface in lookup and delegate project * creation to them. If no instance accepts a project the default web project * implementation will be used. */ public interface WebProjectImplementationFactory { /** Recognize if the project should be owned by your module * or if the default implementation should be used. * * @return true if you want your {@link createProject} to be used for * this project */ boolean acceptProject(AntProjectHelper helper) throws IOException; /** Create your implementation of Project to completely bypass * the web/project functionality. */ Project createProject(AntProjectHelper helper) throws IOException; } org.netbeans.modules.web.project.spi I guess, not .api. IDE: [29.8.06 13:39] Committing "Web Projects" started Directory /cvs/web/project/src/org/netbeans/modules/web/project/spi added to the repository cvs server: scheduling file `WebProjectImplementationFactory.java' for addition on branch `release55' cvs server: use 'cvs commit' to add this file permanently Checking in src/org/netbeans/modules/web/project/WebProjectType.java; /cvs/web/project/src/org/netbeans/modules/web/project/WebProjectType.java,v <-- WebProjectType.java new revision: 1.4.54.2; previous revision: 1.4.54.1 done Checking in src/org/netbeans/modules/web/project/WebProject.java; /cvs/web/project/src/org/netbeans/modules/web/project/WebProject.java,v <-- WebProject.java new revision: 1.85.2.3.2.38; previous revision: 1.85.2.3.2.37 done Checking in nbproject/project.xml; /cvs/web/project/nbproject/project.xml,v <-- project.xml new revision: 1.37.2.4.2.12; previous revision: 1.37.2.4.2.11 done RCS file: /cvs/web/project/src/org/netbeans/modules/web/project/spi/Attic/WebProjectImplementationFactory.java,v done Checking in src/org/netbeans/modules/web/project/spi/WebProjectImplementationFactory.java; /cvs/web/project/src/org/netbeans/modules/web/project/spi/Attic/WebProjectImplementationFactory.java,v <-- WebProjectImplementationFactory.java new revision: 1.1.2.1; previous revision: 1.1 done IDE: [29.8.06 13:39] Committing "Web Projects" finished IDE: [29.8.06 13:40] Committing "golden" started Checking in friend-packages.txt; /cvs/ide/golden/friend-packages.txt,v <-- friend-packages.txt new revision: 1.15.4.1.2.128; previous revision: 1.15.4.1.2.127 done |