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.
For the folder accepted by the ProjectConvertor an artifical in memory project is created causing the folder looks like a regular Project in the UI. The folder is converted into a regular the Project when the artificial Project is opened.
Created attachment 150184 [details] Diff file The diff file contains the SPI, implementation, tests and an example of the ProjectConvertor for J2SE Ant based project. The J2SE Project convertor is only sample and will NOT be a part of final commit.
Created attachment 150222 [details] Diff file The optional convertor lookup is kept as a part of the artificial project lookup after real project creation. This allows a better control over the project services by convertor implementer who can decide which services will be removed and preserved himself.
Y01 Please design the registration to not load all providers on startup - e.g. consider adding @ProjectConvertor.Registration(requiredFile = { "build.xml" }, iconBase = "...") which would delay the instantiation of client code until at least one of the required files is found. I'd like to avoid initializing HTML5 project classes as soon as IDE is loaded. Y02 What is the relation to ide.ergonomics? Should ergonomics be also aware of convertors?
Ad Y01: Tome, please allow to specify more file names. Thanks.
Created attachment 150241 [details] Diff file Split the default convertor services to non UI services (ProjectInformation) in projectui.base and UI services (LogicalView) in projectui. Added internal SPI for locating the services.
Y01 & TM01: The ProjectConvertor.isProject(FileObject) is stronger than the pattern based detection. However for most cases the pattern detection is OK. So I will add the pattern detection using @Registration in addition to the ProjectConvertor.isProject(). In fact the @Registration processor will just generate a wrapping ProjectConvertor for you. Y02: It depends. For the WebIDE it's not needed as the ergonomics is not present. But it would be nice if the ergonomics will work with convertors. It's probably not possible for ergonomics to work with generic ProjectConvertor but it's possible to work with the pattern based convertor registered using the @Registration.
Y01 & TM01: Perhaps we could "skip" isProject() if filePattern will be present to save some resources. Is this what you meant?
TM02: Perhaps we could "skip" isProject() if filePattern will be present to save some resources. No, it's not a good idea as for real word project convertors a content of file is important, eg. delete apisupport and click on the apisupport module with ergonomics. Also you will lose the correct display name and possibly other services.
Created attachment 150260 [details] Diff file Patch with added @Registration annotation. The ProjectConvertor is wrapped by an module private ProjectConvertorAcceptor. The ProjectConvertor.isProject is not called unless the pattern from @Registration matches the project file. When the pattern matches the PC.isProject is called to do additional verification (possibly read content of project file) and returns a Result.
Created attachment 150261 [details] Patch for HTML5 project convertor Attaching patch for HTML5 project convertor, seems to be working without any problem.
The patch for HTML5 project convertor seems good to me, it's nearly identical to J2SEProjectConvertor. So it should work OK.
(In reply to Tomas Zezula from comment #11) > The patch for HTML5 project convertor seems good to me, it's nearly > identical to J2SEProjectConvertor. So it should work OK. I will try to improve it a bit then (to add detection of possible SiteRoot folder - searching for "public" or "www" folder could be OK I guess). Thanks.
TM03: If a convertor needs to know some information from the user since the information is not present in the well-known file - is it possible to ask for it? Can I show some dialog in the Factory (that implements Callable<Project>)? Or it is a bad idea and there should not be anything like this done in any convertor. Thanks.
I agree that asking the user would be the best option from the user's point of view. > searching for "public" or "www" folder could be OK I guess I would also add "app" - that's becoming increasingly more common, and e.g. Yeoman uses that (see 'yo webapp --help').
It's not guaranteed that it's called from the EDT. It's not good to ask user during the convert, the convert should be lightway without user feedback. The feedback will be quite strange as you in fact opening project, if you need a wizard it has not much sense. Have you seen a dialog during opening project? What it you open 100 projects? Should be 100 dialogs opened?
(In reply to Tomas Zezula from comment #15) > It's not guaranteed that it's called from the EDT. > It's not good to ask user during the convert, the convert should be lightway > without user feedback. The feedback will be quite strange as you in fact > opening project, if you need a wizard it has not much sense. > Have you seen a dialog during opening project? > What it you open 100 projects? Should be 100 dialogs opened? So, a bad idea I see :)
I suggest the following solution. Whenever you need some user data create a project without these additional data and add a ProjectProblem with appropriate severity (Severity.ERROR for broken project, Severity.WARNING for some non needed data).
(In reply to Tomas Zezula from comment #17) > I suggest the following solution. Whenever you need some user data create a > project without these additional data and add a ProjectProblem with > appropriate severity (Severity.ERROR for broken project, Severity.WARNING > for some non needed data). I wanted to ask for e.g. SiteRoot - this is not a good case for a project problem (project does not need to have SiteRoot). But no problem, we will simply try to detect it and set it to project directory if the detection fails. Thanks.
Maybe there can be a low-severity project problem called something like "Review and correct important project settings detected by the IDE".
Good idea, will try to do that.
>Maybe there can be a low-severity project problem Yes, there is a ProjectProblem.Severity.WARNING which does not mark project as broken. Just adds the item into project problems. Currently it's used by Maven.
I am going to integrate the change.
Fixed jet-main 226dbe7ee9d9
Integrated into 'main-silver', will be available in build *201411210001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/226dbe7ee9d9 User: Tomas Zezula <tzezula@netbeans.org> Log: #248304:Added an ability to convert a folder into a project
BTW used for HTML5 project now, works perfectly. Once such project is converted/created, a notification is shown on its first opening in the IDE (this notification is shown just once). Thanks. http://hg.netbeans.org/web-main/rev/b6077f92c20d http://hg.netbeans.org/web-main/rev/ee23bc1edbe1
BTW adding position for the PRojectCOnvertor instance caused that the build is unstable, see [1]. One problem seems to be the "position" attribute; the other one seems to be related to the proper service instance [2]. Tome/Jardo, could you please have a look at it? Thanks. [1] http://deadlock.netbeans.org/job/web-main/1577/ [2] Some instances cannot be created File Services/org-netbeans-modules-web-clientproject-ClientSideProjectConvertor.instance should declare instanceOf
So, removing position helps with the position attribute test (surprise :) but the other error [1] still remains (see [2]). I will attach patch (updated commit validation test to ignore my ProjectConvertor, at least I hope so) - wouldn't it be better to put all ProjectConvertor instances into e.g. [Services/]ProjectConvertors and ignore/whitelist just this folder? It would mean that all future implementatitons would pass the commit validation without any problem. Thanks. [1] Some instances cannot be created File Services/org-netbeans-modules-web-clientproject-ClientSideProjectConvertor.instance should declare instanceOf [2] http://deadlock.netbeans.org/job/web-main/1580/
Created attachment 150689 [details] commit validation change
(In reply to Tomas Mysik from comment #27) > Some instances cannot be created > File > Services/org-netbeans-modules-web-clientproject-ClientSideProjectConvertor. > instance should declare instanceOf I tried to fix this issue [1]; Tome, please review my fix and feel free to improve it if needed. Thanks! [1] http://hg.netbeans.org/web-main/rev/02f698e2efb9
Since web-main is again stable now [1], the only problem that exists now is the "position" attribute. Thanks. [1] http://deadlock.netbeans.org/job/web-main/1585/
Integrated into 'main-silver', will be available in build *201411260001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/02f698e2efb9 User: Tomas Mysik <tmysik@netbeans.org> Log: #248304 cont'd - Added an ability to convert a folder into a project Generate instanceOf attribute as well.
Integrated into 'main-silver', will be available in build *201412140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/c14c5579baae User: Jaroslav Tulach <jtulach@netbeans.org> Log: #248304: Documenting and changing location of generated convertor registrations. Needed by my work on bug 248887