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 198318
Collapse All | Expand All

(-)a/apisupport.ant/nbproject/project.xml (-1 / +1 lines)
Lines 109-115 Link Here
109
                    <compile-dependency/>
109
                    <compile-dependency/>
110
                    <run-dependency>
110
                    <run-dependency>
111
                        <release-version>1</release-version>
111
                        <release-version>1</release-version>
112
                        <specification-version>1.48</specification-version>
112
                        <specification-version>1.49</specification-version>
113
                    </run-dependency>
113
                    </run-dependency>
114
                </dependency>
114
                </dependency>
115
                <dependency>
115
                <dependency>
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/ModuleActions.java (-1 / +15 lines)
Lines 72-77 Link Here
72
import org.netbeans.modules.apisupport.project.NbModuleProject;
72
import org.netbeans.modules.apisupport.project.NbModuleProject;
73
import org.netbeans.modules.apisupport.project.NbModuleType;
73
import org.netbeans.modules.apisupport.project.NbModuleType;
74
import org.netbeans.modules.apisupport.project.api.Util;
74
import org.netbeans.modules.apisupport.project.api.Util;
75
import org.netbeans.modules.apisupport.project.spi.ExecProject;
75
import org.netbeans.modules.apisupport.project.suite.SuiteProject;
76
import org.netbeans.modules.apisupport.project.suite.SuiteProject;
76
import org.netbeans.modules.apisupport.project.ui.customizer.CustomizerProviderImpl;
77
import org.netbeans.modules.apisupport.project.ui.customizer.CustomizerProviderImpl;
77
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteProperties;
78
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteProperties;
Lines 97-106 Link Here
97
import org.openide.util.Mutex;
98
import org.openide.util.Mutex;
98
import org.openide.util.NbBundle;
99
import org.openide.util.NbBundle;
99
import org.openide.util.RequestProcessor;
100
import org.openide.util.RequestProcessor;
101
import org.openide.util.Task;
100
import org.openide.util.Utilities;
102
import org.openide.util.Utilities;
101
import org.openide.util.actions.SystemAction;
103
import org.openide.util.actions.SystemAction;
102
104
103
public final class ModuleActions implements ActionProvider {
105
public final class ModuleActions implements ActionProvider, ExecProject {
104
    static final String TEST_USERDIR_LOCK_PROP_NAME = "run.args.ide";    // NOI18N
106
    static final String TEST_USERDIR_LOCK_PROP_NAME = "run.args.ide";    // NOI18N
105
    static final String TEST_USERDIR_LOCK_PROP_VALUE = "--test-userdir-lock-with-invalid-arg";    // NOI18N
107
    static final String TEST_USERDIR_LOCK_PROP_VALUE = "--test-userdir-lock-with-invalid-arg";    // NOI18N
106
108
Lines 109-114 Link Here
109
        COMMAND_DEBUG_SINGLE
111
        COMMAND_DEBUG_SINGLE
110
    ));
112
    ));
111
113
114
    @Override
115
    public Task execute(String... args) throws IOException {
116
        StringBuilder sb = new StringBuilder();
117
        for (String r : args) {
118
            sb.append(r).append(' ');
119
        }
120
        Properties p = new Properties();
121
        p.setProperty("run.args", sb.substring(0, sb.length() - 1));
122
123
        return ActionUtils.runTarget(findBuildXml(project), new String[]{"run"}, p);
124
    }
125
    
112
    static Action[] getProjectActions(NbModuleProject project) {
126
    static Action[] getProjectActions(NbModuleProject project) {
113
        List<Action> actions = new ArrayList<Action>();
127
        List<Action> actions = new ArrayList<Action>();
114
        actions.add(CommonProjectActions.newFileAction());
128
        actions.add(CommonProjectActions.newFileAction());
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/SuiteActions.java (-1 / +14 lines)
Lines 44-49 Link Here
44
44
45
package org.netbeans.modules.apisupport.project.ui;
45
package org.netbeans.modules.apisupport.project.ui;
46
46
47
import org.openide.util.Task;
47
import java.awt.event.ActionEvent;
48
import java.awt.event.ActionEvent;
48
import java.io.IOException;
49
import java.io.IOException;
49
import java.util.ArrayList;
50
import java.util.ArrayList;
Lines 63-68 Link Here
63
import org.netbeans.modules.apisupport.project.suite.SuiteBrandingModel;
64
import org.netbeans.modules.apisupport.project.suite.SuiteBrandingModel;
64
import org.netbeans.modules.apisupport.project.suite.SuiteProject;
65
import org.netbeans.modules.apisupport.project.suite.SuiteProject;
65
import org.netbeans.modules.apisupport.project.spi.BrandingModel;
66
import org.netbeans.modules.apisupport.project.spi.BrandingModel;
67
import org.netbeans.modules.apisupport.project.spi.ExecProject;
66
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteCustomizer;
68
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteCustomizer;
67
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteProperties;
69
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteProperties;
68
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteUtils;
70
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteUtils;
Lines 94-100 Link Here
94
 * Defines actions available on a suite.
96
 * Defines actions available on a suite.
95
 * @author Jesse Glick
97
 * @author Jesse Glick
96
 */
98
 */
97
public final class SuiteActions implements ActionProvider {
99
public final class SuiteActions implements ActionProvider, ExecProject {
100
    @Override
101
    public Task execute(String... args) throws IOException {
102
        StringBuilder sb = new StringBuilder();
103
        for (String r : args) {
104
            sb.append(r).append(' ');
105
        }
106
        Properties p = new Properties();
107
        p.setProperty("run.args", sb.substring(0, sb.length() - 1));
108
109
        return ActionUtils.runTarget(findBuildXml(project), new String[]{"run"}, p);
110
    }
98
    
111
    
99
    static Action[] getProjectActions(SuiteProject project) {
112
    static Action[] getProjectActions(SuiteProject project) {
100
        NbPlatform platform = project.getPlatform(true); //true -> #96095
113
        NbPlatform platform = project.getPlatform(true); //true -> #96095
(-)a/apisupport.project/apichanges.xml (+14 lines)
Lines 110-115 Link Here
110
    <changes>
110
    <changes>
111
        <change>
111
        <change>
112
            <api name="apisupport_spi"/>
112
            <api name="apisupport_spi"/>
113
            <summary>Execute the project</summary>
114
            <version major="1" minor="49"/>
115
            <date day="3" month="8" year="2011"/>
116
            <author login="jtulach"/>
117
            <compatibility addition="yes"/>
118
            <description>
119
                Layout designer seeks for <code>ExecProject</code> interface
120
                in project's lookup when it needs to execute the application
121
                with additional parameters.
122
            </description>
123
            <class package="org.netbeans.modules.apisupport.project.spi" name="ExecProject"/>
124
        </change>
125
        <change>
126
            <api name="apisupport_spi"/>
113
            <summary>Added prepareContext method</summary>
127
            <summary>Added prepareContext method</summary>
114
            <version major="1" minor="38"/>
128
            <version major="1" minor="38"/>
115
            <date day="23" month="2" year="2010"/>
129
            <date day="23" month="2" year="2010"/>
(-)a/apisupport.project/manifest.mf (-1 / +1 lines)
Lines 4-8 Link Here
4
OpenIDE-Module-Requires: javax.script.ScriptEngine.freemarker
4
OpenIDE-Module-Requires: javax.script.ScriptEngine.freemarker
5
OpenIDE-Module-Layer: org/netbeans/modules/apisupport/project/ui/resources/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/apisupport/project/ui/resources/layer.xml
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
7
OpenIDE-Module-Specification-Version: 1.48
7
OpenIDE-Module-Specification-Version: 1.49
8
8
(-)a/apisupport.project/nbproject/project.xml (+17 lines)
Lines 68-73 Link Here
68
                    </run-dependency>
68
                    </run-dependency>
69
                </dependency>
69
                </dependency>
70
                <dependency>
70
                <dependency>
71
                    <code-name-base>org.netbeans.api.progress</code-name-base>
72
                    <build-prerequisite/>
73
                    <compile-dependency/>
74
                    <run-dependency>
75
                        <release-version>1</release-version>
76
                        <specification-version>1.25</specification-version>
77
                    </run-dependency>
78
                </dependency>
79
                <dependency>
71
                    <code-name-base>org.netbeans.api.xml</code-name-base>
80
                    <code-name-base>org.netbeans.api.xml</code-name-base>
72
                    <build-prerequisite/>
81
                    <build-prerequisite/>
73
                    <compile-dependency/>
82
                    <compile-dependency/>
Lines 223-228 Link Here
223
                    </run-dependency>
232
                    </run-dependency>
224
                </dependency>
233
                </dependency>
225
                <dependency>
234
                <dependency>
235
                    <code-name-base>org.netbeans.swing.outline</code-name-base>
236
                    <build-prerequisite/>
237
                    <compile-dependency/>
238
                    <run-dependency>
239
                        <specification-version>1.15</specification-version>
240
                    </run-dependency>
241
                </dependency>
242
                <dependency>
226
                    <code-name-base>org.openide.actions</code-name-base>
243
                    <code-name-base>org.openide.actions</code-name-base>
227
                    <build-prerequisite/>
244
                    <build-prerequisite/>
228
                    <compile-dependency/>
245
                    <compile-dependency/>
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/spi/ExecProject.java (+60 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
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.apisupport.project.spi;
43
44
import java.io.IOException;
45
import org.openide.util.Task;
46
47
/** Abstraction over executing a project.
48
 *
49
 * @author Jaroslav Tulach <jtulach@netbeans.org>
50
 * @since 1.49
51
 */
52
public interface ExecProject {
53
    /** Asks the project to execute itself given provided arguments.
54
     * 
55
     * @param args arguments for the execution
56
     * @return task that will finish as soon as execution is over
57
     * @throws IOException if the launch fails
58
     */
59
    public Task execute(String... args) throws IOException;
60
}
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/resources/newTC.html (-1 / +1 lines)
Lines 41-46 Link Here
41
-->
41
-->
42
<html>
42
<html>
43
    <body>
43
    <body>
44
        Creates a new singleton window component integrated into the Window System along with an action in main menu which opens this window.
44
        Helps redefine the layout of window modes.
45
    </body>
45
    </body>
46
</html>
46
</html>
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/BasicSettingsPanel.form (-1 / +14 lines)
Lines 1-4 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.1" encoding="UTF-8" ?>
2
2
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
4
  <AuxValues>
Lines 167-171 Link Here
167
        </Constraint>
167
        </Constraint>
168
      </Constraints>
168
      </Constraints>
169
    </Component>
169
    </Component>
170
    <Component class="javax.swing.JButton" name="redefine">
171
      <Properties>
172
        <Property name="text" type="java.lang.String" value="&amp;Redefine..."/>
173
      </Properties>
174
      <Events>
175
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="redefineActionPerformed"/>
176
      </Events>
177
      <Constraints>
178
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
179
          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="20" weightX="0.0" weightY="0.0"/>
180
        </Constraint>
181
      </Constraints>
182
    </Component>
170
  </SubComponents>
183
  </SubComponents>
171
</Form>
184
</Form>
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/BasicSettingsPanel.java (-18 / +84 lines)
Lines 45-62 Link Here
45
package org.netbeans.modules.apisupport.project.ui.wizard.winsys;
45
package org.netbeans.modules.apisupport.project.ui.wizard.winsys;
46
46
47
import java.awt.Cursor;
47
import java.awt.Cursor;
48
import java.awt.EventQueue;
48
import java.io.IOException;
49
import java.io.IOException;
49
import java.util.ArrayList;
50
import java.util.Set;
50
import java.util.Collection;
51
import java.util.TreeSet;
52
import java.util.concurrent.atomic.AtomicReference;
51
import javax.swing.DefaultComboBoxModel;
53
import javax.swing.DefaultComboBoxModel;
52
import org.netbeans.modules.apisupport.project.layers.LayerUtils;
54
import org.netbeans.modules.apisupport.project.api.Util;
53
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
55
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
54
import org.openide.WizardDescriptor;
56
import org.openide.WizardDescriptor;
55
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileSystem;
57
import org.openide.util.AsyncGUIJob;
58
import org.openide.util.AsyncGUIJob;
59
import org.openide.util.Exceptions;
58
import org.openide.util.HelpCtx;
60
import org.openide.util.HelpCtx;
59
import org.openide.util.NbBundle;
61
import org.openide.util.NbBundle;
62
import org.openide.util.Task;
63
import org.openide.util.TaskListener;
60
import org.openide.util.Utilities;
64
import org.openide.util.Utilities;
61
65
62
/**
66
/**
Lines 93-99 Link Here
93
            markInvalid();
97
            markInvalid();
94
        }
98
        }
95
    }
99
    }
96
    
100
97
//    public void addNotify() {
101
//    public void addNotify() {
98
//        super.addNotify();
102
//        super.addNotify();
99
//        attachDocumentListeners();
103
//        attachDocumentListeners();
Lines 130-152 Link Here
130
            @Override
134
            @Override
131
            public void construct() {
135
            public void construct() {
132
                try {
136
                try {
133
                    FileSystem fs = LayerUtils.getEffectiveSystemFilesystem(data.getProject());
137
                    modes = DesignSupport.existingModes(data);
134
                    FileObject foRoot = fs.getRoot().getFileObject("Windows2/Modes"); //NOI18N
138
                    if (modes == null) {
135
                    if (foRoot != null) {
136
                        FileObject[] fos = foRoot.getChildren();
137
                        Collection<String> col = new ArrayList<String>();
138
                        for (FileObject fo : fos) {
139
                            if (fo.isData() && "wsmode".equals(fo.getExt())) { //NOI18N
140
                                col.add(fo.getName());
141
                            }
142
                        }
143
                        modes = col.toArray(new String[col.size()]);
144
                    } else {
145
                        modes = DEFAULT_MODES;
139
                        modes = DEFAULT_MODES;
146
                    }
140
                    }
147
                } catch (IOException exc) {
141
                } catch (IOException exc) {
148
                    modes = DEFAULT_MODES;
142
                    modes = DEFAULT_MODES;
149
150
                }
143
                }
151
            }
144
            }
152
145
Lines 162-167 Link Here
162
        });
155
        });
163
    }
156
    }
164
    
157
    
158
    @Override
165
    protected void storeToDataModel() {
159
    protected void storeToDataModel() {
166
        data.setOpened(cbOpenedOnStart.isSelected());
160
        data.setOpened(cbOpenedOnStart.isSelected());
167
        data.setKeepPrefSize(cbKeepPrefSize.isSelected());
161
        data.setKeepPrefSize(cbKeepPrefSize.isSelected());
Lines 173-178 Link Here
173
        data.setMode((String)comMode.getSelectedItem());
167
        data.setMode((String)comMode.getSelectedItem());
174
    }
168
    }
175
    
169
    
170
    @Override
176
    protected void readFromDataModel() {
171
    protected void readFromDataModel() {
177
        cbOpenedOnStart.setSelected(data.isOpened());
172
        cbOpenedOnStart.setSelected(data.isOpened());
178
        cbKeepPrefSize.setSelected(data.isKeepPrefSize());
173
        cbKeepPrefSize.setSelected(data.isKeepPrefSize());
Lines 194-203 Link Here
194
        }
189
        }
195
    }
190
    }
196
    
191
    
192
    @Override
197
    protected String getPanelName() {
193
    protected String getPanelName() {
198
        return getMessage("LBL_BasicSettings_Title");
194
        return getMessage("LBL_BasicSettings_Title");
199
    }
195
    }
200
    
196
    
197
    @Override
201
    protected HelpCtx getHelp() {
198
    protected HelpCtx getHelp() {
202
        return new HelpCtx(BasicSettingsPanel.class);
199
        return new HelpCtx(BasicSettingsPanel.class);
203
    }
200
    }
Lines 224-229 Link Here
224
        cbUndockingNotAllowed = new javax.swing.JCheckBox();
221
        cbUndockingNotAllowed = new javax.swing.JCheckBox();
225
        cbDraggingNotAllowed = new javax.swing.JCheckBox();
222
        cbDraggingNotAllowed = new javax.swing.JCheckBox();
226
        cbMaximizationNotAllowed = new javax.swing.JCheckBox();
223
        cbMaximizationNotAllowed = new javax.swing.JCheckBox();
224
        redefine = new javax.swing.JButton();
227
225
228
        setLayout(new java.awt.GridBagLayout());
226
        setLayout(new java.awt.GridBagLayout());
229
227
Lines 320-325 Link Here
320
        gridBagConstraints.weighty = 0.1;
318
        gridBagConstraints.weighty = 0.1;
321
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
319
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
322
        add(cbMaximizationNotAllowed, gridBagConstraints);
320
        add(cbMaximizationNotAllowed, gridBagConstraints);
321
322
        org.openide.awt.Mnemonics.setLocalizedText(redefine, "&Redefine...");
323
        redefine.addActionListener(new java.awt.event.ActionListener() {
324
            public void actionPerformed(java.awt.event.ActionEvent evt) {
325
                redefineActionPerformed(evt);
326
            }
327
        });
328
        gridBagConstraints = new java.awt.GridBagConstraints();
329
        gridBagConstraints.anchor = java.awt.GridBagConstraints.PAGE_END;
330
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
331
        add(redefine, gridBagConstraints);
323
    }// </editor-fold>//GEN-END:initComponents
332
    }// </editor-fold>//GEN-END:initComponents
324
333
325
private void windowPosChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_windowPosChanged
334
private void windowPosChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_windowPosChanged
Lines 330-335 Link Here
330
    if( !cbSlidingNotAllowed.isEnabled() )
339
    if( !cbSlidingNotAllowed.isEnabled() )
331
        cbSlidingNotAllowed.setSelected( false );
340
        cbSlidingNotAllowed.setSelected( false );
332
}//GEN-LAST:event_windowPosChanged
341
}//GEN-LAST:event_windowPosChanged
342
343
private void redefineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_redefineActionPerformed
344
    try {
345
        final AtomicReference<FileObject> userDir = new AtomicReference<FileObject>();
346
        Task task = DesignSupport.invokeDesignMode(data.getProject(), userDir);
347
        redefine.setEnabled(false);
348
        if (task == null) {
349
            return;
350
        }
351
        redefine.setText(org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "MSG_LaunchingLayout", new Object[]{}));
352
        
353
        class PostProcess implements TaskListener, Runnable {
354
            Set<String> modeNames;
355
            
356
            @Override
357
            public void taskFinished(Task task) {
358
                FileObject modes = userDir.get().getFileObject("config/Windows2Local/Modes");
359
                if (modes != null) {
360
                    modeNames = new TreeSet<String>();
361
                    for (FileObject m : modes.getChildren()) {
362
                        if (m.isData() && "wsmode".equals(m.getExt())) { //NOI18N
363
                            modeNames.add(m.getName());
364
                            try {
365
                                data.defineMode(m.getName(), DesignSupport.readMode(m));
366
                            } catch (IOException ex) {
367
                                Exceptions.printStackTrace(ex);
368
                            }
369
                        }
370
                    }
371
                    EventQueue.invokeLater(this);
372
                }
373
            }
374
375
            @Override
376
            public void run() {
377
                redefine.setEnabled(true);
378
                redefine.setText(org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "MSG_RedefineLayout", new Object[] {}));
379
                int s = comMode.getModel().getSize();
380
                for (int i = 0; i < s; i++) {
381
                    modeNames.remove((String)comMode.getModel().getElementAt(i));
382
                }
383
                boolean first = true;
384
                for (String mn : modeNames) {
385
                    ((DefaultComboBoxModel)comMode.getModel()).addElement(mn);
386
                    if (first) {
387
                        comMode.getModel().setSelectedItem(mn);
388
                    }
389
                    first = false;
390
                }
391
            }
392
        }
393
        task.addTaskListener(new PostProcess());
394
    } catch (IOException e) {
395
        Util.err.notify(e);
396
    }
397
}//GEN-LAST:event_redefineActionPerformed
333
    
398
    
334
    // Variables declaration - do not modify//GEN-BEGIN:variables
399
    // Variables declaration - do not modify//GEN-BEGIN:variables
335
    private javax.swing.JCheckBox cbClosingNotAllowed;
400
    private javax.swing.JCheckBox cbClosingNotAllowed;
Lines 341-346 Link Here
341
    private javax.swing.JCheckBox cbUndockingNotAllowed;
406
    private javax.swing.JCheckBox cbUndockingNotAllowed;
342
    private javax.swing.JComboBox comMode;
407
    private javax.swing.JComboBox comMode;
343
    private javax.swing.JLabel lblMode;
408
    private javax.swing.JLabel lblMode;
409
    private javax.swing.JButton redefine;
344
    // End of variables declaration//GEN-END:variables
410
    // End of variables declaration//GEN-END:variables
345
    
411
    
346
    private void initAccessibility() {
412
    private void initAccessibility() {
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties (+13 lines)
Lines 82-84 Link Here
82
CTL_UndockingNotAllowed=&Undocking not allowed
82
CTL_UndockingNotAllowed=&Undocking not allowed
83
CTL_DraggingNotAllowed=&Dragging not allowed
83
CTL_DraggingNotAllowed=&Dragging not allowed
84
CTL_MaximizationNotAllowed=&Maximization not allowed
84
CTL_MaximizationNotAllowed=&Maximization not allowed
85
MSG_RedefineLayout=Redefine...
86
MSG_LaunchingLayout=Launching...
87
MSG_ReallyLaunch=Following action needs to start your application in a special mode.\n\
88
This requires your application is compilable, executable and does\n\
89
not do anything strange.\n\
90
\n\
91
\As soon as the application is launched, you can play with the layout,\n\
92
create new modes, rename existing. Close the application to save changes.\n\
93
\n\
94
Do you want to proceed?
95
MSG_AlreadyLaunched=Your application may have already been started in design mode.\nContinue with another launch anyway?
96
MSG_ModesGenerated=Following modes has been generated:\\n{0}
97
IGNORE\ PREVIOUS\ RUN=Ignore results of previous run
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/DesignSupport.java (+232 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
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.apisupport.project.ui.wizard.winsys;
43
44
import java.awt.EventQueue;
45
import java.io.File;
46
import java.io.IOException;
47
import java.io.InputStream;
48
import java.io.OutputStream;
49
import java.io.StringWriter;
50
import java.util.ArrayList;
51
import java.util.Collection;
52
import java.util.MissingResourceException;
53
import java.util.concurrent.atomic.AtomicReference;
54
import javax.swing.JButton;
55
import javax.swing.JComponent;
56
import javax.swing.JTextArea;
57
import javax.xml.transform.Result;
58
import javax.xml.transform.Source;
59
import javax.xml.transform.Transformer;
60
import javax.xml.transform.TransformerException;
61
import javax.xml.transform.TransformerFactory;
62
import javax.xml.transform.stream.StreamResult;
63
import javax.xml.transform.stream.StreamSource;
64
import org.netbeans.api.project.Project;
65
import org.netbeans.modules.apisupport.project.layers.LayerUtils;
66
import org.netbeans.modules.apisupport.project.spi.ExecProject;
67
import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
68
import org.openide.DialogDisplayer;
69
import org.openide.NotifyDescriptor;
70
import org.openide.filesystems.FileObject;
71
import org.openide.filesystems.FileSystem;
72
import org.openide.filesystems.FileUtil;
73
import org.openide.util.Exceptions;
74
import org.openide.util.NbBundle;
75
import org.openide.util.Task;
76
import org.openide.util.TaskListener;
77
78
public final class DesignSupport implements TaskListener, Runnable {
79
    private final Project project;
80
    private final JButton toEnable;
81
    private final AtomicReference<FileObject> userDir;
82
83
84
    private DesignSupport(Project p, JButton toEnable, AtomicReference<FileObject> ud) {
85
        this.project = p;
86
        this.toEnable = toEnable;
87
        this.userDir = ud;
88
    }
89
    
90
    static JComponent warningPanel() throws MissingResourceException {
91
        JTextArea a = new JTextArea();
92
        a.setEditable(false);
93
        a.setText(org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "MSG_ReallyLaunch", new Object[]{}));
94
        a.setOpaque(false);
95
        return a;
96
    }
97
    
98
    public static Task invokeDesignMode(
99
        Project prj, AtomicReference<FileObject> userDir
100
    ) throws IOException {
101
        return invokeDesignMode(prj, userDir, true, true);
102
    }
103
    
104
    
105
    static Task invokeDesignMode(
106
        Project prj, AtomicReference<FileObject> userDir, boolean warn, boolean warnPrevResult
107
    ) throws IOException {
108
        ExecProject es = prj.getLookup().lookup(ExecProject.class);
109
        if (es == null) {
110
            throw new IOException("Project " + prj.getProjectDirectory() + " does not support execution!"); // NOI18N
111
        }
112
        if (warn) {
113
            NotifyDescriptor nd = new NotifyDescriptor.Confirmation(warningPanel());
114
            nd.setOptions(new Object[]{NotifyDescriptor.YES_OPTION, NotifyDescriptor.CANCEL_OPTION});
115
            if (DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.YES_OPTION) {
116
                return null;
117
            }
118
        }
119
        FileObject fo = prj.getProjectDirectory().getFileObject("build/designdir"); // NOI18N
120
        if (fo != null) {
121
            if (warnPrevResult) {
122
                NotifyDescriptor nd = new NotifyDescriptor.Confirmation(org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "MSG_AlreadyLaunched", new Object[]{}));
123
                nd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
124
                if (DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.OK_OPTION) {
125
                    return null;
126
                }
127
            }
128
            fo.delete();
129
        }
130
        fo = FileUtil.createFolder(prj.getProjectDirectory(), "build/designdir"); // NOI18N
131
        File path = FileUtil.toFile(fo);
132
        userDir.set(fo);
133
        return es.execute(
134
            "--nosplash", // NOI18N
135
            "-J-Dorg.netbeans.core.WindowSystem.designMode=true", // NOI18N
136
            "--userdir " + path // NOI18N
137
        );
138
    }
139
140
    static String[] existingModes(NewTCIterator.DataModel data) throws IOException {
141
        FileSystem fs = LayerUtils.getEffectiveSystemFilesystem(data.getProject());
142
        FileObject foRoot = fs.getRoot().getFileObject("Windows2/Modes"); //NOI18N
143
        if (foRoot != null) {
144
            FileObject[] fos = foRoot.getChildren();
145
            Collection<String> col = new ArrayList<String>();
146
            for (FileObject fo : fos) {
147
                if (fo.isData() && "wsmode".equals(fo.getExt())) { //NOI18N
148
                    col.add(fo.getName());
149
                    data.existingMode(fo.getName());
150
                }
151
            }
152
            return col.toArray(new String[col.size()]);
153
        } else {
154
            return null;
155
        }
156
    }
157
    
158
    public static String readMode(FileObject fo) throws IOException {
159
        final InputStream is = fo.getInputStream();
160
        try {
161
            StringWriter w = new StringWriter();
162
            Source t = new StreamSource(DesignSupport.class.getResourceAsStream("polishing.xsl")); // NOI18N
163
            Transformer tr = TransformerFactory.newInstance().newTransformer(t);
164
            Source s = new StreamSource(is);
165
            Result r = new StreamResult(w);
166
            tr.transform(s, r);
167
            return w.toString();
168
        } catch (TransformerException ex) {
169
            throw new IOException(ex);
170
        } finally {
171
            is.close();
172
        }
173
    }
174
    public static void redefineLayout(Project p, JButton toEnable) {
175
        try {
176
            AtomicReference<FileObject> userDir = new AtomicReference<FileObject>();
177
            Task task = invokeDesignMode(p, userDir);
178
            if (task == null) {
179
                toEnable.setEnabled(true);
180
            }
181
            task.addTaskListener(new DesignSupport(p, toEnable, userDir));
182
        } catch (IOException ex) {
183
            Exceptions.printStackTrace(ex);
184
        }
185
    }
186
187
    @Override
188
    public void taskFinished(Task task) {
189
        FileObject modeDir = userDir.get().getFileObject("config/Windows2Local/Modes");
190
        OutputStream os;
191
        if (modeDir != null) {
192
            StringBuilder sb = new StringBuilder();
193
            try {
194
                
195
                FileSystem layer = findLayer(project);
196
                if (layer == null) {
197
                    throw new IOException("Cannot find layer in " + project); // NOI18N
198
                }
199
                for (FileObject m : modeDir.getChildren()) {
200
                    if (m.isData() && "wsmode".equals(m.getExt())) { 
201
                        final String name = "Windows2/Modes/" + m.getNameExt(); // NOI18N
202
                        FileObject mode = FileUtil.createData(layer.getRoot(), name); // NOI18N
203
                        os = mode.getOutputStream();
204
                        os.write(DesignSupport.readMode(m).getBytes("UTF-8")); // NOI18N
205
                        os.close();
206
                        sb.append(name).append("\n");
207
                    }
208
                }
209
                NotifyDescriptor nd = new NotifyDescriptor.Message(
210
                    NbBundle.getMessage(DesignSupport.class, "MSG_ModesGenerated", new Object[] {sb}), 
211
                    NotifyDescriptor.INFORMATION_MESSAGE
212
                );
213
                DialogDisplayer.getDefault().notifyLater(nd);
214
            } catch (IOException ex) {
215
                Exceptions.printStackTrace(ex);
216
            }
217
        }
218
        EventQueue.invokeLater(this);
219
    }
220
221
    @Override
222
    public void run() {
223
        toEnable.setEnabled(true);
224
    }
225
    
226
    static FileSystem findLayer(Project p) throws IOException {
227
        if (p.getLookup().lookup(NbModuleProvider.class) != null) {
228
            return LayerUtils.getEffectiveSystemFilesystem(p);
229
        }
230
        return null;
231
    }
232
}
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/NewTCIterator.java (-132 / +49 lines)
Lines 46-53 Link Here
46
46
47
import java.io.File;
47
import java.io.File;
48
import java.io.IOException;
48
import java.io.IOException;
49
import java.io.OutputStream;
49
import java.util.Collections;
50
import java.util.Collections;
50
import java.util.HashMap;
51
import java.util.HashMap;
52
import java.util.HashSet;
51
import java.util.Map;
53
import java.util.Map;
52
import java.util.Set;
54
import java.util.Set;
53
import java.util.logging.Level;
55
import java.util.logging.Level;
Lines 63-101 Link Here
63
import org.openide.filesystems.FileSystem;
65
import org.openide.filesystems.FileSystem;
64
import org.openide.filesystems.FileUtil;
66
import org.openide.filesystems.FileUtil;
65
import org.netbeans.api.templates.TemplateRegistration;
67
import org.netbeans.api.templates.TemplateRegistration;
68
import org.netbeans.modules.apisupport.project.api.LayerHandle;
69
import org.netbeans.modules.apisupport.project.ui.wizard.winsys.NewTCIterator.DataModel;
66
import org.openide.modules.SpecificationVersion;
70
import org.openide.modules.SpecificationVersion;
67
import org.openide.util.NbBundle.Messages;
71
import org.openide.util.NbBundle.Messages;
68
import org.openide.windows.WindowManager;
72
import org.openide.windows.WindowManager;
69
73
70
/**
74
/**
71
 * Wizard for creating new TopComponent.
75
 * Wizard for redefining layout of windows.
72
 *
76
 *
73
 * @author Milos Kleint
77
 * @author Jaroslav Tulach
74
 */
78
 */
75
@TemplateRegistration(
79
@TemplateRegistration(
76
    folder="NetBeansModuleDevelopment",
80
    folder="NetBeansModuleDevelopment",
77
    position=200,
81
    position=3249,
78
    displayName="#template_winsys",
82
    displayName="#template_winsys_layout",
79
    iconBase="org/netbeans/modules/apisupport/project/ui/resources/newTC.png", 
83
    iconBase="org/netbeans/modules/apisupport/project/ui/resources/newLayout.png", 
80
    description="../../resources/newTC.html",
84
    description="../../resources/newLayout.html",
81
    category="nbm-specific"
85
    category="nbm-specific"
82
)
86
)
83
@Messages("template_winsys=Window")
87
@Messages("template_winsys_layout=Layout of Windows")
84
public final class NewTCIterator extends BasicWizardIterator {
88
public final class LayoutIterator extends BasicWizardIterator {
85
89
86
    private NewTCIterator.DataModel data;
90
    private DataModel data;
87
    
91
    
92
    @Override
88
    public Set instantiate() throws IOException {
93
    public Set instantiate() throws IOException {
89
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
94
        CreatedModifiedFiles cmf = data.getCreatedModifiedFiles();
90
        cmf.run();
95
        cmf.run();
91
        return getCreatedFiles(cmf, data.getProject());
96
        return Collections.singleton(
97
            LayerHandle.forProject(data.getProject()).getLayerFile()
98
        );
92
    }
99
    }
93
    
100
    
101
    @Override
94
    protected BasicWizardIterator.Panel[] createPanels(WizardDescriptor wiz) {
102
    protected BasicWizardIterator.Panel[] createPanels(WizardDescriptor wiz) {
95
        data = new NewTCIterator.DataModel(wiz);
103
        data = new DataModel(wiz);
96
        return new BasicWizardIterator.Panel[] {
104
        return new BasicWizardIterator.Panel[] {
97
            new BasicSettingsPanel(wiz, data),
105
            new LayoutWarningPanel(wiz, data),
98
            new NameAndLocationPanel(wiz, data)
106
            new LayoutLaunchingPanel(wiz, data),
107
            new LayoutSummaryPanel(wiz, data)
99
        };
108
        };
100
    }
109
    }
101
    
110
    
Lines 104-226 Link Here
104
        data = null;
113
        data = null;
105
    }
114
    }
106
    
115
    
107
    static final class DataModel extends BasicWizardIterator.BasicDataModel {
116
    static void generateFileChanges(final DataModel model) {
108
        
109
        private String name;
110
        private String icon;
111
        private String mode;
112
        private boolean opened = false;
113
        private boolean keepPrefSize = false;
114
        private boolean slidingNotAllowed = false;
115
        private boolean closingNotAllowed = false;
116
        private boolean draggingNotAllowed = false;
117
        private boolean undockingNotAllowed = false;
118
        private boolean maximizationNotAllowed = false;
119
        
120
        private CreatedModifiedFiles files;
121
        
122
        DataModel(WizardDescriptor wiz) {
123
            super(wiz);
124
        }
125
        
126
        public CreatedModifiedFiles getCreatedModifiedFiles() {
127
            return getFiles();
128
        }
129
        
130
        public void setCreatedModifiedFiles(CreatedModifiedFiles files) {
131
            this.setFiles(files);
132
        }
133
        
134
        public String getName() {
135
            return name;
136
        }
137
        
138
        public void setName(String name) {
139
            this.name = name;
140
        }
141
        
142
        public CreatedModifiedFiles getFiles() {
143
            return files;
144
        }
145
        
146
        public void setFiles(CreatedModifiedFiles files) {
147
            this.files = files;
148
        }
149
150
        public String getIcon() {
151
            return icon;
152
        }
153
154
        public void setIcon(String icon) {
155
            this.icon = icon;
156
        }
157
158
        public String getMode() {
159
            return mode;
160
        }
161
162
        public void setMode(String mode) {
163
            this.mode = mode;
164
        }
165
166
        public boolean isOpened() {
167
            return opened;
168
        }
169
170
        public void setOpened(boolean opened) {
171
            this.opened = opened;
172
        }
173
        
174
        public boolean isKeepPrefSize() {
175
            return keepPrefSize;
176
        }
177
178
        public void setKeepPrefSize(boolean keepPrefSize) {
179
            this.keepPrefSize = keepPrefSize;
180
        }
181
182
        public boolean isClosingNotAllowed() {
183
            return closingNotAllowed;
184
        }
185
186
        public void setClosingNotAllowed(boolean closingNotAllowed) {
187
            this.closingNotAllowed = closingNotAllowed;
188
        }
189
190
        public boolean isDraggingNotAllowed() {
191
            return draggingNotAllowed;
192
        }
193
194
        public void setDraggingNotAllowed(boolean draggingNotAllowed) {
195
            this.draggingNotAllowed = draggingNotAllowed;
196
        }
197
198
        public boolean isMaximizationNotAllowed() {
199
            return maximizationNotAllowed;
200
        }
201
202
        public void setMaximizationNotAllowed(boolean maximizationNotAllowed) {
203
            this.maximizationNotAllowed = maximizationNotAllowed;
204
        }
205
206
        public boolean isSlidingNotAllowed() {
207
            return slidingNotAllowed;
208
        }
209
210
        public void setSlidingNotAllowed(boolean slidingNotAllowed) {
211
            this.slidingNotAllowed = slidingNotAllowed;
212
        }
213
214
        public boolean isUndockingNotAllowed() {
215
            return undockingNotAllowed;
216
        }
217
218
        public void setUndockingNotAllowed(boolean undockingNotAllowed) {
219
            this.undockingNotAllowed = undockingNotAllowed;
220
        }
221
    }
222
    
223
    public static void generateFileChanges(DataModel model) {
224
        CreatedModifiedFiles fileChanges = new CreatedModifiedFiles(model.getProject());
117
        CreatedModifiedFiles fileChanges = new CreatedModifiedFiles(model.getProject());
225
        Project project = model.getProject();
118
        Project project = model.getProject();
226
        NbModuleProvider moduleInfo = model.getModuleInfo();
119
        NbModuleProvider moduleInfo = model.getModuleInfo();
Lines 235-241 Link Here
235
            actionLessTC = current == null || current.compareTo(new SpecificationVersion("6.24")) >= 0; // NOI18N
128
            actionLessTC = current == null || current.compareTo(new SpecificationVersion("6.24")) >= 0; // NOI18N
236
            xmlLessTC = current == null || current.compareTo(new SpecificationVersion("6.37")) >= 0; // NOI18N
129
            xmlLessTC = current == null || current.compareTo(new SpecificationVersion("6.37")) >= 0; // NOI18N
237
        } catch (IOException ex) {
130
        } catch (IOException ex) {
238
            Logger.getLogger(NewTCIterator.class.getName()).log(Level.INFO, null, ex);
131
            Logger.getLogger(LayoutIterator.class.getName()).log(Level.INFO, null, ex);
239
            actionLessTC = false;
132
            actionLessTC = false;
240
            xmlLessTC = false;
133
            xmlLessTC = false;
241
        }
134
        }
Lines 244-250 Link Here
244
            SpecificationVersion current = model.getModuleInfo().getDependencyVersion("org.netbeans.modules.settings");
137
            SpecificationVersion current = model.getModuleInfo().getDependencyVersion("org.netbeans.modules.settings");
245
            propertiesPersistence = current == null || current.compareTo(new SpecificationVersion("1.18")) >= 0; // NOI18N
138
            propertiesPersistence = current == null || current.compareTo(new SpecificationVersion("1.18")) >= 0; // NOI18N
246
        } catch (IOException ex) {
139
        } catch (IOException ex) {
247
            Logger.getLogger(NewTCIterator.class.getName()).log(Level.INFO, null, ex);
140
            Logger.getLogger(LayoutIterator.class.getName()).log(Level.INFO, null, ex);
248
            propertiesPersistence = false;
141
            propertiesPersistence = false;
249
        }
142
        }
250
143
Lines 382-387 Link Here
382
        fileChanges.add(fileChanges.bundleKey(bundlePath, "HINT_" + name + "TopComponent",  // NOI18N
275
        fileChanges.add(fileChanges.bundleKey(bundlePath, "HINT_" + name + "TopComponent",  // NOI18N
383
                                "This is a " + name + " window")); //NOI18N
276
                                "This is a " + name + " window")); //NOI18N
384
        
277
        
278
        final Map<String, String> newModes = model.getNewModes();
279
        if (newModes != null) {
280
            Set<String> files = new HashSet<String>();
281
            for (String wsmode : newModes.keySet()) {
282
                files.add(wsmode + ".wsmode");
283
            }
284
            
285
            fileChanges.add(fileChanges.layerModifications(new CreatedModifiedFiles.LayerOperation() {
286
                @Override
287
                public void run(FileSystem layer) throws IOException {
288
                    FileObject fo = FileUtil.createFolder(layer.getRoot(), "Windows2/Modes");
289
                    for (Map.Entry<String, String> entry : newModes.entrySet()) {
290
                        FileObject wsmode = fo.createData(entry.getKey() + ".wsmode");
291
                        OutputStream os = wsmode.getOutputStream();
292
                        try {
293
                            os.write(entry.getValue().getBytes("UTF-8"));
294
                        } finally {
295
                            os.close();
296
                        }
297
                    }
298
                }   
299
            }, files));
300
        }
301
        
385
        model.setCreatedModifiedFiles(fileChanges);
302
        model.setCreatedModifiedFiles(fileChanges);
386
    }
303
    }
387
304
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/NameAndLocationPanel.form (-185 / +12 lines)
Lines 1-9 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.1" encoding="UTF-8" ?>
2
2
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
7
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
10
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
Lines 14-210 Link Here
14
15
15
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
16
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
16
  <SubComponents>
17
  <SubComponents>
17
    <Component class="javax.swing.JLabel" name="lblPrefix">
18
    <Container class="javax.swing.JPanel" name="progress">
18
      <Properties>
19
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
20
          <ComponentRef name="txtPrefix"/>
21
        </Property>
22
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
23
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/loader/Bundle.properties" key="LBL_Prefix" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
24
        </Property>
25
      </Properties>
26
      <Constraints>
19
      <Constraints>
27
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
20
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
28
          <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="1" insetsLeft="0" insetsBottom="6" insetsRight="12" anchor="10" weightX="0.0" weightY="0.0"/>
21
          <GridBagConstraints gridX="0" gridY="0" gridWidth="4" gridHeight="3" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
29
        </Constraint>
22
        </Constraint>
30
      </Constraints>
23
      </Constraints>
31
    </Component>
24
32
    <Component class="javax.swing.JTextField" name="txtPrefix">
25
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
26
    </Container>
27
    <Container class="javax.swing.JPanel" name="tree">
33
      <Constraints>
28
      <Constraints>
34
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
29
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
35
          <GridBagConstraints gridX="1" gridY="0" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="1" insetsLeft="0" insetsBottom="6" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
30
          <GridBagConstraints gridX="0" gridY="3" gridWidth="4" gridHeight="11" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
36
        </Constraint>
31
        </Constraint>
37
      </Constraints>
32
      </Constraints>
38
    </Component>
33
39
    <Component class="javax.swing.JLabel" name="lblIcon">
34
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
40
      <Properties>
35
    </Container>
41
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
42
          <ComponentRef name="txtIcon"/>
43
        </Property>
44
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
45
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/loader/Bundle.properties" key="LBL_Icon" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
46
        </Property>
47
      </Properties>
48
      <Constraints>
49
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
50
          <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="10" weightX="0.0" weightY="0.0"/>
51
        </Constraint>
52
      </Constraints>
53
    </Component>
54
    <Component class="javax.swing.JTextField" name="txtIcon">
55
      <Constraints>
56
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
57
          <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
58
        </Constraint>
59
      </Constraints>
60
    </Component>
61
    <Component class="javax.swing.JButton" name="btnIcon">
62
      <Properties>
63
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
64
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/loader/Bundle.properties" key="LBL_Icon_Browse" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
65
        </Property>
66
      </Properties>
67
      <Events>
68
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnIconActionPerformed"/>
69
      </Events>
70
      <Constraints>
71
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
72
          <GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
73
        </Constraint>
74
      </Constraints>
75
    </Component>
76
    <Component class="javax.swing.JLabel" name="lblProjectName">
77
      <Properties>
78
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
79
          <ComponentRef name="txtProjectName"/>
80
        </Property>
81
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
82
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle.properties" key="LBL_ProjectName" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
83
        </Property>
84
      </Properties>
85
      <Constraints>
86
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
87
          <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="18" insetsLeft="0" insetsBottom="6" insetsRight="12" anchor="10" weightX="0.0" weightY="0.0"/>
88
        </Constraint>
89
      </Constraints>
90
    </Component>
91
    <Component class="javax.swing.JTextField" name="txtProjectName">
92
      <Properties>
93
        <Property name="editable" type="boolean" value="false"/>
94
      </Properties>
95
      <AuxValues>
96
        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JTextField(ProjectUtils.getInformation(this.data.getProject()).getDisplayName());"/>
97
      </AuxValues>
98
      <Constraints>
99
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
100
          <GridBagConstraints gridX="1" gridY="2" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="18" insetsLeft="0" insetsBottom="6" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
101
        </Constraint>
102
      </Constraints>
103
    </Component>
104
    <Component class="javax.swing.JLabel" name="lblPackageName">
105
      <Properties>
106
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
107
          <ComponentRef name="comPackageName"/>
108
        </Property>
109
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
110
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle.properties" key="LBL_PackageName" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
111
        </Property>
112
      </Properties>
113
      <Constraints>
114
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
115
          <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="10" weightX="0.0" weightY="0.0"/>
116
        </Constraint>
117
      </Constraints>
118
    </Component>
119
    <Component class="javax.swing.JComboBox" name="comPackageName">
120
      <Properties>
121
        <Property name="editable" type="boolean" value="true"/>
122
        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
123
          <StringArray count="0"/>
124
        </Property>
125
      </Properties>
126
      <AuxValues>
127
        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="UIUtil.createPackageComboBox(data.getSourceRootGroup());"/>
128
      </AuxValues>
129
      <Constraints>
130
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
131
          <GridBagConstraints gridX="1" gridY="3" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
132
        </Constraint>
133
      </Constraints>
134
    </Component>
135
    <Component class="javax.swing.JLabel" name="createdFiles">
136
      <Properties>
137
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
138
          <ComponentRef name="createdFilesValue"/>
139
        </Property>
140
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
141
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle.properties" key="LBL_CreatedFiles" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
142
        </Property>
143
      </Properties>
144
      <Constraints>
145
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
146
          <GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="36" insetsLeft="0" insetsBottom="6" insetsRight="12" anchor="18" weightX="0.0" weightY="0.0"/>
147
        </Constraint>
148
      </Constraints>
149
    </Component>
150
    <Component class="javax.swing.JLabel" name="modifiedFiles">
151
      <Properties>
152
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153
          <ComponentRef name="modifiedFilesValue"/>
154
        </Property>
155
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
156
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle.properties" key="LBL_ModifiedFiles" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
157
        </Property>
158
      </Properties>
159
      <Constraints>
160
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
161
          <GridBagConstraints gridX="0" gridY="5" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="18" weightX="0.0" weightY="0.0"/>
162
        </Constraint>
163
      </Constraints>
164
    </Component>
165
    <Component class="javax.swing.JLabel" name="filler">
166
      <Constraints>
167
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
168
          <GridBagConstraints gridX="0" gridY="6" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
169
        </Constraint>
170
      </Constraints>
171
    </Component>
172
    <Component class="javax.swing.JTextArea" name="createdFilesValue">
173
      <Properties>
174
        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
175
          <Color blue="ee" green="ee" id="Label.background" palette="3" red="ee" type="palette"/>
176
        </Property>
177
        <Property name="columns" type="int" value="20"/>
178
        <Property name="editable" type="boolean" value="false"/>
179
        <Property name="rows" type="int" value="5"/>
180
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
181
          <Border info="null"/>
182
        </Property>
183
      </Properties>
184
      <Constraints>
185
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
186
          <GridBagConstraints gridX="1" gridY="4" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="36" insetsLeft="0" insetsBottom="6" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
187
        </Constraint>
188
      </Constraints>
189
    </Component>
190
    <Component class="javax.swing.JTextArea" name="modifiedFilesValue">
191
      <Properties>
192
        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
193
          <Color blue="ee" green="ee" id="Label.background" palette="3" red="ee" type="palette"/>
194
        </Property>
195
        <Property name="columns" type="int" value="20"/>
196
        <Property name="editable" type="boolean" value="false"/>
197
        <Property name="rows" type="int" value="5"/>
198
        <Property name="toolTipText" type="java.lang.String" value="modifiedFilesValue"/>
199
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
200
          <Border info="null"/>
201
        </Property>
202
      </Properties>
203
      <Constraints>
204
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
205
          <GridBagConstraints gridX="1" gridY="5" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
206
        </Constraint>
207
      </Constraints>
208
    </Component>
209
  </SubComponents>
36
  </SubComponents>
210
</Form>
37
</Form>
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/NameAndLocationPanel.java (-265 / +202 lines)
Lines 44-163 Link Here
44
44
45
package org.netbeans.modules.apisupport.project.ui.wizard.winsys;
45
package org.netbeans.modules.apisupport.project.ui.wizard.winsys;
46
46
47
import java.io.File;
47
import java.awt.EventQueue;
48
import javax.swing.JFileChooser;
48
import java.io.IOException;
49
import javax.swing.JTextField;
49
import java.util.concurrent.atomic.AtomicReference;
50
import javax.swing.event.DocumentEvent;
50
import javax.swing.JComponent;
51
import javax.swing.event.DocumentListener;
51
import javax.swing.JLabel;
52
import org.netbeans.api.project.ProjectUtils;
52
import org.netbeans.api.progress.ProgressHandle;
53
import org.netbeans.modules.apisupport.project.api.UIUtil;
53
import org.netbeans.api.progress.ProgressHandleFactory;
54
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
54
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
55
import org.openide.WizardDescriptor;
55
import org.openide.WizardDescriptor;
56
import org.openide.explorer.ExplorerManager;
57
import org.openide.explorer.view.CheckableNode;
58
import org.openide.explorer.view.OutlineView;
59
import org.openide.filesystems.FileObject;
60
import org.openide.filesystems.FileSystem;
61
import org.openide.nodes.AbstractNode;
62
import org.openide.nodes.Children;
63
import org.openide.nodes.Node;
64
import org.openide.util.Exceptions;
56
import org.openide.util.HelpCtx;
65
import org.openide.util.HelpCtx;
57
import org.openide.util.NbBundle;
66
import org.openide.util.NbBundle;
58
import org.openide.util.Utilities;
67
import org.openide.util.Task;
68
import org.openide.util.TaskListener;
59
69
60
/**
70
/**
61
 * the second panel in topcomponent wizard.
71
 * Shows progress of launching first, then let's user pickup changed modes.
62
 *
72
 *
63
 * @author Milos Kleint
73
 * @author Jaroslav Tulach
64
 */
74
 */
65
final class NameAndLocationPanel extends BasicWizardIterator.Panel {
75
final class LayoutLaunchingPanel extends BasicWizardIterator.Panel 
76
implements TaskListener, Runnable, ExplorerManager.Provider {
77
    private AtomicReference<FileObject> userDir = new AtomicReference<FileObject>();
78
    private NewTCIterator.DataModel data;
79
    private Task task;
80
    private ProgressHandle handle;
81
    private ExplorerManager em;
82
    private final OutlineView outlineView;
66
    
83
    
67
    private NewTCIterator.DataModel data;
84
    @NbBundle.Messages({
68
    
85
        "CTL_FoundModes=Found modes",
69
    /** Creates new NameAndLocationPanel */
86
        "LBL_LayoutingWizardTitle=Define Your Modes"
70
    public NameAndLocationPanel(final WizardDescriptor setting, final NewTCIterator.DataModel data) {
87
    })
88
    public LayoutLaunchingPanel(final WizardDescriptor setting, final NewTCIterator.DataModel data) {
71
        super(setting);
89
        super(setting);
72
        this.data = data;
90
        this.data = data;
91
        Node root = new AbstractNode(new Children.Array());
92
        this.em = new ExplorerManager();
93
        this.em.setRootContext(root);
73
        initComponents();
94
        initComponents();
74
        initAccessibility();
95
        initAccessibility();
75
        putClientProperty("NewFileWizard_Title", getMessage("LBL_TCWizardTitle"));
96
        putClientProperty("NewFileWizard_Title", Bundle.LBL_LayoutingWizardTitle()); // NOI18N
76
        
97
        outlineView = new OutlineView(Bundle.CTL_FoundModes());
77
        DocumentListener dListener = new UIUtil.DocumentAdapter() {
98
        outlineView.getOutline().setRootVisible(false);
78
            public void insertUpdate(DocumentEvent e) {
99
        tree.add(outlineView);
79
                if (checkValidity()) {
100
        outlineView.setDefaultActionAllowed(false);
80
                    updateData();
101
        outlineView.setVisible(false);
81
                }
102
        tree.setMinimumSize(outlineView.getPreferredSize());
103
    }
104
    
105
    @Override
106
    protected void storeToDataModel() {
107
        for (Node n : getExplorerManager().getRootContext().getChildren().getNodes()) {
108
            ModeNode mn = (ModeNode)n;
109
            if (mn.isSelected()) {
110
                data.defineMode(mn.getName(), mn.text);
82
            }
111
            }
83
        };
84
        txtPrefix.getDocument().addDocumentListener(dListener);
85
        txtIcon.getDocument().addDocumentListener(dListener);
86
        
87
        if (comPackageName.getEditor().getEditorComponent() instanceof JTextField) {
88
            JTextField txt = (JTextField)comPackageName.getEditor().getEditorComponent();
89
            txt.getDocument().addDocumentListener(dListener);
90
        }
112
        }
91
    }
113
    }
92
    
114
    
93
    protected void storeToDataModel() {
115
    @NbBundle.Messages({
94
        updateData();
116
        "MSG_LaunchingApplication=Launching your application"
117
    })
118
    @Override
119
    protected void readFromDataModel() {
120
        checkValidity();
121
        if (task == null) {
122
            try {
123
                task = DesignSupport.invokeDesignMode(data.getProject(), userDir, false, !data.isIgnorePreviousRun());
124
            } catch (IOException ex) {
125
                Exceptions.printStackTrace(ex);
126
            }
127
            handle = ProgressHandleFactory.createHandle(Bundle.MSG_LaunchingApplication());
128
            JComponent pc = ProgressHandleFactory.createProgressComponent(handle);
129
            JLabel ml = ProgressHandleFactory.createMainLabelComponent(handle);
130
131
            progress.add(ml);
132
            progress.add(pc);
133
134
            handle.start();
135
            markInvalid();
136
            try {
137
                DesignSupport.existingModes(data);
138
            } catch (IOException ex) {
139
                Exceptions.printStackTrace(ex);
140
            }
141
        }
142
        task.addTaskListener(this);
95
    }
143
    }
96
    
144
    
97
    private void updateData() {
145
    @Override
98
        data.setPackageName(comPackageName.getEditor().getItem().toString());
146
    @NbBundle.Messages({
99
        String icon = txtIcon.getText().trim();
147
        "LBL_DesignLayout=Design Window Layout"
100
        data.setIcon(icon.length() == 0 ? (String)null : icon);
148
    })
101
        data.setName(txtPrefix.getText().trim());
102
        NewTCIterator.generateFileChanges(data);
103
        createdFilesValue.setText(UIUtil.generateTextAreaContent(
104
                data.getCreatedModifiedFiles().getCreatedPaths()));
105
        modifiedFilesValue.setText(UIUtil.generateTextAreaContent(
106
                data.getCreatedModifiedFiles().getModifiedPaths()));
107
        //#68294 check if the paths for newly created files are valid or not..
108
        String[] invalid  = data.getCreatedModifiedFiles().getInvalidPaths();
109
        if (invalid.length > 0) {
110
            setError(NbBundle.getMessage(NameAndLocationPanel.class, "ERR_ToBeCreateFileExists", invalid[0]));
111
        }
112
        
113
    }
114
    
115
    protected void readFromDataModel() {
116
        txtPrefix.setText(data.getName());
117
        txtIcon.setText(data.getIcon());
118
        if (data.getPackageName() != null) {
119
            comPackageName.setSelectedItem(data.getPackageName());
120
        }
121
        checkValidity();
122
    }
123
    
124
    protected String getPanelName() {
149
    protected String getPanelName() {
125
        return getMessage("LBL_NameLocation_Title");
150
        return Bundle.LBL_DesignLayout();
126
    }
151
    }
127
    
152
    
128
    private boolean checkValidity() {
153
    private boolean checkValidity() {
129
        if (txtPrefix.getText().trim().length() == 0) {
154
        int cnt = 0;
130
            setInfo(getMessage("ERR_Name_Prefix_Empty"), false);
155
        for (Node node : getExplorerManager().getRootContext().getChildren().getNodes()) {
156
            if (node instanceof ModeNode) {
157
                ModeNode mn = (ModeNode)node;
158
                if (mn.isSelected()) {
159
                    cnt++;
160
                }
161
            }
162
        }
163
        if (cnt == 0 || !outlineView.isVisible()) {
164
            markInvalid();
131
            return false;
165
            return false;
132
        }
166
        }
133
        if (!Utilities.isJavaIdentifier(txtPrefix.getText().trim())) {
134
            setError(getMessage("ERR_Name_Prefix_Invalid"));
135
            return false;
136
        }
137
        String path = txtIcon.getText().trim();
138
        if (path.length() != 0) {
139
            File fil = new File(path);
140
            if (!fil.exists()) {
141
                setError(NbBundle.getMessage(getClass(), "ERR_Icon_Invalid"));
142
                return false;
143
            }
144
        }
145
        String packageName = comPackageName.getEditor().getItem().toString().trim();
146
        if (packageName.length() == 0 || !UIUtil.isValidPackageName(packageName)) {
147
            setError(NbBundle.getMessage(getClass(), "ERR_Package_Invalid"));
148
            return false;
149
        }
150
        
151
        markValid();
167
        markValid();
152
        return true;
168
        return true;
153
    }
169
    }
154
    
170
    
171
    @Override
155
    protected HelpCtx getHelp() {
172
    protected HelpCtx getHelp() {
156
        return new HelpCtx(NameAndLocationPanel.class);
173
        return new HelpCtx(LayoutLaunchingPanel.class);
157
    }
158
    
159
    private static String getMessage(String key) {
160
        return NbBundle.getMessage(NameAndLocationPanel.class, key);
161
    }
174
    }
162
    
175
    
163
    /** This method is called from within the constructor to
176
    /** This method is called from within the constructor to
Lines 165-370 Link Here
165
     * WARNING: Do NOT modify this code. The content of this method is
178
     * WARNING: Do NOT modify this code. The content of this method is
166
     * always regenerated by the Form Editor.
179
     * always regenerated by the Form Editor.
167
     */
180
     */
168
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
181
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
169
    private void initComponents() {
182
    private void initComponents() {
170
        java.awt.GridBagConstraints gridBagConstraints;
183
        java.awt.GridBagConstraints gridBagConstraints;
171
184
172
        lblPrefix = new javax.swing.JLabel();
185
        progress = new javax.swing.JPanel();
173
        txtPrefix = new javax.swing.JTextField();
186
        tree = new javax.swing.JPanel();
174
        lblIcon = new javax.swing.JLabel();
175
        txtIcon = new javax.swing.JTextField();
176
        btnIcon = new javax.swing.JButton();
177
        lblProjectName = new javax.swing.JLabel();
178
        txtProjectName = new JTextField(ProjectUtils.getInformation(this.data.getProject()).getDisplayName());
179
        lblPackageName = new javax.swing.JLabel();
180
        comPackageName = UIUtil.createPackageComboBox(data.getSourceRootGroup());
181
        createdFiles = new javax.swing.JLabel();
182
        modifiedFiles = new javax.swing.JLabel();
183
        filler = new javax.swing.JLabel();
184
        createdFilesValue = new javax.swing.JTextArea();
185
        modifiedFilesValue = new javax.swing.JTextArea();
186
187
187
        setLayout(new java.awt.GridBagLayout());
188
        setLayout(new java.awt.GridBagLayout());
188
189
        lblPrefix.setLabelFor(txtPrefix);
190
        org.openide.awt.Mnemonics.setLocalizedText(lblPrefix, org.openide.util.NbBundle.getMessage(NameAndLocationPanel.class, "LBL_Prefix"));
191
        gridBagConstraints = new java.awt.GridBagConstraints();
189
        gridBagConstraints = new java.awt.GridBagConstraints();
192
        gridBagConstraints.gridx = 0;
190
        gridBagConstraints.gridx = 0;
193
        gridBagConstraints.gridy = 0;
191
        gridBagConstraints.gridy = 0;
192
        gridBagConstraints.gridwidth = 4;
193
        gridBagConstraints.gridheight = 3;
194
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
194
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
195
        gridBagConstraints.insets = new java.awt.Insets(1, 0, 6, 12);
195
        add(progress, gridBagConstraints);
196
        add(lblPrefix, gridBagConstraints);
197
198
        gridBagConstraints = new java.awt.GridBagConstraints();
199
        gridBagConstraints.gridx = 1;
200
        gridBagConstraints.gridy = 0;
201
        gridBagConstraints.gridwidth = 2;
202
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
203
        gridBagConstraints.weightx = 1.0;
204
        gridBagConstraints.insets = new java.awt.Insets(1, 0, 6, 0);
205
        add(txtPrefix, gridBagConstraints);
206
207
        lblIcon.setLabelFor(txtIcon);
208
        org.openide.awt.Mnemonics.setLocalizedText(lblIcon, org.openide.util.NbBundle.getMessage(NameAndLocationPanel.class, "LBL_Icon"));
209
        gridBagConstraints = new java.awt.GridBagConstraints();
210
        gridBagConstraints.gridx = 0;
211
        gridBagConstraints.gridy = 1;
212
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
213
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
214
        add(lblIcon, gridBagConstraints);
215
216
        gridBagConstraints = new java.awt.GridBagConstraints();
217
        gridBagConstraints.gridx = 1;
218
        gridBagConstraints.gridy = 1;
219
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
220
        gridBagConstraints.weightx = 1.0;
221
        add(txtIcon, gridBagConstraints);
222
223
        org.openide.awt.Mnemonics.setLocalizedText(btnIcon, org.openide.util.NbBundle.getMessage(NameAndLocationPanel.class, "LBL_Icon_Browse"));
224
        btnIcon.addActionListener(new java.awt.event.ActionListener() {
225
            public void actionPerformed(java.awt.event.ActionEvent evt) {
226
                btnIconActionPerformed(evt);
227
            }
228
        });
229
230
        gridBagConstraints = new java.awt.GridBagConstraints();
231
        gridBagConstraints.gridx = 2;
232
        gridBagConstraints.gridy = 1;
233
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
234
        add(btnIcon, gridBagConstraints);
235
236
        lblProjectName.setLabelFor(txtProjectName);
237
        org.openide.awt.Mnemonics.setLocalizedText(lblProjectName, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_ProjectName"));
238
        gridBagConstraints = new java.awt.GridBagConstraints();
239
        gridBagConstraints.gridx = 0;
240
        gridBagConstraints.gridy = 2;
241
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
242
        gridBagConstraints.insets = new java.awt.Insets(18, 0, 6, 12);
243
        add(lblProjectName, gridBagConstraints);
244
245
        txtProjectName.setEditable(false);
246
        gridBagConstraints = new java.awt.GridBagConstraints();
247
        gridBagConstraints.gridx = 1;
248
        gridBagConstraints.gridy = 2;
249
        gridBagConstraints.gridwidth = 2;
250
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
251
        gridBagConstraints.weightx = 1.0;
252
        gridBagConstraints.insets = new java.awt.Insets(18, 0, 6, 0);
253
        add(txtProjectName, gridBagConstraints);
254
255
        lblPackageName.setLabelFor(comPackageName);
256
        org.openide.awt.Mnemonics.setLocalizedText(lblPackageName, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_PackageName"));
257
        gridBagConstraints = new java.awt.GridBagConstraints();
196
        gridBagConstraints = new java.awt.GridBagConstraints();
258
        gridBagConstraints.gridx = 0;
197
        gridBagConstraints.gridx = 0;
259
        gridBagConstraints.gridy = 3;
198
        gridBagConstraints.gridy = 3;
260
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
199
        gridBagConstraints.gridwidth = 4;
261
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
200
        gridBagConstraints.gridheight = 11;
262
        add(lblPackageName, gridBagConstraints);
201
        add(tree, gridBagConstraints);
202
    }// </editor-fold>//GEN-END:initComponents
203
    
204
    @NbBundle.Messages({
205
        "ACS_DesignPanel=Design Window Layout"
206
    })
207
    private void initAccessibility() {
208
        this.getAccessibleContext().setAccessibleDescription(Bundle.ACS_DesignPanel());
209
    }
210
        
211
    // Variables declaration - do not modify//GEN-BEGIN:variables
212
    private javax.swing.JPanel progress;
213
    private javax.swing.JPanel tree;
214
    // End of variables declaration//GEN-END:variables
263
215
264
        comPackageName.setEditable(true);
216
    @Override
265
        gridBagConstraints = new java.awt.GridBagConstraints();
217
    @NbBundle.Messages({
266
        gridBagConstraints.gridx = 1;
218
        "LBL_NoModesFound=No layout definition found",
267
        gridBagConstraints.gridy = 3;
219
        "MSG_NoModesFound=Is everything OK? Did your application compile and run?"
268
        gridBagConstraints.gridwidth = 2;
220
    })
269
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
221
    public void taskFinished(Task task) {
270
        gridBagConstraints.weightx = 1.0;
222
        handle.finish();
271
        add(comPackageName, gridBagConstraints);
223
        FileObject modeDir = userDir.get().getFileObject("config/Windows2Local/Modes");
224
        boolean one = false;
225
        final Children ch = getExplorerManager().getRootContext().getChildren();
226
        if (modeDir != null) {
227
            try {
228
                FileSystem layer = DesignSupport.findLayer(data.getProject());
229
                if (layer == null) {
230
                    throw new IOException("Cannot find layer in " + data.getProject()); // NOI18N
231
                }
232
                for (FileObject m : modeDir.getChildren()) {
233
                    if (m.isData() && "wsmode".equals(m.getExt())) {
234
                        ModeNode mn = new ModeNode(m, data);
235
                        ch.add(new Node[] { mn });
236
                        one = true;
237
                    }
238
                }
239
            } catch (IOException ex) {
240
                Exceptions.printStackTrace(ex);
241
            }
242
        }
243
        if (!one) {
244
            AbstractNode empty = new AbstractNode(Children.LEAF);
245
            empty.setName("empty"); // NOI18N
246
            empty.setDisplayName(Bundle.LBL_NoModesFound());
247
            empty.setShortDescription(Bundle.MSG_NoModesFound());
248
            ch.add(new Node[] { empty });
249
            markInvalid();
250
        } else {
251
            markValid();
252
        }
253
        
254
        EventQueue.invokeLater(this);
255
    }
256
    @Override
257
    public void run() {
258
        progress.setVisible(false);
259
        outlineView.setVisible(true);
260
        progress.invalidate();
261
        outlineView.invalidate();
262
        validateTree();
263
    }
272
264
273
        createdFiles.setLabelFor(createdFilesValue);
265
    @Override
274
        org.openide.awt.Mnemonics.setLocalizedText(createdFiles, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_CreatedFiles"));
266
    public ExplorerManager getExplorerManager() {
275
        gridBagConstraints = new java.awt.GridBagConstraints();
267
        return em;
276
        gridBagConstraints.gridx = 0;
268
    }
277
        gridBagConstraints.gridy = 4;
278
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
279
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
280
        gridBagConstraints.insets = new java.awt.Insets(36, 0, 6, 12);
281
        add(createdFiles, gridBagConstraints);
282
269
283
        modifiedFiles.setLabelFor(modifiedFilesValue);
270
    private class ModeNode extends AbstractNode
284
        org.openide.awt.Mnemonics.setLocalizedText(modifiedFiles, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_ModifiedFiles"));
271
    implements CheckableNode {
285
        gridBagConstraints = new java.awt.GridBagConstraints();
272
        private final FileObject mode;
286
        gridBagConstraints.gridx = 0;
273
        private final String text;
287
        gridBagConstraints.gridy = 5;
274
        private boolean selected;
288
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
289
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
290
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
291
        add(modifiedFiles, gridBagConstraints);
292
275
293
        gridBagConstraints = new java.awt.GridBagConstraints();
276
        public ModeNode(FileObject mode, NewTCIterator.DataModel data) throws IOException {
294
        gridBagConstraints.gridx = 0;
277
            super(Children.LEAF);
295
        gridBagConstraints.gridy = 6;
278
            this.mode = mode;
296
        gridBagConstraints.gridwidth = 3;
279
            this.text = DesignSupport.readMode(mode);
297
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
280
            this.selected = !data.isExistingMode(mode.getName());
298
        gridBagConstraints.weightx = 1.0;
281
            
299
        gridBagConstraints.weighty = 1.0;
282
            setName(mode.getName());
300
        add(filler, gridBagConstraints);
283
        }
301
284
302
        createdFilesValue.setBackground(javax.swing.UIManager.getDefaults().getColor("Label.background"));
285
        @Override
303
        createdFilesValue.setColumns(20);
286
        public boolean isCheckable() {
304
        createdFilesValue.setEditable(false);
287
            return true;
305
        createdFilesValue.setRows(5);
288
        }
306
        createdFilesValue.setBorder(null);
307
        gridBagConstraints = new java.awt.GridBagConstraints();
308
        gridBagConstraints.gridx = 1;
309
        gridBagConstraints.gridy = 4;
310
        gridBagConstraints.gridwidth = 2;
311
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
312
        gridBagConstraints.weightx = 1.0;
313
        gridBagConstraints.insets = new java.awt.Insets(36, 0, 6, 0);
314
        add(createdFilesValue, gridBagConstraints);
315
289
316
        modifiedFilesValue.setBackground(javax.swing.UIManager.getDefaults().getColor("Label.background"));
290
        @Override
317
        modifiedFilesValue.setColumns(20);
291
        public boolean isCheckEnabled() {
318
        modifiedFilesValue.setEditable(false);
292
            return true;
319
        modifiedFilesValue.setRows(5);
293
        }
320
        modifiedFilesValue.setToolTipText("modifiedFilesValue");
321
        modifiedFilesValue.setBorder(null);
322
        gridBagConstraints = new java.awt.GridBagConstraints();
323
        gridBagConstraints.gridx = 1;
324
        gridBagConstraints.gridy = 5;
325
        gridBagConstraints.gridwidth = 2;
326
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
327
        gridBagConstraints.weightx = 1.0;
328
        add(modifiedFilesValue, gridBagConstraints);
329
294
330
    }
295
        @Override
331
    // </editor-fold>//GEN-END:initComponents
296
        public Boolean isSelected() {
332
    
297
            return selected;
333
    private void initAccessibility() {
298
        }
334
        this.getAccessibleContext().setAccessibleDescription(getMessage("ACS_NameAndLocationPanel"));
299
335
        comPackageName.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_PackageName"));
300
        @Override
336
        txtIcon.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_Icon"));
301
        public void setSelected(Boolean selected) {
337
        txtPrefix.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_Prefix"));
302
            this.selected = Boolean.TRUE.equals(selected);
338
        btnIcon.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_IconButton"));
303
            checkValidity();
339
        txtProjectName.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ProjectName"));
304
        }
340
        createdFilesValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_CreatedFilesValue"));
341
        modifiedFilesValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ModifiedFilesValue"));
342
    }
305
    }
343
    
306
    
344
    private void btnIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIconActionPerformed
345
        JFileChooser chooser = UIUtil.getIconFileChooser(txtIcon.getText());
346
        int ret = chooser.showDialog(this, getMessage("LBL_Select")); // NOI18N
347
        if (ret == JFileChooser.APPROVE_OPTION) {
348
            File file =  chooser.getSelectedFile();
349
            txtIcon.setText(file.getAbsolutePath());
350
        }
351
    }//GEN-LAST:event_btnIconActionPerformed
352
    
353
    // Variables declaration - do not modify//GEN-BEGIN:variables
354
    private javax.swing.JButton btnIcon;
355
    private javax.swing.JComboBox comPackageName;
356
    private javax.swing.JLabel createdFiles;
357
    private javax.swing.JTextArea createdFilesValue;
358
    private javax.swing.JLabel filler;
359
    private javax.swing.JLabel lblIcon;
360
    private javax.swing.JLabel lblPackageName;
361
    private javax.swing.JLabel lblPrefix;
362
    private javax.swing.JLabel lblProjectName;
363
    private javax.swing.JLabel modifiedFiles;
364
    private javax.swing.JTextArea modifiedFilesValue;
365
    private javax.swing.JTextField txtIcon;
366
    private javax.swing.JTextField txtPrefix;
367
    private javax.swing.JTextField txtProjectName;
368
    // End of variables declaration//GEN-END:variables
369
    
370
}
307
}
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/NameAndLocationPanel.form (-119 / +2 lines)
Lines 1-9 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.1" encoding="UTF-8" ?>
2
2
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
7
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
10
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
Lines 14-137 Link Here
14
15
15
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
16
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
16
  <SubComponents>
17
  <SubComponents>
17
    <Component class="javax.swing.JLabel" name="lblPrefix">
18
      <Properties>
19
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
20
          <ComponentRef name="txtPrefix"/>
21
        </Property>
22
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
23
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/loader/Bundle.properties" key="LBL_Prefix" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
24
        </Property>
25
      </Properties>
26
      <Constraints>
27
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
28
          <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="1" insetsLeft="0" insetsBottom="6" insetsRight="12" anchor="10" weightX="0.0" weightY="0.0"/>
29
        </Constraint>
30
      </Constraints>
31
    </Component>
32
    <Component class="javax.swing.JTextField" name="txtPrefix">
33
      <Constraints>
34
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
35
          <GridBagConstraints gridX="1" gridY="0" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="1" insetsLeft="0" insetsBottom="6" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
36
        </Constraint>
37
      </Constraints>
38
    </Component>
39
    <Component class="javax.swing.JLabel" name="lblIcon">
40
      <Properties>
41
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
42
          <ComponentRef name="txtIcon"/>
43
        </Property>
44
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
45
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/loader/Bundle.properties" key="LBL_Icon" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
46
        </Property>
47
      </Properties>
48
      <Constraints>
49
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
50
          <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="10" weightX="0.0" weightY="0.0"/>
51
        </Constraint>
52
      </Constraints>
53
    </Component>
54
    <Component class="javax.swing.JTextField" name="txtIcon">
55
      <Constraints>
56
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
57
          <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
58
        </Constraint>
59
      </Constraints>
60
    </Component>
61
    <Component class="javax.swing.JButton" name="btnIcon">
62
      <Properties>
63
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
64
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/loader/Bundle.properties" key="LBL_Icon_Browse" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
65
        </Property>
66
      </Properties>
67
      <Events>
68
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnIconActionPerformed"/>
69
      </Events>
70
      <Constraints>
71
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
72
          <GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
73
        </Constraint>
74
      </Constraints>
75
    </Component>
76
    <Component class="javax.swing.JLabel" name="lblProjectName">
77
      <Properties>
78
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
79
          <ComponentRef name="txtProjectName"/>
80
        </Property>
81
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
82
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle.properties" key="LBL_ProjectName" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
83
        </Property>
84
      </Properties>
85
      <Constraints>
86
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
87
          <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="18" insetsLeft="0" insetsBottom="6" insetsRight="12" anchor="10" weightX="0.0" weightY="0.0"/>
88
        </Constraint>
89
      </Constraints>
90
    </Component>
91
    <Component class="javax.swing.JTextField" name="txtProjectName">
92
      <Properties>
93
        <Property name="editable" type="boolean" value="false"/>
94
      </Properties>
95
      <AuxValues>
96
        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JTextField(ProjectUtils.getInformation(this.data.getProject()).getDisplayName());"/>
97
      </AuxValues>
98
      <Constraints>
99
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
100
          <GridBagConstraints gridX="1" gridY="2" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="18" insetsLeft="0" insetsBottom="6" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
101
        </Constraint>
102
      </Constraints>
103
    </Component>
104
    <Component class="javax.swing.JLabel" name="lblPackageName">
105
      <Properties>
106
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
107
          <ComponentRef name="comPackageName"/>
108
        </Property>
109
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
110
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle.properties" key="LBL_PackageName" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
111
        </Property>
112
      </Properties>
113
      <Constraints>
114
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
115
          <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="10" weightX="0.0" weightY="0.0"/>
116
        </Constraint>
117
      </Constraints>
118
    </Component>
119
    <Component class="javax.swing.JComboBox" name="comPackageName">
120
      <Properties>
121
        <Property name="editable" type="boolean" value="true"/>
122
        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
123
          <StringArray count="0"/>
124
        </Property>
125
      </Properties>
126
      <AuxValues>
127
        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="UIUtil.createPackageComboBox(data.getSourceRootGroup());"/>
128
      </AuxValues>
129
      <Constraints>
130
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
131
          <GridBagConstraints gridX="1" gridY="3" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
132
        </Constraint>
133
      </Constraints>
134
    </Component>
135
    <Component class="javax.swing.JLabel" name="createdFiles">
18
    <Component class="javax.swing.JLabel" name="createdFiles">
136
      <Properties>
19
      <Properties>
137
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
20
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/NameAndLocationPanel.java (-208 / +32 lines)
Lines 44-104 Link Here
44
44
45
package org.netbeans.modules.apisupport.project.ui.wizard.winsys;
45
package org.netbeans.modules.apisupport.project.ui.wizard.winsys;
46
46
47
import java.io.File;
48
import javax.swing.JFileChooser;
49
import javax.swing.JTextField;
50
import javax.swing.event.DocumentEvent;
51
import javax.swing.event.DocumentListener;
52
import org.netbeans.api.project.ProjectUtils;
53
import org.netbeans.modules.apisupport.project.api.UIUtil;
47
import org.netbeans.modules.apisupport.project.api.UIUtil;
54
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
48
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
55
import org.openide.WizardDescriptor;
49
import org.openide.WizardDescriptor;
56
import org.openide.util.HelpCtx;
50
import org.openide.util.HelpCtx;
57
import org.openide.util.NbBundle;
51
import org.openide.util.NbBundle;
58
import org.openide.util.Utilities;
59
52
60
/**
53
/**
61
 * the second panel in topcomponent wizard.
54
 * 3rd panel of the layout wizard.
62
 *
63
 * @author Milos Kleint
64
 */
55
 */
65
final class NameAndLocationPanel extends BasicWizardIterator.Panel {
56
final class LayoutSummaryPanel extends BasicWizardIterator.Panel {
66
    
57
    
67
    private NewTCIterator.DataModel data;
58
    private NewTCIterator.DataModel data;
68
    
59
    
69
    /** Creates new NameAndLocationPanel */
60
    public LayoutSummaryPanel(final WizardDescriptor setting, final NewTCIterator.DataModel data) {
70
    public NameAndLocationPanel(final WizardDescriptor setting, final NewTCIterator.DataModel data) {
71
        super(setting);
61
        super(setting);
72
        this.data = data;
62
        this.data = data;
73
        initComponents();
63
        initComponents();
74
        initAccessibility();
64
        initAccessibility();
75
        putClientProperty("NewFileWizard_Title", getMessage("LBL_TCWizardTitle"));
65
        putClientProperty("NewFileWizard_Title", Bundle.LBL_LayoutSummaryTitle());
76
        
77
        DocumentListener dListener = new UIUtil.DocumentAdapter() {
78
            public void insertUpdate(DocumentEvent e) {
79
                if (checkValidity()) {
80
                    updateData();
81
                }
82
            }
83
        };
84
        txtPrefix.getDocument().addDocumentListener(dListener);
85
        txtIcon.getDocument().addDocumentListener(dListener);
86
        
87
        if (comPackageName.getEditor().getEditorComponent() instanceof JTextField) {
88
            JTextField txt = (JTextField)comPackageName.getEditor().getEditorComponent();
89
            txt.getDocument().addDocumentListener(dListener);
90
        }
91
    }
66
    }
92
    
67
    
68
    @Override
93
    protected void storeToDataModel() {
69
    protected void storeToDataModel() {
94
        updateData();
70
        
95
    }
71
    }
96
    
72
    
97
    private void updateData() {
73
    @Override
98
        data.setPackageName(comPackageName.getEditor().getItem().toString());
74
    protected void readFromDataModel() {
99
        String icon = txtIcon.getText().trim();
100
        data.setIcon(icon.length() == 0 ? (String)null : icon);
101
        data.setName(txtPrefix.getText().trim());
102
        NewTCIterator.generateFileChanges(data);
75
        NewTCIterator.generateFileChanges(data);
103
        createdFilesValue.setText(UIUtil.generateTextAreaContent(
76
        createdFilesValue.setText(UIUtil.generateTextAreaContent(
104
                data.getCreatedModifiedFiles().getCreatedPaths()));
77
                data.getCreatedModifiedFiles().getCreatedPaths()));
Lines 107-163 Link Here
107
        //#68294 check if the paths for newly created files are valid or not..
80
        //#68294 check if the paths for newly created files are valid or not..
108
        String[] invalid  = data.getCreatedModifiedFiles().getInvalidPaths();
81
        String[] invalid  = data.getCreatedModifiedFiles().getInvalidPaths();
109
        if (invalid.length > 0) {
82
        if (invalid.length > 0) {
110
            setError(NbBundle.getMessage(NameAndLocationPanel.class, "ERR_ToBeCreateFileExists", invalid[0]));
83
            setError(NbBundle.getMessage(LayoutSummaryPanel.class, "ERR_ToBeCreateFileExists", invalid[0]));
111
        }
84
        }
112
        
113
    }
85
    }
114
    
86
    
115
    protected void readFromDataModel() {
87
    @Override
116
        txtPrefix.setText(data.getName());
88
    @NbBundle.Messages({
117
        txtIcon.setText(data.getIcon());
89
        "LBL_LayoutSummaryTitle=Changed Files"
118
        if (data.getPackageName() != null) {
90
    })
119
            comPackageName.setSelectedItem(data.getPackageName());
91
    protected String getPanelName() {
120
        }
92
        return Bundle.LBL_LayoutSummaryTitle();
121
        checkValidity();
122
    }
93
    }
123
    
94
    
124
    protected String getPanelName() {
95
    @Override
125
        return getMessage("LBL_NameLocation_Title");
126
    }
127
    
128
    private boolean checkValidity() {
129
        if (txtPrefix.getText().trim().length() == 0) {
130
            setInfo(getMessage("ERR_Name_Prefix_Empty"), false);
131
            return false;
132
        }
133
        if (!Utilities.isJavaIdentifier(txtPrefix.getText().trim())) {
134
            setError(getMessage("ERR_Name_Prefix_Invalid"));
135
            return false;
136
        }
137
        String path = txtIcon.getText().trim();
138
        if (path.length() != 0) {
139
            File fil = new File(path);
140
            if (!fil.exists()) {
141
                setError(NbBundle.getMessage(getClass(), "ERR_Icon_Invalid"));
142
                return false;
143
            }
144
        }
145
        String packageName = comPackageName.getEditor().getItem().toString().trim();
146
        if (packageName.length() == 0 || !UIUtil.isValidPackageName(packageName)) {
147
            setError(NbBundle.getMessage(getClass(), "ERR_Package_Invalid"));
148
            return false;
149
        }
150
        
151
        markValid();
152
        return true;
153
    }
154
    
155
    protected HelpCtx getHelp() {
96
    protected HelpCtx getHelp() {
156
        return new HelpCtx(NameAndLocationPanel.class);
97
        return new HelpCtx(LayoutSummaryPanel.class);
157
    }
158
    
159
    private static String getMessage(String key) {
160
        return NbBundle.getMessage(NameAndLocationPanel.class, key);
161
    }
98
    }
162
    
99
    
163
    /** This method is called from within the constructor to
100
    /** This method is called from within the constructor to
Lines 165-183 Link Here
165
     * WARNING: Do NOT modify this code. The content of this method is
102
     * WARNING: Do NOT modify this code. The content of this method is
166
     * always regenerated by the Form Editor.
103
     * always regenerated by the Form Editor.
167
     */
104
     */
168
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
105
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
169
    private void initComponents() {
106
    private void initComponents() {
170
        java.awt.GridBagConstraints gridBagConstraints;
107
        java.awt.GridBagConstraints gridBagConstraints;
171
108
172
        lblPrefix = new javax.swing.JLabel();
173
        txtPrefix = new javax.swing.JTextField();
174
        lblIcon = new javax.swing.JLabel();
175
        txtIcon = new javax.swing.JTextField();
176
        btnIcon = new javax.swing.JButton();
177
        lblProjectName = new javax.swing.JLabel();
178
        txtProjectName = new JTextField(ProjectUtils.getInformation(this.data.getProject()).getDisplayName());
179
        lblPackageName = new javax.swing.JLabel();
180
        comPackageName = UIUtil.createPackageComboBox(data.getSourceRootGroup());
181
        createdFiles = new javax.swing.JLabel();
109
        createdFiles = new javax.swing.JLabel();
182
        modifiedFiles = new javax.swing.JLabel();
110
        modifiedFiles = new javax.swing.JLabel();
183
        filler = new javax.swing.JLabel();
111
        filler = new javax.swing.JLabel();
Lines 186-277 Link Here
186
114
187
        setLayout(new java.awt.GridBagLayout());
115
        setLayout(new java.awt.GridBagLayout());
188
116
189
        lblPrefix.setLabelFor(txtPrefix);
190
        org.openide.awt.Mnemonics.setLocalizedText(lblPrefix, org.openide.util.NbBundle.getMessage(NameAndLocationPanel.class, "LBL_Prefix"));
191
        gridBagConstraints = new java.awt.GridBagConstraints();
192
        gridBagConstraints.gridx = 0;
193
        gridBagConstraints.gridy = 0;
194
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
195
        gridBagConstraints.insets = new java.awt.Insets(1, 0, 6, 12);
196
        add(lblPrefix, gridBagConstraints);
197
198
        gridBagConstraints = new java.awt.GridBagConstraints();
199
        gridBagConstraints.gridx = 1;
200
        gridBagConstraints.gridy = 0;
201
        gridBagConstraints.gridwidth = 2;
202
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
203
        gridBagConstraints.weightx = 1.0;
204
        gridBagConstraints.insets = new java.awt.Insets(1, 0, 6, 0);
205
        add(txtPrefix, gridBagConstraints);
206
207
        lblIcon.setLabelFor(txtIcon);
208
        org.openide.awt.Mnemonics.setLocalizedText(lblIcon, org.openide.util.NbBundle.getMessage(NameAndLocationPanel.class, "LBL_Icon"));
209
        gridBagConstraints = new java.awt.GridBagConstraints();
210
        gridBagConstraints.gridx = 0;
211
        gridBagConstraints.gridy = 1;
212
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
213
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
214
        add(lblIcon, gridBagConstraints);
215
216
        gridBagConstraints = new java.awt.GridBagConstraints();
217
        gridBagConstraints.gridx = 1;
218
        gridBagConstraints.gridy = 1;
219
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
220
        gridBagConstraints.weightx = 1.0;
221
        add(txtIcon, gridBagConstraints);
222
223
        org.openide.awt.Mnemonics.setLocalizedText(btnIcon, org.openide.util.NbBundle.getMessage(NameAndLocationPanel.class, "LBL_Icon_Browse"));
224
        btnIcon.addActionListener(new java.awt.event.ActionListener() {
225
            public void actionPerformed(java.awt.event.ActionEvent evt) {
226
                btnIconActionPerformed(evt);
227
            }
228
        });
229
230
        gridBagConstraints = new java.awt.GridBagConstraints();
231
        gridBagConstraints.gridx = 2;
232
        gridBagConstraints.gridy = 1;
233
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
234
        add(btnIcon, gridBagConstraints);
235
236
        lblProjectName.setLabelFor(txtProjectName);
237
        org.openide.awt.Mnemonics.setLocalizedText(lblProjectName, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_ProjectName"));
238
        gridBagConstraints = new java.awt.GridBagConstraints();
239
        gridBagConstraints.gridx = 0;
240
        gridBagConstraints.gridy = 2;
241
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
242
        gridBagConstraints.insets = new java.awt.Insets(18, 0, 6, 12);
243
        add(lblProjectName, gridBagConstraints);
244
245
        txtProjectName.setEditable(false);
246
        gridBagConstraints = new java.awt.GridBagConstraints();
247
        gridBagConstraints.gridx = 1;
248
        gridBagConstraints.gridy = 2;
249
        gridBagConstraints.gridwidth = 2;
250
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
251
        gridBagConstraints.weightx = 1.0;
252
        gridBagConstraints.insets = new java.awt.Insets(18, 0, 6, 0);
253
        add(txtProjectName, gridBagConstraints);
254
255
        lblPackageName.setLabelFor(comPackageName);
256
        org.openide.awt.Mnemonics.setLocalizedText(lblPackageName, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_PackageName"));
257
        gridBagConstraints = new java.awt.GridBagConstraints();
258
        gridBagConstraints.gridx = 0;
259
        gridBagConstraints.gridy = 3;
260
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
261
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
262
        add(lblPackageName, gridBagConstraints);
263
264
        comPackageName.setEditable(true);
265
        gridBagConstraints = new java.awt.GridBagConstraints();
266
        gridBagConstraints.gridx = 1;
267
        gridBagConstraints.gridy = 3;
268
        gridBagConstraints.gridwidth = 2;
269
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
270
        gridBagConstraints.weightx = 1.0;
271
        add(comPackageName, gridBagConstraints);
272
273
        createdFiles.setLabelFor(createdFilesValue);
117
        createdFiles.setLabelFor(createdFilesValue);
274
        org.openide.awt.Mnemonics.setLocalizedText(createdFiles, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_CreatedFiles"));
118
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle"); // NOI18N
119
        org.openide.awt.Mnemonics.setLocalizedText(createdFiles, bundle.getString("LBL_CreatedFiles")); // NOI18N
275
        gridBagConstraints = new java.awt.GridBagConstraints();
120
        gridBagConstraints = new java.awt.GridBagConstraints();
276
        gridBagConstraints.gridx = 0;
121
        gridBagConstraints.gridx = 0;
277
        gridBagConstraints.gridy = 4;
122
        gridBagConstraints.gridy = 4;
Lines 281-287 Link Here
281
        add(createdFiles, gridBagConstraints);
126
        add(createdFiles, gridBagConstraints);
282
127
283
        modifiedFiles.setLabelFor(modifiedFilesValue);
128
        modifiedFiles.setLabelFor(modifiedFilesValue);
284
        org.openide.awt.Mnemonics.setLocalizedText(modifiedFiles, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/librarydescriptor/Bundle").getString("LBL_ModifiedFiles"));
129
        org.openide.awt.Mnemonics.setLocalizedText(modifiedFiles, bundle.getString("LBL_ModifiedFiles")); // NOI18N
285
        gridBagConstraints = new java.awt.GridBagConstraints();
130
        gridBagConstraints = new java.awt.GridBagConstraints();
286
        gridBagConstraints.gridx = 0;
131
        gridBagConstraints.gridx = 0;
287
        gridBagConstraints.gridy = 5;
132
        gridBagConstraints.gridy = 5;
Lines 289-295 Link Here
289
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
134
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
290
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
135
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
291
        add(modifiedFiles, gridBagConstraints);
136
        add(modifiedFiles, gridBagConstraints);
292
293
        gridBagConstraints = new java.awt.GridBagConstraints();
137
        gridBagConstraints = new java.awt.GridBagConstraints();
294
        gridBagConstraints.gridx = 0;
138
        gridBagConstraints.gridx = 0;
295
        gridBagConstraints.gridy = 6;
139
        gridBagConstraints.gridy = 6;
Lines 326-370 Link Here
326
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
170
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
327
        gridBagConstraints.weightx = 1.0;
171
        gridBagConstraints.weightx = 1.0;
328
        add(modifiedFilesValue, gridBagConstraints);
172
        add(modifiedFilesValue, gridBagConstraints);
173
    }// </editor-fold>//GEN-END:initComponents
329
174
175
    @NbBundle.Messages({
176
        "ACS_LayoutSummaryPanel=Overview Your Changes",
177
        "ACS_CTL_Layout_CreatedFilesValue=List of files that will be created",
178
        "ACS_CTL_Layout_ModifiedFilesValue=List of files that will be modified"
179
    })
180
    private void initAccessibility() {
181
        this.getAccessibleContext().setAccessibleDescription(Bundle.ACS_LayoutSummaryPanel());
182
        createdFilesValue.getAccessibleContext().setAccessibleDescription(Bundle.ACS_CTL_Layout_CreatedFilesValue());
183
        modifiedFilesValue.getAccessibleContext().setAccessibleDescription(Bundle.ACS_CTL_Layout_ModifiedFilesValue());
330
    }
184
    }
331
    // </editor-fold>//GEN-END:initComponents
185
        
332
    
333
    private void initAccessibility() {
334
        this.getAccessibleContext().setAccessibleDescription(getMessage("ACS_NameAndLocationPanel"));
335
        comPackageName.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_PackageName"));
336
        txtIcon.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_Icon"));
337
        txtPrefix.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_Prefix"));
338
        btnIcon.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_IconButton"));
339
        txtProjectName.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ProjectName"));
340
        createdFilesValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_CreatedFilesValue"));
341
        modifiedFilesValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ModifiedFilesValue"));
342
    }
343
    
344
    private void btnIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIconActionPerformed
345
        JFileChooser chooser = UIUtil.getIconFileChooser(txtIcon.getText());
346
        int ret = chooser.showDialog(this, getMessage("LBL_Select")); // NOI18N
347
        if (ret == JFileChooser.APPROVE_OPTION) {
348
            File file =  chooser.getSelectedFile();
349
            txtIcon.setText(file.getAbsolutePath());
350
        }
351
    }//GEN-LAST:event_btnIconActionPerformed
352
    
353
    // Variables declaration - do not modify//GEN-BEGIN:variables
186
    // Variables declaration - do not modify//GEN-BEGIN:variables
354
    private javax.swing.JButton btnIcon;
355
    private javax.swing.JComboBox comPackageName;
356
    private javax.swing.JLabel createdFiles;
187
    private javax.swing.JLabel createdFiles;
357
    private javax.swing.JTextArea createdFilesValue;
188
    private javax.swing.JTextArea createdFilesValue;
358
    private javax.swing.JLabel filler;
189
    private javax.swing.JLabel filler;
359
    private javax.swing.JLabel lblIcon;
360
    private javax.swing.JLabel lblPackageName;
361
    private javax.swing.JLabel lblPrefix;
362
    private javax.swing.JLabel lblProjectName;
363
    private javax.swing.JLabel modifiedFiles;
190
    private javax.swing.JLabel modifiedFiles;
364
    private javax.swing.JTextArea modifiedFilesValue;
191
    private javax.swing.JTextArea modifiedFilesValue;
365
    private javax.swing.JTextField txtIcon;
366
    private javax.swing.JTextField txtPrefix;
367
    private javax.swing.JTextField txtProjectName;
368
    // End of variables declaration//GEN-END:variables
192
    // End of variables declaration//GEN-END:variables
369
    
193
    
370
}
194
}
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/BasicSettingsPanel.form (-149 / +31 lines)
Lines 1-4 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.1" encoding="UTF-8" ?>
2
2
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
4
  <AuxValues>
Lines 7-171 Link Here
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
10
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
11
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
12
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
12
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
13
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
13
    <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
14
    <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
14
  </AuxValues>
15
  </AuxValues>
15
16
16
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
17
  <Layout>
18
    <DimensionLayout dim="0">
19
      <Group type="103" groupAlignment="0" attributes="0">
20
          <Group type="102" alignment="0" attributes="0">
21
              <EmptySpace min="8" pref="8" max="8" attributes="0"/>
22
              <Component id="ignore" pref="384" max="32767" attributes="0"/>
23
              <EmptySpace max="-2" attributes="0"/>
24
          </Group>
25
          <Component id="panel" alignment="0" pref="400" max="32767" attributes="0"/>
26
      </Group>
27
    </DimensionLayout>
28
    <DimensionLayout dim="1">
29
      <Group type="103" groupAlignment="0" attributes="0">
30
          <Group type="102" attributes="0">
31
              <Component id="panel" pref="267" max="32767" attributes="0"/>
32
              <EmptySpace min="-2" max="-2" attributes="0"/>
33
              <Component id="ignore" min="-2" max="-2" attributes="0"/>
34
              <EmptySpace min="-2" max="-2" attributes="0"/>
35
          </Group>
36
      </Group>
37
    </DimensionLayout>
38
  </Layout>
17
  <SubComponents>
39
  <SubComponents>
18
    <Component class="javax.swing.JLabel" name="lblMode">
40
    <Container class="javax.swing.JPanel" name="panel">
41
42
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
43
    </Container>
44
    <Component class="javax.swing.JCheckBox" name="ignore">
19
      <Properties>
45
      <Properties>
20
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
46
        <Property name="selected" type="boolean" value="true"/>
21
          <ComponentRef name="comMode"/>
22
        </Property>
23
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
47
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
24
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties" key="LBL_Mode" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
48
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties" key="IGNORE PREVIOUS RUN" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;, {arguments})"/>
25
        </Property>
49
        </Property>
26
      </Properties>
50
      </Properties>
27
      <Constraints>
28
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
29
          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
30
        </Constraint>
31
      </Constraints>
32
    </Component>
33
    <Component class="javax.swing.JComboBox" name="comMode">
34
      <Events>
35
        <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="windowPosChanged"/>
36
      </Events>
37
      <Constraints>
38
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
39
          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="6" insetsBottom="0" insetsRight="6" anchor="18" weightX="0.1" weightY="0.0"/>
40
        </Constraint>
41
      </Constraints>
42
    </Component>
43
    <Component class="javax.swing.JCheckBox" name="cbOpenedOnStart">
44
      <Properties>
45
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
46
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties" key="LBL_OpenOnStart" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
47
        </Property>
48
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
49
          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
50
            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
51
          </Border>
52
        </Property>
53
        <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
54
          <Insets value="[0, 0, 0, 0]"/>
55
        </Property>
56
      </Properties>
57
      <Constraints>
58
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
59
          <GridBagConstraints gridX="0" gridY="1" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
60
        </Constraint>
61
      </Constraints>
62
    </Component>
63
    <Component class="javax.swing.JCheckBox" name="cbKeepPrefSize">
64
      <Properties>
65
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
66
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties" key="LBL_KeepPrefSize" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
67
        </Property>
68
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
69
          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
70
            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
71
          </Border>
72
        </Property>
73
        <Property name="enabled" type="boolean" value="false"/>
74
        <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
75
          <Insets value="[0, 0, 0, 0]"/>
76
        </Property>
77
      </Properties>
78
      <Constraints>
79
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
80
          <GridBagConstraints gridX="0" gridY="2" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
81
        </Constraint>
82
      </Constraints>
83
    </Component>
84
    <Component class="javax.swing.JCheckBox" name="cbSlidingNotAllowed">
85
      <Properties>
86
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
87
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties" key="CTL_SlidingNotAllowed" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
88
        </Property>
89
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
90
          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
91
            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
92
          </Border>
93
        </Property>
94
        <Property name="enabled" type="boolean" value="false"/>
95
      </Properties>
96
      <Constraints>
97
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
98
          <GridBagConstraints gridX="0" gridY="3" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
99
        </Constraint>
100
      </Constraints>
101
    </Component>
102
    <Component class="javax.swing.JCheckBox" name="cbClosingNotAllowed">
103
      <Properties>
104
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
105
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties" key="CTL_ClosingNotAllowed" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
106
        </Property>
107
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
108
          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
109
            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
110
          </Border>
111
        </Property>
112
      </Properties>
113
      <Constraints>
114
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
115
          <GridBagConstraints gridX="0" gridY="4" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
116
        </Constraint>
117
      </Constraints>
118
    </Component>
119
    <Component class="javax.swing.JCheckBox" name="cbUndockingNotAllowed">
120
      <Properties>
121
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
122
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties" key="CTL_UndockingNotAllowed" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
123
        </Property>
124
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
125
          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
126
            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
127
          </Border>
128
        </Property>
129
      </Properties>
130
      <Constraints>
131
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
132
          <GridBagConstraints gridX="0" gridY="5" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
133
        </Constraint>
134
      </Constraints>
135
    </Component>
136
    <Component class="javax.swing.JCheckBox" name="cbDraggingNotAllowed">
137
      <Properties>
138
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
139
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties" key="CTL_DraggingNotAllowed" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
140
        </Property>
141
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
142
          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
143
            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
144
          </Border>
145
        </Property>
146
      </Properties>
147
      <Constraints>
148
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
149
          <GridBagConstraints gridX="0" gridY="6" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
150
        </Constraint>
151
      </Constraints>
152
    </Component>
153
    <Component class="javax.swing.JCheckBox" name="cbMaximizationNotAllowed">
154
      <Properties>
155
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
156
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties" key="CTL_MaximizationNotAllowed" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
157
        </Property>
158
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
159
          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
160
            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
161
          </Border>
162
        </Property>
163
      </Properties>
164
      <Constraints>
165
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
166
          <GridBagConstraints gridX="0" gridY="7" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.1"/>
167
        </Constraint>
168
      </Constraints>
169
    </Component>
51
    </Component>
170
  </SubComponents>
52
  </SubComponents>
171
</Form>
53
</Form>
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/BasicSettingsPanel.java (-264 / +54 lines)
Lines 44-209 Link Here
44
44
45
package org.netbeans.modules.apisupport.project.ui.wizard.winsys;
45
package org.netbeans.modules.apisupport.project.ui.wizard.winsys;
46
46
47
import java.awt.Cursor;
47
import java.awt.BorderLayout;
48
import java.io.IOException;
49
import java.util.ArrayList;
50
import java.util.Collection;
51
import javax.swing.DefaultComboBoxModel;
52
import org.netbeans.modules.apisupport.project.layers.LayerUtils;
53
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
48
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
49
import org.netbeans.modules.apisupport.project.ui.wizard.winsys.NewTCIterator.DataModel;
54
import org.openide.WizardDescriptor;
50
import org.openide.WizardDescriptor;
55
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileSystem;
57
import org.openide.util.AsyncGUIJob;
58
import org.openide.util.HelpCtx;
51
import org.openide.util.HelpCtx;
59
import org.openide.util.NbBundle;
52
import org.openide.util.NbBundle;
60
import org.openide.util.Utilities;
61
53
62
/**
54
/**
63
 * the first panel in TopComponent wizard
55
 * Ask whether the user is ready to launch the application. With all 
56
 * the consequences.
64
 *
57
 *
65
 * @author Milos Kleint
58
 * @author Jaroslav Tulach
66
 */
59
 */
67
final class BasicSettingsPanel extends BasicWizardIterator.Panel {
60
final class LayoutWarningPanel extends BasicWizardIterator.Panel {
61
    private final DataModel data;
68
    
62
    
69
    private NewTCIterator.DataModel data;
63
    @NbBundle.Messages({
70
    private static final String[] DEFAULT_MODES = 
64
        "LBL_LayoutWizardTitle=Launch Your Application?"
71
            new String[] {
65
    })
72
                "editor" //NOI18N
66
    public LayoutWarningPanel(WizardDescriptor setting, NewTCIterator.DataModel data) {
73
            };
74
    private boolean loadedComboBox = false;
75
76
    /**
77
     * Creates new form BasicSettingsPanel
78
     */
79
    public BasicSettingsPanel(WizardDescriptor setting, NewTCIterator.DataModel data) {
80
        super(setting);
67
        super(setting);
81
        this.data = data;
68
        this.data = data;
82
        initComponents();
69
        initComponents();
83
        initAccessibility();
70
        initAccessibility();
84
        setupCombo();
71
        putClientProperty("NewFileWizard_Title", Bundle.LBL_LayoutWizardTitle()); //NOI18N
85
        putClientProperty("NewFileWizard_Title", getMessage("LBL_TCWizardTitle"));
72
        panel.add(DesignSupport.warningPanel(), BorderLayout.CENTER);
86
    }
73
    }
87
    
74
    
88
    private void checkValidity() {
75
    @Override
89
        //TODO: probably nothing...
76
    protected void storeToDataModel() {
90
        if (loadedComboBox) {
77
        data.setIgnorePreviousRun(ignore.isSelected());
91
            markValid();
92
        } else {
93
            markInvalid();
94
        }
95
    }
78
    }
96
    
79
    
97
//    public void addNotify() {
80
    @Override
98
//        super.addNotify();
81
    protected void readFromDataModel() {
99
//        attachDocumentListeners();
82
        ignore.setSelected(data.isIgnorePreviousRun());
100
//        checkValidity();
83
    }
101
//    }
102
//
103
//    public void removeNotify() {
104
//        // prevent checking when the panel is not "active"
105
//        removeDocumentListeners();
106
//        super.removeNotify();
107
//    }
108
//
109
//    private void attachDocumentListeners() {
110
//        if (!listenersAttached) {
111
//            listenersAttached = true;
112
//        }
113
//    }
114
//
115
//    private void removeDocumentListeners() {
116
//        if (listenersAttached) {
117
//            listenersAttached = false;
118
//        }
119
//    }
120
    
121
    private void setupCombo() {
122
        //TODO get dynamically from layers??
123
        final Cursor currentCursor = getCursor();
124
        setCursor(Utilities.createProgressCursor(this));
125
84
126
        Utilities.attachInitJob(comMode, new AsyncGUIJob() {
85
    @Override
127
86
    protected String getPanelName() {
128
            String[] modes = null;
87
        return Bundle.LBL_LayoutWizardTitle();
129
130
            @Override
131
            public void construct() {
132
                try {
133
                    FileSystem fs = LayerUtils.getEffectiveSystemFilesystem(data.getProject());
134
                    FileObject foRoot = fs.getRoot().getFileObject("Windows2/Modes"); //NOI18N
135
                    if (foRoot != null) {
136
                        FileObject[] fos = foRoot.getChildren();
137
                        Collection<String> col = new ArrayList<String>();
138
                        for (FileObject fo : fos) {
139
                            if (fo.isData() && "wsmode".equals(fo.getExt())) { //NOI18N
140
                                col.add(fo.getName());
141
                            }
142
                        }
143
                        modes = col.toArray(new String[col.size()]);
144
                    } else {
145
                        modes = DEFAULT_MODES;
146
                    }
147
                } catch (IOException exc) {
148
                    modes = DEFAULT_MODES;
149
150
                }
151
            }
152
153
            @Override
154
            public void finished() {
155
                comMode.setModel(new DefaultComboBoxModel(modes));
156
                setComModeSelectedItem();
157
                windowPosChanged(null);
158
                setCursor(currentCursor);
159
                loadedComboBox = true;
160
                checkValidity();
161
            }
162
        });
163
    }
88
    }
164
    
89
    
165
    protected void storeToDataModel() {
90
    @Override
166
        data.setOpened(cbOpenedOnStart.isSelected());
167
        data.setKeepPrefSize(cbKeepPrefSize.isSelected());
168
        data.setClosingNotAllowed(cbClosingNotAllowed.isSelected());
169
        data.setDraggingNotAllowed(cbDraggingNotAllowed.isSelected());
170
        data.setMaximizationNotAllowed(cbMaximizationNotAllowed.isSelected());
171
        data.setSlidingNotAllowed(cbSlidingNotAllowed.isSelected());
172
        data.setUndockingNotAllowed(cbUndockingNotAllowed.isSelected());
173
        data.setMode((String)comMode.getSelectedItem());
174
    }
175
    
176
    protected void readFromDataModel() {
177
        cbOpenedOnStart.setSelected(data.isOpened());
178
        cbKeepPrefSize.setSelected(data.isKeepPrefSize());
179
        cbClosingNotAllowed.setSelected(data.isClosingNotAllowed());
180
        cbDraggingNotAllowed.setSelected(data.isDraggingNotAllowed());
181
        cbMaximizationNotAllowed.setSelected(data.isMaximizationNotAllowed());
182
        cbSlidingNotAllowed.setSelected(data.isSlidingNotAllowed());
183
        cbUndockingNotAllowed.setSelected(data.isUndockingNotAllowed());
184
        setComModeSelectedItem();
185
        windowPosChanged(null);
186
        checkValidity();
187
    }
188
189
    private void setComModeSelectedItem() {
190
        if (data.getMode() != null) {
191
            comMode.setSelectedItem(data.getMode());
192
        } else {
193
            comMode.setSelectedItem("output");//NOI18N
194
        }
195
    }
196
    
197
    protected String getPanelName() {
198
        return getMessage("LBL_BasicSettings_Title");
199
    }
200
    
201
    protected HelpCtx getHelp() {
91
    protected HelpCtx getHelp() {
202
        return new HelpCtx(BasicSettingsPanel.class);
92
        return new HelpCtx(LayoutWarningPanel.class);
203
    }
204
    
205
    private static String getMessage(String key) {
206
        return NbBundle.getMessage(BasicSettingsPanel.class, key);
207
    }
93
    }
208
    
94
    
209
    /** This method is called from within the constructor to
95
    /** This method is called from within the constructor to
Lines 213-353 Link Here
213
     */
99
     */
214
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
100
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
215
    private void initComponents() {
101
    private void initComponents() {
216
        java.awt.GridBagConstraints gridBagConstraints;
217
102
218
        lblMode = new javax.swing.JLabel();
103
        panel = new javax.swing.JPanel();
219
        comMode = new javax.swing.JComboBox();
104
        ignore = new javax.swing.JCheckBox();
220
        cbOpenedOnStart = new javax.swing.JCheckBox();
221
        cbKeepPrefSize = new javax.swing.JCheckBox();
222
        cbSlidingNotAllowed = new javax.swing.JCheckBox();
223
        cbClosingNotAllowed = new javax.swing.JCheckBox();
224
        cbUndockingNotAllowed = new javax.swing.JCheckBox();
225
        cbDraggingNotAllowed = new javax.swing.JCheckBox();
226
        cbMaximizationNotAllowed = new javax.swing.JCheckBox();
227
105
228
        setLayout(new java.awt.GridBagLayout());
106
        panel.setLayout(new java.awt.BorderLayout());
229
107
230
        lblMode.setLabelFor(comMode);
108
        ignore.setSelected(true);
231
        org.openide.awt.Mnemonics.setLocalizedText(lblMode, org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "LBL_Mode")); // NOI18N
109
        org.openide.awt.Mnemonics.setLocalizedText(ignore, org.openide.util.NbBundle.getMessage(LayoutWarningPanel.class, "IGNORE PREVIOUS RUN", new Object[] {})); // NOI18N
232
        gridBagConstraints = new java.awt.GridBagConstraints();
233
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
234
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
235
        add(lblMode, gridBagConstraints);
236
110
237
        comMode.addItemListener(new java.awt.event.ItemListener() {
111
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
238
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
112
        this.setLayout(layout);
239
                windowPosChanged(evt);
113
        layout.setHorizontalGroup(
240
            }
114
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
241
        });
115
            .addGroup(layout.createSequentialGroup()
242
        gridBagConstraints = new java.awt.GridBagConstraints();
116
                .addGap(8, 8, 8)
243
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
117
                .addComponent(ignore, javax.swing.GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE)
244
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
118
                .addContainerGap())
245
        gridBagConstraints.weightx = 0.1;
119
            .addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
246
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 6);
120
        );
247
        add(comMode, gridBagConstraints);
121
        layout.setVerticalGroup(
248
122
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
249
        org.openide.awt.Mnemonics.setLocalizedText(cbOpenedOnStart, org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "LBL_OpenOnStart")); // NOI18N
123
            .addGroup(layout.createSequentialGroup()
250
        cbOpenedOnStart.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
124
                .addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)
251
        cbOpenedOnStart.setMargin(new java.awt.Insets(0, 0, 0, 0));
125
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
252
        gridBagConstraints = new java.awt.GridBagConstraints();
126
                .addComponent(ignore)
253
        gridBagConstraints.gridx = 0;
127
                .addContainerGap())
254
        gridBagConstraints.gridy = 1;
128
        );
255
        gridBagConstraints.gridwidth = 2;
256
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
257
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
258
        add(cbOpenedOnStart, gridBagConstraints);
259
260
        org.openide.awt.Mnemonics.setLocalizedText(cbKeepPrefSize, org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "LBL_KeepPrefSize")); // NOI18N
261
        cbKeepPrefSize.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
262
        cbKeepPrefSize.setEnabled(false);
263
        cbKeepPrefSize.setMargin(new java.awt.Insets(0, 0, 0, 0));
264
        gridBagConstraints = new java.awt.GridBagConstraints();
265
        gridBagConstraints.gridx = 0;
266
        gridBagConstraints.gridy = 2;
267
        gridBagConstraints.gridwidth = 2;
268
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
269
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
270
        add(cbKeepPrefSize, gridBagConstraints);
271
272
        org.openide.awt.Mnemonics.setLocalizedText(cbSlidingNotAllowed, org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "CTL_SlidingNotAllowed")); // NOI18N
273
        cbSlidingNotAllowed.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
274
        cbSlidingNotAllowed.setEnabled(false);
275
        gridBagConstraints = new java.awt.GridBagConstraints();
276
        gridBagConstraints.gridx = 0;
277
        gridBagConstraints.gridy = 3;
278
        gridBagConstraints.gridwidth = 2;
279
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
280
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
281
        add(cbSlidingNotAllowed, gridBagConstraints);
282
283
        org.openide.awt.Mnemonics.setLocalizedText(cbClosingNotAllowed, org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "CTL_ClosingNotAllowed")); // NOI18N
284
        cbClosingNotAllowed.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
285
        gridBagConstraints = new java.awt.GridBagConstraints();
286
        gridBagConstraints.gridx = 0;
287
        gridBagConstraints.gridy = 4;
288
        gridBagConstraints.gridwidth = 2;
289
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
290
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
291
        add(cbClosingNotAllowed, gridBagConstraints);
292
293
        org.openide.awt.Mnemonics.setLocalizedText(cbUndockingNotAllowed, org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "CTL_UndockingNotAllowed")); // NOI18N
294
        cbUndockingNotAllowed.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
295
        gridBagConstraints = new java.awt.GridBagConstraints();
296
        gridBagConstraints.gridx = 0;
297
        gridBagConstraints.gridy = 5;
298
        gridBagConstraints.gridwidth = 2;
299
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
300
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
301
        add(cbUndockingNotAllowed, gridBagConstraints);
302
303
        org.openide.awt.Mnemonics.setLocalizedText(cbDraggingNotAllowed, org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "CTL_DraggingNotAllowed")); // NOI18N
304
        cbDraggingNotAllowed.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
305
        gridBagConstraints = new java.awt.GridBagConstraints();
306
        gridBagConstraints.gridx = 0;
307
        gridBagConstraints.gridy = 6;
308
        gridBagConstraints.gridwidth = 2;
309
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
310
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
311
        add(cbDraggingNotAllowed, gridBagConstraints);
312
313
        org.openide.awt.Mnemonics.setLocalizedText(cbMaximizationNotAllowed, org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "CTL_MaximizationNotAllowed")); // NOI18N
314
        cbMaximizationNotAllowed.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
315
        gridBagConstraints = new java.awt.GridBagConstraints();
316
        gridBagConstraints.gridx = 0;
317
        gridBagConstraints.gridy = 7;
318
        gridBagConstraints.gridwidth = 2;
319
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
320
        gridBagConstraints.weighty = 0.1;
321
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
322
        add(cbMaximizationNotAllowed, gridBagConstraints);
323
    }// </editor-fold>//GEN-END:initComponents
129
    }// </editor-fold>//GEN-END:initComponents
324
325
private void windowPosChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_windowPosChanged
326
    cbKeepPrefSize.setEnabled( !("editor".equals( comMode.getSelectedItem()) ) );
327
    if( !cbKeepPrefSize.isEnabled() )
328
        cbKeepPrefSize.setSelected( false );
329
    cbSlidingNotAllowed.setEnabled( !("editor".equals( comMode.getSelectedItem()) ) );
330
    if( !cbSlidingNotAllowed.isEnabled() )
331
        cbSlidingNotAllowed.setSelected( false );
332
}//GEN-LAST:event_windowPosChanged
333
    
130
    
334
    // Variables declaration - do not modify//GEN-BEGIN:variables
131
    // Variables declaration - do not modify//GEN-BEGIN:variables
335
    private javax.swing.JCheckBox cbClosingNotAllowed;
132
    private javax.swing.JCheckBox ignore;
336
    private javax.swing.JCheckBox cbDraggingNotAllowed;
133
    private javax.swing.JPanel panel;
337
    private javax.swing.JCheckBox cbKeepPrefSize;
338
    private javax.swing.JCheckBox cbMaximizationNotAllowed;
339
    private javax.swing.JCheckBox cbOpenedOnStart;
340
    private javax.swing.JCheckBox cbSlidingNotAllowed;
341
    private javax.swing.JCheckBox cbUndockingNotAllowed;
342
    private javax.swing.JComboBox comMode;
343
    private javax.swing.JLabel lblMode;
344
    // End of variables declaration//GEN-END:variables
134
    // End of variables declaration//GEN-END:variables
345
    
135
    
136
    @NbBundle.Messages({
137
        "ACS_LayoutWarningPanel=Do you want to launch your application?"
138
    })
346
    private void initAccessibility() {
139
    private void initAccessibility() {
347
        this.getAccessibleContext().setAccessibleDescription(getMessage("ACS_BasicSettingsPanel"));
140
        this.getAccessibleContext().setAccessibleDescription(Bundle.ACS_LayoutWarningPanel());
348
        cbOpenedOnStart.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_OpenOnStart"));
349
        cbKeepPrefSize.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_KeepPrefSize"));
350
        comMode.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_Mode"));
351
    }
141
    }
352
    
142
    
353
}
143
}
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/NewTCIterator.java (-128 / +194 lines)
Lines 46-55 Link Here
46
46
47
import java.io.File;
47
import java.io.File;
48
import java.io.IOException;
48
import java.io.IOException;
49
import java.io.OutputStream;
49
import java.util.Collections;
50
import java.util.Collections;
50
import java.util.HashMap;
51
import java.util.HashMap;
52
import java.util.HashSet;
51
import java.util.Map;
53
import java.util.Map;
52
import java.util.Set;
54
import java.util.Set;
55
import java.util.TreeMap;
56
import java.util.TreeSet;
53
import java.util.logging.Level;
57
import java.util.logging.Level;
54
import java.util.logging.Logger;
58
import java.util.logging.Logger;
55
import org.netbeans.api.project.Project;
59
import org.netbeans.api.project.Project;
Lines 105-111 Link Here
105
    }
109
    }
106
    
110
    
107
    static final class DataModel extends BasicWizardIterator.BasicDataModel {
111
    static final class DataModel extends BasicWizardIterator.BasicDataModel {
108
        
109
        private String name;
112
        private String name;
110
        private String icon;
113
        private String icon;
111
        private String mode;
114
        private String mode;
Lines 116-121 Link Here
116
        private boolean draggingNotAllowed = false;
119
        private boolean draggingNotAllowed = false;
117
        private boolean undockingNotAllowed = false;
120
        private boolean undockingNotAllowed = false;
118
        private boolean maximizationNotAllowed = false;
121
        private boolean maximizationNotAllowed = false;
122
        private Map<String,String> newModes;
123
        private Set<String> existingModes;
124
        private boolean ignorePreviousRun = true;
119
        
125
        
120
        private CreatedModifiedFiles files;
126
        private CreatedModifiedFiles files;
121
        
127
        
Lines 158-163 Link Here
158
        public String getMode() {
164
        public String getMode() {
159
            return mode;
165
            return mode;
160
        }
166
        }
167
        
168
        public void defineMode(String name, String definition) {
169
            if (newModes == null) {
170
                newModes = new TreeMap<String, String>();
171
            }
172
            newModes.put(name, definition);
173
        }
174
        void existingMode(String name) {
175
            if (existingModes == null) {
176
                existingModes = new TreeSet<String>();
177
            }
178
            existingModes.add(name);
179
        }
180
        boolean isExistingMode(String name) {
181
            return existingModes != null && existingModes.contains(name);
182
        }
183
    
184
        Map<String,String> getNewModes() {
185
            if (newModes == null) {
186
                return null;
187
            }
188
            TreeMap<String,String> copy = new TreeMap<String,String>(newModes);
189
            if (existingModes != null) {
190
                copy.keySet().removeAll(existingModes);
191
            }
192
            return copy.isEmpty() ? null : copy;
193
        }
194
195
        public boolean isIgnorePreviousRun() {
196
            return ignorePreviousRun;
197
        }
198
199
        public void setIgnorePreviousRun(boolean ignorePreviousRun) {
200
            this.ignorePreviousRun = ignorePreviousRun;
201
        }
161
202
162
        public void setMode(String mode) {
203
        public void setMode(String mode) {
163
            this.mode = mode;
204
            this.mode = mode;
Lines 220-226 Link Here
220
        }
261
        }
221
    }
262
    }
222
    
263
    
223
    public static void generateFileChanges(DataModel model) {
264
    static void generateFileChanges(final DataModel model) {
224
        CreatedModifiedFiles fileChanges = new CreatedModifiedFiles(model.getProject());
265
        CreatedModifiedFiles fileChanges = new CreatedModifiedFiles(model.getProject());
225
        Project project = model.getProject();
266
        Project project = model.getProject();
226
        NbModuleProvider moduleInfo = model.getModuleInfo();
267
        NbModuleProvider moduleInfo = model.getModuleInfo();
Lines 248-387 Link Here
248
            propertiesPersistence = false;
289
            propertiesPersistence = false;
249
        }
290
        }
250
291
251
        
292
        if (name != null) {
252
        Map<String,String> replaceTokens = new HashMap<String,String>();
293
            Map<String,String> replaceTokens = new HashMap<String,String>();
253
        replaceTokens.put("TEMPLATENAME", name);//NOI18N
294
            replaceTokens.put("TEMPLATENAME", name);//NOI18N
254
        replaceTokens.put("PACKAGENAME", packageName);//NOI18N
295
            replaceTokens.put("PACKAGENAME", packageName);//NOI18N
255
        replaceTokens.put("MODE", mode); //NOI18N
296
            replaceTokens.put("MODE", mode); //NOI18N
256
        replaceTokens.put("OPENED", model.isOpened() ? "true" : "false"); //NOI18N
297
            replaceTokens.put("OPENED", model.isOpened() ? "true" : "false"); //NOI18N
257
        replaceTokens.put("WINSYSBEHAVIOR", defineWinSysBehavior( model ) ); //NOI18N
298
            replaceTokens.put("WINSYSBEHAVIOR", defineWinSysBehavior( model ) ); //NOI18N
258
299
259
        // 0. move icon file if necessary
300
            // 0. move icon file if necessary
260
        String icon = model.getIcon();
301
            String icon = model.getIcon();
261
        File fil = null;
302
            File fil = null;
262
        if (icon != null) {
303
            if (icon != null) {
263
            fil = new File(icon);
304
                fil = new File(icon);
264
            if (!fil.exists()) {
305
                if (!fil.exists()) {
265
                fil = null;
306
                    fil = null;
307
                }
266
            }
308
            }
267
        }
309
            String relativeIconPath = null;
268
        String relativeIconPath = null;
310
            if (fil != null) {
269
        if (fil != null) {
311
                FileObject fo = FileUtil.toFileObject(fil);
270
            FileObject fo = FileUtil.toFileObject(fil);
312
                if (!FileUtil.isParentOf(Util.getResourceDirectory(project), fo)) {
271
            if (!FileUtil.isParentOf(Util.getResourceDirectory(project), fo)) {
313
                    String iconPath = getRelativePath(moduleInfo.getResourceDirectoryPath(false), packageName, 
272
                String iconPath = getRelativePath(moduleInfo.getResourceDirectoryPath(false), packageName, 
314
                                                    "", fo.getNameExt()); //NOI18N
273
                                                "", fo.getNameExt()); //NOI18N
315
                    fileChanges.add(fileChanges.createFile(iconPath, fo));
274
                fileChanges.add(fileChanges.createFile(iconPath, fo));
316
                    relativeIconPath = packageName.replace('.', '/') + "/" + fo.getNameExt(); // NOI18N
275
                relativeIconPath = packageName.replace('.', '/') + "/" + fo.getNameExt(); // NOI18N
317
                } else {
318
                    relativeIconPath = FileUtil.getRelativePath(Util.getResourceDirectory(project), fo);
319
                }
320
                replaceTokens.put("ICONPATH", relativeIconPath);//NOI18N
321
                replaceTokens.put("COMMENTICON", "");//NOI18N
322
276
            } else {
323
            } else {
277
                relativeIconPath = FileUtil.getRelativePath(Util.getResourceDirectory(project), fo);
324
                replaceTokens.put("ICONPATH", "SET/PATH/TO/ICON/HERE"); //NOI18N
325
                replaceTokens.put("COMMENTICON", "//");//NOI18N
278
            }
326
            }
279
            replaceTokens.put("ICONPATH", relativeIconPath);//NOI18N
327
280
            replaceTokens.put("COMMENTICON", "");//NOI18N
328
281
            
329
            // 2. update project dependencies
282
        } else {
330
            replaceTokens.put("MODULENAME", moduleInfo.getCodeNameBase()); // NOI18N
283
            replaceTokens.put("ICONPATH", "SET/PATH/TO/ICON/HERE"); //NOI18N
331
            String specVersion = moduleInfo.getSpecVersion();
284
            replaceTokens.put("COMMENTICON", "//");//NOI18N
332
            replaceTokens.put("SPECVERSION", specVersion != null ? specVersion : "0"); // NOI18N
333
            fileChanges.add(fileChanges.addModuleDependency("org.openide.windows")); //NOI18N
334
            fileChanges.add(fileChanges.addManifestToken(ManifestManager.OPENIDE_MODULE_REQUIRES, WindowManager.class.getName()));
335
            fileChanges.add(fileChanges.addModuleDependency("org.openide.util")); //NOI18N
336
            fileChanges.add(fileChanges.addModuleDependency("org.openide.util.lookup")); //NOI18N
337
            fileChanges.add(fileChanges.addModuleDependency("org.openide.awt")); //NOI18N
338
            if (propertiesPersistence) {
339
                fileChanges.add(fileChanges.addModuleDependency("org.netbeans.modules.settings")); //NOI18N
340
            }
341
342
            // x. generate java classes
343
            final String tcName = getRelativePath(moduleInfo.getSourceDirectoryPath(), packageName,
344
                    name, "TopComponent.java"); //NOI18N
345
            FileObject template = CreatedModifiedFiles.getTemplate(
346
                xmlLessTC ? "templateTopComponent637.java" :    
347
                (propertiesPersistence ? "templateTopComponentAnno.java" : "templateTopComponent.java")
348
            );
349
            fileChanges.add(fileChanges.createFileWithSubstitutions(tcName, template, replaceTokens));
350
            // x. generate java classes
351
            final String tcFormName = getRelativePath(moduleInfo.getSourceDirectoryPath(), packageName,
352
                    name, "TopComponent.form"); //NOI18N
353
            template = CreatedModifiedFiles.getTemplate("templateTopComponent.form");//NOI18N
354
            fileChanges.add(fileChanges.createFileWithSubstitutions(tcFormName, template, replaceTokens));
355
356
            if (!actionLessTC) {
357
                final String actionName = getRelativePath(moduleInfo.getSourceDirectoryPath(), packageName,
358
                        name, "Action.java"); //NOI18N
359
                template = CreatedModifiedFiles.getTemplate("templateAction.java");//NOI18N
360
                fileChanges.add(fileChanges.createFileWithSubstitutions(actionName, template, replaceTokens));
361
            }
362
363
            if (!xmlLessTC) {
364
                final String settingsName = name + "TopComponent.settings"; //NOI18N
365
                template = CreatedModifiedFiles.getTemplate("templateSettings.xml");//NOI18N
366
                fileChanges.add(fileChanges.createLayerEntry("Windows2/Components/" + settingsName, template, replaceTokens, null, null)); // NOI18N
367
            }
368
369
            if (!xmlLessTC) {
370
                final String wstcrefName = name + "TopComponent.wstcref"; //NOI18N
371
                template = CreatedModifiedFiles.getTemplate("templateWstcref.xml");//NOI18N
372
                fileChanges.add(fileChanges.createLayerEntry("Windows2/Modes/" + mode + "/" + wstcrefName, // NOI18N
373
                                     template, replaceTokens, null, null));
374
            }
375
376
            String bundlePath = getRelativePath(moduleInfo.getResourceDirectoryPath(false), packageName, "", "Bundle.properties"); //NOI18N
377
            if (xmlLessTC) {
378
                // nothing in layer
379
            } else if (actionLessTC) {
380
                String path = "Actions/Window/" + packageName.replace('.','-') + "-" + name + "Action.instance"; // NOI18N
381
                {
382
                    Map<String,Object> attrs = new HashMap<String,Object>();
383
                    attrs.put("instanceCreate", "methodvalue:org.openide.windows.TopComponent.openAction"); // NOI18N
384
                    attrs.put("component", "methodvalue:" + packageName + '.' + name + "TopComponent.findInstance"); // NOI18N
385
                    if (relativeIconPath != null) {
386
                        attrs.put("iconBase", relativeIconPath); // NOI18N
387
                    }
388
                    attrs.put("displayName", "bundlevalue:" + packageName + ".Bundle#CTL_" + name + "Action"); // NOI18N
389
                    fileChanges.add(
390
                        fileChanges.createLayerEntry(
391
                            path,
392
                            null,
393
                            null,
394
                            null,
395
                            attrs
396
                        )
397
                    );
398
                }
399
400
                {
401
                    Map<String,Object> attrs = new HashMap<String,Object>();
402
                    attrs.put("originalFile", path); // NOI18N
403
                    fileChanges.add(
404
                        fileChanges.createLayerEntry(
405
                            "Menu/Window/" + name + "Action.shadow", // NOI18N
406
                            null,
407
                            null,
408
                            null,
409
                            attrs
410
                        )
411
                    );
412
                }
413
            } else {
414
                fileChanges.add(fileChanges.layerModifications(new CreateActionEntryOperation(name + "Action", packageName), // NOI18N
415
                                                           Collections.<String>emptySet()));
416
            }
417
            // XXX use @Messages where available
418
            fileChanges.add(fileChanges.bundleKey(bundlePath, "CTL_" + name + "Action",  // NOI18N
419
                                    name)); //NOI18N
420
421
            fileChanges.add(fileChanges.bundleKey(bundlePath, "CTL_" + name + "TopComponent",  // NOI18N
422
                                    name + " Window")); //NOI18N
423
            fileChanges.add(fileChanges.bundleKey(bundlePath, "HINT_" + name + "TopComponent",  // NOI18N
424
                                    "This is a " + name + " window")); //NOI18N
285
        }
425
        }
286
        
426
        
287
        
427
        final Map<String, String> newModes = model.getNewModes();
288
        // 2. update project dependencies
428
        if (newModes != null) {
289
        replaceTokens.put("MODULENAME", moduleInfo.getCodeNameBase()); // NOI18N
429
            Set<String> files = new HashSet<String>();
290
        String specVersion = moduleInfo.getSpecVersion();
430
            for (String wsmode : newModes.keySet()) {
291
        replaceTokens.put("SPECVERSION", specVersion != null ? specVersion : "0"); // NOI18N
431
                files.add(wsmode + ".wsmode");
292
        fileChanges.add(fileChanges.addModuleDependency("org.openide.windows")); //NOI18N
432
            }
293
        fileChanges.add(fileChanges.addManifestToken(ManifestManager.OPENIDE_MODULE_REQUIRES, WindowManager.class.getName()));
433
            
294
        fileChanges.add(fileChanges.addModuleDependency("org.openide.util")); //NOI18N
434
            fileChanges.add(fileChanges.layerModifications(new CreatedModifiedFiles.LayerOperation() {
295
        fileChanges.add(fileChanges.addModuleDependency("org.openide.util.lookup")); //NOI18N
435
                @Override
296
        fileChanges.add(fileChanges.addModuleDependency("org.openide.awt")); //NOI18N
436
                public void run(FileSystem layer) throws IOException {
297
        if (propertiesPersistence) {
437
                    FileObject fo = FileUtil.createFolder(layer.getRoot(), "Windows2/Modes");
298
            fileChanges.add(fileChanges.addModuleDependency("org.netbeans.modules.settings")); //NOI18N
438
                    for (Map.Entry<String, String> entry : newModes.entrySet()) {
439
                        FileObject wsmode = fo.createData(entry.getKey() + ".wsmode");
440
                        OutputStream os = wsmode.getOutputStream();
441
                        try {
442
                            os.write(entry.getValue().getBytes("UTF-8"));
443
                        } finally {
444
                            os.close();
445
                        }
446
                    }
447
                }   
448
            }, files));
299
        }
449
        }
300
        
450
        
301
        // x. generate java classes
302
        final String tcName = getRelativePath(moduleInfo.getSourceDirectoryPath(), packageName,
303
                name, "TopComponent.java"); //NOI18N
304
        FileObject template = CreatedModifiedFiles.getTemplate(
305
            xmlLessTC ? "templateTopComponent637.java" :    
306
            (propertiesPersistence ? "templateTopComponentAnno.java" : "templateTopComponent.java")
307
        );
308
        fileChanges.add(fileChanges.createFileWithSubstitutions(tcName, template, replaceTokens));
309
        // x. generate java classes
310
        final String tcFormName = getRelativePath(moduleInfo.getSourceDirectoryPath(), packageName,
311
                name, "TopComponent.form"); //NOI18N
312
        template = CreatedModifiedFiles.getTemplate("templateTopComponent.form");//NOI18N
313
        fileChanges.add(fileChanges.createFileWithSubstitutions(tcFormName, template, replaceTokens));
314
315
        if (!actionLessTC) {
316
            final String actionName = getRelativePath(moduleInfo.getSourceDirectoryPath(), packageName,
317
                    name, "Action.java"); //NOI18N
318
            template = CreatedModifiedFiles.getTemplate("templateAction.java");//NOI18N
319
            fileChanges.add(fileChanges.createFileWithSubstitutions(actionName, template, replaceTokens));
320
        }
321
        
322
        if (!xmlLessTC) {
323
            final String settingsName = name + "TopComponent.settings"; //NOI18N
324
            template = CreatedModifiedFiles.getTemplate("templateSettings.xml");//NOI18N
325
            fileChanges.add(fileChanges.createLayerEntry("Windows2/Components/" + settingsName, template, replaceTokens, null, null)); // NOI18N
326
        }
327
        
328
        if (!xmlLessTC) {
329
            final String wstcrefName = name + "TopComponent.wstcref"; //NOI18N
330
            template = CreatedModifiedFiles.getTemplate("templateWstcref.xml");//NOI18N
331
            fileChanges.add(fileChanges.createLayerEntry("Windows2/Modes/" + mode + "/" + wstcrefName, // NOI18N
332
                                 template, replaceTokens, null, null));
333
        }
334
335
        String bundlePath = getRelativePath(moduleInfo.getResourceDirectoryPath(false), packageName, "", "Bundle.properties"); //NOI18N
336
        if (xmlLessTC) {
337
            // nothing in layer
338
        } else if (actionLessTC) {
339
            String path = "Actions/Window/" + packageName.replace('.','-') + "-" + name + "Action.instance"; // NOI18N
340
            {
341
                Map<String,Object> attrs = new HashMap<String,Object>();
342
                attrs.put("instanceCreate", "methodvalue:org.openide.windows.TopComponent.openAction"); // NOI18N
343
                attrs.put("component", "methodvalue:" + packageName + '.' + name + "TopComponent.findInstance"); // NOI18N
344
                if (relativeIconPath != null) {
345
                    attrs.put("iconBase", relativeIconPath); // NOI18N
346
                }
347
                attrs.put("displayName", "bundlevalue:" + packageName + ".Bundle#CTL_" + name + "Action"); // NOI18N
348
                fileChanges.add(
349
                    fileChanges.createLayerEntry(
350
                        path,
351
                        null,
352
                        null,
353
                        null,
354
                        attrs
355
                    )
356
                );
357
            }
358
359
            {
360
                Map<String,Object> attrs = new HashMap<String,Object>();
361
                attrs.put("originalFile", path); // NOI18N
362
                fileChanges.add(
363
                    fileChanges.createLayerEntry(
364
                        "Menu/Window/" + name + "Action.shadow", // NOI18N
365
                        null,
366
                        null,
367
                        null,
368
                        attrs
369
                    )
370
                );
371
            }
372
        } else {
373
            fileChanges.add(fileChanges.layerModifications(new CreateActionEntryOperation(name + "Action", packageName), // NOI18N
374
                                                       Collections.<String>emptySet()));
375
        }
376
        // XXX use @Messages where available
377
        fileChanges.add(fileChanges.bundleKey(bundlePath, "CTL_" + name + "Action",  // NOI18N
378
                                name)); //NOI18N
379
        
380
        fileChanges.add(fileChanges.bundleKey(bundlePath, "CTL_" + name + "TopComponent",  // NOI18N
381
                                name + " Window")); //NOI18N
382
        fileChanges.add(fileChanges.bundleKey(bundlePath, "HINT_" + name + "TopComponent",  // NOI18N
383
                                "This is a " + name + " window")); //NOI18N
384
        
385
        model.setCreatedModifiedFiles(fileChanges);
451
        model.setCreatedModifiedFiles(fileChanges);
386
    }
452
    }
387
453
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/polishing.xsl (+20 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
3
<xsl:stylesheet version="1.0" 
4
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
    xmlns:atom="http://www.w3.org/2005/Atom"
6
    xmlns:xalan="http://xml.apache.org/xslt"
7
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
8
>
9
    <xsl:output method="xml" indent="yes" xalan:indent-amount="4"/>
10
11
    <!-- skip active-tc element -->
12
    <xsl:template match="active-tc"/>
13
14
    <xsl:template match="@*|node()">
15
      <xsl:copy>
16
        <xsl:apply-templates select="@*|node()"/>
17
      </xsl:copy>
18
    </xsl:template>
19
20
</xsl:stylesheet>
(-)a/apisupport.project/test/unit/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/DesignSupportTest.java (+76 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
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.apisupport.project.ui.wizard.winsys;
43
44
import java.io.IOException;
45
import java.io.OutputStream;
46
import org.netbeans.junit.NbTestCase;
47
import org.openide.filesystems.FileObject;
48
import org.openide.filesystems.FileSystem;
49
import org.openide.filesystems.FileUtil;
50
51
52
public class DesignSupportTest extends NbTestCase {
53
    private FileObject fo;
54
    
55
    public DesignSupportTest(String n) {
56
        super(n);
57
    }
58
    
59
    @Override
60
    protected void setUp() throws IOException {
61
        FileSystem ms = FileUtil.createMemoryFileSystem();
62
        fo = ms.getRoot().createData("my.wsmode");
63
        OutputStream os = fo.getOutputStream();
64
        FileUtil.copy(DesignSupportTest.class.getResourceAsStream("testWsmode.xml"), os);
65
        os.close();
66
    }
67
    public void testReadingOfAMode() throws Exception {
68
        String read = DesignSupport.readMode(fo);
69
        if (read.contains("active-tc")) {
70
            fail("No active-tc:\n" + read);
71
        }
72
        if (read.indexOf("path orientation") == -1) {
73
            fail("<path orientation= should be there:\n" + read);
74
        }
75
    }
76
}
(-)a/apisupport.project/test/unit/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/testWsmode.xml (+15 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
3
<mode version="2.4">
4
    <name unique="nadexplorer"  />
5
  <kind type="view" />
6
  <state type="joined"  />
7
  <constraints>
8
    <path orientation="horizontal" number="20" weight="0.3"/>
9
    <path orientation="vertical" number="20" weight="0.5"/>
10
  </constraints>
11
  <bounds x="0" y="0" width="0" height="0" />
12
  <frame state="0"/>
13
    <active-tc  id="DesignViewComponentTopComponent_11" />
14
    <empty-behavior permanent="false"/>
15
</mode>
(-)a/core.windows/arch.xml (+9 lines)
Lines 583-588 Link Here
583
Action obj = (Action)fo.getAttribute("instanceCreate");
583
Action obj = (Action)fo.getAttribute("instanceCreate");
584
 </pre>
584
 </pre>
585
  </api>
585
  </api>
586
  <api name="org.netbeans.core.WindowSystem.designMode" category="friend" group="systemproperty"
587
    type="export">
588
    Special property for apisupport project to run an application in a 
589
    <b>design mode</b> to define new layout. 
590
    In such mode user components are removed and replaced with uniform ones
591
    allowing change of a mode name. Don't rely on this property much, it may
592
    soon go away - as soon as apisupport is rewritten to have quasi-preview
593
    editor.
594
    </api>
586
  </p>
595
  </p>
587
 </answer>
596
 </answer>
588
597
(-)a/core.windows/nbproject/project.xml (-1 / +1 lines)
Lines 67-73 Link Here
67
                        <specification-version>1.6</specification-version>
67
                        <specification-version>1.6</specification-version>
68
                    </run-dependency>
68
                    </run-dependency>
69
                </dependency>
69
                </dependency>
70
                <dependency>
70
               <dependency>
71
                    <code-name-base>org.netbeans.modules.settings</code-name-base>
71
                    <code-name-base>org.netbeans.modules.settings</code-name-base>
72
                    <build-prerequisite/>
72
                    <build-prerequisite/>
73
                    <compile-dependency/>
73
                    <compile-dependency/>
(-)a/core.windows/src/org/netbeans/core/windows/Central.java (+4 lines)
Lines 557-562 Link Here
557
        WindowManagerImpl.getInstance().doFirePropertyChange(
557
        WindowManagerImpl.getInstance().doFirePropertyChange(
558
            WindowManager.PROP_MODES, null, null);
558
            WindowManager.PROP_MODES, null, null);
559
    }
559
    }
560
    
561
    final void setModeName(ModeImpl mode, String text) {
562
        model.setModeName(mode, text);
563
    }
560
564
561
    /** Removes mode from model and requests view (if needed). */
565
    /** Removes mode from model and requests view (if needed). */
562
    public void removeMode(ModeImpl mode) {
566
    public void removeMode(ModeImpl mode) {
(-)a/core.windows/src/org/netbeans/core/windows/ModeImpl.java (+4 lines)
Lines 565-570 Link Here
565
    // Utility methods<<
565
    // Utility methods<<
566
    ////////////////////
566
    ////////////////////
567
567
568
    public void setModeName(String text) {
569
        getCentral().setModeName(this, text);
570
    }
571
568
    
572
    
569
}
573
}
570
574
(-)a/core.windows/src/org/netbeans/core/windows/WindowSystemImpl.java (+4 lines)
Lines 48-53 Link Here
48
48
49
import java.awt.EventQueue;
49
import java.awt.EventQueue;
50
import org.netbeans.core.WindowSystem;
50
import org.netbeans.core.WindowSystem;
51
import org.netbeans.core.windows.design.DesignView;
51
import org.netbeans.core.windows.services.DialogDisplayerImpl;
52
import org.netbeans.core.windows.services.DialogDisplayerImpl;
52
import org.netbeans.core.windows.view.ui.MainWindow;
53
import org.netbeans.core.windows.view.ui.MainWindow;
53
import org.openide.util.lookup.ServiceProvider;
54
import org.openide.util.lookup.ServiceProvider;
Lines 64-69 Link Here
64
    @Override
65
    @Override
65
    public void init() {
66
    public void init() {
66
        assert !EventQueue.isDispatchThread();
67
        assert !EventQueue.isDispatchThread();
68
        if (Boolean.getBoolean("org.netbeans.core.WindowSystem.designMode")) { // NOI18N
69
            DesignView.initialize();
70
        }
67
        MainWindow.init();
71
        MainWindow.init();
68
    }
72
    }
69
73
(-)a/core.windows/src/org/netbeans/core/windows/design/Bundle.properties (+46 lines)
Line 0 Link Here
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
#
3
# Copyright 2011 Oracle and/or its affiliates. All rights reserved.
4
#
5
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6
# Other names may be trademarks of their respective owners.
7
#
8
# The contents of this file are subject to the terms of either the GNU
9
# General Public License Version 2 only ("GPL") or the Common
10
# Development and Distribution License("CDDL") (collectively, the
11
# "License"). You may not use this file except in compliance with the
12
# License. You can obtain a copy of the License at
13
# http://www.netbeans.org/cddl-gplv2.html
14
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15
# specific language governing permissions and limitations under the
16
# License.  When distributing the software, include this License Header
17
# Notice in each file and include the License file at
18
# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
19
# particular file as subject to the "Classpath" exception as provided
20
# by Oracle in the GPL Version 2 section of the License file that
21
# accompanied this code. If applicable, add the following below the
22
# License Header, with the fields enclosed by brackets [] replaced by
23
# your own identifying information:
24
# "Portions Copyrighted [year] [name of copyright owner]"
25
#
26
# If you wish your version of this file to be governed by only the CDDL
27
# or only the GPL Version 2, indicate your decision by adding
28
# "[Contributor] elects to include this software in this distribution
29
# under the [CDDL or GPL Version 2] license." If you do not indicate a
30
# single choice of license, a recipient has the option to distribute
31
# your version of this file under either the CDDL, the GPL Version 2 or
32
# to extend the choice of license to its licensees as provided above.
33
# However, if you add GPL Version 2 code and therefore, elected the GPL
34
# Version 2 license, then the option applies only if the new code is
35
# made subject to such option by the copyright holder.
36
#
37
# Contributor(s):
38
#
39
# Portions Copyrighted 2011 Sun Microsystems, Inc.
40
41
CTL_DesignViewComponentTopComponent=Mode Component
42
HINT_DesignViewComponentTopComponent=Represents a mode and allows its rename
43
DesignViewComponent.modeName.text=
44
DesignViewComponent.jLabel1.text=Mode Name:
45
DesignViewComponent.jButton1.text=Rename Mode
46
(-)a/core.windows/src/org/netbeans/core/windows/design/DesignView.java (+174 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
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.core.windows.design;
43
44
import java.awt.event.ActionEvent;
45
import java.awt.event.ActionListener;
46
import java.beans.PropertyChangeEvent;
47
import java.beans.PropertyChangeListener;
48
import java.io.IOException;
49
import org.openide.awt.ActionID;
50
import org.openide.awt.ActionRegistration;
51
import org.openide.filesystems.FileObject;
52
import org.openide.filesystems.FileUtil;
53
import org.openide.util.Exceptions;
54
import org.openide.util.NbBundle.Messages;
55
import org.openide.windows.Mode;
56
import org.openide.windows.TopComponent;
57
import org.openide.windows.WindowManager;
58
59
/**
60
 *
61
 * @author Jaroslav Tulach <jtulach@netbeans.org>
62
 */
63
public final class DesignView implements Runnable, PropertyChangeListener {
64
    private static final DesignView INSTANCE = new DesignView();
65
    static int designModeCounter;
66
    
67
    private DesignView() {
68
    }
69
70
    public static void initialize() {
71
        INSTANCE.cleanToolbarsAndMenu();
72
        WindowManager.getDefault().invokeWhenUIReady(INSTANCE);
73
        TopComponent.getRegistry().addPropertyChangeListener(INSTANCE);
74
    }
75
    
76
    private void cleanToolbarsAndMenu() {
77
        FileObject tb = FileUtil.getConfigFile("Toolbars");
78
79
        if (tb != null) {
80
            for (FileObject fileObject : tb.getChildren()) {
81
                try {
82
                    fileObject.delete();
83
                } catch (IOException ex) {
84
                    Exceptions.printStackTrace(ex);
85
                }
86
            }
87
            FileObject shadow;
88
            try {
89
                shadow = tb.createFolder("DesignView").createData("org-netbeans-core-windows-model-NewMode.shadow");
90
                shadow.setAttribute("originalFile", "Actions/System/org-netbeans-core-windows-model-NewMode.instance");
91
            } catch (IOException ex) {
92
                Exceptions.printStackTrace(ex);
93
            }
94
        }
95
        FileObject mb = FileUtil.getConfigFile("Menu");
96
97
        if (mb != null) {
98
            for (FileObject fileObject : mb.getChildren()) {
99
                try {
100
                    fileObject.delete();
101
                } catch (IOException ex) {
102
                    Exceptions.printStackTrace(ex);
103
                }
104
            }
105
        }
106
        FileObject ws = FileUtil.getConfigFile("Windows2Local");
107
108
        if (ws != null) {
109
            try {
110
                ws.delete();
111
            } catch (IOException ex) {
112
                Exceptions.printStackTrace(ex);
113
            }
114
        }
115
116
        WindowManager.getDefault().invokeWhenUIReady(this);
117
    }
118
119
    @Override
120
    public void propertyChange(PropertyChangeEvent evt) {
121
        if (TopComponent.Registry.PROP_OPENED.equals(evt.getPropertyName())) {
122
            for (Mode m : WindowManager.getDefault().getModes()) {
123
                for (TopComponent topComponent : m.getTopComponents()) {
124
                    if (topComponent instanceof DesignViewComponent) {
125
                        continue;
126
                    }
127
                    topComponent.close();
128
                }
129
            }
130
        }
131
    }
132
    
133
    @Override
134
    public void run() {
135
        BIG: for (Mode m : WindowManager.getDefault().getModes()) {
136
            boolean found = false;
137
            for (TopComponent topComponent : m.getTopComponents()) {
138
                if (topComponent instanceof DesignViewComponent) {
139
                    found = true;
140
                    continue;
141
                }
142
                topComponent.close();
143
            }
144
            if (!found) {
145
                final DesignViewComponent mc = new DesignViewComponent();
146
                m.dockInto(mc);
147
                mc.open();
148
            }
149
        }
150
    }
151
    
152
    @ActionID(category = "System", id = "org.netbeans.core.windows.model.NewMode")
153
    @ActionRegistration(iconBase = "org/netbeans/core/windows/design/DesignView.png",
154
    displayName = "#CTL_NewMode")
155
    @Messages("CTL_NewMode=New Mode")
156
    public static ActionListener newModeAction() {
157
        return new ActionListener() {
158
            @Override
159
            public void actionPerformed(ActionEvent e) {
160
                DesignViewComponent dvc = new DesignViewComponent();
161
                /*
162
                WindowManagerImpl wmi = (WindowManagerImpl)WindowManager.getDefault();
163
                Mode m = wmi.createMode("mode_" + (++designModeCounter),
164
                    Constants.MODE_KIND_VIEW, Constants.MODE_KIND_VIEW, true,
165
                    new SplitConstraint[]{new SplitConstraint(Constants.HORIZONTAL, 1, 0.2)}
166
                );
167
                m.dockInto(dvc);
168
                 */
169
                dvc.open();
170
                dvc.requestAttention(true);
171
            }
172
        };
173
    }
174
}
(-)a/core.windows/src/org/netbeans/core/windows/design/DesignViewComponent.form (+109 lines)
Line 0 Link Here
1
<?xml version="1.1" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
12
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
14
  </AuxValues>
15
16
  <Layout>
17
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
19
          <Group type="102" attributes="0">
20
              <EmptySpace max="-2" attributes="0"/>
21
              <Group type="103" groupAlignment="0" attributes="0">
22
                  <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
23
                  <Component id="modeName" alignment="0" pref="500" max="32767" attributes="0"/>
24
                  <Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
25
                  <Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
26
                  <Component id="jButton1" alignment="0" min="-2" max="-2" attributes="0"/>
27
              </Group>
28
              <EmptySpace max="-2" attributes="0"/>
29
          </Group>
30
      </Group>
31
    </DimensionLayout>
32
    <DimensionLayout dim="1">
33
      <Group type="103" groupAlignment="0" attributes="0">
34
          <Group type="102" max="-2" attributes="0">
35
              <EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
36
              <Component id="jPanel1" max="32767" attributes="0"/>
37
              <EmptySpace max="-2" attributes="0"/>
38
              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
39
              <EmptySpace max="-2" attributes="0"/>
40
              <Component id="modeName" min="-2" max="-2" attributes="0"/>
41
              <EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
42
              <Component id="jButton1" min="-2" max="-2" attributes="0"/>
43
              <EmptySpace max="-2" attributes="0"/>
44
              <Component id="jPanel2" max="32767" attributes="0"/>
45
              <EmptySpace min="-2" max="-2" attributes="0"/>
46
          </Group>
47
      </Group>
48
    </DimensionLayout>
49
  </Layout>
50
  <SubComponents>
51
    <Component class="javax.swing.JTextField" name="modeName">
52
      <Properties>
53
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
54
          <ResourceString bundle="org/netbeans/core/windows/design/Bundle.properties" key="DesignViewComponent.modeName.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;, {arguments})"/>
55
        </Property>
56
      </Properties>
57
      <Events>
58
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="modeNameActionPerformed"/>
59
      </Events>
60
    </Component>
61
    <Container class="javax.swing.JPanel" name="jPanel1">
62
63
      <Layout>
64
        <DimensionLayout dim="0">
65
          <Group type="103" groupAlignment="0" attributes="0">
66
              <EmptySpace min="0" pref="500" max="32767" attributes="0"/>
67
          </Group>
68
        </DimensionLayout>
69
        <DimensionLayout dim="1">
70
          <Group type="103" groupAlignment="0" attributes="0">
71
              <EmptySpace min="0" pref="88" max="32767" attributes="0"/>
72
          </Group>
73
        </DimensionLayout>
74
      </Layout>
75
    </Container>
76
    <Container class="javax.swing.JPanel" name="jPanel2">
77
78
      <Layout>
79
        <DimensionLayout dim="0">
80
          <Group type="103" groupAlignment="0" attributes="0">
81
              <EmptySpace min="0" pref="500" max="32767" attributes="0"/>
82
          </Group>
83
        </DimensionLayout>
84
        <DimensionLayout dim="1">
85
          <Group type="103" groupAlignment="0" attributes="0">
86
              <EmptySpace min="0" pref="63" max="32767" attributes="0"/>
87
          </Group>
88
        </DimensionLayout>
89
      </Layout>
90
    </Container>
91
    <Component class="javax.swing.JLabel" name="jLabel1">
92
      <Properties>
93
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
94
          <ResourceString bundle="org/netbeans/core/windows/design/Bundle.properties" key="DesignViewComponent.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;, {arguments})"/>
95
        </Property>
96
      </Properties>
97
    </Component>
98
    <Component class="javax.swing.JButton" name="jButton1">
99
      <Properties>
100
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
101
          <ResourceString bundle="org/netbeans/core/windows/design/Bundle.properties" key="DesignViewComponent.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;, {arguments})"/>
102
        </Property>
103
      </Properties>
104
      <Events>
105
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
106
      </Events>
107
    </Component>
108
  </SubComponents>
109
</Form>
(-)a/core.windows/src/org/netbeans/core/windows/design/DesignViewComponent.java (+209 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-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
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
package org.netbeans.core.windows.design;
45
46
import org.openide.util.NbBundle;
47
import org.openide.windows.Mode;
48
import org.openide.windows.TopComponent;
49
import org.netbeans.api.settings.ConvertAsProperties;
50
import org.netbeans.core.windows.ModeImpl;
51
import org.openide.windows.WindowManager;
52
53
@ConvertAsProperties(
54
    dtd = "-//org.netbeans.core.windows.model//DesignViewComponent//EN",
55
    autostore = false
56
)
57
@TopComponent.Description(preferredID = "DesignViewComponentTopComponent",
58
    iconBase = "org/netbeans/core/windows/model/DesignView.png",
59
    persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED
60
)
61
final class DesignViewComponent extends TopComponent {
62
    DesignViewComponent() {
63
        initComponents();
64
        setName(NbBundle.getMessage(DesignViewComponent.class, "CTL_DesignViewComponentTopComponent"));
65
        setToolTipText(NbBundle.getMessage(DesignViewComponent.class, "HINT_DesignViewComponentTopComponent"));
66
        putClientProperty("TopComponentAllowDockAnywhere", true);
67
        refresh();
68
    }
69
70
    /** This method is called from within the constructor to
71
     * initialize the form.
72
     * WARNING: Do NOT modify this code. The content of this method is
73
     * always regenerated by the Form Editor.
74
     */
75
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
76
    private void initComponents() {
77
78
        modeName = new javax.swing.JTextField();
79
        jPanel1 = new javax.swing.JPanel();
80
        jPanel2 = new javax.swing.JPanel();
81
        jLabel1 = new javax.swing.JLabel();
82
        jButton1 = new javax.swing.JButton();
83
84
        modeName.setText(org.openide.util.NbBundle.getMessage(DesignViewComponent.class, "DesignViewComponent.modeName.text", new Object[] {})); // NOI18N
85
        modeName.addActionListener(new java.awt.event.ActionListener() {
86
            public void actionPerformed(java.awt.event.ActionEvent evt) {
87
                modeNameActionPerformed(evt);
88
            }
89
        });
90
91
        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
92
        jPanel1.setLayout(jPanel1Layout);
93
        jPanel1Layout.setHorizontalGroup(
94
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
95
            .addGap(0, 500, Short.MAX_VALUE)
96
        );
97
        jPanel1Layout.setVerticalGroup(
98
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
99
            .addGap(0, 88, Short.MAX_VALUE)
100
        );
101
102
        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
103
        jPanel2.setLayout(jPanel2Layout);
104
        jPanel2Layout.setHorizontalGroup(
105
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
106
            .addGap(0, 500, Short.MAX_VALUE)
107
        );
108
        jPanel2Layout.setVerticalGroup(
109
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
110
            .addGap(0, 63, Short.MAX_VALUE)
111
        );
112
113
        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(DesignViewComponent.class, "DesignViewComponent.jLabel1.text", new Object[] {})); // NOI18N
114
115
        org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(DesignViewComponent.class, "DesignViewComponent.jButton1.text", new Object[] {})); // NOI18N
116
        jButton1.addActionListener(new java.awt.event.ActionListener() {
117
            public void actionPerformed(java.awt.event.ActionEvent evt) {
118
                jButton1ActionPerformed(evt);
119
            }
120
        });
121
122
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
123
        this.setLayout(layout);
124
        layout.setHorizontalGroup(
125
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
126
            .addGroup(layout.createSequentialGroup()
127
                .addContainerGap()
128
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
129
                    .addComponent(jLabel1)
130
                    .addComponent(modeName, javax.swing.GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
131
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
132
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
133
                    .addComponent(jButton1))
134
                .addContainerGap())
135
        );
136
        layout.setVerticalGroup(
137
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
138
            .addGroup(layout.createSequentialGroup()
139
                .addGap(9, 9, 9)
140
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
141
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
142
                .addComponent(jLabel1)
143
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
144
                .addComponent(modeName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
145
                .addGap(3, 3, 3)
146
                .addComponent(jButton1)
147
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
148
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
149
                .addContainerGap())
150
        );
151
    }// </editor-fold>//GEN-END:initComponents
152
153
    private void refresh() {
154
        Mode mode = WindowManager.getDefault().findMode(this);
155
        if (mode != null) {
156
            modeName.setText(mode.getName());
157
            setName(mode.getName());
158
        }
159
    }
160
    
161
    private void modeNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modeNameActionPerformed
162
        Mode mode = WindowManager.getDefault().findMode(this);
163
        if (mode instanceof ModeImpl) {
164
            ModeImpl mi = (ModeImpl)mode;
165
            mi.setModeName(modeName.getText());
166
        }
167
168
        for (TopComponent tc : mode.getTopComponents()) {
169
            if (tc instanceof DesignViewComponent) {
170
                DesignViewComponent dvc = (DesignViewComponent)tc;
171
                dvc.refresh();
172
            }
173
        }
174
    }//GEN-LAST:event_modeNameActionPerformed
175
176
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
177
        modeNameActionPerformed(evt);
178
    }//GEN-LAST:event_jButton1ActionPerformed
179
180
    // Variables declaration - do not modify//GEN-BEGIN:variables
181
    private javax.swing.JButton jButton1;
182
    private javax.swing.JLabel jLabel1;
183
    private javax.swing.JPanel jPanel1;
184
    private javax.swing.JPanel jPanel2;
185
    private javax.swing.JTextField modeName;
186
    // End of variables declaration//GEN-END:variables
187
    
188
    @Override
189
    public void componentOpened() {
190
        refresh();
191
    }
192
193
    @Override
194
    protected void componentActivated() {
195
        refresh();
196
    }
197
198
    void writeProperties(java.util.Properties p) {
199
        // better to version settings since initial version as advocated at
200
        // http://wiki.apidesign.org/wiki/PropertyFiles
201
        p.setProperty("version", "1.0");
202
        // TODO store your settings
203
    }
204
205
    void readProperties(java.util.Properties p) {
206
        String version = p.getProperty("version");
207
        // TODO read your settings according to their version
208
    }
209
}
(-)a/core.windows/src/org/netbeans/core/windows/model/DefaultModeModel.java (-2 / +7 lines)
Lines 73-79 Link Here
73
73
74
74
75
    /** Programatic name of mode. */
75
    /** Programatic name of mode. */
76
    private final String name;
76
    private String name;
77
    
77
    
78
    private final Set<String> otherNames = new HashSet<String>(3);
78
    private final Set<String> otherNames = new HashSet<String>(3);
79
79
Lines 123-129 Link Here
123
        this.permanent = permanent;
123
        this.permanent = permanent;
124
        this.topComponentSubModel = new TopComponentSubModel(kind);
124
        this.topComponentSubModel = new TopComponentSubModel(kind);
125
    }
125
    }
126
126
    
127
    /////////////////////////////////////
127
    /////////////////////////////////////
128
    // Mutator methods >>
128
    // Mutator methods >>
129
    /////////////////////////////////////
129
    /////////////////////////////////////
Lines 380-385 Link Here
380
            return topComponentSubModel.getOpenedTopComponents();
380
            return topComponentSubModel.getOpenedTopComponents();
381
        }
381
        }
382
    }
382
    }
383
384
    @Override
385
    public final void setName(String name) {
386
        this.name = name;
387
    }
383
    
388
    
384
    // XXX
389
    // XXX
385
    @Override
390
    @Override
(-)a/core.windows/src/org/netbeans/core/windows/model/DefaultModel.java (+6 lines)
Lines 796-801 Link Here
796
            return null;
796
            return null;
797
        }
797
        }
798
    }
798
    }
799
800
    @Override
801
    public final void setModeName(ModeImpl mode, String name) {
802
        ModeModel modeModel = getModelForMode(mode);
803
        modeModel.setName(name);
804
    }
799
    
805
    
800
    /** Gets bounds. */
806
    /** Gets bounds. */
801
    @Override
807
    @Override
(-)a/core.windows/src/org/netbeans/core/windows/model/ModeModel.java (+2 lines)
Lines 62-67 Link Here
62
interface ModeModel {
62
interface ModeModel {
63
63
64
    // Mutators
64
    // Mutators
65
    /** Change name of the mode */
66
    public void setName(String name);
65
    /** Sets state. */
67
    /** Sets state. */
66
    public void setState(int state);
68
    public void setState(int state);
67
    /** Sets bounds. */
69
    /** Sets bounds. */
(-)a/core.windows/src/org/netbeans/core/windows/model/Model.java (+2 lines)
Lines 108-113 Link Here
108
    public void addModeAroundEditor(ModeImpl mode, String side);
108
    public void addModeAroundEditor(ModeImpl mode, String side);
109
    /** Removes mode. */
109
    /** Removes mode. */
110
    public void removeMode(ModeImpl mode);
110
    public void removeMode(ModeImpl mode);
111
    /** Renames a mode */
112
    public void setModeName(ModeImpl mode, String name);
111
    /** Sets mode constraints. */
113
    /** Sets mode constraints. */
112
    public void setModeConstraints(ModeImpl mode, SplitConstraint[] constraints);
114
    public void setModeConstraints(ModeImpl mode, SplitConstraint[] constraints);
113
    /** Adds top component group. */
115
    /** Adds top component group. */

Return to bug 198318