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
(-)0b68df27a7c0 (+60 lines)
Added 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/branding/Bundle.properties (+2 lines)
Lines 134-136 Link Here
134
WindowSystemBrandingPanel.cbEnableModeSliding.text=Sliding Window Groups
134
WindowSystemBrandingPanel.cbEnableModeSliding.text=Sliding Window Groups
135
WindowSystemBrandingPanel.cbEnableModeClosing.text=Closing of Window Groups
135
WindowSystemBrandingPanel.cbEnableModeClosing.text=Closing of Window Groups
136
WindowSystemBrandingPanel.cbEnableAutoSlideInMinimizedMode.text=Auto-slide Windows in Minimized Window Groups
136
WindowSystemBrandingPanel.cbEnableAutoSlideInMinimizedMode.text=Auto-slide Windows in Minimized Window Groups
137
WindowSystemBrandingPanel.jButton1.text=jButton1
138
WindowSystemBrandingPanel.redefineLayout.text=Redefine &Layout
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/WindowSystemBrandingPanel.form (-18 / +44 lines)
Lines 1-6 Link Here
1
<?xml version="1.1" encoding="UTF-8" ?>
1
<?xml version="1.1" encoding="UTF-8" ?>
2
2
3
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <NonVisualComponents>
5
    <Component class="javax.swing.JButton" name="jButton1">
6
      <Properties>
7
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
8
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="WindowSystemBrandingPanel.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;, {arguments})"/>
9
        </Property>
10
      </Properties>
11
    </Component>
12
  </NonVisualComponents>
4
  <AccessibilityProperties>
13
  <AccessibilityProperties>
5
    <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
14
    <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
6
      <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="SuiteCustomizerWindowSystemBranding.AccessibleContext.accessibleName" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
15
      <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="SuiteCustomizerWindowSystemBranding.AccessibleContext.accessibleName" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
Lines 21-46 Link Here
21
  <Layout>
30
  <Layout>
22
    <DimensionLayout dim="0">
31
    <DimensionLayout dim="0">
23
      <Group type="103" groupAlignment="0" attributes="0">
32
      <Group type="103" groupAlignment="0" attributes="0">
24
          <Group type="102" alignment="0" attributes="0">
33
          <Group type="102" attributes="0">
25
              <EmptySpace max="-2" attributes="0"/>
26
              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
27
              <EmptySpace max="-2" attributes="0"/>
34
              <EmptySpace max="-2" attributes="0"/>
28
              <Group type="103" groupAlignment="0" attributes="0">
35
              <Group type="103" groupAlignment="0" attributes="0">
29
                  <Component id="cbEnableAutoSlideInMinimizedMode" alignment="0" min="-2" max="-2" attributes="0"/>
36
                  <Group type="102" attributes="0">
30
                  <Component id="cbEnableModeClosing" alignment="0" min="-2" max="-2" attributes="0"/>
37
                      <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
31
                  <Component id="cbEnableEditorModeDnD" alignment="0" min="-2" max="-2" attributes="0"/>
38
                      <EmptySpace max="-2" attributes="0"/>
32
                  <Component id="cbEnableViewModeDnD" alignment="0" min="-2" max="-2" attributes="0"/>
39
                      <Group type="103" groupAlignment="0" attributes="0">
33
                  <Component id="cbEnableEditorModeUndocking" alignment="0" min="-2" max="-2" attributes="0"/>
40
                          <Component id="cbEnableAutoSlideInMinimizedMode" alignment="0" min="-2" max="-2" attributes="0"/>
34
                  <Component id="cbEnableViewModeUndocking" alignment="0" min="-2" max="-2" attributes="0"/>
41
                          <Component id="cbEnableModeClosing" alignment="0" min="-2" max="-2" attributes="0"/>
35
                  <Component id="cbEnableModeSliding" alignment="0" min="-2" max="-2" attributes="0"/>
42
                          <Component id="cbEnableEditorModeDnD" alignment="0" min="-2" max="-2" attributes="0"/>
36
                  <Component id="cbEnableEditorClosing" alignment="0" min="-2" max="-2" attributes="0"/>
43
                          <Component id="cbEnableViewModeDnD" alignment="0" min="-2" max="-2" attributes="0"/>
37
                  <Component id="cbEnableMinimumSize" alignment="0" min="-2" max="-2" attributes="0"/>
44
                          <Component id="cbEnableEditorModeUndocking" alignment="0" min="-2" max="-2" attributes="0"/>
38
                  <Component id="cbEnableFloating" alignment="0" min="-2" max="-2" attributes="0"/>
45
                          <Component id="cbEnableViewModeUndocking" alignment="0" min="-2" max="-2" attributes="0"/>
39
                  <Component id="cbEnableSliding" alignment="0" min="-2" max="-2" attributes="0"/>
46
                          <Component id="cbEnableModeSliding" alignment="0" min="-2" max="-2" attributes="0"/>
40
                  <Component id="cbEnableMaximization" alignment="0" min="-2" max="-2" attributes="0"/>
47
                          <Component id="cbEnableEditorClosing" alignment="0" min="-2" max="-2" attributes="0"/>
41
                  <Component id="cbEnableViewClosing" alignment="0" min="-2" max="-2" attributes="0"/>
48
                          <Component id="cbEnableMinimumSize" alignment="0" min="-2" max="-2" attributes="0"/>
42
                  <Component id="cbEnableResizing" alignment="0" min="-2" max="-2" attributes="0"/>
49
                          <Component id="cbEnableFloating" alignment="0" min="-2" max="-2" attributes="0"/>
43
                  <Component id="cbEnableDnd" min="-2" max="-2" attributes="0"/>
50
                          <Component id="cbEnableSliding" alignment="0" min="-2" max="-2" attributes="0"/>
51
                          <Component id="cbEnableMaximization" alignment="0" min="-2" max="-2" attributes="0"/>
52
                          <Component id="cbEnableViewClosing" alignment="0" min="-2" max="-2" attributes="0"/>
53
                          <Component id="cbEnableResizing" alignment="0" min="-2" max="-2" attributes="0"/>
54
                          <Component id="cbEnableDnd" min="-2" max="-2" attributes="0"/>
55
                      </Group>
56
                  </Group>
57
                  <Component id="redefineLayout" alignment="0" min="-2" max="-2" attributes="0"/>
44
              </Group>
58
              </Group>
45
              <EmptySpace pref="127" max="32767" attributes="0"/>
59
              <EmptySpace pref="127" max="32767" attributes="0"/>
46
          </Group>
60
          </Group>
Lines 82-87 Link Here
82
              <Component id="cbEnableResizing" min="-2" max="-2" attributes="0"/>
96
              <Component id="cbEnableResizing" min="-2" max="-2" attributes="0"/>
83
              <EmptySpace max="-2" attributes="0"/>
97
              <EmptySpace max="-2" attributes="0"/>
84
              <Component id="cbEnableMinimumSize" min="-2" max="-2" attributes="0"/>
98
              <Component id="cbEnableMinimumSize" min="-2" max="-2" attributes="0"/>
99
              <EmptySpace max="-2" attributes="0"/>
100
              <Component id="redefineLayout" min="-2" max="-2" attributes="0"/>
85
              <EmptySpace max="32767" attributes="0"/>
101
              <EmptySpace max="32767" attributes="0"/>
86
          </Group>
102
          </Group>
87
      </Group>
103
      </Group>
Lines 259-263 Link Here
259
        </Property>
275
        </Property>
260
      </Properties>
276
      </Properties>
261
    </Component>
277
    </Component>
278
    <Component class="javax.swing.JButton" name="redefineLayout">
279
      <Properties>
280
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
281
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="WindowSystemBrandingPanel.redefineLayout.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;, {arguments})"/>
282
        </Property>
283
      </Properties>
284
      <Events>
285
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="redefineLayoutActionPerformed"/>
286
      </Events>
287
    </Component>
262
  </SubComponents>
288
  </SubComponents>
263
</Form>
289
</Form>
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/WindowSystemBrandingPanel.java (-17 / +41 lines)
Lines 47-52 Link Here
47
import org.netbeans.modules.apisupport.project.spi.BrandingModel;
47
import org.netbeans.modules.apisupport.project.spi.BrandingModel;
48
import java.awt.event.ItemEvent;
48
import java.awt.event.ItemEvent;
49
import java.awt.event.ItemListener;
49
import java.awt.event.ItemListener;
50
import org.netbeans.modules.apisupport.project.ui.wizard.winsys.DesignSupport;
50
import org.openide.util.NbBundle;
51
import org.openide.util.NbBundle;
51
52
52
/**
53
/**
Lines 159-164 Link Here
159
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
160
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
160
    private void initComponents() {
161
    private void initComponents() {
161
162
163
        jButton1 = new javax.swing.JButton();
162
        cbEnableDnd = new javax.swing.JCheckBox();
164
        cbEnableDnd = new javax.swing.JCheckBox();
163
        cbEnableFloating = new javax.swing.JCheckBox();
165
        cbEnableFloating = new javax.swing.JCheckBox();
164
        cbEnableSliding = new javax.swing.JCheckBox();
166
        cbEnableSliding = new javax.swing.JCheckBox();
Lines 175-180 Link Here
175
        cbEnableEditorModeDnD = new javax.swing.JCheckBox();
177
        cbEnableEditorModeDnD = new javax.swing.JCheckBox();
176
        cbEnableModeClosing = new javax.swing.JCheckBox();
178
        cbEnableModeClosing = new javax.swing.JCheckBox();
177
        cbEnableAutoSlideInMinimizedMode = new javax.swing.JCheckBox();
179
        cbEnableAutoSlideInMinimizedMode = new javax.swing.JCheckBox();
180
        redefineLayout = new javax.swing.JButton();
181
182
        org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(WindowSystemBrandingPanel.class, "WindowSystemBrandingPanel.jButton1.text", new Object[] {})); // NOI18N
178
183
179
        cbEnableDnd.setMnemonic('D');
184
        cbEnableDnd.setMnemonic('D');
180
        org.openide.awt.Mnemonics.setLocalizedText(cbEnableDnd, org.openide.util.NbBundle.getMessage(WindowSystemBrandingPanel.class, "LBL_EnableDnD")); // NOI18N
185
        org.openide.awt.Mnemonics.setLocalizedText(cbEnableDnd, org.openide.util.NbBundle.getMessage(WindowSystemBrandingPanel.class, "LBL_EnableDnD")); // NOI18N
Lines 216-245 Link Here
216
221
217
        org.openide.awt.Mnemonics.setLocalizedText(cbEnableAutoSlideInMinimizedMode, NbBundle.getMessage(WindowSystemBrandingPanel.class, "WindowSystemBrandingPanel.cbEnableAutoSlideInMinimizedMode.text")); // NOI18N
222
        org.openide.awt.Mnemonics.setLocalizedText(cbEnableAutoSlideInMinimizedMode, NbBundle.getMessage(WindowSystemBrandingPanel.class, "WindowSystemBrandingPanel.cbEnableAutoSlideInMinimizedMode.text")); // NOI18N
218
223
224
        org.openide.awt.Mnemonics.setLocalizedText(redefineLayout, org.openide.util.NbBundle.getMessage(WindowSystemBrandingPanel.class, "WindowSystemBrandingPanel.redefineLayout.text", new Object[] {})); // NOI18N
225
        redefineLayout.addActionListener(new java.awt.event.ActionListener() {
226
            public void actionPerformed(java.awt.event.ActionEvent evt) {
227
                redefineLayoutActionPerformed(evt);
228
            }
229
        });
230
219
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
231
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
220
        this.setLayout(layout);
232
        this.setLayout(layout);
221
        layout.setHorizontalGroup(
233
        layout.setHorizontalGroup(
222
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
234
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
223
            .addGroup(layout.createSequentialGroup()
235
            .addGroup(layout.createSequentialGroup()
224
                .addContainerGap()
236
                .addContainerGap()
225
                .addComponent(jLabel1)
226
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
227
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
237
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
228
                    .addComponent(cbEnableAutoSlideInMinimizedMode)
238
                    .addGroup(layout.createSequentialGroup()
229
                    .addComponent(cbEnableModeClosing)
239
                        .addComponent(jLabel1)
230
                    .addComponent(cbEnableEditorModeDnD)
240
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
231
                    .addComponent(cbEnableViewModeDnD)
241
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
232
                    .addComponent(cbEnableEditorModeUndocking)
242
                            .addComponent(cbEnableAutoSlideInMinimizedMode)
233
                    .addComponent(cbEnableViewModeUndocking)
243
                            .addComponent(cbEnableModeClosing)
234
                    .addComponent(cbEnableModeSliding)
244
                            .addComponent(cbEnableEditorModeDnD)
235
                    .addComponent(cbEnableEditorClosing)
245
                            .addComponent(cbEnableViewModeDnD)
236
                    .addComponent(cbEnableMinimumSize)
246
                            .addComponent(cbEnableEditorModeUndocking)
237
                    .addComponent(cbEnableFloating)
247
                            .addComponent(cbEnableViewModeUndocking)
238
                    .addComponent(cbEnableSliding)
248
                            .addComponent(cbEnableModeSliding)
239
                    .addComponent(cbEnableMaximization)
249
                            .addComponent(cbEnableEditorClosing)
240
                    .addComponent(cbEnableViewClosing)
250
                            .addComponent(cbEnableMinimumSize)
241
                    .addComponent(cbEnableResizing)
251
                            .addComponent(cbEnableFloating)
242
                    .addComponent(cbEnableDnd))
252
                            .addComponent(cbEnableSliding)
253
                            .addComponent(cbEnableMaximization)
254
                            .addComponent(cbEnableViewClosing)
255
                            .addComponent(cbEnableResizing)
256
                            .addComponent(cbEnableDnd)))
257
                    .addComponent(redefineLayout))
243
                .addContainerGap(127, Short.MAX_VALUE))
258
                .addContainerGap(127, Short.MAX_VALUE))
244
        );
259
        );
245
        layout.setVerticalGroup(
260
        layout.setVerticalGroup(
Lines 277-282 Link Here
277
                .addComponent(cbEnableResizing)
292
                .addComponent(cbEnableResizing)
278
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
293
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
279
                .addComponent(cbEnableMinimumSize)
294
                .addComponent(cbEnableMinimumSize)
295
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
296
                .addComponent(redefineLayout)
280
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
297
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
281
        );
298
        );
282
299
Lines 294-299 Link Here
294
311
295
        getAccessibleContext().setAccessibleName(NbBundle.getMessage(WindowSystemBrandingPanel.class, "SuiteCustomizerWindowSystemBranding.AccessibleContext.accessibleName")); // NOI18N
312
        getAccessibleContext().setAccessibleName(NbBundle.getMessage(WindowSystemBrandingPanel.class, "SuiteCustomizerWindowSystemBranding.AccessibleContext.accessibleName")); // NOI18N
296
    }// </editor-fold>//GEN-END:initComponents
313
    }// </editor-fold>//GEN-END:initComponents
314
315
private void redefineLayoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_redefineLayoutActionPerformed
316
    redefineLayout.setEnabled(false);
317
    DesignSupport.redefineLayout(getBranding().getProject(), redefineLayout);
318
}//GEN-LAST:event_redefineLayoutActionPerformed
297
            
319
            
298
    
320
    
299
    // Variables declaration - do not modify//GEN-BEGIN:variables
321
    // Variables declaration - do not modify//GEN-BEGIN:variables
Lines 312-317 Link Here
312
    private javax.swing.JCheckBox cbEnableViewClosing;
334
    private javax.swing.JCheckBox cbEnableViewClosing;
313
    private javax.swing.JCheckBox cbEnableViewModeDnD;
335
    private javax.swing.JCheckBox cbEnableViewModeDnD;
314
    private javax.swing.JCheckBox cbEnableViewModeUndocking;
336
    private javax.swing.JCheckBox cbEnableViewModeUndocking;
337
    private javax.swing.JButton jButton1;
315
    private javax.swing.JLabel jLabel1;
338
    private javax.swing.JLabel jLabel1;
339
    private javax.swing.JButton redefineLayout;
316
    // End of variables declaration//GEN-END:variables
340
    // End of variables declaration//GEN-END:variables
317
}
341
}
(-)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 (-1 / +88 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;
49
import java.io.File;
48
import java.io.IOException;
50
import java.io.IOException;
49
import java.util.ArrayList;
51
import java.util.ArrayList;
50
import java.util.Collection;
52
import java.util.Collection;
53
import java.util.MissingResourceException;
54
import java.util.Properties;
55
import java.util.Set;
56
import java.util.TreeSet;
57
import java.util.concurrent.atomic.AtomicReference;
51
import javax.swing.DefaultComboBoxModel;
58
import javax.swing.DefaultComboBoxModel;
59
import org.netbeans.api.project.Project;
60
import org.netbeans.modules.apisupport.project.api.Util;
52
import org.netbeans.modules.apisupport.project.layers.LayerUtils;
61
import org.netbeans.modules.apisupport.project.layers.LayerUtils;
62
import org.netbeans.modules.apisupport.project.spi.ExecProject;
53
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
63
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
64
import org.openide.DialogDisplayer;
65
import org.openide.NotifyDescriptor;
54
import org.openide.WizardDescriptor;
66
import org.openide.WizardDescriptor;
55
import org.openide.filesystems.FileObject;
67
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileSystem;
68
import org.openide.filesystems.FileSystem;
69
import org.openide.filesystems.FileUtil;
57
import org.openide.util.AsyncGUIJob;
70
import org.openide.util.AsyncGUIJob;
71
import org.openide.util.Exceptions;
58
import org.openide.util.HelpCtx;
72
import org.openide.util.HelpCtx;
59
import org.openide.util.NbBundle;
73
import org.openide.util.NbBundle;
74
import org.openide.util.Task;
75
import org.openide.util.TaskListener;
60
import org.openide.util.Utilities;
76
import org.openide.util.Utilities;
61
77
62
/**
78
/**
Lines 93-99 Link Here
93
            markInvalid();
109
            markInvalid();
94
        }
110
        }
95
    }
111
    }
96
    
112
97
//    public void addNotify() {
113
//    public void addNotify() {
98
//        super.addNotify();
114
//        super.addNotify();
99
//        attachDocumentListeners();
115
//        attachDocumentListeners();
Lines 138-143 Link Here
138
                        for (FileObject fo : fos) {
154
                        for (FileObject fo : fos) {
139
                            if (fo.isData() && "wsmode".equals(fo.getExt())) { //NOI18N
155
                            if (fo.isData() && "wsmode".equals(fo.getExt())) { //NOI18N
140
                                col.add(fo.getName());
156
                                col.add(fo.getName());
157
                                data.existingMode(fo.getName());
141
                            }
158
                            }
142
                        }
159
                        }
143
                        modes = col.toArray(new String[col.size()]);
160
                        modes = col.toArray(new String[col.size()]);
Lines 224-229 Link Here
224
        cbUndockingNotAllowed = new javax.swing.JCheckBox();
241
        cbUndockingNotAllowed = new javax.swing.JCheckBox();
225
        cbDraggingNotAllowed = new javax.swing.JCheckBox();
242
        cbDraggingNotAllowed = new javax.swing.JCheckBox();
226
        cbMaximizationNotAllowed = new javax.swing.JCheckBox();
243
        cbMaximizationNotAllowed = new javax.swing.JCheckBox();
244
        redefine = new javax.swing.JButton();
227
245
228
        setLayout(new java.awt.GridBagLayout());
246
        setLayout(new java.awt.GridBagLayout());
229
247
Lines 320-325 Link Here
320
        gridBagConstraints.weighty = 0.1;
338
        gridBagConstraints.weighty = 0.1;
321
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
339
        gridBagConstraints.insets = new java.awt.Insets(12, 6, 0, 0);
322
        add(cbMaximizationNotAllowed, gridBagConstraints);
340
        add(cbMaximizationNotAllowed, gridBagConstraints);
341
342
        org.openide.awt.Mnemonics.setLocalizedText(redefine, "&Redefine...");
343
        redefine.addActionListener(new java.awt.event.ActionListener() {
344
            public void actionPerformed(java.awt.event.ActionEvent evt) {
345
                redefineActionPerformed(evt);
346
            }
347
        });
348
        gridBagConstraints = new java.awt.GridBagConstraints();
349
        gridBagConstraints.anchor = java.awt.GridBagConstraints.PAGE_END;
350
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
351
        add(redefine, gridBagConstraints);
323
    }// </editor-fold>//GEN-END:initComponents
352
    }// </editor-fold>//GEN-END:initComponents
324
353
325
private void windowPosChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_windowPosChanged
354
private void windowPosChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_windowPosChanged
Lines 330-335 Link Here
330
    if( !cbSlidingNotAllowed.isEnabled() )
359
    if( !cbSlidingNotAllowed.isEnabled() )
331
        cbSlidingNotAllowed.setSelected( false );
360
        cbSlidingNotAllowed.setSelected( false );
332
}//GEN-LAST:event_windowPosChanged
361
}//GEN-LAST:event_windowPosChanged
362
363
private void redefineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_redefineActionPerformed
364
    try {
365
        final AtomicReference<FileObject> userDir = new AtomicReference<FileObject>();
366
        Task task = DesignSupport.invokeDesignMode(data.getProject(), userDir);
367
        redefine.setEnabled(false);
368
        if (task == null) {
369
            return;
370
        }
371
        redefine.setText(org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "MSG_LaunchingLayout", new Object[]{}));
372
        
373
        class PostProcess implements TaskListener, Runnable {
374
            Set<String> modeNames;
375
            
376
            @Override
377
            public void taskFinished(Task task) {
378
                FileObject modes = userDir.get().getFileObject("config/Windows2Local/Modes");
379
                if (modes != null) {
380
                    modeNames = new TreeSet<String>();
381
                    for (FileObject m : modes.getChildren()) {
382
                        if (m.isData() && "wsmode".equals(m.getExt())) { //NOI18N
383
                            modeNames.add(m.getName());
384
                            try {
385
                                data.defineMode(m.getName(), DesignSupport.readMode(m));
386
                            } catch (IOException ex) {
387
                                Exceptions.printStackTrace(ex);
388
                            }
389
                        }
390
                    }
391
                    EventQueue.invokeLater(this);
392
                }
393
            }
394
395
            @Override
396
            public void run() {
397
                redefine.setEnabled(true);
398
                redefine.setText(org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "MSG_RedefineLayout", new Object[] {}));
399
                int s = comMode.getModel().getSize();
400
                for (int i = 0; i < s; i++) {
401
                    modeNames.remove((String)comMode.getModel().getElementAt(i));
402
                }
403
                boolean first = true;
404
                for (String mn : modeNames) {
405
                    ((DefaultComboBoxModel)comMode.getModel()).addElement(mn);
406
                    if (first) {
407
                        comMode.getModel().setSelectedItem(mn);
408
                    }
409
                    first = false;
410
                }
411
            }
412
        }
413
        task.addTaskListener(new PostProcess());
414
    } catch (IOException e) {
415
        Util.err.notify(e);
416
    }
417
    
418
}//GEN-LAST:event_redefineActionPerformed
333
    
419
    
334
    // Variables declaration - do not modify//GEN-BEGIN:variables
420
    // Variables declaration - do not modify//GEN-BEGIN:variables
335
    private javax.swing.JCheckBox cbClosingNotAllowed;
421
    private javax.swing.JCheckBox cbClosingNotAllowed;
Lines 341-346 Link Here
341
    private javax.swing.JCheckBox cbUndockingNotAllowed;
427
    private javax.swing.JCheckBox cbUndockingNotAllowed;
342
    private javax.swing.JComboBox comMode;
428
    private javax.swing.JComboBox comMode;
343
    private javax.swing.JLabel lblMode;
429
    private javax.swing.JLabel lblMode;
430
    private javax.swing.JButton redefine;
344
    // End of variables declaration//GEN-END:variables
431
    // End of variables declaration//GEN-END:variables
345
    
432
    
346
    private void initAccessibility() {
433
    private void initAccessibility() {
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/Bundle.properties (+12 lines)
Lines 84-86 Link Here
84
CTL_UndockingNotAllowed=&Undocking not allowed
84
CTL_UndockingNotAllowed=&Undocking not allowed
85
CTL_DraggingNotAllowed=&Dragging not allowed
85
CTL_DraggingNotAllowed=&Dragging not allowed
86
CTL_MaximizationNotAllowed=&Maximization not allowed
86
CTL_MaximizationNotAllowed=&Maximization not allowed
87
MSG_RedefineLayout=Redefine...
88
MSG_LaunchingLayout=Launching...
89
MSG_ReallyLaunch=Following action needs to start your application in a special mode.\n\
90
This requires your application is compilable, executable and does\n\
91
not do anything strange.\n\
92
\n\
93
\As soon as the application is launched, you can play with the layout,\n\
94
create new modes, rename existing. Close the application to save changes.\n\
95
\n\
96
Do you want to proceed?
97
MSG_AlreadyLaunched=Your application may have already been started in design mode.\nContinue with another launch anyway?
98
MSG_ModesGenerated=Following modes has been generated:\\n{0}
(-)0b68df27a7c0 (+202 lines)
Added 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.SortedMap;
51
import java.util.TreeMap;
52
import java.util.concurrent.atomic.AtomicReference;
53
import javax.swing.JButton;
54
import javax.xml.transform.Result;
55
import javax.xml.transform.Source;
56
import javax.xml.transform.Transformer;
57
import javax.xml.transform.TransformerException;
58
import javax.xml.transform.TransformerFactory;
59
import javax.xml.transform.stream.StreamResult;
60
import javax.xml.transform.stream.StreamSource;
61
import org.netbeans.api.project.Project;
62
import org.netbeans.modules.apisupport.project.layers.LayerUtils;
63
import org.netbeans.modules.apisupport.project.spi.ExecProject;
64
import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
65
import org.netbeans.spi.project.SubprojectProvider;
66
import org.openide.DialogDisplayer;
67
import org.openide.NotifyDescriptor;
68
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileSystem;
70
import org.openide.filesystems.FileUtil;
71
import org.openide.util.Exceptions;
72
import org.openide.util.NbBundle;
73
import org.openide.util.Task;
74
import org.openide.util.TaskListener;
75
76
public final class DesignSupport implements TaskListener, Runnable {
77
    private final Project project;
78
    private final JButton toEnable;
79
    private final AtomicReference<FileObject> userDir;
80
81
82
    private DesignSupport(Project p, JButton toEnable, AtomicReference<FileObject> ud) {
83
        this.project = p;
84
        this.toEnable = toEnable;
85
        this.userDir = ud;
86
    }
87
    
88
    
89
    public static Task invokeDesignMode(Project prj, AtomicReference<FileObject> userDir) throws IOException {
90
        ExecProject es = prj.getLookup().lookup(ExecProject.class);
91
        if (es == null) {
92
            return null;
93
        }
94
        NotifyDescriptor nd = new NotifyDescriptor.Confirmation(org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "MSG_ReallyLaunch", new Object[]{}));
95
        nd.setOptions(new Object[]{NotifyDescriptor.YES_OPTION, NotifyDescriptor.CANCEL_OPTION});
96
        if (DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.YES_OPTION) {
97
            return null;
98
        }
99
        FileObject fo = prj.getProjectDirectory().getFileObject("build/designdir"); // NOI18N
100
        if (fo != null) {
101
            nd = new NotifyDescriptor.Confirmation(org.openide.util.NbBundle.getMessage(BasicSettingsPanel.class, "MSG_AlreadyLaunched", new Object[]{}));
102
            nd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
103
            if (DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.OK_OPTION) {
104
                return null;
105
            }
106
            fo.delete();
107
        }
108
        fo = FileUtil.createFolder(prj.getProjectDirectory(), "build/designdir"); // NOI18N
109
        File path = FileUtil.toFile(fo);
110
        userDir.set(fo);
111
        return es.execute(
112
                "--nosplash", // NOI18N
113
                "-J-Dorg.netbeans.core.WindowSystem.designMode=true", // NOI18N
114
                "--userdir " + path // NOI18N
115
                );
116
    }
117
    
118
    public static String readMode(FileObject fo) throws IOException {
119
        final InputStream is = fo.getInputStream();
120
        try {
121
            StringWriter w = new StringWriter();
122
            Source t = new StreamSource(DesignSupport.class.getResourceAsStream("polishing.xsl")); // NOI18N
123
            Transformer tr = TransformerFactory.newInstance().newTransformer(t);
124
            Source s = new StreamSource(is);
125
            Result r = new StreamResult(w);
126
            tr.transform(s, r);
127
            return w.toString();
128
        } catch (TransformerException ex) {
129
            throw new IOException(ex);
130
        } finally {
131
            is.close();
132
        }
133
    }
134
    public static void redefineLayout(Project p, JButton toEnable) {
135
        try {
136
            AtomicReference<FileObject> userDir = new AtomicReference<FileObject>();
137
            Task task = invokeDesignMode(p, userDir);
138
            if (task == null) {
139
                toEnable.setEnabled(true);
140
            }
141
            task.addTaskListener(new DesignSupport(p, toEnable, userDir));
142
        } catch (IOException ex) {
143
            Exceptions.printStackTrace(ex);
144
        }
145
    }
146
147
    @Override
148
    public void taskFinished(Task task) {
149
        FileObject modeDir = userDir.get().getFileObject("config/Windows2Local/Modes");
150
        OutputStream os;
151
        if (modeDir != null) {
152
            StringBuilder sb = new StringBuilder();
153
            try {
154
                
155
                FileSystem layer = findLayer(project);
156
                if (layer == null) {
157
                    throw new IOException("Cannot find layer in " + project); // NOI18N
158
                }
159
                for (FileObject m : modeDir.getChildren()) {
160
                    if (m.isData() && "wsmode".equals(m.getExt())) { 
161
                        final String name = "Windows2/Modes/" + m.getNameExt(); // NOI18N
162
                        FileObject mode = FileUtil.createData(layer.getRoot(), name); // NOI18N
163
                        os = mode.getOutputStream();
164
                        os.write(DesignSupport.readMode(m).getBytes("UTF-8")); // NOI18N
165
                        os.close();
166
                        sb.append(name).append("\n");
167
                    }
168
                }
169
                NotifyDescriptor nd = new NotifyDescriptor.Message(
170
                    NbBundle.getMessage(DesignSupport.class, "MSG_ModesGenerated", new Object[] {sb}), 
171
                    NotifyDescriptor.INFORMATION_MESSAGE
172
                );
173
                DialogDisplayer.getDefault().notifyLater(nd);
174
            } catch (IOException ex) {
175
                Exceptions.printStackTrace(ex);
176
            }
177
        }
178
        EventQueue.invokeLater(this);
179
    }
180
181
    @Override
182
    public void run() {
183
        toEnable.setEnabled(true);
184
    }
185
    
186
    private static FileSystem findLayer(Project p) throws IOException {
187
        if (p.getLookup().lookup(NbModuleProvider.class) != null) {
188
            return LayerUtils.getEffectiveSystemFilesystem(p);
189
        }
190
        SubprojectProvider lookup = p.getLookup().lookup(SubprojectProvider.class);
191
        if (lookup == null) {
192
            return null;
193
        }
194
        for (Project project : lookup.getSubprojects()) {
195
            FileSystem fs = findLayer(project);
196
            if (fs != null) {
197
                return fs;
198
            }
199
        }
200
        return null;
201
    }
202
}
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/NewTCIterator.java (-1 / +53 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 111-116 Link Here
111
        private boolean draggingNotAllowed = false;
115
        private boolean draggingNotAllowed = false;
112
        private boolean undockingNotAllowed = false;
116
        private boolean undockingNotAllowed = false;
113
        private boolean maximizationNotAllowed = false;
117
        private boolean maximizationNotAllowed = false;
118
        private Map<String,String> newModes;
119
        private Set<String> existingModes;
114
        
120
        
115
        private CreatedModifiedFiles files;
121
        private CreatedModifiedFiles files;
116
        
122
        
Lines 153-158 Link Here
153
        public String getMode() {
159
        public String getMode() {
154
            return mode;
160
            return mode;
155
        }
161
        }
162
        
163
        public void defineMode(String name, String definition) {
164
            if (newModes == null) {
165
                newModes = new TreeMap<String, String>();
166
            }
167
            newModes.put(name, definition);
168
        }
169
        void existingMode(String name) {
170
            if (existingModes == null) {
171
                existingModes = new TreeSet<String>();
172
            }
173
            existingModes.add(name);
174
        }
175
        
176
        Map<String,String> getNewModes() {
177
            if (newModes == null) {
178
                return null;
179
            }
180
            TreeMap<String,String> copy = new TreeMap<String,String>(newModes);
181
            copy.keySet().removeAll(existingModes);
182
            return copy.isEmpty() ? null : copy;
183
        }
156
184
157
        public void setMode(String mode) {
185
        public void setMode(String mode) {
158
            this.mode = mode;
186
            this.mode = mode;
Lines 215-221 Link Here
215
        }
243
        }
216
    }
244
    }
217
    
245
    
218
    public static void generateFileChanges(DataModel model) {
246
    public static void generateFileChanges(final DataModel model) {
219
        CreatedModifiedFiles fileChanges = new CreatedModifiedFiles(model.getProject());
247
        CreatedModifiedFiles fileChanges = new CreatedModifiedFiles(model.getProject());
220
        Project project = model.getProject();
248
        Project project = model.getProject();
221
        NbModuleProvider moduleInfo = model.getModuleInfo();
249
        NbModuleProvider moduleInfo = model.getModuleInfo();
Lines 377-382 Link Here
377
        fileChanges.add(fileChanges.bundleKey(bundlePath, "HINT_" + name + "TopComponent",  // NOI18N
405
        fileChanges.add(fileChanges.bundleKey(bundlePath, "HINT_" + name + "TopComponent",  // NOI18N
378
                                "This is a " + name + " window")); //NOI18N
406
                                "This is a " + name + " window")); //NOI18N
379
        
407
        
408
        final Map<String, String> newModes = model.getNewModes();
409
        if (newModes != null) {
410
            Set<String> files = new HashSet<String>();
411
            for (String wsmode : newModes.keySet()) {
412
                files.add(wsmode + ".wsmode");
413
            }
414
            
415
            fileChanges.add(fileChanges.layerModifications(new CreatedModifiedFiles.LayerOperation() {
416
                @Override
417
                public void run(FileSystem layer) throws IOException {
418
                    FileObject fo = FileUtil.createFolder(layer.getRoot(), "Windows2/Modes");
419
                    for (Map.Entry<String, String> entry : newModes.entrySet()) {
420
                        FileObject wsmode = fo.createData(entry.getKey() + ".wsmode");
421
                        OutputStream os = wsmode.getOutputStream();
422
                        try {
423
                            os.write(entry.getValue().getBytes("UTF-8"));
424
                        } finally {
425
                            os.close();
426
                        }
427
                    }
428
                }   
429
            }, files));
430
        }
431
        
380
        model.setCreatedModifiedFiles(fileChanges);
432
        model.setCreatedModifiedFiles(fileChanges);
381
    }
433
    }
382
434
(-)0b68df27a7c0 (+20 lines)
Added 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>
(-)0b68df27a7c0 (+76 lines)
Added 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
}
(-)0b68df27a7c0 (+15 lines)
Added 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
(-)0b68df27a7c0 (+46 lines)
Added 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
(-)0b68df27a7c0 (+174 lines)
Added 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
}
(-)0b68df27a7c0 (+109 lines)
Added 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>
(-)0b68df27a7c0 (+209 lines)
Added 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