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.

View | Details | Raw Unified | Return to bug 200175
Collapse All | Expand All

(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/resources/layer.xml (-32 lines)
Lines 43-80 Link Here
43
            <folder name="APISupport">
43
            <folder name="APISupport">
44
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.Bundle#Templates/Project/APISupport"/>
44
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.Bundle#Templates/Project/APISupport"/>
45
                <attr name="position" intvalue="900"/>
45
                <attr name="position" intvalue="900"/>
46
                <file name="emptyModule">
47
                    <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.Bundle#Templates/Project/APISupport/emptyModule"/>
48
                    <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/resources/module.png"/>
49
                    <attr name="position" intvalue="100"/>
50
                    <attr name="template" boolvalue="true"/>
51
                    <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.NewNbModuleWizardIterator.createModuleIterator"/>
52
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/resources/emptyModule.html"/>
53
                </file>
54
                <file name="emptySuite">
55
                    <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.Bundle#Templates/Project/APISupport/emptySuite"/>
56
                    <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/suite/resources/suite.png"/>
57
                    <attr name="position" intvalue="200"/>
58
                    <attr name="template" boolvalue="true"/>
59
                    <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.NewNbModuleWizardIterator.createSuiteIterator"/>
60
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/resources/emptySuite.html"/>
61
                </file>
62
                <file name="libraryModule">
63
                    <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.Bundle#Templates/Project/APISupport/libraryModule"/>
64
                    <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/resources/module.png"/>
65
                    <attr name="position" intvalue="300"/>
66
                    <attr name="template" boolvalue="true"/>
67
                    <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.NewNbModuleWizardIterator.createLibraryModuleIterator"/>
68
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/resources/libraryModule.html"/>
69
                </file>
70
                <file name="emptyApplication">
71
                    <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.Bundle#Templates/Project/APISupport/emptyApplication"/>
72
                    <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/suite/resources/suite.png"/>
73
                    <attr name="position" intvalue="400"/>
74
                    <attr name="template" boolvalue="true"/>
75
                    <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.NewNbModuleWizardIterator.createApplicationIterator"/>
76
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/resources/emptyApplication.html"/>
77
                </file>
78
            </folder>
46
            </folder>
79
        </folder>
47
        </folder>
80
    </folder>
48
    </folder>
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties (-4 lines)
Lines 42-51 Link Here
42
42
43
# System file system
43
# System file system
44
Templates/Project/APISupport=NetBeans Modules
44
Templates/Project/APISupport=NetBeans Modules
45
Templates/Project/APISupport/emptyModule=Module
46
Templates/Project/APISupport/emptySuite=Module Suite
47
Templates/Project/APISupport/emptyApplication=NetBeans Platform Application
48
Templates/Project/APISupport/libraryModule=Library Wrapper Module
49
45
50
# general
46
# general
51
CTL_BrowseButton_o=Br&owse...
47
CTL_BrowseButton_o=Br&owse...
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/wizard/NewNbModuleWizardIterator.java (-2 / +15 lines)
Lines 50-56 Link Here
50
import java.util.ArrayList;
50
import java.util.ArrayList;
51
import java.util.HashSet;
51
import java.util.HashSet;
52
import java.util.List;
52
import java.util.List;
53
import java.util.Map;
54
import java.util.NoSuchElementException;
53
import java.util.NoSuchElementException;
55
import java.util.Set;
54
import java.util.Set;
56
import javax.swing.JComponent;
55
import javax.swing.JComponent;
Lines 68-74 Link Here
68
import org.openide.WizardDescriptor;
67
import org.openide.WizardDescriptor;
69
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileObject;
70
import org.openide.filesystems.FileUtil;
69
import org.openide.filesystems.FileUtil;
70
import org.openide.loaders.Template;
71
import org.openide.util.NbBundle;
71
import org.openide.util.NbBundle;
72
import org.openide.util.NbBundle.Messages;
72
73
73
/**
74
/**
74
 * Wizard to create a new NetBeans Module project.
75
 * Wizard to create a new NetBeans Module project.
Lines 76-81 Link Here
76
 * @author Martin Krauskopf
77
 * @author Martin Krauskopf
77
 */
78
 */
78
public class NewNbModuleWizardIterator implements WizardDescriptor.AsynchronousInstantiatingIterator<WizardDescriptor> {
79
public class NewNbModuleWizardIterator implements WizardDescriptor.AsynchronousInstantiatingIterator<WizardDescriptor> {
80
    
81
    private static final String FOLDER = "Project/APISupport";
82
    private static final String MODULE_ICON = "org/netbeans/modules/apisupport/project/resources/module.png";
83
    private static final String SUITE_ICON = "org/netbeans/modules/apisupport/project/suite/resources/suite.png";
79
84
80
    enum Type {
85
    enum Type {
81
        /** Either standalone module, suite component or NB.org module. */
86
        /** Either standalone module, suite component or NB.org module. */
Lines 119-125 Link Here
119
     * Returns wizard for creating NetBeans module in general - i.e. either
124
     * Returns wizard for creating NetBeans module in general - i.e. either
120
     * standalone module, suite component or NB.org module.
125
     * standalone module, suite component or NB.org module.
121
     */
126
     */
122
    public static NewNbModuleWizardIterator createModuleIterator(Map m) {
127
    @Template(folder = FOLDER, position = 100, displayName = "#template_module", iconBase = MODULE_ICON, description = "../../resources/emptyModule.html")
128
    @Messages("template_module=Module")
129
    public static NewNbModuleWizardIterator createModuleIterator() {
123
        return new NewNbModuleWizardIterator(Type.MODULE);
130
        return new NewNbModuleWizardIterator(Type.MODULE);
124
    }
131
    }
125
    
132
    
Lines 133-142 Link Here
133
        return iterator;
140
        return iterator;
134
    }
141
    }
135
    
142
    
143
    @Template(folder = FOLDER, position = 200, displayName = "#template_suite", iconBase = SUITE_ICON, description = "../../resources/emptySuite.html")
144
    @Messages("template_suite=Module Suite")
136
    public static NewNbModuleWizardIterator createSuiteIterator() {
145
    public static NewNbModuleWizardIterator createSuiteIterator() {
137
        return new NewNbModuleWizardIterator(Type.SUITE);
146
        return new NewNbModuleWizardIterator(Type.SUITE);
138
    }
147
    }
139
    
148
    
149
    @Template(folder = FOLDER, position = 400, displayName = "#template_application", iconBase = SUITE_ICON, description = "../../resources/emptyApplication.html")
150
    @Messages("template_application=NetBeans Platform Application")
140
    public static NewNbModuleWizardIterator createApplicationIterator() {
151
    public static NewNbModuleWizardIterator createApplicationIterator() {
141
        return new NewNbModuleWizardIterator(Type.APPLICATION);
152
        return new NewNbModuleWizardIterator(Type.APPLICATION);
142
    }
153
    }
Lines 154-159 Link Here
154
        return iterator;
165
        return iterator;
155
    }
166
    }
156
    
167
    
168
    @Template(folder = FOLDER, position = 300, displayName = "#template_library_module", iconBase = MODULE_ICON, description = "../../resources/libraryModule.html")
169
    @Messages("template_library_module=Library Wrapper Module")
157
    public static NewNbModuleWizardIterator createLibraryModuleIterator() {
170
    public static NewNbModuleWizardIterator createLibraryModuleIterator() {
158
        return new NewNbModuleWizardIterator(Type.LIBRARY_MODULE);
171
        return new NewNbModuleWizardIterator(Type.LIBRARY_MODULE);
159
    }
172
    }
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/wizard/NewTemplateVisualPanel.java (-8 / +8 lines)
Lines 43-49 Link Here
43
package org.netbeans.modules.apisupport.project.ui.wizard;
43
package org.netbeans.modules.apisupport.project.ui.wizard;
44
44
45
import org.netbeans.modules.apisupport.project.api.BasicVisualPanel;
45
import org.netbeans.modules.apisupport.project.api.BasicVisualPanel;
46
import org.openide.util.NbBundle;
46
import static org.netbeans.modules.apisupport.project.ui.wizard.Bundle.*;
47
47
48
abstract class NewTemplateVisualPanel extends BasicVisualPanel {
48
abstract class NewTemplateVisualPanel extends BasicVisualPanel {
49
49
Lines 52-78 Link Here
52
    NewTemplateVisualPanel(final NewModuleProjectData data) {
52
    NewTemplateVisualPanel(final NewModuleProjectData data) {
53
        super(data.getSettings());
53
        super(data.getSettings());
54
        this.data = data;
54
        this.data = data;
55
        String resource;
55
        String title;
56
        switch (data.getWizardType()) {
56
        switch (data.getWizardType()) {
57
            case SUITE:
57
            case SUITE:
58
                resource = "emptySuite"; // NOI18N
58
                title = template_suite();
59
                break;
59
                break;
60
            case APPLICATION:
60
            case APPLICATION:
61
                resource = "emptyApplication"; // NOI18N
61
                title = template_application();
62
                break;
62
                break;
63
            case MODULE:
63
            case MODULE:
64
            case SUITE_COMPONENT:
64
            case SUITE_COMPONENT:
65
                resource = "emptyModule"; // NOI18N
65
                title = template_module();
66
                break;
66
                break;
67
            case LIBRARY_MODULE:
67
            case LIBRARY_MODULE:
68
                resource = "libraryModule"; // NOI18N
68
                title = template_library_module();
69
                break;
69
                break;
70
            default:
70
            default:
71
                assert false : "Unknown wizard type = " + data.getWizardType();
71
                assert false : "Unknown wizard type = " + data.getWizardType();
72
                resource = "";
72
                title = "";
73
        }
73
        }
74
        data.getSettings().putProperty("NewProjectWizard_Title", // NOI18N
74
        data.getSettings().putProperty("NewProjectWizard_Title", // NOI18N
75
                NbBundle.getMessage(NewTemplateVisualPanel.class, "Templates/Project/APISupport/" + resource));
75
                title);
76
    }
76
    }
77
77
78
    protected NewModuleProjectData getData() {
78
    protected NewModuleProjectData getData() {
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/resources/layer.xml (-117 lines)
Lines 49-171 Link Here
49
        <folder name="NetBeansModuleDevelopment">
49
        <folder name="NetBeansModuleDevelopment">
50
            <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.common.Bundle#NetBeansModuleDevelopment"/>
50
            <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.common.Bundle#NetBeansModuleDevelopment"/>
51
            <attr name="position" intvalue="200"/>
51
            <attr name="position" intvalue="200"/>
52
            <file name="newAction">
53
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.action.Bundle#Templates/NetBeansModuleDevelopment/newAction"/>
54
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/newAction.png"/>
55
                <attr name="position" intvalue="100"/>
56
                <attr boolvalue="true" name="template"/>
57
                <attr methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.action.NewActionIterator.createIterator" name="instantiatingIterator"/>
58
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newAction.html"/>
59
                <attr name="templateCategory" stringvalue="nbm-specific"/>
60
            </file>
61
            <file name="newWindow">
62
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.winsys.Bundle#Templates/NetBeansModuleDevelopment/newWindow"/>
63
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/newTC.png"/>
64
                <attr name="position" intvalue="200"/>
65
                <attr name="template" boolvalue="true"/>
66
                <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.winsys.NewTCIterator.createIterator"/>
67
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newTC.html"/>
68
                <attr name="templateCategory" stringvalue="nbm-specific"/>
69
            </file>
70
            <file name="newWizard">
71
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.wizard.Bundle#Templates/NetBeansModuleDevelopment/newWizard"/>
72
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/newWizard.png"/>
73
                <attr name="position" intvalue="300"/>
74
                <attr boolvalue="true" name="template"/>
75
                <attr methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.wizard.NewWizardIterator.createIterator" name="instantiatingIterator"/>
76
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newWizard.html"/>
77
                <attr name="templateCategory" stringvalue="nbm-specific"/>
78
            </file>
79
            <file name="newOptions">
80
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.options.Bundle#Templates/NetBeansModuleDevelopment/newOptions"/>
81
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/newOptions.png"/>
82
                <attr name="position" intvalue="400"/>
83
                <attr boolvalue="true" name="template"/>
84
                <attr methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.options.NewOptionsIterator.createIterator" name="instantiatingIterator"/>
85
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newOptions.html"/>
86
                <attr name="templateCategory" stringvalue="nbm-specific"/>
87
            </file>
88
            <file name="newLoader">
89
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.loader.Bundle#Templates/NetBeansModuleDevelopment/newLoader"/>
90
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/newLoader.png"/>
91
                <attr name="position" intvalue="500"/>
92
                <attr boolvalue="true" name="template"/>
93
                <attr methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.loader.NewLoaderIterator.createIterator" name="instantiatingIterator"/>
94
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newLoader.html"/>
95
                <attr name="templateCategory" stringvalue="nbm-specific"/>
96
            </file>
97
            <file name="newUpdateCenter">
98
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.updatecenter.Bundle#Templates/NetBeansModuleDevelopment/newUpdateCenter"/>
99
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/newUpdateCenter.png"/>
100
                <attr name="position" intvalue="600"/>
101
                <attr name="template" boolvalue="true"/>
102
                <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.updatecenter.NewUpdateCenterIterator.createIterator"/>
103
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newUpdateCenter.html"/>
104
                <attr name="templateCategory" stringvalue="nbm-specific"/>
105
            </file>
106
            <file name="newModuleInstall">
107
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.moduleinstall.Bundle#Templates/NetBeansModuleDevelopment/newModuleInstall"/>
108
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/resources/module.png"/>
109
                <attr name="position" intvalue="700"/>
110
                <attr boolvalue="true" name="template"/>
111
                <attr methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.moduleinstall.NewModuleInstallIterator.createIterator" name="instantiatingIterator"/>
112
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newModuleInstall.html"/>
113
                <attr name="templateCategory" stringvalue="nbm-specific"/>
114
            </file>
115
            <file name="newQuickSearch">
116
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.quicksearch.Bundle#Templates/NetBeansModuleDevelopment/newQuickSearch"/>
117
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/newQuickSearch.png"/>
118
                <attr name="position" intvalue="800"/>
119
                <attr name="template" boolvalue="true"/>
120
                <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.quicksearch.NewQuickSearchIterator.createIterator"/>
121
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newQuickSearch.html"/>
122
                <attr name="templateCategory" stringvalue="nbm-specific"/>
123
            </file>
124
            <file name="newJavaHelp">
125
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.javahelp.Bundle#Templates/NetBeansModuleDevelopment/newJavaHelp"/>
126
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/newJavaHelp.png"/>
127
                <attr name="position" intvalue="900"/>
128
                <attr boolvalue="true" name="template"/>
129
                <attr methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.javahelp.NewJavaHelpIterator.createIterator" name="instantiatingIterator"/>
130
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newJavaHelp.html"/>
131
                <attr name="templateCategory" stringvalue="nbm-specific"/>
132
            </file>
133
            <file name="newProject">
134
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.project.Bundle#Templates/NetBeansModuleDevelopment/newProject"/>
135
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/newProject.png"/>
136
                <attr name="position" intvalue="1000"/>
137
                <attr name="template" boolvalue="true"/>
138
                <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.project.NewProjectIterator.createIterator"/>
139
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newProject.html"/>
140
                <attr name="templateCategory" stringvalue="nbm-specific"/>
141
            </file>
142
            <file name="emptyLibraryDescriptor">
143
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.librarydescriptor.Bundle#Templates/NetBeansModuleDevelopment/emptyLibraryDescriptor"/>
144
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/libraries.gif"/>
145
                <attr name="position" intvalue="1100"/>
146
                <attr boolvalue="true" name="template"/>
147
                <attr methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.librarydescriptor.NewLibraryDescriptor.createIterator" name="instantiatingIterator"/>
148
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/emptyLibraryDescriptor.html"/>
149
                <attr name="templateCategory" stringvalue="nbm-specific"/>
150
            </file>
151
            <file name="newCodeGenerator">
152
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.codegenerator.Bundle#Templates/NetBeansModuleDevelopment/newCodeGenerator"/>
153
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/newCodeGenerator.png"/>
154
                <attr name="position" intvalue="1200"/>
155
                <attr name="template" boolvalue="true"/>
156
                <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.apisupport.project.ui.wizard.codegenerator.NewCodeGeneratorIterator.createIterator"/>
157
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newCodeGenerator.html"/>
158
                <attr name="templateCategory" stringvalue="nbm-specific"/>
159
            </file>
160
            <file name="newLayer">
161
                <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.project.ui.wizard.layer.Bundle#template_label"/>
162
                <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/project/ui/resources/layerObject.gif"/>
163
                <attr name="position" intvalue="1300"/>
164
                <attr name="template" boolvalue="true"/>
165
                <attr name="instantiatingIterator" newvalue="org.netbeans.modules.apisupport.project.ui.wizard.layer.NewLayerIterator"/>
166
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/project/ui/resources/newLayer.html"/>
167
                <attr name="templateCategory" stringvalue="nbm-specific"/>
168
            </file>
169
        </folder>
52
        </folder>
170
        <folder name="NetBeansModuleDevelopment-files"> <!-- XXX later could be made visible (just need localized labels) -->
53
        <folder name="NetBeansModuleDevelopment-files"> <!-- XXX later could be made visible (just need localized labels) -->
171
            <attr name="position" intvalue="0"/>
54
            <attr name="position" intvalue="0"/>
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/action/Bundle.properties (-1 lines)
Lines 41-47 Link Here
41
# Version 2 license, then the option applies only if the new code is
41
# Version 2 license, then the option applies only if the new code is
42
# made subject to such option by the copyright holder.
42
# made subject to such option by the copyright holder.
43
43
44
Templates/NetBeansModuleDevelopment/newAction=Action
45
LBL_ActionWizardTitle=Action
44
LBL_ActionWizardTitle=Action
46
45
47
# Action Type panel (1.step)
46
# Action Type panel (1.step)
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/action/NewActionIterator.java (-7 / +5 lines)
Lines 49-70 Link Here
49
import org.netbeans.modules.apisupport.project.ui.wizard.common.CreatedModifiedFiles;
49
import org.netbeans.modules.apisupport.project.ui.wizard.common.CreatedModifiedFiles;
50
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
50
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
51
import org.openide.WizardDescriptor;
51
import org.openide.WizardDescriptor;
52
import org.openide.loaders.Template;
53
import org.openide.util.NbBundle.Messages;
52
54
53
/**
55
/**
54
 * Wizard for creating new Actions.
56
 * Wizard for creating new Actions.
55
 *
57
 *
56
 * @author Martin Krauskopf
58
 * @author Martin Krauskopf
57
 */
59
 */
58
final class NewActionIterator extends BasicWizardIterator {
60
@Template(folder="NetBeansModuleDevelopment", displayName="#template", iconBase="org/netbeans/modules/apisupport/project/ui/resources/newAction.png", position=100, description="../../resources/newAction.html", category="nbm-specific")
61
@Messages("template=Action")
62
public final class NewActionIterator extends BasicWizardIterator {
59
63
60
    private DataModel data;
64
    private DataModel data;
61
65
62
    private NewActionIterator() {}
63
64
    public static NewActionIterator createIterator() {
65
        return new NewActionIterator();
66
    }
67
    
68
    public Set instantiate() throws IOException {
66
    public Set instantiate() throws IOException {
69
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
67
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
70
        cmf.run();
68
        cmf.run();
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/codegenerator/NewCodeGeneratorIterator.java (+2 lines)
Lines 52-57 Link Here
52
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
52
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
53
import org.openide.WizardDescriptor;
53
import org.openide.WizardDescriptor;
54
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileObject;
55
import org.openide.loaders.Template;
55
56
56
/**
57
/**
57
 * Wiziard for creating ne Code Generators
58
 * Wiziard for creating ne Code Generators
Lines 164-169 Link Here
164
     * layer.xml entrypoint
165
     * layer.xml entrypoint
165
     * @return instance
166
     * @return instance
166
     */
167
     */
168
    @Template(folder = "NetBeansModuleDevelopment", position = 1200, displayName = "#Templates/NetBeansModuleDevelopment/newCodeGenerator", iconBase = "org/netbeans/modules/apisupport/project/ui/resources/newCodeGenerator.png", description = "/org/netbeans/modules/apisupport/project/ui/resources/newCodeGenerator.html", category = "nbm-specific")
167
    public static NewCodeGeneratorIterator createIterator() {
169
    public static NewCodeGeneratorIterator createIterator() {
168
        return new NewCodeGeneratorIterator();
170
        return new NewCodeGeneratorIterator();
169
    }
171
    }
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/javahelp/NewJavaHelpIterator.java (+2 lines)
Lines 57-62 Link Here
57
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
57
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
58
import org.openide.WizardDescriptor;
58
import org.openide.WizardDescriptor;
59
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileObject;
60
import org.openide.loaders.Template;
60
import org.openide.modules.SpecificationVersion;
61
import org.openide.modules.SpecificationVersion;
61
import org.openide.util.Exceptions;
62
import org.openide.util.Exceptions;
62
63
Lines 69-74 Link Here
69
    
70
    
70
    private NewJavaHelpIterator.DataModel data;
71
    private NewJavaHelpIterator.DataModel data;
71
    
72
    
73
    @Template(folder = "NetBeansModuleDevelopment", position = 900, displayName = "#Templates/NetBeansModuleDevelopment/newJavaHelp", iconBase = "org/netbeans/modules/apisupport/project/ui/resources/newJavaHelp.png", description = "/org/netbeans/modules/apisupport/project/ui/resources/newJavaHelp.html", category = "nbm-specific")
72
    public static NewJavaHelpIterator createIterator() {
74
    public static NewJavaHelpIterator createIterator() {
73
        return new NewJavaHelpIterator();
75
        return new NewJavaHelpIterator();
74
    }
76
    }
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/layer/NewLayerIterator.java (+2 lines)
Lines 47-53 Link Here
47
import org.openide.WizardDescriptor;
47
import org.openide.WizardDescriptor;
48
import org.openide.filesystems.FileObject;
48
import org.openide.filesystems.FileObject;
49
import org.openide.filesystems.FileSystem;
49
import org.openide.filesystems.FileSystem;
50
import org.openide.loaders.Template;
50
51
52
@Template(folder = "NetBeansModuleDevelopment", position = 1300, displayName = "#template_label", iconBase = "org/netbeans/modules/apisupport/project/ui/resources/layerObject.gif", description = "/org/netbeans/modules/apisupport/project/ui/resources/newLayer.html", category = "nbm-specific")
51
public class NewLayerIterator extends BasicWizardIterator {
53
public class NewLayerIterator extends BasicWizardIterator {
52
54
53
    private BasicDataModel data;
55
    private BasicDataModel data;
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/NewLibraryDescriptor.java (+2 lines)
Lines 55-60 Link Here
55
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
55
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
56
import org.openide.WizardDescriptor;
56
import org.openide.WizardDescriptor;
57
import org.openide.filesystems.FileSystem;
57
import org.openide.filesystems.FileSystem;
58
import org.openide.loaders.Template;
58
59
59
/**
60
/**
60
 * Wizard <em>J2SE Library Descriptor</em> for registering
61
 * Wizard <em>J2SE Library Descriptor</em> for registering
Lines 66-71 Link Here
66
    
67
    
67
    NewLibraryDescriptor.DataModel data;
68
    NewLibraryDescriptor.DataModel data;
68
    
69
    
70
    @Template(folder = "NetBeansModuleDevelopment", position = 1100, displayName = "#Templates/NetBeansModuleDevelopment/emptyLibraryDescriptor", iconBase = "org/netbeans/modules/apisupport/project/ui/resources/libraries.gif", description = "/org/netbeans/modules/apisupport/project/ui/resources/emptyLibraryDescriptor.html", category = "nbm-specific")
69
    public static NewLibraryDescriptor createIterator() {
71
    public static NewLibraryDescriptor createIterator() {
70
        return new NewLibraryDescriptor();
72
        return new NewLibraryDescriptor();
71
    }
73
    }
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/loader/Bundle.properties (-1 lines)
Lines 42-48 Link Here
42
42
43
# Sample ResourceBundle properties file
43
# Sample ResourceBundle properties file
44
LBL_LoaderWizardTitle=File Type
44
LBL_LoaderWizardTitle=File Type
45
Templates/NetBeansModuleDevelopment/newLoader=File Type
46
45
47
# FileRecognitionPanel: texts of components
46
# FileRecognitionPanel: texts of components
48
LBL_FileRecognition_Title=File Recognition
47
LBL_FileRecognition_Title=File Recognition
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/loader/NewLoaderIterator.java (-7 / +12 lines)
Lines 69-75 Link Here
69
import org.openide.filesystems.FileUtil;
69
import org.openide.filesystems.FileUtil;
70
import org.openide.loaders.DataFolder;
70
import org.openide.loaders.DataFolder;
71
import org.openide.loaders.DataObject;
71
import org.openide.loaders.DataObject;
72
import org.openide.loaders.Template;
72
import org.openide.modules.SpecificationVersion;
73
import org.openide.modules.SpecificationVersion;
74
import org.openide.util.NbBundle.Messages;
73
import org.openide.xml.XMLUtil;
75
import org.openide.xml.XMLUtil;
74
76
75
/**
77
/**
Lines 77-92 Link Here
77
 *
79
 *
78
 * @author Milos Kleint
80
 * @author Milos Kleint
79
 */
81
 */
80
final class NewLoaderIterator extends BasicWizardIterator {
82
@Template(
83
    folder="NetBeansModuleDevelopment",
84
    position=500,
85
    displayName="#template",
86
    iconBase="org/netbeans/modules/apisupport/project/ui/resources/newLoader.png",
87
    description="../../resources/newLoader.html",
88
    category="nbm-specific"
89
)
90
@Messages("template=File Type")
91
public final class NewLoaderIterator extends BasicWizardIterator {
81
    
92
    
82
    private NewLoaderIterator.DataModel data;
93
    private NewLoaderIterator.DataModel data;
83
    
94
    
84
    private NewLoaderIterator() { /* Use factory method. */ };
85
    
86
    public static NewLoaderIterator createIterator() {
87
        return new NewLoaderIterator();
88
    }
89
    
90
    public Set instantiate() throws IOException {
95
    public Set instantiate() throws IOException {
91
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
96
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
92
        cmf.run();
97
        cmf.run();
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/moduleinstall/NewModuleInstallIterator.java (+2 lines)
Lines 49-54 Link Here
49
import org.netbeans.modules.apisupport.project.ui.wizard.common.CreatedModifiedFiles;
49
import org.netbeans.modules.apisupport.project.ui.wizard.common.CreatedModifiedFiles;
50
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
50
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
51
import org.openide.WizardDescriptor;
51
import org.openide.WizardDescriptor;
52
import org.openide.loaders.Template;
52
53
53
/**
54
/**
54
 * Wizard for creating Module Installer.
55
 * Wizard for creating Module Installer.
Lines 61-66 Link Here
61
62
62
    private NewModuleInstallIterator() {}
63
    private NewModuleInstallIterator() {}
63
64
65
    @Template(folder = "NetBeansModuleDevelopment", position = 700, displayName = "#Templates/NetBeansModuleDevelopment/newModuleInstall", iconBase = "org/netbeans/modules/apisupport/project/ui/wizard/moduleinstall/module.png", description = "/org/netbeans/modules/apisupport/project/ui/resources/newModuleInstall.html", category = "nbm-specific")
64
    public static NewModuleInstallIterator createIterator() {
66
    public static NewModuleInstallIterator createIterator() {
65
        return new NewModuleInstallIterator();
67
        return new NewModuleInstallIterator();
66
    }
68
    }
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/options/Bundle.properties (-1 lines)
Lines 41-47 Link Here
41
# made subject to such option by the copyright holder.
41
# made subject to such option by the copyright holder.
42
42
43
LBL_OptionsWizardTitle=Options Panel
43
LBL_OptionsWizardTitle=Options Panel
44
Templates/NetBeansModuleDevelopment/newOptions=Options Panel
45
44
46
# NameAndLocationPanel: texts of components
45
# NameAndLocationPanel: texts of components
47
LBL_OptionsPanel0_Title=Choose Panel Type
46
LBL_OptionsPanel0_Title=Choose Panel Type
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/options/NewOptionsIterator.java (-5 / +12 lines)
Lines 58-63 Link Here
58
import org.netbeans.modules.apisupport.project.api.Util;
58
import org.netbeans.modules.apisupport.project.api.Util;
59
import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
59
import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
60
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
60
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
61
import org.openide.loaders.Template;
62
import org.openide.util.NbBundle.Messages;
61
import org.openide.util.Utilities;
63
import org.openide.util.Utilities;
62
import org.openide.WizardDescriptor;
64
import org.openide.WizardDescriptor;
63
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileObject;
Lines 71-86 Link Here
71
 * @author Radek Matous
73
 * @author Radek Matous
72
 * @author Max Sauer
74
 * @author Max Sauer
73
 */
75
 */
74
final class NewOptionsIterator extends BasicWizardIterator {
76
@Template(
77
    folder="NetBeansModuleDevelopment",
78
    position=400,
79
    displayName="#template",
80
    iconBase="org/netbeans/modules/apisupport/project/ui/resources/newOptions.png",
81
    description="../../resources/newOptions.html",
82
    category="nbm-specific"
83
)
84
@Messages("template=Options Panel")
85
public final class NewOptionsIterator extends BasicWizardIterator {
75
    
86
    
76
    private NewOptionsIterator.DataModel data;
87
    private NewOptionsIterator.DataModel data;
77
    
88
    
78
    private NewOptionsIterator() {  /* Use factory method. */ }
89
    private NewOptionsIterator() {  /* Use factory method. */ }
79
    
90
    
80
    public static NewOptionsIterator createIterator() {
81
        return new NewOptionsIterator();
82
    }
83
    
84
    public Set instantiate() throws IOException {
91
    public Set instantiate() throws IOException {
85
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
92
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
86
        cmf.run();
93
        cmf.run();
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/project/NewProjectIterator.java (-2 / +3 lines)
Lines 73-78 Link Here
73
import org.openide.filesystems.FileObject;
73
import org.openide.filesystems.FileObject;
74
import org.openide.filesystems.FileSystem;
74
import org.openide.filesystems.FileSystem;
75
import org.openide.filesystems.FileUtil;
75
import org.openide.filesystems.FileUtil;
76
import org.openide.loaders.Template;
77
import org.openide.loaders.Template;
76
78
77
/**
79
/**
78
 * Wizard for creating new project templates.
80
 * Wizard for creating new project templates.
Lines 93-100 Link Here
93
        "org.openide.awt", // NOI18N
95
        "org.openide.awt", // NOI18N
94
    };
96
    };
95
    
97
    
96
    private NewProjectIterator() { /* Use factory method. */ };
98
    @Template(folder = "NetBeansModuleDevelopment", position = 1000, displayName = "#Templates/NetBeansModuleDevelopment/newProject", iconBase = "org/netbeans/modules/apisupport/project/ui/resources/newProject.png", description = "/org/netbeans/modules/apisupport/project/ui/resources/newProject.html", category = "nbm-specific")
97
    
98
    public static NewProjectIterator createIterator() {
99
    public static NewProjectIterator createIterator() {
99
        return new NewProjectIterator();
100
        return new NewProjectIterator();
100
    }
101
    }
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/quicksearch/NewQuickSearchIterator.java (+2 lines)
Lines 51-56 Link Here
51
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
51
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
52
import org.openide.WizardDescriptor;
52
import org.openide.WizardDescriptor;
53
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileObject;
54
import org.openide.loaders.Template;
54
55
55
/**
56
/**
56
 * Wizard for creating new providers for QuickSearch SPI
57
 * Wizard for creating new providers for QuickSearch SPI
Lines 80-85 Link Here
80
     * layer.xml entrypoint
81
     * layer.xml entrypoint
81
     * @return instance
82
     * @return instance
82
     */
83
     */
84
    @Template(folder = "NetBeansModuleDevelopment", position = 800, displayName = "#Templates/NetBeansModuleDevelopment/newQuickSearch", iconBase = "org/netbeans/modules/apisupport/project/ui/resources/newQuickSearch.png", description = "/org/netbeans/modules/apisupport/project/ui/resources/newQuickSearch.html", category = "nbm-specific")
83
    public static NewQuickSearchIterator createIterator() {
85
    public static NewQuickSearchIterator createIterator() {
84
        return new NewQuickSearchIterator();
86
        return new NewQuickSearchIterator();
85
    }
87
    }
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/updatecenter/Bundle.properties (-1 lines)
Lines 40-46 Link Here
40
# Version 2 license, then the option applies only if the new code is
40
# Version 2 license, then the option applies only if the new code is
41
# made subject to such option by the copyright holder.
41
# made subject to such option by the copyright holder.
42
42
43
Templates/NetBeansModuleDevelopment/newUpdateCenter=Update Center
44
43
45
LBL_NewUpdateCenterWizardTitle=Update Center
44
LBL_NewUpdateCenterWizardTitle=Update Center
46
LBL_UpdateCenterRegistrationPanel_Title=Update Center Declaration
45
LBL_UpdateCenterRegistrationPanel_Title=Update Center Declaration
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/updatecenter/NewUpdateCenterIterator.java (-5 / +12 lines)
Lines 51-70 Link Here
51
import org.netbeans.modules.apisupport.project.api.LayerHandle;
51
import org.netbeans.modules.apisupport.project.api.LayerHandle;
52
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
52
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
53
import org.openide.WizardDescriptor;
53
import org.openide.WizardDescriptor;
54
import org.openide.loaders.Template;
55
import org.openide.util.NbBundle.Messages;
54
56
55
/**
57
/**
56
 * Wizard for creating new update catalog.
58
 * Wizard for creating new update catalog.
57
 *
59
 *
58
 * @author Jiri Rechtacek
60
 * @author Jiri Rechtacek
59
 */
61
 */
60
final class NewUpdateCenterIterator extends BasicWizardIterator {
62
@Template(
63
    folder="NetBeansModuleDevelopment",
64
    position=600,
65
    displayName="#template",
66
    iconBase="org/netbeans/modules/apisupport/project/ui/resources/newUpdateCenter.png",
67
    description="../../resources/newUpdateCenter.html",
68
    category="nbm-specific"
69
)
70
@Messages("template=Update Center")
71
public final class NewUpdateCenterIterator extends BasicWizardIterator {
61
72
62
    private DataModel data;
73
    private DataModel data;
63
    
74
    
64
    public static NewUpdateCenterIterator createIterator() {
65
        return new NewUpdateCenterIterator();
66
    }
67
    
68
    public Set instantiate() throws IOException {
75
    public Set instantiate() throws IOException {
69
        CreatedModifiedFiles cmf = data.refreshCreatedModifiedFiles();
76
        CreatedModifiedFiles cmf = data.refreshCreatedModifiedFiles();
70
        cmf.run();
77
        cmf.run();
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties (-2 lines)
Lines 40-47 Link Here
40
# Version 2 license, then the option applies only if the new code is
40
# Version 2 license, then the option applies only if the new code is
41
# made subject to such option by the copyright holder.
41
# made subject to such option by the copyright holder.
42
42
43
# Sample ResourceBundle properties file
44
Templates/NetBeansModuleDevelopment/newWindow=Window
45
LBL_TCWizardTitle=Window
43
LBL_TCWizardTitle=Window
46
44
47
# NameAndLocationPanel: texts of components
45
# NameAndLocationPanel: texts of components
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/NewTCIterator.java (-7 / +12 lines)
Lines 62-68 Link Here
62
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileObject;
63
import org.openide.filesystems.FileSystem;
63
import org.openide.filesystems.FileSystem;
64
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.FileUtil;
65
import org.openide.loaders.Template;
65
import org.openide.modules.SpecificationVersion;
66
import org.openide.modules.SpecificationVersion;
67
import org.openide.util.NbBundle.Messages;
66
import org.openide.windows.WindowManager;
68
import org.openide.windows.WindowManager;
67
69
68
/**
70
/**
Lines 70-85 Link Here
70
 *
72
 *
71
 * @author Milos Kleint
73
 * @author Milos Kleint
72
 */
74
 */
73
final class NewTCIterator extends BasicWizardIterator {
75
@Template(
76
    folder="NetBeansModuleDevelopment",
77
    position=200,
78
    displayName="#template",
79
    iconBase="org/netbeans/modules/apisupport/project/ui/resources/newTC.png", 
80
    description="../../resources/newTC.html",
81
    category="nbm-specific"
82
)
83
@Messages("template=Window")
84
public final class NewTCIterator extends BasicWizardIterator {
74
85
75
    private NewTCIterator.DataModel data;
86
    private NewTCIterator.DataModel data;
76
    
87
    
77
    private NewTCIterator() { /* Use factory method. */ };
78
    
79
    public static NewTCIterator createIterator() {
80
        return new NewTCIterator();
81
    }
82
    
83
    public Set instantiate() throws IOException {
88
    public Set instantiate() throws IOException {
84
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
89
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
85
        cmf.run();
90
        cmf.run();
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/wizard/Bundle.properties (-1 lines)
Lines 40-46 Link Here
40
# Version 2 license, then the option applies only if the new code is
40
# Version 2 license, then the option applies only if the new code is
41
# made subject to such option by the copyright holder.
41
# made subject to such option by the copyright holder.
42
42
43
Templates/NetBeansModuleDevelopment/newWizard=Wizard
44
LBL_WizardWizardTitle=Wizard
43
LBL_WizardWizardTitle=Wizard
45
44
46
# Wizard Type panel (1.step)
45
# Wizard Type panel (1.step)
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/wizard/NewWizardIterator.java (-7 / +12 lines)
Lines 49-70 Link Here
49
import org.netbeans.modules.apisupport.project.ui.wizard.common.CreatedModifiedFiles;
49
import org.netbeans.modules.apisupport.project.ui.wizard.common.CreatedModifiedFiles;
50
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
50
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
51
import org.openide.WizardDescriptor;
51
import org.openide.WizardDescriptor;
52
import org.openide.loaders.Template;
53
import org.openide.util.NbBundle.Messages;
52
54
53
/**
55
/**
54
 * Wizard for creating new Wizards.
56
 * Wizard for creating new Wizards.
55
 *
57
 *
56
 * @author Martin Krauskopf
58
 * @author Martin Krauskopf
57
 */
59
 */
58
final class NewWizardIterator extends BasicWizardIterator {
60
@Template(
61
    folder="NetBeansModuleDevelopment",
62
    position=300,
63
    displayName="#template",
64
    iconBase="org/netbeans/modules/apisupport/project/ui/resources/newWizard.png",
65
    description="../../resources/newWizard.html",
66
    category="nbm-specific"
67
)
68
@Messages("template=Wizard")
69
public final class NewWizardIterator extends BasicWizardIterator {
59
70
60
    private DataModel data;
71
    private DataModel data;
61
72
62
    private NewWizardIterator() {}
63
64
    public static NewWizardIterator createIterator() {
65
        return new NewWizardIterator();
66
    }
67
    
68
    public Set instantiate() throws IOException {
73
    public Set instantiate() throws IOException {
69
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
74
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
70
        cmf.run();
75
        cmf.run();
(-)a/apisupport.refactoring/src/org/netbeans/modules/apisupport/hints/Hinter.java (-3 / +20 lines)
Lines 47-52 Link Here
47
import java.io.IOException;
47
import java.io.IOException;
48
import java.util.ArrayList;
48
import java.util.ArrayList;
49
import java.util.Arrays;
49
import java.util.Arrays;
50
import java.util.Collections;
50
import java.util.List;
51
import java.util.List;
51
import java.util.Map;
52
import java.util.Map;
52
import java.util.concurrent.Callable;
53
import java.util.concurrent.Callable;
Lines 351-357 Link Here
351
         * @param wc Java source context
352
         * @param wc Java source context
352
         * @param modifiers the element's modifiers to append to
353
         * @param modifiers the element's modifiers to append to
353
         * @param type canonical name of the annotation type
354
         * @param type canonical name of the annotation type
354
         * @param parameters simple parameters of String or primitive type (null values are skipped)
355
         * @param parameters simple parameters of String or primitive type or String[] (null values are skipped)
355
         * @return the expanded modifiers tree
356
         * @return the expanded modifiers tree
356
         */
357
         */
357
        public @CheckReturnValue ModifiersTree addAnnotation(WorkingCopy wc, ModifiersTree modifiers, String type, Map<String,Object> parameters) {
358
        public @CheckReturnValue ModifiersTree addAnnotation(WorkingCopy wc, ModifiersTree modifiers, String type, Map<String,Object> parameters) {
Lines 363-371 Link Here
363
            }
364
            }
364
            List<ExpressionTree> arguments = new ArrayList<ExpressionTree>();
365
            List<ExpressionTree> arguments = new ArrayList<ExpressionTree>();
365
            for (Map.Entry<String,Object> entry : parameters.entrySet()) {
366
            for (Map.Entry<String,Object> entry : parameters.entrySet()) {
366
                if (entry.getValue() != null) {
367
                Object value = entry.getValue();
367
                    arguments.add(make.Assignment(make.Identifier(entry.getKey()), make.Literal(entry.getValue())));
368
                ExpressionTree valueTree;
369
                if (value instanceof Object[]) {
370
                    Object[] array = (Object[]) value;
371
                    if (array.length == 1) {
372
                        valueTree = make.Literal(array[0]);
373
                    } else {
374
                        List<ExpressionTree> elements = new ArrayList<ExpressionTree>();
375
                        for (Object o : array) {
376
                            elements.add(make.Literal(o));
377
                        }
378
                        valueTree = make.NewArray(null, Collections.<ExpressionTree>emptyList(), elements);
379
                    }
380
                } else if (value != null) {
381
                    valueTree = make.Literal(value);
382
                } else {
383
                    continue;
368
                }
384
                }
385
                arguments.add(make.Assignment(make.Identifier(entry.getKey()), valueTree));
369
            }
386
            }
370
            return make.addModifiersAnnotation(modifiers, make.Annotation(make.QualIdent(ann), arguments));
387
            return make.addModifiersAnnotation(modifiers, make.Annotation(make.QualIdent(ann), arguments));
371
        }
388
        }
(-)a/apisupport.refactoring/src/org/netbeans/modules/apisupport/hints/TemplateHinter.java (+138 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common Development and
11
 * Distribution License("CDDL") (collectively, the "License"). You may not use
12
 * this file except in compliance with the License. You can obtain a copy of
13
 * the License at http://www.netbeans.org/cddl-gplv2.html or
14
 * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
15
 * governing permissions and limitations under the License. When distributing
16
 * the software, include this License Header Notice in each file and include
17
 * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18
 * particular file as subject to the "Classpath" exception as provided by
19
 * Oracle in the GPL Version 2 section of the License file that accompanied
20
 * this code. If applicable, add the following below the License Header, with
21
 * the fields enclosed by brackets [] replaced by your own identifying
22
 * information: "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL or
25
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26
 * elects to include this software in this distribution under the [CDDL or GPL
27
 * Version 2] license." If you do not indicate a single choice of license, a
28
 * recipient has the option to distribute your version of this file under
29
 * either the CDDL, the GPL Version 2 or to extend the choice of license to its
30
 * licensees as provided above. However, if you add GPL Version 2 code and
31
 * therefore, elected the GPL Version 2 license, then the option applies only
32
 * if the new code is made subject to such option by the copyright holder.
33
 *
34
 * Contributor(s):
35
 *
36
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
37
 */
38
39
package org.netbeans.modules.apisupport.hints;
40
41
import java.util.LinkedHashMap;
42
import com.sun.source.tree.ModifiersTree;
43
import java.net.URL;
44
import java.util.Map;
45
import java.util.concurrent.Callable;
46
import javax.lang.model.element.Element;
47
import org.netbeans.api.java.source.GeneratorUtilities;
48
import org.netbeans.api.java.source.WorkingCopy;
49
import org.netbeans.modules.apisupport.hints.Hinter.Context;
50
import org.netbeans.spi.editor.hints.Severity;
51
import org.openide.DialogDisplayer;
52
import org.openide.NotifyDescriptor;
53
import org.openide.NotifyDescriptor.Message;
54
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileUtil;
56
import org.openide.util.NbBundle.Messages;
57
import org.openide.util.NbCollections;
58
import org.openide.util.lookup.ServiceProvider;
59
import static org.netbeans.modules.apisupport.hints.Bundle.*;
60
61
@ServiceProvider(service=Hinter.class)
62
public class TemplateHinter implements Hinter {
63
64
    @Messages({
65
        "TemplateHinter_content_file=Replace with @Template",
66
        "# {0} - file attribute name", "TemplateHinter_unrecognized_attr=Unrecognized template attribute: {0}"
67
    })
68
    public @Override void process(final Context ctx) throws Exception {
69
        final FileObject file = ctx.file();
70
        if (!file.isData()) {
71
            return;
72
        }
73
        Object iterator = file.getAttribute("literal:instantiatingIterator");
74
        if (iterator == null) {
75
            iterator = file.getAttribute("literal:templateWizardIterator");
76
        }
77
        if (iterator == null) {
78
            return;
79
        }
80
         if (file.getSize() > 0) {
81
             // XXX currently only handle virtual templates
82
             ctx.addHint(Severity.WARNING, TemplateHinter_content_file());
83
             return;
84
         }
85
         for (String attr : NbCollections.iterable(file.getAttributes())) {
86
             if (!attr.matches("instantiatingIterator|templateWizardIterator|template|displayName|iconBase|position|instantiatingWizardURL|templateWizardURL|templateCategory")) {
87
                 ctx.addHint(Severity.WARNING, TemplateHinter_unrecognized_attr(attr));
88
                 return;
89
             }
90
         }
91
        final Object _iterator = iterator;
92
        ctx.addStandardAnnotationHint(new Callable<Void>() {
93
            public @Override Void call() throws Exception {
94
                if (!annotationsAvailable(ctx)) {
95
                    return null;
96
                }
97
                ctx.findAndModifyDeclaration(_iterator, new Context.ModifyDeclarationTask() {
98
                    public @Override void run(WorkingCopy wc, Element declaration, ModifiersTree modifiers) throws Exception {
99
                        Map<String,Object> params = new LinkedHashMap<String,Object>();
100
                        FileObject file = ctx.file();
101
                        params.put("folder", FileUtil.getRelativePath(file.getFileSystem().findResource("Templates"), file.getParent()));
102
                        params.put("position", file.getAttribute("position"));
103
                        params.put("displayName", ctx.bundlevalue(file.getAttribute("literal:displayName"), declaration));
104
                        params.put("iconBase", file.getAttribute("iconBase"));
105
                        URL desc = (URL) file.getAttribute("instantiatingWizardURL");
106
                        if (desc == null) {
107
                            desc = (URL) file.getAttribute("templateWizardURL");
108
                        }
109
                        if (desc != null) {
110
                            // XXX could relativize it
111
                            params.put("description", desc.getPath());
112
                        }
113
                        String category = (String) file.getAttribute("templateCategory");
114
                        if (category != null) {
115
                            params.put("category", category.split(","));
116
                        }
117
                        // XXX use @Templates where necessary
118
                        ModifiersTree nue = ctx.addAnnotation(wc, modifiers, "org.openide.loaders.Template", params);
119
                        ctx.delete(file);
120
                        wc.rewrite(modifiers, GeneratorUtilities.get(wc).importFQNs(nue));
121
                    }
122
                });
123
                return null;
124
            }
125
        });
126
    }
127
128
    @Messages("TemplateHinter.missing_dep=You must add a dependency on org.openide.loaders (7.29+) before using this fix.")
129
    private boolean annotationsAvailable(Context ctx) {
130
        if (ctx.canAccess("org.openide.loaders.Template")) {
131
            return true;
132
        } else {
133
            DialogDisplayer.getDefault().notify(new Message(Bundle.TemplateHinter_missing_dep(), NotifyDescriptor.WARNING_MESSAGE));
134
            return false;
135
        }
136
    }
137
138
}
(-)a/beans/nbproject/project.xml (+9 lines)
Lines 137-142 Link Here
137
                    </run-dependency>
137
                    </run-dependency>
138
                </dependency>
138
                </dependency>
139
                <dependency>
139
                <dependency>
140
                    <code-name-base>org.netbeans.modules.java.project</code-name-base>
141
                    <build-prerequisite/>
142
                    <compile-dependency/>
143
                    <run-dependency>
144
                        <release-version>1</release-version>
145
                        <specification-version>1.39</specification-version>
146
                    </run-dependency>
147
                </dependency>
148
                <dependency>
140
                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
149
                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
141
                    <build-prerequisite/>
150
                    <build-prerequisite/>
142
                    <compile-dependency/>
151
                    <compile-dependency/>
(-)a/beans/src/org/netbeans/modules/beans/beaninfo/BIDataLoader.java (+3 lines)
Lines 91-96 Link Here
91
91
92
    @Override
92
    @Override
93
    protected FileObject findPrimaryFile(FileObject fo) {
93
    protected FileObject findPrimaryFile(FileObject fo) {
94
        if (fo.getAttribute("template") != null && fo.getAttribute("javax.script.ScriptEngine") != null) {
95
            return null; // as in JavaDataLoader
96
        }
94
        return isBeanInfo(fo)? fo: null;
97
        return isBeanInfo(fo)? fo: null;
95
    }
98
    }
96
    
99
    
(-)a/beans/src/org/netbeans/modules/beans/resources/mf-layer.xml (-68 / +11 lines)
Lines 43-118 Link Here
43
Version 2 license, then the option applies only if the new code is
43
Version 2 license, then the option applies only if the new code is
44
made subject to such option by the copyright holder.
44
made subject to such option by the copyright holder.
45
-->
45
-->
46
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN" "http://www.netbeans.org/dtds/filesystem-1_0.dtd">
46
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
47
48
<filesystem>
47
<filesystem>
49
  <folder name="Templates">
48
    <folder name="Templates">
50
    <folder name="Beans">
49
        <folder name="Beans">
51
      <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/beans/resources/Beans.html" />
50
            <attr name="displayName" bundlevalue="org.netbeans.modules.beans.Bundle#Templates/Beans"/>
52
      <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.beans.Bundle"/>
51
            <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/beans/resources/Beans.html"/>
53
      <attr name="position" intvalue="1052"/>
52
            <attr name="position" intvalue="1052"/>
54
      <file name="Bean.java" url="templates/Bean.template">
53
            <file name="Package.shadow">
55
         <attr name="position" intvalue="100"/>
54
                <attr name="position" intvalue="700"/>
56
         <attr name="template" boolvalue="true" />
55
                <attr name="originalFile" stringvalue="Templates/Classes/Package"/>
57
         <attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>
56
            </file>
58
         <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/beans/resources/Bean.html" />
57
        </folder>
59
         <attr name="instantiatingIterator" methodvalue="org.netbeans.spi.java.project.support.ui.templates.JavaTemplates.createJavaTemplateIterator" />
60
         <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/java/resources/class.gif"/>
61
         <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.beans.Bundle"/>
62
         <attr name="templateCategory" stringvalue="java-beans"/>
63
      </file>
64
      <file name="BeanInfo.java" url="templates/BeanInfo.template">
65
         <attr name="position" intvalue="200"/>
66
         <attr name="template" boolvalue="true" />
67
         <attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>
68
         <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.beans.Bundle"/>
69
         <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/java/resources/class.gif"/>
70
         <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/beans/resources/BeanInfo.html" />
71
         <attr name="instantiatingIterator" methodvalue="org.netbeans.spi.java.project.support.ui.templates.JavaTemplates.createJavaTemplateIterator" />
72
         <attr name="templateCategory" stringvalue="java-beans"/>
73
      </file>
74
      <file name="NoIconBeanInfo.java" url="templates/BeanInfoNoIcon.template">
75
         <attr name="position" intvalue="300"/>
76
         <attr name="template" boolvalue="true" />
77
         <attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>
78
         <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/beans/resources/BeanInfo.html" />
79
         <attr name="instantiatingIterator" methodvalue="org.netbeans.spi.java.project.support.ui.templates.JavaTemplates.createJavaTemplateIterator" />
80
         <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.beans.Bundle"/>
81
         <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/java/resources/class.gif"/>
82
         <attr name="templateCategory" stringvalue="java-beans"/>
83
      </file>
84
      <file name="Customizer.java" url="templates/Customizer.template">
85
         <attr name="position" intvalue="400"/>
86
         <attr name="template" boolvalue="true" />
87
         <attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>
88
         <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/beans/resources/Customizer.html" />
89
         <attr name="instantiatingIterator" methodvalue="org.netbeans.spi.java.project.support.ui.templates.JavaTemplates.createJavaTemplateIterator" />
90
         <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.beans.Bundle"/>
91
         <attr name="templateCategory" stringvalue="java-beans"/>
92
      </file>
93
      <file name="Customizer.form" url="templates/Customizer.form.template">
94
         <attr name="position" intvalue="500"/>
95
         <attr name="template" boolvalue="true" />
96
         <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/beans/resources/Customizer.html" />
97
         <attr name="instantiatingIterator" methodvalue="org.netbeans.spi.java.project.support.ui.templates.JavaTemplates.createJavaTemplateIterator" />
98
         <attr name="templateCategory" stringvalue="java-beans"/>
99
      </file>
100
      <file name="PropertyEditor.java" url="templates/PropertyEditor.template">
101
         <attr name="position" intvalue="600"/>
102
         <attr name="template" boolvalue="true" />
103
         <attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>
104
         <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/beans/resources/PropertyEditor.html" />
105
         <attr name="instantiatingIterator" methodvalue="org.netbeans.spi.java.project.support.ui.templates.JavaTemplates.createJavaTemplateIterator" />
106
         <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.beans.Bundle"/>
107
         <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/java/resources/class.gif"/>
108
         <attr name="templateCategory" stringvalue="java-beans"/>
109
      </file>
110
      <file name="Package.shadow">
111
          <attr name="position" intvalue="700"/>
112
         <attr name="originalFile" stringvalue="Templates/Classes/Package"/>
113
      </file>
114
    </folder>
58
    </folder>
115
  </folder>
116
  <folder name="Navigator">
59
  <folder name="Navigator">
117
        <folder name="Panels">
60
        <folder name="Panels">
118
            <folder name="text">
61
            <folder name="text">
(-)a/beans/src/org/netbeans/modules/beans/resources/templates/package-info.java (+49 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common Development and
11
 * Distribution License("CDDL") (collectively, the "License"). You may not use
12
 * this file except in compliance with the License. You can obtain a copy of
13
 * the License at http://www.netbeans.org/cddl-gplv2.html or
14
 * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
15
 * governing permissions and limitations under the License. When distributing
16
 * the software, include this License Header Notice in each file and include
17
 * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18
 * particular file as subject to the "Classpath" exception as provided by
19
 * Oracle in the GPL Version 2 section of the License file that accompanied
20
 * this code. If applicable, add the following below the License Header, with
21
 * the fields enclosed by brackets [] replaced by your own identifying
22
 * information: "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL or
25
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26
 * elects to include this software in this distribution under the [CDDL or GPL
27
 * Version 2] license." If you do not indicate a single choice of license, a
28
 * recipient has the option to distribute your version of this file under
29
 * either the CDDL, the GPL Version 2 or to extend the choice of license to its
30
 * licensees as provided above. However, if you add GPL Version 2 code and
31
 * therefore, elected the GPL Version 2 license, then the option applies only
32
 * if the new code is made subject to such option by the copyright holder.
33
 *
34
 * Contributor(s):
35
 *
36
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
37
 */
38
39
@JavaTemplates.Registrations({
40
    @JavaTemplates.Registration(@Template(folder="Beans", position=100, content="Bean.java.template", displayName="org.netbeans.modules.beans.Bundle#Templates/Beans/Bean.java", description="Bean.html", category="java-beans", scriptEngine="freemarker")),
41
    @JavaTemplates.Registration(@Template(folder="Beans", position=200, content="BeanInfo.java.template", displayName="org.netbeans.modules.beans.Bundle#Templates/Beans/BeanInfo.java", description="BeanInfo.html", category="java-beans", scriptEngine="freemarker")),
42
    @JavaTemplates.Registration(@Template(folder="Beans", position=300, content="NoIconBeanInfo.java.template", displayName="org.netbeans.modules.beans.Bundle#Templates/Beans/NoIconBeanInfo.java", description="BeanInfo.html", category="java-beans", scriptEngine="freemarker")),
43
    @JavaTemplates.Registration(@Template(folder="Beans", position=400, content={"Customizer.java.template", "Customizer.form.template"}, displayName="org.netbeans.modules.beans.Bundle#Templates/Beans/Customizer.java", description="Customizer.html", category="java-beans", scriptEngine="freemarker")),
44
    @JavaTemplates.Registration(@Template(folder="Beans", position=600, content="PropertyEditor.java.template", displayName="org.netbeans.modules.beans.Bundle#Templates/Beans/PropertyEditor.java", description="PropertyEditor.html", category="java-beans", scriptEngine="freemarker"))
45
})
46
package org.netbeans.modules.beans.resources.templates;
47
48
import org.netbeans.spi.java.project.support.ui.templates.JavaTemplates;
49
import org.openide.loaders.Template;
(-)a/html/src/org/netbeans/modules/html/mf-layer.xml (-21 lines)
Lines 46-72 Link Here
46
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
46
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
47
<filesystem>
47
<filesystem>
48
48
49
    <folder name="Templates">
50
        <folder name="Other">
51
            <file name="html.html" url="templates/html.html">
52
                <attr name="displayName" bundlevalue="org.netbeans.modules.html.Bundle#Templates/Other/html.html"/>
53
                <attr name="position" intvalue="100"/>
54
                <attr name="template" boolvalue="true"/>
55
                <attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>
56
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/html/TemplateHelp.html"/>
57
                <attr name="templateCategory" stringvalue="simple-files"/>
58
            </file>
59
            <file name="xhtml.xhtml" url="templates/xhtml.xhtml">
60
                <attr name="displayName" bundlevalue="org.netbeans.modules.html.Bundle#Templates/Other/xhtml.xhtml"/>
61
                <attr name="position" intvalue="200"/>
62
                <attr name="template" boolvalue="true"/>
63
                <attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>
64
                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/html/XhtmlTemplateHelp.html"/>
65
                <attr name="templateCategory" stringvalue="simple-files"/>
66
            </file>
67
        </folder>
68
    </folder>
69
    
70
    <folder name="Services">
49
    <folder name="Services">
71
        <folder name="MIMEResolver">
50
        <folder name="MIMEResolver">
72
            <file name="html.xml" url="resolver.xml">
51
            <file name="html.xml" url="resolver.xml">
(-)a/html/src/org/netbeans/modules/html/package-info.java (+47 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common Development and
11
 * Distribution License("CDDL") (collectively, the "License"). You may not use
12
 * this file except in compliance with the License. You can obtain a copy of
13
 * the License at http://www.netbeans.org/cddl-gplv2.html or
14
 * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
15
 * governing permissions and limitations under the License. When distributing
16
 * the software, include this License Header Notice in each file and include
17
 * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18
 * particular file as subject to the "Classpath" exception as provided by
19
 * Oracle in the GPL Version 2 section of the License file that accompanied
20
 * this code. If applicable, add the following below the License Header, with
21
 * the fields enclosed by brackets [] replaced by your own identifying
22
 * information: "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL or
25
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26
 * elects to include this software in this distribution under the [CDDL or GPL
27
 * Version 2] license." If you do not indicate a single choice of license, a
28
 * recipient has the option to distribute your version of this file under
29
 * either the CDDL, the GPL Version 2 or to extend the choice of license to its
30
 * licensees as provided above. However, if you add GPL Version 2 code and
31
 * therefore, elected the GPL Version 2 license, then the option applies only
32
 * if the new code is made subject to such option by the copyright holder.
33
 *
34
 * Contributor(s):
35
 *
36
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
37
 */
38
39
@Templates({
40
    @Template(folder="Other", position=100, displayName="#Templates/Other/html.html", content="templates/html.html", scriptEngine="freemarker", category="simple-files", description="TemplateHelp.html"),
41
    @Template(folder="Other", position=200, displayName="#Templates/Other/xhtml.xhtml", content="templates/xhtml.xhtml", scriptEngine="freemarker", category="simple-files", description="XhtmlTemplateHelp.html"),
42
})
43
package org.netbeans.modules.html;
44
45
import org.openide.loaders.Template;
46
import org.openide.loaders.Templates;
47
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/resources/layer.xml (-34 / +1 lines)
Lines 48-90 Link Here
48
48
49
    <folder name="Templates">
49
    <folder name="Templates">
50
        <folder name="Project">
50
        <folder name="Project">
51
52
            <folder name="Standard">
51
            <folder name="Standard">
53
                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.java.j2seproject.ui.wizards.Bundle"/>
52
                <attr name="displayName" bundlevalue="org.netbeans.modules.java.j2seproject.ui.wizards.Bundle#Templates/Project/Standard"/>
54
                <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/java/j2seproject/ui/resources/desktop.html"/>
53
                <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/java/j2seproject/ui/resources/desktop.html"/>
55
56
                <attr name="position" intvalue="100"/>
54
                <attr name="position" intvalue="100"/>
57
                <file name="emptyJ2SE.xml">
58
                    <attr name="position" intvalue="100"/>
59
                    <attr name="template" boolvalue="true"/>
60
                    <attr name="instantiatingIterator" newvalue="org.netbeans.modules.java.j2seproject.ui.wizards.NewJ2SEProjectWizardIterator"/>
61
                    <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.java.j2seproject.ui.wizards.Bundle"/>
62
                    <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/java/j2seproject/ui/resources/j2seProject.png"/>
63
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/java/j2seproject/ui/resources/emptyProject.html"/>
64
                </file>
65
        
66
                
67
68
                <file name="emptyJ2SElibrary.xml">
69
                    <attr name="position" intvalue="200"/>
70
                    <attr name="template" boolvalue="true"/>
71
                    <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.java.j2seproject.ui.wizards.NewJ2SEProjectWizardIterator.library"/>
72
                    <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.java.j2seproject.ui.wizards.Bundle"/>
73
                    <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/java/j2seproject/ui/resources/j2seProject.png"/>
74
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/java/j2seproject/ui/resources/emptyLibrary.html"/>
75
                </file>                
76
77
                
78
79
                <file name="existingJ2SE.xml">
80
                    <attr name="position" intvalue="300"/>
81
                    <attr name="template" boolvalue="true"/>
82
                    <attr name="templateWizardIterator" methodvalue="org.netbeans.modules.java.j2seproject.ui.wizards.NewJ2SEProjectWizardIterator.existing"/>
83
                    <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.java.j2seproject.ui.wizards.Bundle"/>
84
                    <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/java/j2seproject/ui/resources/j2seProject.png"/>
85
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/java/j2seproject/ui/resources/existingProject.html"/>
86
                </file>
87
88
            </folder>
55
            </folder>
89
        </folder>
56
        </folder>
90
    </folder>
57
    </folder>
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/Bundle.properties (-4 lines)
Lines 40-50 Link Here
40
# Version 2 license, then the option applies only if the new code is
40
# Version 2 license, then the option applies only if the new code is
41
# made subject to such option by the copyright holder.
41
# made subject to such option by the copyright holder.
42
42
43
#System file system
44
Templates/Project/Standard/emptyJ2SE.xml=Java Application
45
Templates/Project/Standard/emptyJ2SElibrary.xml=Java Class Library
46
Templates/Project/Standard=Java
43
Templates/Project/Standard=Java
47
Templates/Project/Standard/existingJ2SE.xml= Java Project with Existing Sources
48
#New project wizard
44
#New project wizard
49
TXT_DefaultPackageName=mypkg
45
TXT_DefaultPackageName=mypkg
50
46
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/NewJ2SEProjectWizardIterator.java (-8 / +15 lines)
Lines 66-72 Link Here
66
import org.openide.filesystems.FileLock;
66
import org.openide.filesystems.FileLock;
67
import org.openide.filesystems.FileObject;
67
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileUtil;
68
import org.openide.filesystems.FileUtil;
69
import org.openide.loaders.Template;
69
import org.openide.util.NbBundle;
70
import org.openide.util.NbBundle;
71
import org.openide.util.NbBundle.Messages;
70
72
71
/**
73
/**
72
 * Wizard to create a new J2SE project.
74
 * Wizard to create a new J2SE project.
Lines 83-101 Link Here
83
    
85
    
84
    private WizardType type;
86
    private WizardType type;
85
    
87
    
86
    /** Create a new wizard iterator. */
88
    private NewJ2SEProjectWizardIterator(WizardType type) {
87
    public NewJ2SEProjectWizardIterator() {
88
        this(WizardType.APP);
89
    }
90
    
91
    public NewJ2SEProjectWizardIterator(WizardType type) {
92
        this.type = type;
89
        this.type = type;
93
    }
90
    }
94
        
91
92
    @Template(folder="Project/Standard", position=100, displayName="#template_app", iconBase="org/netbeans/modules/java/j2seproject/ui/resources/j2seProject.png", description="../resources/emptyProject.html")
93
    @Messages("template_app=Java Application")
94
    public static NewJ2SEProjectWizardIterator app() {
95
        return new NewJ2SEProjectWizardIterator(WizardType.APP);
96
    }
97
98
    @Template(folder="Project/Standard", position=200, displayName="#template_library", iconBase="org/netbeans/modules/java/j2seproject/ui/resources/j2seProject.png", description="../resources/emptyLibrary.html")
99
    @Messages("template_library=Java Class Library")
95
    public static NewJ2SEProjectWizardIterator library() {
100
    public static NewJ2SEProjectWizardIterator library() {
96
        return new NewJ2SEProjectWizardIterator(WizardType.LIB);
101
        return new NewJ2SEProjectWizardIterator(WizardType.LIB);
97
    }
102
    }
98
    
103
104
    @Template(folder="Project/Standard", position=300, displayName="#template_existing", iconBase="org/netbeans/modules/java/j2seproject/ui/resources/j2seProject.png", description="../resources/existingProject.html")
105
    @Messages("template_existing=Java Project with Existing Sources")
99
    public static NewJ2SEProjectWizardIterator existing() {
106
    public static NewJ2SEProjectWizardIterator existing() {
100
        return new NewJ2SEProjectWizardIterator(WizardType.EXT);
107
        return new NewJ2SEProjectWizardIterator(WizardType.EXT);
101
    }
108
    }
(-)a/java.project/nbproject/project.xml (-1 / +3 lines)
Lines 206-212 Link Here
206
                    <code-name-base>org.openide.loaders</code-name-base>
206
                    <code-name-base>org.openide.loaders</code-name-base>
207
                    <build-prerequisite/>
207
                    <build-prerequisite/>
208
                    <compile-dependency/>
208
                    <compile-dependency/>
209
                    <run-dependency/>
209
                    <run-dependency>
210
                        <specification-version>7.29</specification-version>
211
                    </run-dependency>
210
                </dependency>
212
                </dependency>
211
                <dependency>
213
                <dependency>
212
                    <code-name-base>org.openide.modules</code-name-base>
214
                    <code-name-base>org.openide.modules</code-name-base>
(-)a/java.project/src/org/netbeans/modules/java/project/JavaTemplatesProcessor.java (+87 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common Development and
11
 * Distribution License("CDDL") (collectively, the "License"). You may not use
12
 * this file except in compliance with the License. You can obtain a copy of
13
 * the License at http://www.netbeans.org/cddl-gplv2.html or
14
 * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
15
 * governing permissions and limitations under the License. When distributing
16
 * the software, include this License Header Notice in each file and include
17
 * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18
 * particular file as subject to the "Classpath" exception as provided by
19
 * Oracle in the GPL Version 2 section of the License file that accompanied
20
 * this code. If applicable, add the following below the License Header, with
21
 * the fields enclosed by brackets [] replaced by your own identifying
22
 * information: "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL or
25
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26
 * elects to include this software in this distribution under the [CDDL or GPL
27
 * Version 2] license." If you do not indicate a single choice of license, a
28
 * recipient has the option to distribute your version of this file under
29
 * either the CDDL, the GPL Version 2 or to extend the choice of license to its
30
 * licensees as provided above. However, if you add GPL Version 2 code and
31
 * therefore, elected the GPL Version 2 license, then the option applies only
32
 * if the new code is made subject to such option by the copyright holder.
33
 *
34
 * Contributor(s):
35
 *
36
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
37
 */
38
39
package org.netbeans.modules.java.project;
40
41
import java.util.Arrays;
42
import java.util.HashSet;
43
import java.util.Set;
44
import javax.annotation.processing.Processor;
45
import javax.annotation.processing.RoundEnvironment;
46
import javax.annotation.processing.SupportedSourceVersion;
47
import javax.lang.model.SourceVersion;
48
import javax.lang.model.element.Element;
49
import javax.lang.model.element.TypeElement;
50
import org.netbeans.spi.java.project.support.ui.templates.JavaTemplates;
51
import org.openide.filesystems.annotations.LayerBuilder;
52
import org.openide.filesystems.annotations.LayerGenerationException;
53
import org.openide.loaders.AbstractTemplateProcessor;
54
import org.openide.util.lookup.ServiceProvider;
55
56
@ServiceProvider(service=Processor.class)
57
@SupportedSourceVersion(SourceVersion.RELEASE_6)
58
public class JavaTemplatesProcessor extends AbstractTemplateProcessor {
59
60
    @Override public Set<String> getSupportedAnnotationTypes() {
61
        return new HashSet<String>(Arrays.asList(JavaTemplates.Registration.class.getCanonicalName(), JavaTemplates.Registrations.class.getCanonicalName()));
62
    }
63
64
    @Override protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
65
        if (roundEnv.processingOver()) {
66
            return false;
67
        }
68
        for (Element e : roundEnv.getElementsAnnotatedWith(JavaTemplates.Registration.class)) {
69
            process(e, e.getAnnotation(JavaTemplates.Registration.class));
70
        }
71
        for (Element e : roundEnv.getElementsAnnotatedWith(JavaTemplates.Registrations.class)) {
72
            for (JavaTemplates.Registration r : e.getAnnotation(JavaTemplates.Registrations.class).value()) {
73
                process(e, r);
74
            }
75
        }
76
        return true;
77
    }
78
79
    private void process(Element e, JavaTemplates.Registration r) throws LayerGenerationException {
80
        LayerBuilder.File f = process(e, r.value()).methodvalue("instantiatingIterator", JavaTemplates.class.getName(), "createJavaTemplateIterator");
81
        if (r.value().iconBase().isEmpty() && /* not a form file! */r.value().content().length == 1) {
82
            f.stringvalue("iconBase", /* JavaNode.JAVA_ICON_BASE */"org/netbeans/modules/java/resources/class.png");
83
        }
84
        f.write();
85
    }
86
87
}
(-)a/java.project/src/org/netbeans/spi/java/project/support/ui/templates/JavaTemplates.java (+28 lines)
Lines 44-54 Link Here
44
44
45
package org.netbeans.spi.java.project.support.ui.templates;
45
package org.netbeans.spi.java.project.support.ui.templates;
46
46
47
import java.lang.annotation.ElementType;
48
import java.lang.annotation.Retention;
49
import java.lang.annotation.RetentionPolicy;
50
import java.lang.annotation.Target;
47
import org.netbeans.api.project.Project;
51
import org.netbeans.api.project.Project;
48
import org.netbeans.modules.java.project.JavaTargetChooserPanel;
52
import org.netbeans.modules.java.project.JavaTargetChooserPanel;
49
import org.netbeans.modules.java.project.NewJavaFileWizardIterator;
53
import org.netbeans.modules.java.project.NewJavaFileWizardIterator;
50
import org.netbeans.api.project.SourceGroup;
54
import org.netbeans.api.project.SourceGroup;
51
import org.openide.WizardDescriptor;
55
import org.openide.WizardDescriptor;
56
import org.openide.loaders.Template;
52
57
53
/**
58
/**
54
 * Default implementations of Java-specific template UI.
59
 * Default implementations of Java-specific template UI.
Lines 113-121 Link Here
113
    
118
    
114
    /** Creates new WizardIterator containing standard Package chooser
119
    /** Creates new WizardIterator containing standard Package chooser
115
     * @return WizardIterator consisting of one panel containing package chooser
120
     * @return WizardIterator consisting of one panel containing package chooser
121
     * @see Registration
116
     */
122
     */
117
    public static WizardDescriptor.InstantiatingIterator createJavaTemplateIterator () {
123
    public static WizardDescriptor.InstantiatingIterator createJavaTemplateIterator () {
118
        return new NewJavaFileWizardIterator ();
124
        return new NewJavaFileWizardIterator ();
119
    }
125
    }
120
    
126
    
127
    /**
128
     * Specialized version of {@link Template} for Java source files.
129
     * @see #createJavaTemplateIterator
130
     * @see Registrations
131
     * @since XXX
132
     */
133
    @Target(ElementType.PACKAGE)
134
    @Retention(RetentionPolicy.SOURCE)
135
    public @interface Registration {
136
        Template value();
137
    }
138
139
    /**
140
     * Multiple registrations.
141
     * @since XXX
142
     */
143
    @Target(ElementType.PACKAGE)
144
    @Retention(RetentionPolicy.SOURCE)
145
    public @interface Registrations {
146
        Registration[] value();
147
    }
148
121
}
149
}
(-)a/maven.apisupport/src/org/netbeans/modules/maven/apisupport/Bundle.properties (-3 lines)
Lines 44-52 Link Here
44
repo.netbeans=NetBeans
44
repo.netbeans=NetBeans
45
PublicPackagesPanel.jLabel1.text=&Public packages:
45
PublicPackagesPanel.jLabel1.text=&Public packages:
46
46
47
template.module=NetBeans Module
48
template.suite=NetBeans Module Suite
49
template.app=NetBeans Application
50
47
51
NbmWizardPanelVisual.panel.accessiblename=additional properties of the project
48
NbmWizardPanelVisual.panel.accessiblename=additional properties of the project
52
NbmWizardPanelVisual.panel.accessibledesc=Select the additional project properties.
49
NbmWizardPanelVisual.panel.accessibledesc=Select the additional project properties.
(-)a/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NbmWizardIterator.java (-1 / +8 lines)
Lines 80-85 Link Here
80
import org.openide.WizardDescriptor;
80
import org.openide.WizardDescriptor;
81
import org.openide.filesystems.FileObject;
81
import org.openide.filesystems.FileObject;
82
import org.openide.filesystems.FileUtil;
82
import org.openide.filesystems.FileUtil;
83
import org.openide.loaders.Template;
83
import org.openide.util.NbBundle.Messages;
84
import org.openide.util.NbBundle.Messages;
84
import static org.netbeans.modules.maven.apisupport.Bundle.*;
85
import static org.netbeans.modules.maven.apisupport.Bundle.*;
85
86
Lines 116-130 Link Here
116
    private NbmWizardIterator(Archetype archetype) {
117
    private NbmWizardIterator(Archetype archetype) {
117
        this.archetype = archetype;
118
        this.archetype = archetype;
118
    }
119
    }
119
    
120
121
    @Template(folder="Project/Maven2", position=400, displayName="#template.module", iconBase="org/netbeans/modules/maven/apisupport/nbmicon.png", description="NbModuleDescription.html")
122
    @Messages("template.module=NetBeans Module")
120
    public static NbmWizardIterator createNbModuleIterator() {
123
    public static NbmWizardIterator createNbModuleIterator() {
121
        return new NbmWizardIterator(NB_MODULE_ARCH);
124
        return new NbmWizardIterator(NB_MODULE_ARCH);
122
    }
125
    }
123
126
127
    @Template(folder="Project/Maven2", position=500, displayName="#template.app", iconBase="org/netbeans/modules/maven/apisupport/suiteicon.png", description="NbAppDescription.html")
128
    @Messages("template.app=NetBeans Application")
124
    public static NbmWizardIterator createNbAppIterator() {
129
    public static NbmWizardIterator createNbAppIterator() {
125
        return new NbmWizardIterator(NB_APP_ARCH);
130
        return new NbmWizardIterator(NB_APP_ARCH);
126
    }
131
    }
127
132
133
    @Template(folder="Project/Maven2", position=450, displayName="#template.suite", iconBase="org/netbeans/modules/maven/apisupport/suiteicon.png", description="NbSuiteDescription.html")
134
    @Messages("template.suite=NetBeans Module Suite")
128
    public static NbmWizardIterator createNbSuiteIterator() {
135
    public static NbmWizardIterator createNbSuiteIterator() {
129
        return new NbmWizardIterator(NB_SUITE_ARCH);
136
        return new NbmWizardIterator(NB_SUITE_ARCH);
130
    }
137
    }
(-)a/maven.apisupport/src/org/netbeans/modules/maven/apisupport/layer.xml (-30 lines)
Lines 57-90 Link Here
57
            </folder>
57
            </folder>
58
        </folder>
58
        </folder>
59
    </folder>
59
    </folder>
60
    <folder name="Templates">
61
        <folder name="Project">
62
            <folder name="Maven2">
63
                <file name="NbModule">
64
                    <attr name="position" intvalue="400"/>
65
                    <attr name="displayName" bundlevalue="org.netbeans.modules.maven.apisupport.Bundle#template.module"/>
66
                    <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.maven.apisupport.NbmWizardIterator.createNbModuleIterator"/>
67
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/maven/apisupport/NbModuleDescription.html"/>
68
                    <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/maven/resources/nbmicon.png"/>
69
                    <attr name="template" boolvalue="true"/>
70
                </file>
71
                <file name="NbSuite">
72
                    <attr name="position" intvalue="450"/>
73
                    <attr name="displayName" bundlevalue="org.netbeans.modules.maven.apisupport.Bundle#template.suite"/>
74
                    <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.maven.apisupport.NbmWizardIterator.createNbSuiteIterator"/>
75
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/maven/apisupport/NbSuiteDescription.html"/>
76
                    <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/maven/resources/suiteicon.png"/>
77
                    <attr name="template" boolvalue="true"/>
78
                </file>
79
                <file name="NbApp">
80
                    <attr name="position" intvalue="500"/>
81
                    <attr name="displayName" bundlevalue="org.netbeans.modules.maven.apisupport.Bundle#template.app"/>
82
                    <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.maven.apisupport.NbmWizardIterator.createNbAppIterator"/>
83
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/maven/apisupport/NbAppDescription.html"/>
84
                    <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/maven/resources/suiteicon.png"/>
85
                    <attr name="template" boolvalue="true"/>
86
                </file>
87
            </folder>
88
        </folder>
89
    </folder>
90
</filesystem>
60
</filesystem>
(-)a/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java (-2 / +2 lines)
Lines 575-583 Link Here
575
            put(NbMavenProject.TYPE_EJB, "org/netbeans/modules/maven/resources/maven_ejb_module_16.png"); //NOI18N
575
            put(NbMavenProject.TYPE_EJB, "org/netbeans/modules/maven/resources/maven_ejb_module_16.png"); //NOI18N
576
            put(NbMavenProject.TYPE_EAR, "org/netbeans/modules/maven/resources/maven_enterprise_application_16.png"); //NOI18N
576
            put(NbMavenProject.TYPE_EAR, "org/netbeans/modules/maven/resources/maven_enterprise_application_16.png"); //NOI18N
577
            put(NbMavenProject.TYPE_POM, "org/netbeans/modules/maven/resources/Maven2Icon.gif"); //NOI18N
577
            put(NbMavenProject.TYPE_POM, "org/netbeans/modules/maven/resources/Maven2Icon.gif"); //NOI18N
578
            put(NbMavenProject.TYPE_NBM, "org/netbeans/modules/maven/resources/nbmicon.png"); //NOI18N
578
            put(NbMavenProject.TYPE_NBM, "org/netbeans/modules/maven/apisupport/nbmicon.png"); //NOI18N
579
            put(NbMavenProject.TYPE_OSGI, "org/netbeans/modules/maven/resources/maven_osgi_16.png"); //NOI18N
579
            put(NbMavenProject.TYPE_OSGI, "org/netbeans/modules/maven/resources/maven_osgi_16.png"); //NOI18N
580
            put(NbMavenProject.TYPE_NBM_APPLICATION, "org/netbeans/modules/maven/resources/suiteicon.png"); //NOI18N
580
            put(NbMavenProject.TYPE_NBM_APPLICATION, "org/netbeans/modules/maven/apisupport/suiteicon.png"); //NOI18N
581
        }
581
        }
582
    });
582
    });
583
583
(-)a/openide.loaders/apichanges.xml (+17 lines)
Lines 109-114 Link Here
109
<!-- ACTUAL CHANGES BEGIN HERE: -->
109
<!-- ACTUAL CHANGES BEGIN HERE: -->
110
110
111
  <changes>
111
  <changes>
112
      <change id="Template">
113
          <api name="loaders"/>
114
          <summary>Introduced <code>Template</code></summary>
115
          <version major="7" minor="29"/>
116
          <date day="25" month="7" year="2011"/>
117
          <author login="jglick"/>
118
          <compatibility addition="yes"/>
119
          <description>
120
              <p>
121
                  Introduced a new annotation for registering (file or project) templates.
122
              </p>
123
          </description>
124
          <class package="org.openide.loaders" name="Template"/>
125
          <class package="org.openide.loaders" name="Templates"/>
126
          <class package="org.openide.loaders" name="AbstractTemplateProcessor"/>
127
          <issue number="200175"/>
128
      </change>
112
    <change id="DataEditorSupport.constr3">
129
    <change id="DataEditorSupport.constr3">
113
          <api name="editor"/>
130
          <api name="editor"/>
114
          <summary>DataEditorSupport constructor with Lookup parameter</summary>
131
          <summary>DataEditorSupport constructor with Lookup parameter</summary>
(-)a/openide.loaders/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.loaders
2
OpenIDE-Module: org.openide.loaders
3
OpenIDE-Module-Specification-Version: 7.28
3
OpenIDE-Module-Specification-Version: 7.29
4
OpenIDE-Module-Localizing-Bundle: org/openide/loaders/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/openide/loaders/Bundle.properties
5
OpenIDE-Module-Provides: org.netbeans.modules.templates.v1_0
5
OpenIDE-Module-Provides: org.netbeans.modules.templates.v1_0
6
OpenIDE-Module-Layer: org/netbeans/modules/openide/loaders/layer.xml
6
OpenIDE-Module-Layer: org/netbeans/modules/openide/loaders/layer.xml
(-)a/openide.loaders/nbproject/project.xml (-1 / +1 lines)
Lines 122-128 Link Here
122
                    <build-prerequisite/>
122
                    <build-prerequisite/>
123
                    <compile-dependency/>
123
                    <compile-dependency/>
124
                    <run-dependency>
124
                    <run-dependency>
125
                        <specification-version>7.19</specification-version>
125
                        <specification-version>7.51</specification-version>
126
                    </run-dependency>
126
                    </run-dependency>
127
                </dependency>
127
                </dependency>
128
                <dependency>
128
                <dependency>
(-)a/openide.loaders/src/org/netbeans/modules/openide/loaders/TemplateProcessor.java (+79 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common Development and
11
 * Distribution License("CDDL") (collectively, the "License"). You may not use
12
 * this file except in compliance with the License. You can obtain a copy of
13
 * the License at http://www.netbeans.org/cddl-gplv2.html or
14
 * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
15
 * governing permissions and limitations under the License. When distributing
16
 * the software, include this License Header Notice in each file and include
17
 * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18
 * particular file as subject to the "Classpath" exception as provided by
19
 * Oracle in the GPL Version 2 section of the License file that accompanied
20
 * this code. If applicable, add the following below the License Header, with
21
 * the fields enclosed by brackets [] replaced by your own identifying
22
 * information: "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL or
25
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26
 * elects to include this software in this distribution under the [CDDL or GPL
27
 * Version 2] license." If you do not indicate a single choice of license, a
28
 * recipient has the option to distribute your version of this file under
29
 * either the CDDL, the GPL Version 2 or to extend the choice of license to its
30
 * licensees as provided above. However, if you add GPL Version 2 code and
31
 * therefore, elected the GPL Version 2 license, then the option applies only
32
 * if the new code is made subject to such option by the copyright holder.
33
 *
34
 * Contributor(s):
35
 *
36
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
37
 */
38
39
package org.netbeans.modules.openide.loaders;
40
41
import java.util.Arrays;
42
import java.util.HashSet;
43
import java.util.Set;
44
import javax.annotation.processing.Processor;
45
import javax.annotation.processing.RoundEnvironment;
46
import javax.annotation.processing.SupportedSourceVersion;
47
import javax.lang.model.SourceVersion;
48
import javax.lang.model.element.Element;
49
import javax.lang.model.element.TypeElement;
50
import org.openide.filesystems.annotations.LayerGenerationException;
51
import org.openide.loaders.AbstractTemplateProcessor;
52
import org.openide.loaders.Template;
53
import org.openide.loaders.Templates;
54
import org.openide.util.lookup.ServiceProvider;
55
56
@ServiceProvider(service=Processor.class)
57
@SupportedSourceVersion(SourceVersion.RELEASE_6)
58
public class TemplateProcessor extends AbstractTemplateProcessor {
59
60
    @Override public Set<String> getSupportedAnnotationTypes() {
61
        return new HashSet<String>(Arrays.asList(Template.class.getCanonicalName(), Templates.class.getCanonicalName()));
62
    }
63
64
    @Override protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
65
        if (roundEnv.processingOver()) {
66
            return false;
67
        }
68
        for (Element e : roundEnv.getElementsAnnotatedWith(Template.class)) {
69
            process(e, e.getAnnotation(Template.class)).write();
70
        }
71
        for (Element e : roundEnv.getElementsAnnotatedWith(Templates.class)) {
72
            for (Template t : e.getAnnotation(Templates.class).value()) {
73
                process(e, t).write();
74
            }
75
        }
76
        return true;
77
    }
78
79
}
(-)a/openide.loaders/src/org/netbeans/modules/templates/ScriptingCreateFromTemplateHandler.java (-1 / +4 lines)
Lines 64-69 Link Here
64
*/
64
*/
65
@ServiceProvider(service=CreateFromTemplateHandler.class)
65
@ServiceProvider(service=CreateFromTemplateHandler.class)
66
public class ScriptingCreateFromTemplateHandler extends CreateFromTemplateHandler {
66
public class ScriptingCreateFromTemplateHandler extends CreateFromTemplateHandler {
67
68
    public static final String SCRIPT_ENGINE_ATTR = "javax.script.ScriptEngine";
69
    
67
    private static ScriptEngineManager manager;
70
    private static ScriptEngineManager manager;
68
    
71
    
69
    private static final String ENCODING_PROPERTY_NAME = "encoding"; //NOI18N
72
    private static final String ENCODING_PROPERTY_NAME = "encoding"; //NOI18N
Lines 121-127 Link Here
121
    }
124
    }
122
    
125
    
123
    private static ScriptEngine engine(FileObject fo) {
126
    private static ScriptEngine engine(FileObject fo) {
124
        Object obj = fo.getAttribute("javax.script.ScriptEngine"); // NOI18N
127
        Object obj = fo.getAttribute(SCRIPT_ENGINE_ATTR); // NOI18N
125
        if (obj instanceof ScriptEngine) {
128
        if (obj instanceof ScriptEngine) {
126
            return (ScriptEngine)obj;
129
            return (ScriptEngine)obj;
127
        }
130
        }
(-)a/openide.loaders/src/org/openide/actions/SaveAsTemplateAction.java (-1 / +2 lines)
Lines 50-55 Link Here
50
import java.util.HashMap;
50
import java.util.HashMap;
51
import java.util.Map;
51
import java.util.Map;
52
import java.util.Map.Entry;
52
import java.util.Map.Entry;
53
import org.netbeans.modules.templates.ScriptingCreateFromTemplateHandler;
53
import org.openide.cookies.SaveCookie;
54
import org.openide.cookies.SaveCookie;
54
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileObject;
55
import org.openide.loaders.*;
56
import org.openide.loaders.*;
Lines 155-161 Link Here
155
            newTemplate.setTemplate(true);
156
            newTemplate.setTemplate(true);
156
            if (templateSample == null) {
157
            if (templateSample == null) {
157
                // a fallback if no template sample found
158
                // a fallback if no template sample found
158
                newTemplate.getPrimaryFile ().setAttribute ("javax.script.ScriptEngine", "freemarker"); // NOI18N
159
                newTemplate.getPrimaryFile().setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "freemarker"); // NOI18N
159
            } else {
160
            } else {
160
                setTemplateAttributes (newTemplate.getPrimaryFile (), getAttributes (templateSample.getPrimaryFile ()));
161
                setTemplateAttributes (newTemplate.getPrimaryFile (), getAttributes (templateSample.getPrimaryFile ()));
161
            }
162
            }
(-)a/openide.loaders/src/org/openide/loaders/AbstractTemplateProcessor.java (+135 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common Development and
11
 * Distribution License("CDDL") (collectively, the "License"). You may not use
12
 * this file except in compliance with the License. You can obtain a copy of
13
 * the License at http://www.netbeans.org/cddl-gplv2.html or
14
 * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
15
 * governing permissions and limitations under the License. When distributing
16
 * the software, include this License Header Notice in each file and include
17
 * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18
 * particular file as subject to the "Classpath" exception as provided by
19
 * Oracle in the GPL Version 2 section of the License file that accompanied
20
 * this code. If applicable, add the following below the License Header, with
21
 * the fields enclosed by brackets [] replaced by your own identifying
22
 * information: "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL or
25
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26
 * elects to include this software in this distribution under the [CDDL or GPL
27
 * Version 2] license." If you do not indicate a single choice of license, a
28
 * recipient has the option to distribute your version of this file under
29
 * either the CDDL, the GPL Version 2 or to extend the choice of license to its
30
 * licensees as provided above. However, if you add GPL Version 2 code and
31
 * therefore, elected the GPL Version 2 license, then the option applies only
32
 * if the new code is made subject to such option by the copyright holder.
33
 *
34
 * Contributor(s):
35
 *
36
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
37
 */
38
39
package org.openide.loaders;
40
41
import java.net.URI;
42
import java.net.URISyntaxException;
43
import javax.lang.model.element.Element;
44
import javax.lang.model.element.ElementKind;
45
import javax.lang.model.element.TypeElement;
46
import org.netbeans.modules.templates.ScriptingCreateFromTemplateHandler;
47
import org.openide.WizardDescriptor.InstantiatingIterator;
48
import org.openide.filesystems.annotations.LayerBuilder;
49
import org.openide.filesystems.annotations.LayerGeneratingProcessor;
50
import org.openide.filesystems.annotations.LayerGenerationException;
51
52
/**
53
 * Performs basic logic of processing {@link Template} registrations.
54
 * While {@code @Template} itself is automatically processed, it is possible to
55
 * have more domain-specific annotations that add further metadata.
56
 * This class may be used to create the basic registration.
57
 * @since 7.29
58
 */
59
public abstract class AbstractTemplateProcessor extends LayerGeneratingProcessor {
60
61
    /**
62
     * Performs basic template registration.
63
     * @param e the originating element
64
     * @param t a template annotation associated with element
65
     * @return a layer file on which {@link LayerBuilder.File#write} must still be called
66
     * @throws LayerGenerationException in case of problems
67
     */
68
    protected final LayerBuilder.File process(Element e, Template t) throws LayerGenerationException {
69
        LayerBuilder builder = layer(e);
70
        String basename;
71
        if (t.content().length > 0) {
72
            basename = basename(t.content()[0]);
73
        } else {
74
            if (e.getKind() == ElementKind.CLASS) {
75
                basename = ((TypeElement) e).getQualifiedName().toString().replace('.', '-');
76
            } else if (e.getKind() == ElementKind.METHOD) {
77
                basename = ((TypeElement) e.getEnclosingElement()).getQualifiedName().toString().replace('.', '-') + '-' + e.getSimpleName();
78
            } else {
79
                throw new LayerGenerationException("cannot use @Template on a package without specifying content", e);
80
            }
81
        }
82
        String folder = "Templates/" + t.folder() + '/';
83
        LayerBuilder.File f = builder.file(folder + basename);
84
        f.boolvalue("template", true);
85
        f.position(t.position());
86
        if (!t.displayName().isEmpty()) {
87
            f.bundlevalue("displayName", t.displayName());
88
        }
89
        if (!t.iconBase().isEmpty()) {
90
            builder.validateResource(t.iconBase(), e, t, "iconBase", true);
91
            f.stringvalue("iconBase", t.iconBase());
92
        }
93
        if (!t.description().isEmpty()) {
94
            f.urlvalue("instantiatingWizardURL", contentURI(e, t.description(), builder, t, "description"));
95
        }
96
        if (e.getKind() != ElementKind.PACKAGE) {
97
            f.instanceAttribute("instantiatingIterator", InstantiatingIterator.class);
98
        }
99
        if (t.content().length > 0) {
100
            f.url(contentURI(e, t.content()[0], builder, t, "content").toString());
101
            for (int i = 1; i < t.content().length; i++) {
102
                builder.file(folder + basename(t.content()[i])).url(contentURI(e, t.content()[i], builder, t, "content").toString()).position(0).write();
103
            }
104
        }
105
        if (!t.scriptEngine().isEmpty()) {
106
            f.stringvalue(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, t.scriptEngine());
107
        }
108
        if (t.category().length > 0) {
109
            StringBuilder sb = new StringBuilder();
110
            for (String c : t.category()) {
111
                if (sb.length() > 0) {
112
                    sb.append(',');
113
                }
114
                sb.append(c);
115
            }
116
            f.stringvalue("templateCategory", sb.toString());
117
        }
118
        return f;
119
    }
120
121
    private static String basename(String relativeResource) {
122
        return relativeResource.replaceFirst(".+/", "").replaceFirst("[.]template$", "");
123
    }
124
125
    private static URI contentURI(Element e, String relativePath, LayerBuilder builder, Template t, String annotationMethod) throws LayerGenerationException {
126
        String path = LayerBuilder.absolutizeResource(e, relativePath);
127
        builder.validateResource(path, e, t, annotationMethod, false);
128
        try {
129
            return new URI("nbresloc", "/" + path, null).normalize();
130
        } catch (URISyntaxException x) {
131
            throw new LayerGenerationException("could not translate " + path, e);
132
        }
133
    }
134
135
}
(-)a/openide.loaders/src/org/openide/loaders/Template.java (+117 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common Development and
11
 * Distribution License("CDDL") (collectively, the "License"). You may not use
12
 * this file except in compliance with the License. You can obtain a copy of
13
 * the License at http://www.netbeans.org/cddl-gplv2.html or
14
 * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
15
 * governing permissions and limitations under the License. When distributing
16
 * the software, include this License Header Notice in each file and include
17
 * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18
 * particular file as subject to the "Classpath" exception as provided by
19
 * Oracle in the GPL Version 2 section of the License file that accompanied
20
 * this code. If applicable, add the following below the License Header, with
21
 * the fields enclosed by brackets [] replaced by your own identifying
22
 * information: "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL or
25
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26
 * elects to include this software in this distribution under the [CDDL or GPL
27
 * Version 2] license." If you do not indicate a single choice of license, a
28
 * recipient has the option to distribute your version of this file under
29
 * either the CDDL, the GPL Version 2 or to extend the choice of license to its
30
 * licensees as provided above. However, if you add GPL Version 2 code and
31
 * therefore, elected the GPL Version 2 license, then the option applies only
32
 * if the new code is made subject to such option by the copyright holder.
33
 *
34
 * Contributor(s):
35
 *
36
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
37
 */
38
39
package org.openide.loaders;
40
41
import java.lang.annotation.ElementType;
42
import java.lang.annotation.Retention;
43
import java.lang.annotation.RetentionPolicy;
44
import java.lang.annotation.Target;
45
import javax.script.ScriptEngineFactory;
46
import org.openide.WizardDescriptor.InstantiatingIterator;
47
48
/**
49
 * Registers a template the user can select.
50
 * May be placed on a class (with a default constructor) or static method (with no arguments)
51
 * to register an {@link InstantiatingIterator} for a custom template;
52
 * or on a package to register a plain-file template with no custom behavior.
53
 * @since 7.29
54
 * @see TemplateWizard
55
 * @see Templates
56
 * @see AbstractTemplateProcessor
57
 */
58
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PACKAGE})
59
@Retention(RetentionPolicy.SOURCE)
60
public @interface Template {
61
    
62
    /**
63
     * Subfolder in which to place the template, such as {@code Other} or {@code Project/Standard}.
64
     */
65
    String folder();
66
    
67
    /**
68
     * Optional position within {@link #folder}.
69
     */
70
    int position() default Integer.MAX_VALUE;
71
72
    /**
73
     * File contents, as resources relative to the package of this declaration.
74
     * A nonempty list is mandatory for a template registered on a package.
75
     * For a template with a custom iterator, the content may be omitted, though it may still be specified.
76
     * <p>Normally only a single file is specified, but for a multifile data object, list the primary entry first.
77
     * <p>The file basenames (incl. extension) of the actual template files (as in {@link TemplateWizard#getTemplate})
78
     * will be taken from the basename of the content resources, though a {@code .template} suffix
79
     * may be appended to prevent template resources in a source project from being misinterpreted.
80
     * For a "pure" custom iterator with no specified content, the template basename
81
     * will be the FQN of the class or method defining it but with {@code -} for {@code .} characters,
82
     * e.g. {@code pkg-Class-method}.
83
     */
84
    String[] content() default {};
85
86
    /**
87
     * Localized label for the template.
88
     * Mandatory unless {@link #content} is specified, in which case it would be defaulted by the data node.
89
     * May use the usual {@code #key} syntax.
90
     */
91
    String displayName() default "";
92
93
    // XXX should this assume an absolute resource path, or permit relative paths, or either? check for consistency with other annotations, and consider #196452
94
    /**
95
     * Icon to use for the template.
96
     * Mandatory unless {@link #content} is specified, in which case it would be defaulted by the data node.
97
     */
98
    String iconBase() default "";
99
100
    /**
101
     * Optional but recommended relative resource path to an HTML description of the template.
102
     * @see TemplateWizard#getDescription
103
     */
104
    String description() default "";
105
106
    /**
107
     * Optional name of a script engine to use when processing file content, such as {@code freemarker}.
108
     * @see ScriptEngineFactory#getNames
109
     */
110
    String scriptEngine() default "";
111
112
    /**
113
     * Optional list of categories interpreted by the project system.
114
     */
115
    String[] category() default {};
116
117
}
(-)a/openide.loaders/src/org/openide/loaders/TemplateWizard.java (+2 lines)
Lines 65-70 Link Here
65
/** Wizard for creation of new objects from a template.
65
/** Wizard for creation of new objects from a template.
66
*
66
*
67
* @author Jaroslav Tulach, Jiri Rechtacek
67
* @author Jaroslav Tulach, Jiri Rechtacek
68
* @see Template
68
*/
69
*/
69
public class TemplateWizard extends WizardDescriptor {
70
public class TemplateWizard extends WizardDescriptor {
70
    /** EA that defines the wizards description */
71
    /** EA that defines the wizards description */
Lines 832-837 Link Here
832
    * use of <CODE>putProperty</CODE> method and read it using <code>getProperty</code>.
833
    * use of <CODE>putProperty</CODE> method and read it using <code>getProperty</code>.
833
    * <P>
834
    * <P>
834
    * Implements <code>Node.Cookie</code> since version 2.13
835
    * Implements <code>Node.Cookie</code> since version 2.13
836
    * @see Template
835
    */
837
    */
836
    public interface Iterator extends WizardDescriptor.Iterator<WizardDescriptor>,
838
    public interface Iterator extends WizardDescriptor.Iterator<WizardDescriptor>,
837
    java.io.Serializable, org.openide.nodes.Node.Cookie {
839
    java.io.Serializable, org.openide.nodes.Node.Cookie {
(-)a/openide.loaders/src/org/openide/loaders/Templates.java (+54 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common Development and
11
 * Distribution License("CDDL") (collectively, the "License"). You may not use
12
 * this file except in compliance with the License. You can obtain a copy of
13
 * the License at http://www.netbeans.org/cddl-gplv2.html or
14
 * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
15
 * governing permissions and limitations under the License. When distributing
16
 * the software, include this License Header Notice in each file and include
17
 * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18
 * particular file as subject to the "Classpath" exception as provided by
19
 * Oracle in the GPL Version 2 section of the License file that accompanied
20
 * this code. If applicable, add the following below the License Header, with
21
 * the fields enclosed by brackets [] replaced by your own identifying
22
 * information: "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL or
25
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26
 * elects to include this software in this distribution under the [CDDL or GPL
27
 * Version 2] license." If you do not indicate a single choice of license, a
28
 * recipient has the option to distribute your version of this file under
29
 * either the CDDL, the GPL Version 2 or to extend the choice of license to its
30
 * licensees as provided above. However, if you add GPL Version 2 code and
31
 * therefore, elected the GPL Version 2 license, then the option applies only
32
 * if the new code is made subject to such option by the copyright holder.
33
 *
34
 * Contributor(s):
35
 *
36
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
37
 */
38
39
package org.openide.loaders;
40
41
import java.lang.annotation.ElementType;
42
import java.lang.annotation.Retention;
43
import java.lang.annotation.RetentionPolicy;
44
import java.lang.annotation.Target;
45
46
/**
47
 * May be used to register multiple plain-file {@link Template}s from a single package.
48
 * @since 7.29
49
 */
50
@Target(ElementType.PACKAGE)
51
@Retention(RetentionPolicy.SOURCE)
52
public @interface Templates {
53
    Template[] value();
54
}
(-)a/openide.loaders/test/unit/src/org/netbeans/modules/templates/Bug138973Test.java (-1 / +1 lines)
Lines 102-108 Link Here
102
        FileObject templateFile = FileUtil.createData(templatesFolder,
102
        FileObject templateFile = FileUtil.createData(templatesFolder,
103
                                                      TEMPLATE_NAME_EXT);
103
                                                      TEMPLATE_NAME_EXT);
104
        templateFile.setAttribute ("template", Boolean.TRUE);
104
        templateFile.setAttribute ("template", Boolean.TRUE);
105
        templateFile.setAttribute("javax.script.ScriptEngine", "js");
105
        templateFile.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
106
        byte[] templateBytes = TESTING_TEXT.getBytes("ISO-8859-1");
106
        byte[] templateBytes = TESTING_TEXT.getBytes("ISO-8859-1");
107
        InputStream source = new ByteArrayInputStream(templateBytes);
107
        InputStream source = new ByteArrayInputStream(templateBytes);
108
        OutputStream target = templateFile.getOutputStream();
108
        OutputStream target = templateFile.getOutputStream();
(-)a/openide.loaders/test/unit/src/org/netbeans/modules/templates/IndentEngineIntTest.java (-1 / +1 lines)
Lines 93-99 Link Here
93
        String txt = "print('<html><h1>'); print(title); print('</h1></html>');";
93
        String txt = "print('<html><h1>'); print(title); print('</h1></html>');";
94
        os.write(txt.getBytes());
94
        os.write(txt.getBytes());
95
        os.close();
95
        os.close();
96
        fo.setAttribute("javax.script.ScriptEngine", "JavaScript");
96
        fo.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "JavaScript");
97
        
97
        
98
        
98
        
99
        DataObject obj = DataObject.find(fo);
99
        DataObject obj = DataObject.find(fo);
(-)a/openide.loaders/test/unit/src/org/netbeans/modules/templates/SCFTHandlerTest.java (-8 / +8 lines)
Lines 113-119 Link Here
113
        String txt = "print('<html><h1>'); print(title); print('</h1></html>');";
113
        String txt = "print('<html><h1>'); print(title); print('</h1></html>');";
114
        os.write(txt.getBytes());
114
        os.write(txt.getBytes());
115
        os.close();
115
        os.close();
116
        fo.setAttribute("javax.script.ScriptEngine", "js");
116
        fo.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
117
        
117
        
118
        
118
        
119
        DataObject obj = DataObject.find(fo);
119
        DataObject obj = DataObject.find(fo);
Lines 138-144 Link Here
138
        String txt = "print('<html><h1>'); print(nameAndExt); print('</h1></html>')";
138
        String txt = "print('<html><h1>'); print(nameAndExt); print('</h1></html>')";
139
        os.write(txt.getBytes());
139
        os.write(txt.getBytes());
140
        os.close();
140
        os.close();
141
        fo.setAttribute("javax.script.ScriptEngine", "js");
141
        fo.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
142
        
142
        
143
        
143
        
144
        DataObject obj = DataObject.find(fo);
144
        DataObject obj = DataObject.find(fo);
Lines 165-178 Link Here
165
        String txt = "print('<html><h1>'); print(nameAndExt); print('</h1></html>')";
165
        String txt = "print('<html><h1>'); print(nameAndExt); print('</h1></html>')";
166
        os.write(txt.getBytes());
166
        os.write(txt.getBytes());
167
        os.close();
167
        os.close();
168
        fo.setAttribute("javax.script.ScriptEngine", "js");
168
        fo.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
169
        
169
        
170
        FileObject fo2 = FileUtil.createData(root, "j.form");
170
        FileObject fo2 = FileUtil.createData(root, "j.form");
171
        OutputStream os2 = fo2.getOutputStream();
171
        OutputStream os2 = fo2.getOutputStream();
172
        String txt2 = "print('<html><h2>'); print(nameAndExt); print('</h2></html>')";
172
        String txt2 = "print('<html><h2>'); print(nameAndExt); print('</h2></html>')";
173
        os2.write(txt2.getBytes());
173
        os2.write(txt2.getBytes());
174
        os2.close();
174
        os2.close();
175
        fo2.setAttribute("javax.script.ScriptEngine", "js");
175
        fo2.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
176
        
176
        
177
        DataObject obj = DataObject.find(fo);
177
        DataObject obj = DataObject.find(fo);
178
        assertEquals("Both files", 2, obj.files().size());
178
        assertEquals("Both files", 2, obj.files().size());
Lines 215-221 Link Here
215
            "print('</html>');";
215
            "print('</html>');";
216
        os.write(txt.getBytes());
216
        os.write(txt.getBytes());
217
        os.close();
217
        os.close();
218
        fo.setAttribute("javax.script.ScriptEngine", "js");
218
        fo.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
219
        
219
        
220
        
220
        
221
        DataObject obj = DataObject.find(fo);
221
        DataObject obj = DataObject.find(fo);
Lines 262-268 Link Here
262
         FileObject xml = FileUtil.createData(xmldir, "class.txt");
262
         FileObject xml = FileUtil.createData(xmldir, "class.txt");
263
         OutputStream os = xml.getOutputStream();
263
         OutputStream os = xml.getOutputStream();
264
         FileUtil.copy(getClass().getResourceAsStream("utf8.xml"), os);
264
         FileUtil.copy(getClass().getResourceAsStream("utf8.xml"), os);
265
         xml.setAttribute("javax.script.ScriptEngine", "js");
265
         xml.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
266
         os.close();
266
         os.close();
267
         
267
         
268
         DataObject obj = DataObject.find(xml);
268
         DataObject obj = DataObject.find(xml);
Lines 298-305 Link Here
298
        FileObject root = fs.getRoot();
298
        FileObject root = fs.getRoot();
299
        FileObject fo = FileUtil.createData(root, "simpleObject.java");
299
        FileObject fo = FileUtil.createData(root, "simpleObject.java");
300
        FileObject fo2 = FileUtil.createData(root, "simpleObject.form");
300
        FileObject fo2 = FileUtil.createData(root, "simpleObject.form");
301
        fo.setAttribute("javax.script.ScriptEngine", "js");
301
        fo.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
302
        fo2.setAttribute("javax.script.ScriptEngine", "js");
302
        fo2.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
303
303
304
        Charset set = Charset.forName("iso-8859-2");
304
        Charset set = Charset.forName("iso-8859-2");
305
        OutputStream os = fo2.getOutputStream();
305
        OutputStream os = fo2.getOutputStream();
(-)a/openide.loaders/test/unit/src/org/netbeans/modules/templates/ScriptingCreateFromTemplateTest.java (-3 / +3 lines)
Lines 89-95 Link Here
89
        assertEquals("content/unknown", fo.getMIMEType());
89
        assertEquals("content/unknown", fo.getMIMEType());
90
        fo.setAttribute ("template", Boolean.TRUE);
90
        fo.setAttribute ("template", Boolean.TRUE);
91
        assertEquals("content/unknown", fo.getMIMEType());
91
        assertEquals("content/unknown", fo.getMIMEType());
92
        fo.setAttribute("javax.script.ScriptEngine", "js");
92
        fo.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
93
        
93
        
94
        DataObject obj = DataObject.find(fo);
94
        DataObject obj = DataObject.find(fo);
95
        DataFolder folder = DataFolder.findFolder(FileUtil.createFolder(root, "target"));
95
        DataFolder folder = DataFolder.findFolder(FileUtil.createFolder(root, "target"));
Lines 118-124 Link Here
118
        os.write("println('#!/usr/bin/perl'); print('# ');println(license);print('# ');print(name);print(' in ');println(nameAndExt);".getBytes());
118
        os.write("println('#!/usr/bin/perl'); print('# ');println(license);print('# ');print(name);print(' in ');println(nameAndExt);".getBytes());
119
        os.close();
119
        os.close();
120
        template.setAttribute("template", true);
120
        template.setAttribute("template", true);
121
        template.setAttribute("javax.script.ScriptEngine", "js");
121
        template.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
122
        Map<String,Object> parameters = new HashMap<String,Object>();
122
        Map<String,Object> parameters = new HashMap<String,Object>();
123
        parameters.put("license", "GPL");
123
        parameters.put("license", "GPL");
124
        parameters.put(CreateFromTemplateHandler.FREE_FILE_EXTENSION, true);
124
        parameters.put(CreateFromTemplateHandler.FREE_FILE_EXTENSION, true);
Lines 163-169 Link Here
163
        os.write("test".getBytes());
163
        os.write("test".getBytes());
164
        os.close();
164
        os.close();
165
        fo.setAttribute ("template", Boolean.TRUE);
165
        fo.setAttribute ("template", Boolean.TRUE);
166
        fo.setAttribute("javax.script.ScriptEngine", "js");
166
        fo.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
167
167
168
        MockServices.setServices(MockMimeLookup.class);
168
        MockServices.setServices(MockMimeLookup.class);
169
        MockMimeLookup.setInstances(MimePath.parse("content/unknown"), new TestEditorKit());
169
        MockMimeLookup.setInstances(MimePath.parse("content/unknown"), new TestEditorKit());
(-)a/projectuiapi/src/org/netbeans/spi/project/ui/PrivilegedTemplates.java (+4 lines)
Lines 44-49 Link Here
44
44
45
package org.netbeans.spi.project.ui;
45
package org.netbeans.spi.project.ui;
46
46
47
import org.openide.loaders.Template;
48
47
/**
49
/**
48
 * List of templates which should be in the initial "privileged" list
50
 * List of templates which should be in the initial "privileged" list
49
 * when making a new file.
51
 * when making a new file.
Lines 65-70 Link Here
65
    /**
67
    /**
66
     * Lists privileged templates.
68
     * Lists privileged templates.
67
     * @return full paths to privileged templates, e.g. <samp>Templates/Other/XmlFile.xml</samp>
69
     * @return full paths to privileged templates, e.g. <samp>Templates/Other/XmlFile.xml</samp>
70
     * @see Template#folder
71
     * @see Template#content
68
     */
72
     */
69
    public String[] getPrivilegedTemplates();
73
    public String[] getPrivilegedTemplates();
70
    
74
    
(-)a/projectuiapi/src/org/netbeans/spi/project/ui/RecommendedTemplates.java (+3 lines)
Lines 44-49 Link Here
44
44
45
package org.netbeans.spi.project.ui;
45
package org.netbeans.spi.project.ui;
46
46
47
import org.openide.loaders.Template;
48
47
/**
49
/**
48
 * List of template types supported by a project when making a new file.
50
 * List of template types supported by a project when making a new file.
49
 * An instance should be placed in {@link org.netbeans.api.project.Project#getLookup}
51
 * An instance should be placed in {@link org.netbeans.api.project.Project#getLookup}
Lines 58-63 Link Here
58
    /**
60
    /**
59
     * Lists supported template types.
61
     * Lists supported template types.
60
     * @return types of supported templates (should match template file attribute names)
62
     * @return types of supported templates (should match template file attribute names)
63
     * @see Template#category
61
     */
64
     */
62
    public String[] getRecommendedTypes();
65
    public String[] getRecommendedTypes();
63
    
66
    
(-)a/projectuiapi/src/org/netbeans/spi/project/ui/templates/support/package.html (-1 / +1 lines)
Lines 58-64 Link Here
58
provide own iterator for project-specific customization of given file type.</p>
58
provide own iterator for project-specific customization of given file type.</p>
59
59
60
<p>The project type has to declare its file templates in the module's layer file
60
<p>The project type has to declare its file templates in the module's layer file
61
in folder the <code>Templates</code>. The declaration should look as follows:
61
in folder the <code>Templates</code>. The declaration should look as follows (or <code>@Template</code> may be used):
62
<p>
62
<p>
63
<code>
63
<code>
64
&lt;folder name="Templates"&gt;<br>
64
&lt;folder name="Templates"&gt;<br>

Return to bug 200175