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.
When creating a new web project, under Frameworks wizard, if there is error (e.g., wrong Servlet URL Mapping for JavaServer Faces framework), then the panel shows an error mesg and disable the Finish button. This is good! But if users want to add framework by using the Project Properties window, with the same error, the panel does not show the error mesg, the OK button is still enabled, and the users can continue to add the framework but got error later!
BTW, I think this is a P2 bug because after the error, the framework is not working properly and difficult to fix sometimes.
Fixed. Checking in src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.form; /cvs/web/project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.form,v <-- CustomizerFrameworks.form new revision: 1.6; previous revision: 1.5 done Checking in src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java; /cvs/web/project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java,v <-- CustomizerFrameworks.java new revision: 1.11; previous revision: 1.10 done Checking in src/org/netbeans/modules/web/project/ui/customizer/WebCompositePanelProvider.java; /cvs/web/project/src/org/netbeans/modules/web/project/ui/customizer/WebCompositePanelProvider.java,v <-- WebCompositePanelProvider.java new revision: 1.2; previous revision: 1.1 done
Thanks for this fix! There are still 3 issues happened when adding the Visual Web framework. 1. Since Visual Web sometimes cannot be added before users adding some plugin, the panel should check the 'isValid' method even before users type/change the settings. The patch/fix is simply add the checking when initializing FrameworkConfigurationPanelListener as follows: =================================================================== RCS file: /cvs/web/project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java,v retrieving revision 1.12 diff -u -r1.12 CustomizerFrameworks.java @@ -262,6 +262,8 @@ wizardDescriptor.putProperty("j2eeLevel", j2eeVersion); wizardDescriptor.putProperty("serverInstanceID", serverInstanceID); frameworkConfigurationPanel.readSettings(wizardDescriptor); + + stateChanged(new ChangeEvent(this)); } public void stateChanged(ChangeEvent e) { 2. Looks like the error mesg cannot handle the HTML tags! Since the New Project wizard can handle the HTML tags, I think the Project Properties should do the same. Otherwise, I see some tags like <html> inside the error mesg area. 3. When creating a new project, the framework can get the project info from the wizardDescriptor.getProperty("projdir") and do some checking for isValid method. But from the Project Properties, this property is missing! Could you please add this property (or even the 'Project' object) so that the framework can use it for checking. Thanks!
> 1. Since Visual Web sometimes cannot be added before users adding some > plugin, the panel should check the 'isValid' method even before users > type/change the settings. The patch/fix is simply add the checking when > initializing FrameworkConfigurationPanelListener as follows: > > =================================================================== > RCS file: > /cvs/web/project/src/org/netbeans/modules/web/project/ui/customizer/Customi >zerFrameworks.java,v retrieving revision 1.12 > diff -u -r1.12 CustomizerFrameworks.java > @@ -262,6 +262,8 @@ > wizardDescriptor.putProperty("j2eeLevel", j2eeVersion); > wizardDescriptor.putProperty("serverInstanceID", > serverInstanceID); > frameworkConfigurationPanel.readSettings(wizardDescriptor); + > + stateChanged(new ChangeEvent(this)); > } > > public void stateChanged(ChangeEvent e) { > Done as suggested. Checking in src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java; /cvs/web/project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java,v <-- CustomizerFrameworks.java new revision: 1.13; previous revision: 1.12 done > > 2. Looks like the error mesg cannot handle the HTML tags! Since the New > Project wizard can handle the HTML tags, I think the Project Properties > should do the same. Otherwise, I see some tags like <html> inside the error > mesg area. > This has to be done in Project UI API module, not in the Web module - so file an issue against that module please. > 3. When creating a new project, the framework can get the project info from > the wizardDescriptor.getProperty("projdir") and do some checking for > isValid method. But from the Project Properties, this property is missing! > Could you please add this property (or even the 'Project' object) so that > the framework can use it for checking. Thanks! I've discussed this with Petr Pisl and you should not rely on such information. It's not API so it can change any time and we cannot ensure that this information will always be available. Any other comments Petr?
Thanks for the integration! I have also filed a bug against project UI. Should web project gives some way (even a private way that visualweb can use as I requested before; like "projdir") to pass the underneath project to the framework? I think it's very needed functionality for the framework use to check whether the project is suitable to add the framework or not. Thanks!
BTW, I think the web project also does the similar in: RCS file: /cvs/web/project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java,v @@ -262,6 +262,8 @@ wizardDescriptor.putProperty("j2eeLevel", j2eeVersion); wizardDescriptor.putProperty("serverInstanceID", serverInstanceID); passing j2eeLevel and serverInstanceID for checking the JSF libraries, I think 'Project' is also very needed here for framework to validate the extend condition.
> we cannot ensure that this information will always be available Could you please add the following line in, RCS file: /cvs/web/project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java,v @@ -73,6 +73,7 @@ Properties properties = controller.getProperties(); properties.setProperty("j2eeLevel", j2eeVersion); // NOI18N properties.setProperty("serverInstanceID", serverInstanceID); // NOI18N + properties.setProperty("project", project); // NOI18N I think the Project object is pretty available here. Visual Web has several issues for checking the condition whether to allow adding the framework or not by using the Project object. I believe the other framework will also need this for validating. Looks like it's also pretty safe to passing this property. If this object is not available (I can't think of any corner case has this situation), passing null is still OK because the framework should check the availability easily. Thanks!
Property added, please verify. Checking in src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java; /cvs/web/project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java,v <-- CustomizerFrameworks.java new revision: 1.15; previous revision: 1.14 done
I'm sorry, but I disagree with the last commit so I am reverting it. When extending a web module you should not even need to know which project it is in. What information do you exactly need from the project? Can't you obtain it from the WebModule? The reason I'm asking is that there is probably some API missing from WebModule. I want to know which API exactly. Checking in src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java; /cvs/web/project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerFrameworks.java,v <-- CustomizerFrameworks.java new revision: 1.16; previous revision: 1.15 done
After the discussion reassigning to Andrei.
Visual Web needs to check, 1. whether the target project has valid Source Folder or not, it can't add its page bean file (Java file) to it if the target project does not have valid Source Folder. It needs "Sources src = ProjectUtils.getSources(Project);" and "SourceGroup[] grp = src.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);" ... 2. it needs to check the Source Level of the target project. When the target project's source level is 1.4, then it needs to check whether the IDE has some needed libraries available. Otherwise, it will need to ask the users to get the Visual Web kit. The point is, framework is usually need to check several conditions for method valid() to see whether the target project is ready to add this framework or not. (currently the checking for many other frameworks are just been ignored! One reason is they can't do this check without more info like the Project object.) The NetBeans web JSF framework needs 2 properties "j2eeLevel" and "serverInstanceID" and the web project adds them here. That's not fair to other framework :-) The web project should not add some selected individual properties just because some framework need them. It should also include the Project object for the framework. I really don't see any risk here by passing the Project object. I don't think any framework can break the whole structure here just because they can at least read/use the Project.
For #1: is WebModule.getJavaSources() enough for you? If not, why? (I know the method is deprecated. That's because 1) it is not currently called by NetBeans code 2) it needs to return something better than FileObject. But you can safely call it.) For #2: use SourceLevelQuery on the FileObject returned by #1. Generally, the frameworks should know nothing about projects. They should only work with WebModule's. The project might still be added to ExtenderController's properties, but only as the last resort. Regarding the j2eeLevel and serverInstanceId, you're right. There's some missing API there. But passing the project is no solution to that (note, for example, that there is no project available when the WebModuleExtender is invoked from the New Project wizard).
I'm confused here! I don't see there is any way to get the WebModule from these classes. Visual Web somehow forked the following 2 classes from web/jsf but getting WebModule looks like not straightforward. Could you please give me some hints here? Thanks! org.netbeans.modules.web.jsf.wizards.JSFConfigurationPanel extends WebModuleExtender org.netbeans.modules.web.jsf.wizards.JSFConfigurationPanelVisual extends javax.swing.JPanel
JSFFrameworkProvider.createWebModuleExtender() gets the web module, you can then pass it to JSFConfigurationPanel as another parameter to its constructor (i.e., along with the ExtenderController). Don't forget to read the Javadoc of WebFrameworkProvider.createWebModuleExtender().
OK! Thanks! I got the idea.
Not reproducible, changing status to verified. Product Version: NetBeans IDE Dev (Build 200807101204) Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11 System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb) Userdir: /home/josin/.netbeans/dev