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 58489

Summary: Define contract to pass hints to new project wizard panels
Product: projects Reporter: _ pkuzel <pkuzel>
Component: Generic Projects UIAssignee: Petr Hrebejk <phrebejk>
Status: RESOLVED FIXED    
Severity: blocker CC: jchalupa, jrechtacek, jtulach
Priority: P2 Keywords: API, API_REVIEW
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 58486, 54150    
Attachments: Proposed solution
Proposed CommonProjectActions API change
To be commited soon...
Consistency: FileObject and Templates utilized.

Description _ pkuzel 2005-05-02 15:16:38 UTC
I have a case where I need to pass default directory to wizard panel choosers
for unknown project types (see issue #58486). 

Initiator (Checkout wizard) holds Swing Action (it's NewProject but it does not
know it).

Target (all relevant project type panels) that have access to WizadrDecriptor.

My prototype implementation simply joins initiator and target via action
(get/setValue carry hints).
Comment 1 _ pkuzel 2005-05-02 15:18:09 UTC
It needs to be addressed till 4.2. 
Comment 2 _ pkuzel 2005-05-02 15:19:32 UTC
Created attachment 21935 [details]
Proposed solution
Comment 3 _ pkuzel 2005-05-02 15:25:27 UTC
See issue #58486 that contains example J2SE target panel patch.
"EXISTING_SOURCES_CURRENT_DIRECTORY" keyed value is passed to the panel.

"EXISTING_SOURCES_CURRENT_DIRECTORY" key must be defined sepately from CVS and
project types.
Comment 4 _ pkuzel 2005-05-02 16:02:47 UTC
Well there ia another missing contract. It's not possible to invoke New Project
wizard without using refrection. There are also undocumented PRESELECT_* action
values.
Comment 5 _ pkuzel 2005-05-02 16:21:41 UTC
Finally I'd appreciate CommonProjectActions.selectProject(Project). Currenly 
have copy&paste impl from project/ui/ProjectUtilities.java#selectAndExpandProject
Comment 6 _ pkuzel 2005-05-02 16:40:09 UTC
Created attachment 21939 [details]
Proposed CommonProjectActions API change
Comment 7 Jaroslav Tulach 2005-05-09 12:31:19 UTC
Does the currently proposed solution rely on the newProjectAction method to 
return always the same instance? And where is the change in the code to honor 
that property? Is there any test to verify that it really works? Moreover the 
name of the property shall probably reflect its content... 
 
 
Imho there could be better solution (also from UI point of view) if there was 
a new query: FileObject RecentlLocationsQuery.getSourceDirectory() that would 
delegate to all implementation registered in lookup. Every wizard could then 
use it to find its initial directory. [but this is just an idea anyway]. 
 
 
Comment 8 _ pkuzel 2005-05-16 15:49:39 UTC
Yarda thank you for review, there was one interesting point. The
newProjectAction() method must always return new instance to avoid action
properties sharing among independent callers. It's covered by new test.

Otherwise I'll follow original property based idea suggested by phrebejk. It's
simpler than Templates, ContextAwareAtcion, ... approach.
Comment 9 _ pkuzel 2005-05-16 16:05:30 UTC
Created attachment 22149 [details]
To be commited soon...
Comment 10 _ pkuzel 2005-05-16 16:36:42 UTC
Created attachment 22151 [details]
Consistency: FileObject and Templates utilized.
Comment 11 _ pkuzel 2005-05-17 11:06:28 UTC
Checking in projectui/src/org/netbeans/modules/project/ui/actions/NewProject.java;
/cvs/projects/projectui/src/org/netbeans/modules/project/ui/actions/NewProject.java,v
 <--  NewProject.java
new revision: 1.20; previous revision: 1.19
done
Checking in projectui/src/org/netbeans/modules/project/ui/actions/Actions.java;
/cvs/projects/projectui/src/org/netbeans/modules/project/ui/actions/Actions.java,v
 <--  Actions.java
new revision: 1.21; previous revision: 1.20
done
Checking in projectuiapi/apichanges.xml;
/cvs/projects/projectuiapi/apichanges.xml,v  <--  apichanges.xml
new revision: 1.10; previous revision: 1.9
done
Checking in projectuiapi/src/org/netbeans/modules/project/uiapi/ActionsFactory.java;
/cvs/projects/projectuiapi/src/org/netbeans/modules/project/uiapi/ActionsFactory.java,v
 <--  ActionsFactory.java
new revision: 1.7; previous revision: 1.6
done
Checking in
projectuiapi/src/org/netbeans/spi/project/ui/templates/support/Templates.java;
/cvs/projects/projectuiapi/src/org/netbeans/spi/project/ui/templates/support/Templates.java,v
 <--  Templates.java
new revision: 1.13; previous revision: 1.12
done
Checking in
projectuiapi/src/org/netbeans/spi/project/ui/support/CommonProjectActions.java;
/cvs/projects/projectuiapi/src/org/netbeans/spi/project/ui/support/CommonProjectActions.java,v
 <--  CommonProjectActions.java
new revision: 1.7; previous revision: 1.6
done
Checking in projectuiapi/nbproject/project.properties;
/cvs/projects/projectuiapi/nbproject/project.properties,v  <--  project.properties
new revision: 1.9; previous revision: 1.8
done
RCS file:
/cvs/projects/projectuiapi/test/unit/src/org/netbeans/spi/project/ui/support/CommonProjectActionsTest.java,v
done
Checking in
projectuiapi/test/unit/src/org/netbeans/spi/project/ui/support/CommonProjectActionsTest.java;
/cvs/projects/projectuiapi/test/unit/src/org/netbeans/spi/project/ui/support/CommonProjectActionsTest.java,v
 <--  CommonProjectActionsTest.java
initial revision: 1.1
done
Comment 12 Jesse Glick 2005-05-17 14:47:59 UTC
I also sent some comments to the CVS list after the commit. In particular, one
method name is broken in the last patch.