Lines 45-50
Link Here
|
45 |
package org.netbeans.spi.project.ui.support; |
45 |
package org.netbeans.spi.project.ui.support; |
46 |
|
46 |
|
47 |
import java.util.List; |
47 |
import java.util.List; |
|
|
48 |
import java.util.Map; |
48 |
import javax.swing.Action; |
49 |
import javax.swing.Action; |
49 |
import org.netbeans.modules.project.uiapi.Utilities; |
50 |
import org.netbeans.modules.project.uiapi.Utilities; |
50 |
import org.netbeans.spi.project.ui.LogicalViewProvider; |
51 |
import org.netbeans.spi.project.ui.LogicalViewProvider; |
Lines 71-76
Link Here
|
71 |
*/ |
72 |
*/ |
72 |
public static final String PROJECT_PARENT_FOLDER = "projdir"; |
73 |
public static final String PROJECT_PARENT_FOLDER = "projdir"; |
73 |
|
74 |
|
|
|
75 |
/** |
76 |
* {@link String}-valued action property honored by {@link #newProjectAction} |
77 |
* that defines the project category (subfolder code name) to be selected. |
78 |
* |
79 |
* @since 1.80 |
80 |
*/ |
81 |
public static final String PRESELECT_CATEGORY = "PRESELECT_CATEGORY"; |
82 |
|
83 |
/** |
84 |
* {@link String}[]-valued action property honored by {@link #newProjectAction} |
85 |
* for propagating custom properties to the new project wizard's |
86 |
* {@link org.openide.WizardDescriptor} |
87 |
* |
88 |
* @since 1.80 |
89 |
*/ |
90 |
public static final String INITIAL_VALUE_PROPERTIES = "initialValueProperties"; |
91 |
|
74 |
private CommonProjectActions() {} |
92 |
private CommonProjectActions() {} |
75 |
|
93 |
|
76 |
/** |
94 |
/** |
Lines 206-211
Link Here
|
206 |
* expectations about initial value for wizard |
224 |
* expectations about initial value for wizard |
207 |
* choosers that refers to existing sources location. |
225 |
* choosers that refers to existing sources location. |
208 |
* |
226 |
* |
|
|
227 |
* <p>{@link #PRESELECT_CATEGORY} keyed action value can carry a {@link String} |
228 |
* that presents a category path to be selected in the new project wizard. |
229 |
* |
230 |
* <p>{@link #INITIAL_VALUE_PROPERTIES} keyed action value can carry a |
231 |
* {@link Map<String, Object>} of custom properties which are propagated to |
232 |
* the new project wizard's {@link org.openide.WizardDescriptor} |
233 |
* |
209 |
* @return an action |
234 |
* @return an action |
210 |
* |
235 |
* |
211 |
* @since org.netbeans.modules.projectuiapi/1 1.3 |
236 |
* @since org.netbeans.modules.projectuiapi/1 1.3 |
Lines 215-220
Link Here
|
215 |
} |
240 |
} |
216 |
|
241 |
|
217 |
/** |
242 |
/** |
|
|
243 |
* Creates action that invokes the <b>New Project</b> wizard, preselects the |
244 |
* given category path and propagates a set of custom properties the wizard's |
245 |
* {@link org.openide.WizardDescriptor}. |
246 |
* |
247 |
* @param categoryPath the category path to be selected |
248 |
* @param initialProperties a map of custom properties which are propagated |
249 |
* to the new project wizard's {@link org.openide.WizardDescriptor} |
250 |
* |
251 |
* @since 1.80 |
252 |
* @return an action |
253 |
*/ |
254 |
public static Action newProjectAction(String categoryPath, Map<String, Object> initialProperties) { |
255 |
Action a = newProjectAction(); |
256 |
|
257 |
a.putValue(PRESELECT_CATEGORY, categoryPath ); |
258 |
String[] keys = initialProperties.keySet().toArray(new String[initialProperties.size()]); |
259 |
a.putValue(INITIAL_VALUE_PROPERTIES, keys); |
260 |
for (String key : keys) { |
261 |
a.putValue(key, initialProperties.get(key)); |
262 |
} |
263 |
return a; |
264 |
} |
265 |
|
266 |
/** |
218 |
* Creates an action that sets the configuration of the selected project. |
267 |
* Creates an action that sets the configuration of the selected project. |
219 |
* It should be displayed with an action context containing |
268 |
* It should be displayed with an action context containing |
220 |
* exactly one {@link org.netbeans.api.project.Project}. |
269 |
* exactly one {@link org.netbeans.api.project.Project}. |