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

(-)a/j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/Bundle.properties (+1 lines)
Lines 44-46 Link Here
44
LBL_JavaEEPlusSIP=Sailfin v1
44
LBL_JavaEEPlusSIP=Sailfin v1
45
45
46
CTL_InfoAction=Java EE Usage...
46
CTL_InfoAction=Java EE Usage...
47
CTL_InfoWizard=Servers for Java EE
(-)a/j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/layer.xml (+1 lines)
Lines 312-317 Link Here
312
                <attr name="position" intvalue="550"/>
312
                <attr name="position" intvalue="550"/>
313
                <attr name="property-com.sun.aas.installRoot" boolvalue="true"/>
313
                <attr name="property-com.sun.aas.installRoot" boolvalue="true"/>
314
                <attr name="property-org.netbeans.modules.tomcat.autoregister.catalinaHome" boolvalue="true"/>
314
                <attr name="property-org.netbeans.modules.tomcat.autoregister.catalinaHome" boolvalue="true"/>
315
                <attr name="wizardMessage" bundlevalue="org.netbeans.modules.j2ee.sun.ide.Bundle#CTL_InfoWizard"/>
315
            </file>
316
            </file>
316
        </folder>
317
        </folder>
317
    </folder>
318
    </folder>
(-)a/ruby.help/src/org/netbeans/modules/ruby/help/Bundle.properties (+2 lines)
Lines 44-46 Link Here
44
    Contains the actual JavaHelp content files for the Ruby Support
44
    Contains the actual JavaHelp content files for the Ruby Support
45
45
46
CTL_InfoAction=Ruby Usage...
46
CTL_InfoAction=Ruby Usage...
47
CTL_InfoWizard=Servers for Ruby on Rails
48
(-)a/ruby.help/src/org/netbeans/modules/ruby/help/InfoAction.java (+3 lines)
Lines 48-53 Link Here
48
48
49
public final class InfoAction implements ActionListener {
49
public final class InfoAction implements ActionListener {
50
    public void actionPerformed(ActionEvent e) {
50
    public void actionPerformed(ActionEvent e) {
51
        if ("noui".equals(e.getActionCommand())) { // NOI18N
52
            return;
53
        }
51
        Help h = (Help)Lookup.getDefault().lookup(Help.class);
54
        Help h = (Help)Lookup.getDefault().lookup(Help.class);
52
        if (h == null) {
55
        if (h == null) {
53
            Toolkit.getDefaultToolkit().beep();
56
            Toolkit.getDefaultToolkit().beep();
(-)a/ruby.help/src/org/netbeans/modules/ruby/help/layer.xml (+1 lines)
Lines 22-27 Link Here
22
            <file name="org-netbeans-modules-ruby-help-InfoAction.shadow">
22
            <file name="org-netbeans-modules-ruby-help-InfoAction.shadow">
23
                <attr name="originalFile" stringvalue="Actions/Help/org-netbeans-modules-ruby-help-InfoAction.instance"/>
23
                <attr name="originalFile" stringvalue="Actions/Help/org-netbeans-modules-ruby-help-InfoAction.instance"/>
24
                <attr name="position" intvalue="650"/>
24
                <attr name="position" intvalue="650"/>
25
                <attr name="wizardMessage" bundlevalue="org.netbeans.modules.ruby.help.Bundle#CTL_InfoWizard"/>
25
            </file>
26
            </file>
26
        </folder>
27
        </folder>
27
    </folder>
28
    </folder>
(-)a/server/arch.xml (-3 / +29 lines)
Lines 72-80 Link Here
72
  </p>
72
  </p>
73
  <p>
73
  <p>
74
      <api group="layer" name="ServersNodeActions" type="export" category="devel">
74
      <api group="layer" name="ServersNodeActions" type="export" category="devel">
75
                By registering actions to <code>Servers/Actions</code> you
75
            By registering actions to <code>Servers/Actions</code> you
76
                can extend the list of popup actions on Servers node in
76
            can extend the list of popup actions on Servers node in
77
                Services tab.
77
            Services tab.
78
      </api>
79
      <api group="layer" name="ServersNodeActionsAttributes" type="export" category="friend">
80
            <p>
81
            By adding additional attributes to files in <code>Servers/Actions</code>
82
            folder you can influence behaviour of the <q>Servers</q> node.
83
            </p>
84
            <p>
85
            By adding <code>property-something</code> attribute you identify
86
            an action that will be called as soon as the node is expanded and
87
            <code>System.getProperty("something")</code> is non-null.
88
            </p>
89
            <p>
90
            By adding <code>wizardMessage</code> attribute you tell the
91
            <q>Add Server...</q> action to display this message as an
92
            option, if no servers are yet registered. If user agrees, your
93
            action will be called then to enable some server providers.
94
            </p>
95
            <p>
96
            In both of these cases, the action receives command <q>noui</q>,
97
            to know that it shall only enable given functionality, but there
98
            is no need to show user anything.
99
            </p>
100
            <p>
101
            These attribute based APIs shall be seen as temporary and subject
102
            to replacement. Please notify us as soon as you start to use them.
103
            </p>
78
      </api>
104
      </api>
79
  </p>
105
  </p>
80
 </answer>
106
 </answer>
(-)a/server/src/org/netbeans/modules/server/ui/wizard/AddServerInstanceWizard.java (-14 / +72 lines)
Lines 42-56 Link Here
42
package org.netbeans.modules.server.ui.wizard;
42
package org.netbeans.modules.server.ui.wizard;
43
43
44
import java.awt.Dialog;
44
import java.awt.Dialog;
45
import java.awt.event.ActionEvent;
45
import java.io.IOException;
46
import java.io.IOException;
46
import java.text.MessageFormat;
47
import java.text.MessageFormat;
48
import java.util.ArrayList;
47
import java.util.Collection;
49
import java.util.Collection;
50
import java.util.Enumeration;
48
import java.util.HashMap;
51
import java.util.HashMap;
52
import java.util.List;
49
import java.util.Map;
53
import java.util.Map;
50
import java.util.Set;
54
import java.util.Set;
51
import java.util.logging.Level;
55
import java.util.logging.Level;
52
import java.util.logging.Logger;
56
import java.util.logging.Logger;
57
import javax.swing.Action;
53
import javax.swing.JComponent;
58
import javax.swing.JComponent;
59
import javax.swing.JRadioButton;
54
import javax.swing.event.ChangeListener;
60
import javax.swing.event.ChangeListener;
55
import org.netbeans.api.server.ServerInstance;
61
import org.netbeans.api.server.ServerInstance;
56
import org.netbeans.modules.server.ServerRegistry;
62
import org.netbeans.modules.server.ServerRegistry;
Lines 58-63 Link Here
58
import org.openide.DialogDescriptor;
64
import org.openide.DialogDescriptor;
59
import org.openide.DialogDisplayer;
65
import org.openide.DialogDisplayer;
60
import org.openide.WizardDescriptor;
66
import org.openide.WizardDescriptor;
67
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileUtil;
69
import org.openide.util.Lookup;
61
import org.openide.util.NbBundle;
70
import org.openide.util.NbBundle;
62
import org.openide.util.lookup.Lookups;
71
import org.openide.util.lookup.Lookups;
63
72
Lines 114-134 Link Here
114
                ServerRegistry.SERVERS_PATH).lookupAll(ServerWizardProvider.class);
123
                ServerRegistry.SERVERS_PATH).lookupAll(ServerWizardProvider.class);
115
        // this will almost never happen if this module will be autoload
124
        // this will almost never happen if this module will be autoload
116
        if (providers.isEmpty()) {
125
        if (providers.isEmpty()) {
117
            // display the warning dialog - no server plugins
126
            // except we run in ergonomics mode and providers are not yet on
118
            String close = NbBundle.getMessage(AddServerInstanceWizard.class, "LBL_NoServerPlugins_Close");
127
            // inspite there some are ready
119
            DialogDescriptor descriptor = new DialogDescriptor(
128
            JRadioButton[] ready = listAvailableProviders();
120
                    NbBundle.getMessage(AddServerInstanceWizard.class, "LBL_NoServerPlugins_Text"),
129
            if (ready.length == 0) {
121
                    NbBundle.getMessage(AddServerInstanceWizard.class, "LBL_NoServerPlugins_Title"),
130
                // display the warning dialog - no server plugins
122
                    true,
131
                String close = NbBundle.getMessage(AddServerInstanceWizard.class, "LBL_NoServerPlugins_Close");
123
                    new Object[] {close},
132
                DialogDescriptor descriptor = new DialogDescriptor(
124
                    close,
133
                        NbBundle.getMessage(AddServerInstanceWizard.class, "LBL_NoServerPlugins_Text"),
125
                    DialogDescriptor.DEFAULT_ALIGN,
134
                        NbBundle.getMessage(AddServerInstanceWizard.class, "LBL_NoServerPlugins_Title"),
126
                    null,
135
                        true,
127
                    null);
136
                        new Object[] {close},
137
                        close,
138
                        DialogDescriptor.DEFAULT_ALIGN,
139
                        null,
140
                        null);
128
141
129
            // TODO invoke plugin manager once API to do that will be available
142
                // TODO invoke plugin manager once API to do that will be available
130
            DialogDisplayer.getDefault().notify(descriptor);
143
                DialogDisplayer.getDefault().notify(descriptor);
131
            return null;
144
                return null;
145
            } else {
146
                AvailableProvidersPanel available = new AvailableProvidersPanel(ready);
147
                DialogDescriptor descriptor = new DialogDescriptor(
148
                        available,
149
                        NbBundle.getMessage(AddServerInstanceWizard.class, "LBL_NoServerPlugins_Title"),
150
                        true,
151
                        new Object[] {DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION },
152
                        null,
153
                        DialogDescriptor.DEFAULT_ALIGN,
154
                        null,
155
                        null);
156
157
                DialogDisplayer.getDefault().notify(descriptor);
158
                if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
159
                    Action a = (Action)available.getSelected().getClientProperty("action"); // NOI18N
160
                    a.actionPerformed(new ActionEvent(descriptor, 0, "noui")); // NOI18N
161
                } else {
162
                    return null;
163
                }
164
            }
132
        }
165
        }
133
166
134
        AddServerInstanceWizard wizard = new AddServerInstanceWizard();
167
        AddServerInstanceWizard wizard = new AddServerInstanceWizard();
Lines 172-177 Link Here
172
            putProperty(PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(getContentSelectedIndex()));
205
            putProperty(PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(getContentSelectedIndex()));
173
        }
206
        }
174
    }
207
    }
208
209
    static JRadioButton[] listAvailableProviders() {
210
        List<JRadioButton> res = new ArrayList<JRadioButton>();
211
212
        FileObject fo = FileUtil.getConfigFile("Servers/Actions"); // NOI18N
213
        if (fo != null) {
214
            for (FileObject o : fo.getChildren()) {
215
                Object msg = o.getAttribute("wizardMessage"); // NOI18N
216
                if (msg instanceof String) {
217
                    Lookup l = Lookups.forPath("Servers/Actions"); // NOI18N
218
                    for (Lookup.Item<Action> item : l.lookupResult(Action.class).allItems()) {
219
                        if (item.getId().contains(o.getName())) {
220
                            Action a = item.getInstance();
221
                            JRadioButton button = new JRadioButton((String)msg);
222
                            button.putClientProperty("action", a); // NOI18N
223
                            res.add(button);
224
                        }
225
                    }
226
                }
227
            }
228
        }
229
230
        return res.toArray(new JRadioButton[0]);
231
    }
232
175
233
176
    private ServerWizardPanel getChooser() {
234
    private ServerWizardPanel getChooser() {
177
        if (chooser == null) {
235
        if (chooser == null) {
(-)3ee3cc758b01 (+101 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <NonVisualComponents>
5
    <Component class="javax.swing.ButtonGroup" name="radioGroup">
6
    </Component>
7
  </NonVisualComponents>
8
  <AuxValues>
9
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
10
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
11
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
12
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
14
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
15
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
16
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
17
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
18
  </AuxValues>
19
20
  <Layout>
21
    <DimensionLayout dim="0">
22
      <Group type="103" groupAlignment="0" attributes="0">
23
          <Component id="msgPanel" alignment="0" max="32767" attributes="0"/>
24
          <Group type="102" attributes="0">
25
              <EmptySpace min="12" pref="12" max="12" attributes="0"/>
26
              <Component id="radioPanel" pref="402" max="32767" attributes="0"/>
27
              <EmptySpace min="12" pref="12" max="12" attributes="0"/>
28
          </Group>
29
      </Group>
30
    </DimensionLayout>
31
    <DimensionLayout dim="1">
32
      <Group type="103" groupAlignment="0" attributes="0">
33
          <Group type="102" alignment="0" attributes="0">
34
              <Component id="msgPanel" max="32767" attributes="0"/>
35
              <EmptySpace min="-2" max="-2" attributes="0"/>
36
              <Component id="radioPanel" min="-2" max="-2" attributes="0"/>
37
              <EmptySpace min="-2" max="-2" attributes="1"/>
38
          </Group>
39
      </Group>
40
    </DimensionLayout>
41
  </Layout>
42
  <SubComponents>
43
    <Container class="javax.swing.JPanel" name="radioPanel">
44
45
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
46
        <Property name="columns" type="int" value="1"/>
47
        <Property name="rows" type="int" value="0"/>
48
      </Layout>
49
      <SubComponents>
50
        <Component class="javax.swing.JRadioButton" name="jRadioButton2">
51
          <Properties>
52
            <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
53
              <ComponentRef name="radioGroup"/>
54
            </Property>
55
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
56
              <ResourceString bundle="org/netbeans/modules/server/ui/wizard/Bundle.properties" key="AvailableProvidersPanel.jRadioButton2.text" replaceFormat="org.openide.util.NbBundle.getBundle({sourceFileName}.class).getString(&quot;{key}&quot;)"/>
57
            </Property>
58
          </Properties>
59
        </Component>
60
        <Component class="javax.swing.JRadioButton" name="jRadioButton3">
61
          <Properties>
62
            <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
63
              <ComponentRef name="radioGroup"/>
64
            </Property>
65
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
66
              <ResourceString bundle="org/netbeans/modules/server/ui/wizard/Bundle.properties" key="AvailableProvidersPanel.jRadioButton3.text" replaceFormat="org.openide.util.NbBundle.getBundle({sourceFileName}.class).getString(&quot;{key}&quot;)"/>
67
            </Property>
68
          </Properties>
69
        </Component>
70
      </SubComponents>
71
    </Container>
72
    <Container class="javax.swing.JPanel" name="msgPanel">
73
74
      <Layout>
75
        <DimensionLayout dim="0">
76
          <Group type="103" groupAlignment="0" attributes="0">
77
              <Group type="102" alignment="0" attributes="0">
78
                  <EmptySpace max="-2" attributes="0"/>
79
                  <Component id="jLabel1" pref="402" max="32767" attributes="0"/>
80
                  <EmptySpace max="-2" attributes="0"/>
81
              </Group>
82
          </Group>
83
        </DimensionLayout>
84
        <DimensionLayout dim="1">
85
          <Group type="103" groupAlignment="0" attributes="0">
86
              <Component id="jLabel1" alignment="1" pref="99" max="32767" attributes="0"/>
87
          </Group>
88
        </DimensionLayout>
89
      </Layout>
90
      <SubComponents>
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/modules/server/ui/wizard/Bundle.properties" key="MSG_AvailableProviders" replaceFormat="org.openide.util.NbBundle.getBundle({sourceFileName}.class).getString(&quot;{key}&quot;)"/>
95
            </Property>
96
          </Properties>
97
        </Component>
98
      </SubComponents>
99
    </Container>
100
  </SubComponents>
101
</Form>
(-)3ee3cc758b01 (+153 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
38
 */
39
40
/*
41
 * AvailableProvidersPanel.java
42
 *
43
 * Created on 10.4.2009, 12:12:45
44
 */
45
46
package org.netbeans.modules.server.ui.wizard;
47
48
import java.util.Enumeration;
49
import javax.swing.AbstractButton;
50
import javax.swing.JRadioButton;
51
52
/**
53
 *
54
 * @author Jaroslav Tulach <jtulach@netbeans.org>
55
 */
56
final class AvailableProvidersPanel extends javax.swing.JPanel {
57
58
    /** Creates new form AvailableProvidersPanel */
59
    public AvailableProvidersPanel(JRadioButton[] arr) {
60
        initComponents();
61
62
        radioPanel.removeAll();
63
        for (JRadioButton b : arr) {
64
            radioGroup.add(b);
65
            radioPanel.add(b);
66
        }
67
        arr[0].setSelected(true);
68
    }
69
70
    public JRadioButton getSelected() {
71
        Enumeration<AbstractButton> en = radioGroup.getElements();
72
        while (en.hasMoreElements()) {
73
            AbstractButton b = en.nextElement();
74
            if (b.isSelected()) {
75
                return (JRadioButton)b;
76
            }
77
        }
78
        throw new IllegalStateException();
79
    }
80
81
    /** This method is called from within the constructor to
82
     * initialize the form.
83
     * WARNING: Do NOT modify this code. The content of this method is
84
     * always regenerated by the Form Editor.
85
     */
86
    @SuppressWarnings("unchecked")
87
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
88
    private void initComponents() {
89
90
        radioGroup = new javax.swing.ButtonGroup();
91
        radioPanel = new javax.swing.JPanel();
92
        jRadioButton2 = new javax.swing.JRadioButton();
93
        jRadioButton3 = new javax.swing.JRadioButton();
94
        msgPanel = new javax.swing.JPanel();
95
        jLabel1 = new javax.swing.JLabel();
96
97
        radioPanel.setLayout(new java.awt.GridLayout(0, 1));
98
99
        radioGroup.add(jRadioButton2);
100
        jRadioButton2.setText(org.openide.util.NbBundle.getBundle(AvailableProvidersPanel.class).getString("AvailableProvidersPanel.jRadioButton2.text")); // NOI18N
101
        radioPanel.add(jRadioButton2);
102
103
        radioGroup.add(jRadioButton3);
104
        jRadioButton3.setText(org.openide.util.NbBundle.getBundle(AvailableProvidersPanel.class).getString("AvailableProvidersPanel.jRadioButton3.text")); // NOI18N
105
        radioPanel.add(jRadioButton3);
106
107
        jLabel1.setText(org.openide.util.NbBundle.getBundle(AvailableProvidersPanel.class).getString("MSG_AvailableProviders")); // NOI18N
108
109
        javax.swing.GroupLayout msgPanelLayout = new javax.swing.GroupLayout(msgPanel);
110
        msgPanel.setLayout(msgPanelLayout);
111
        msgPanelLayout.setHorizontalGroup(
112
            msgPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
113
            .addGroup(msgPanelLayout.createSequentialGroup()
114
                .addContainerGap()
115
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE)
116
                .addContainerGap())
117
        );
118
        msgPanelLayout.setVerticalGroup(
119
            msgPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
120
            .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE)
121
        );
122
123
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
124
        this.setLayout(layout);
125
        layout.setHorizontalGroup(
126
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
127
            .addComponent(msgPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
128
            .addGroup(layout.createSequentialGroup()
129
                .addGap(12, 12, 12)
130
                .addComponent(radioPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE)
131
                .addGap(12, 12, 12))
132
        );
133
        layout.setVerticalGroup(
134
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
135
            .addGroup(layout.createSequentialGroup()
136
                .addComponent(msgPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
137
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
138
                .addComponent(radioPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
139
                .addContainerGap())
140
        );
141
    }// </editor-fold>//GEN-END:initComponents
142
143
144
    // Variables declaration - do not modify//GEN-BEGIN:variables
145
    private javax.swing.JLabel jLabel1;
146
    private javax.swing.JRadioButton jRadioButton2;
147
    private javax.swing.JRadioButton jRadioButton3;
148
    private javax.swing.JPanel msgPanel;
149
    private javax.swing.ButtonGroup radioGroup;
150
    private javax.swing.JPanel radioPanel;
151
    // End of variables declaration//GEN-END:variables
152
153
}
(-)a/server/src/org/netbeans/modules/server/ui/wizard/Bundle.properties (+6 lines)
Lines 71-73 Link Here
71
The IDE needs a server plugin (e.g. GlassFish plugin) to enable registering<br>\
71
The IDE needs a server plugin (e.g. GlassFish plugin) to enable registering<br>\
72
and using a server. Use Plugins Manager to install server plugins.</html>
72
and using a server. Use Plugins Manager to install server plugins.</html>
73
LBL_NoServerPlugins_Close=Close
73
LBL_NoServerPlugins_Close=Close
74
MSG_AvailableProviders=<html><strong>No server plugins are enabled in the IDE right now.</strong> \
75
However some server plugins seem to be <strong>available</strong>. \
76
Please choose the type of servers you wish to work with \
77
and proceed with enabling necessary functionality.</html>
78
AvailableProvidersPanel.jRadioButton2.text=
79
AvailableProvidersPanel.jRadioButton3.text=
(-)3ee3cc758b01 (+133 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.modules.server.ui.wizard;
41
42
import java.awt.EventQueue;
43
import java.awt.event.ActionEvent;
44
import java.io.IOException;
45
import javax.swing.AbstractAction;
46
import javax.swing.JRadioButton;
47
import org.junit.Test;
48
import static org.junit.Assert.*;
49
import org.openide.filesystems.FileObject;
50
import org.openide.filesystems.FileUtil;
51
52
/**
53
 *
54
 * @author Jaroslav Tulach <jtulach@netbeans.org>
55
 */
56
public class AddServerInstanceWizardTest {
57
58
    public AddServerInstanceWizardTest() {
59
    }
60
61
    @Test
62
    public void testListAvailableProviders() throws Throwable {
63
        class Work implements Runnable {
64
            int action;
65
            Throwable t;
66
            CntAction a;
67
            CntAction b;
68
69
70
            public void run() {
71
                switch (action) {
72
                    case 0: setup(); break;
73
                    case 1: check1(); break;
74
                    default: fail();
75
                }
76
            }
77
78
            private void setup() {
79
                try {
80
                    FileObject fo = FileUtil.getConfigFile("Servers/Actions");
81
                    assertNotNull("Folder for actions precreated", fo);
82
                    a = new CntAction();
83
                    FileObject afo = fo.createData("A2.instance");
84
                    afo.setAttribute("instanceCreate", a);
85
                    afo.setAttribute("wizardMessage", "Ahoj");
86
                    afo.setAttribute("position", 309);
87
                    b = new CntAction();
88
                    FileObject bfo = fo.createData("A3.instance");
89
                    bfo.setAttribute("instanceCreate", b);
90
                    bfo.setAttribute("position", 159);
91
                } catch (IOException ex) {
92
                    this.t = ex;
93
                }
94
            }
95
96
            private void check1() {
97
                try {
98
                    JRadioButton[] result = AddServerInstanceWizard.listAvailableProviders();
99
                    assertEquals("One action found", 1, result.length);
100
                    assertEquals("Message is taken from attribute", "Ahoj", result[0].getText());
101
                    assertSame("Not part of API, but behaviour: Action is stored in property",
102
                        a,
103
                        result[0].getClientProperty("action")
104
                    );
105
                } catch (Throwable ex) {
106
                    this.t = ex;
107
                }
108
            }
109
        }
110
111
        Work w = new Work();
112
        w.action = 0;
113
        FileUtil.runAtomicAction(w);
114
        w.action = 1;
115
        EventQueue.invokeAndWait(w);
116
117
        if (w.t != null) {
118
            throw w.t;
119
        }
120
121
        
122
    }
123
124
    public static final class CntAction extends AbstractAction {
125
        int cnt;
126
127
        public void actionPerformed(ActionEvent e) {
128
            assertEquals("noui", e.getActionCommand());
129
            cnt++;
130
        }
131
    }
132
133
}

Return to bug 162274