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

(-)a/options.keymap/nbproject/project.properties (-1 / +1 lines)
Lines 1-5 Link Here
1
javac.compilerargs=-Xlint:unchecked
1
javac.compilerargs=-Xlint:unchecked
2
javac.source=1.6
2
javac.source=1.7
3
javadoc.arch=${basedir}/arch.xml
3
javadoc.arch=${basedir}/arch.xml
4
javadoc.apichanges=${basedir}/apichanges.xml
4
javadoc.apichanges=${basedir}/apichanges.xml
5
5
(-)a/options.keymap/src/org/netbeans/modules/options/keymap/Bundle.properties (+2 lines)
Lines 200-202 Link Here
200
Import.failed.title=Import Keymap Profile
200
Import.failed.title=Import Keymap Profile
201
KeymapPanel.waitLabel.text=Please wait while actions are collected
201
KeymapPanel.waitLabel.text=Please wait while actions are collected
202
KeymapPanel.actionProgress.string=Please wait while actions load
202
KeymapPanel.actionProgress.string=Please wait while actions load
203
KeymapPanel.btnPrintAsHTML.text=Show as HTML
204
KeymapPanel.btnPrintAsHTML.toolTipText=Generate a printable HTML-file for the current keymap-profile and open it in the HTML-Browser.
(-)a/options.keymap/src/org/netbeans/modules/options/keymap/ExportShortcutsAction.java (-15 / +74 lines)
Lines 53-77 Link Here
53
import java.io.OutputStreamWriter;
53
import java.io.OutputStreamWriter;
54
import java.io.Writer;
54
import java.io.Writer;
55
import java.util.ArrayList;
55
import java.util.ArrayList;
56
import java.util.Arrays;
57
import java.util.Collection;
56
import java.util.Collections;
58
import java.util.Collections;
57
import java.util.HashMap;
59
import java.util.HashMap;
58
import java.util.Iterator;
60
import java.util.Iterator;
59
import java.util.List;
61
import java.util.List;
60
import java.util.Map;
62
import java.util.Map;
61
import java.util.Set;
63
import java.util.Set;
64
import java.util.StringTokenizer;
62
import java.util.TreeMap;
65
import java.util.TreeMap;
63
import javax.swing.AbstractAction;
66
import javax.swing.AbstractAction;
64
import javax.swing.Action;
67
import javax.swing.Action;
65
import javax.swing.JFileChooser;
68
import javax.swing.JFileChooser;
69
import javax.swing.KeyStroke;
70
import org.netbeans.core.options.keymap.api.KeyStrokeUtils;
66
import org.netbeans.core.options.keymap.api.ShortcutAction;
71
import org.netbeans.core.options.keymap.api.ShortcutAction;
67
import org.netbeans.core.options.keymap.spi.KeymapManager;
72
import org.netbeans.core.options.keymap.spi.KeymapManager;
68
import org.netbeans.modules.options.keymap.XMLStorage.Attribs;
73
import org.netbeans.modules.options.keymap.XMLStorage.Attribs;
69
import org.openide.ErrorManager;
74
import org.openide.ErrorManager;
75
import org.openide.awt.HtmlBrowser;
70
import org.openide.filesystems.FileLock;
76
import org.openide.filesystems.FileLock;
71
import org.openide.filesystems.FileObject;
77
import org.openide.filesystems.FileObject;
72
import org.openide.filesystems.FileUtil;
78
import org.openide.filesystems.FileUtil;
73
import org.openide.loaders.DataObject;
79
import org.openide.loaders.DataObject;
74
import org.openide.util.NbBundle;
80
import org.openide.util.NbBundle;
81
import org.openide.util.Utilities;
75
import org.openide.windows.WindowManager;
82
import org.openide.windows.WindowManager;
76
83
77
public class ExportShortcutsAction {
84
public class ExportShortcutsAction {
Lines 157-163 Link Here
157
        {putValue (Action.NAME, loc ("CTL_Export_Shortcuts_to_HTML_Action"));}
164
        {putValue (Action.NAME, loc ("CTL_Export_Shortcuts_to_HTML_Action"));}
158
        
165
        
159
        public void actionPerformed (ActionEvent e) {
166
        public void actionPerformed (ActionEvent e) {
160
            exportShortcutsToHTML ();
167
            exportShortcutsOfAllProfilesToHTML ();
161
        }
168
        }
162
    };
169
    };
163
    
170
    
Lines 167-179 Link Here
167
174
168
    
175
    
169
    // helper methods ..........................................................
176
    // helper methods ..........................................................
177
    public static void exportShortcutsOfProfileToHTML (String profile) {
178
	final boolean showSystemSpecificShortcuts = true;
179
	exportShortcutsToHTML(new KeymapModel(), Arrays.asList(profile), showSystemSpecificShortcuts);
180
    }
181
182
    private static void exportShortcutsOfAllProfilesToHTML () {
183
	KeymapModel keymapModel = new KeymapModel ();
184
	List<String> allProfiles = keymapModel.getProfiles ();
185
	final boolean showSystemSpecificShortcuts = false;
186
	exportShortcutsToHTML(keymapModel, allProfiles, showSystemSpecificShortcuts);
187
    }
170
    
188
    
171
    private static void exportShortcutsToHTML () {
189
    
190
    private static void exportShortcutsToHTML (KeymapModel keymapModel, Collection<String> profiles, boolean displayHumanReadibleShortcuts) {
172
        // read all shortcuts to keymaps
191
        // read all shortcuts to keymaps
173
        KeymapModel keymapModel = new KeymapModel ();
174
        Map<String, Map<ShortcutAction, Set<String>>> keymaps = 
192
        Map<String, Map<ShortcutAction, Set<String>>> keymaps = 
175
                new TreeMap<String, Map<ShortcutAction, Set<String>>> ();
193
                new TreeMap<String, Map<ShortcutAction, Set<String>>> ();
176
        for (String profile: keymapModel.getProfiles ()) {
194
        for (String profile: profiles) {
177
            keymaps.put (
195
            keymaps.put (
178
                profile,
196
                profile,
179
                keymapModel.getKeymap (profile)
197
                keymapModel.getKeymap (profile)
Lines 208-214 Link Here
208
            }
226
            }
209
            
227
            
210
            // print body of table
228
            // print body of table
211
            exportShortcutsToHTML2 (keymapModel, sb, keymaps);
229
            exportShortcutsToHTML2 (keymapModel, sb, keymaps, displayHumanReadibleShortcuts);
212
            
230
            
213
            XMLStorage.generateFolderEnd (sb, "table", "    ");
231
            XMLStorage.generateFolderEnd (sb, "table", "    ");
214
            XMLStorage.generateFolderEnd (sb, "body", "  ");
232
            XMLStorage.generateFolderEnd (sb, "body", "  ");
Lines 219-234 Link Here
219
                "shortcuts.html"
237
                "shortcuts.html"
220
            );
238
            );
221
            FileLock fileLock = fo.lock ();
239
            FileLock fileLock = fo.lock ();
222
            try {
240
            try (OutputStream outputStream = fo.getOutputStream (fileLock);
223
                OutputStream outputStream = fo.getOutputStream (fileLock);
241
                OutputStreamWriter writer = new OutputStreamWriter (outputStream)){
224
                OutputStreamWriter writer = new OutputStreamWriter (outputStream);
225
                writer.write (sb.toString ());
242
                writer.write (sb.toString ());
226
                writer.close ();
243
                writer.close ();
227
            } catch (IOException ex) {
244
245
		if (fo.canRead() && displayHumanReadibleShortcuts) {
246
		    //open generated HTML in external browser
247
		    HtmlBrowser.URLDisplayer.getDefault().showURLExternal(fo.toURL());
248
		}
249
	    } catch (IOException ex) {
228
                ErrorManager.getDefault ().notify (ex);
250
                ErrorManager.getDefault ().notify (ex);
229
            } finally {
251
            } finally {
230
                fileLock.releaseLock ();
252
                fileLock.releaseLock ();
231
            }
253
            }
254
	    
232
        } catch (IOException ex) {
255
        } catch (IOException ex) {
233
            ErrorManager.getDefault ().notify (ex);
256
            ErrorManager.getDefault ().notify (ex);
234
        }
257
        }
Lines 240-246 Link Here
240
    private static void exportShortcutsToHTML2 (
263
    private static void exportShortcutsToHTML2 (
241
        KeymapModel keymapModel, 
264
        KeymapModel keymapModel, 
242
        StringBuffer sb,
265
        StringBuffer sb,
243
        Map<String, Map<ShortcutAction, Set<String>>> keymaps
266
        Map<String, Map<ShortcutAction, Set<String>>> keymaps, 
267
	boolean displayHumanReadibleShortcuts
244
    ) {
268
    ) {
245
        List<String> categories = new ArrayList<String> (keymapModel.getActionCategories ());
269
        List<String> categories = new ArrayList<String> (keymapModel.getActionCategories ());
246
        Collections.<String>sort (categories);
270
        Collections.<String>sort (categories);
Lines 260-266 Link Here
260
            XMLStorage.generateFolderEnd (sb, "tr", "      ");
284
            XMLStorage.generateFolderEnd (sb, "tr", "      ");
261
            
285
            
262
            // print body of one category
286
            // print body of one category
263
            exportShortcutsToHTML3 (sb, keymapModel, category, keymaps);
287
            exportShortcutsToHTML3 (sb, keymapModel, category, keymaps, displayHumanReadibleShortcuts);
264
        }
288
        }
265
    }
289
    }
266
290
Lines 271-277 Link Here
271
        StringBuffer sb, 
295
        StringBuffer sb, 
272
        KeymapModel keymapModel, 
296
        KeymapModel keymapModel, 
273
        String category,
297
        String category,
274
        Map<String, Map<ShortcutAction, Set<String>>> keymaps
298
        Map<String, Map<ShortcutAction, Set<String>>> keymaps, 
299
	boolean displayHumanReadibleShortcuts
275
    ) {
300
    ) {
276
        Set<ShortcutAction> actions = keymapModel.getActions (category);
301
        Set<ShortcutAction> actions = keymapModel.getActions (category);
277
302
Lines 301-307 Link Here
301
                Set<String> shortcuts = keymap.get (action);
326
                Set<String> shortcuts = keymap.get (action);
302
327
303
                XMLStorage.generateFolderStart (sb, "td", attribs, "        ");
328
                XMLStorage.generateFolderStart (sb, "td", attribs, "        ");
304
                printShortcuts (shortcuts, sb);
329
                printShortcuts (shortcuts, sb, displayHumanReadibleShortcuts);
305
                XMLStorage.generateFolderEnd (sb, "td", "        ");
330
                XMLStorage.generateFolderEnd (sb, "td", "        ");
306
            }
331
            }
307
            
332
            
Lines 309-315 Link Here
309
        }
334
        }
310
    }
335
    }
311
    
336
    
312
    private static void printShortcuts (Set<String> shortcuts, StringBuffer sb) {
337
    private static void printShortcuts (Set<String> shortcuts, StringBuffer sb, boolean displayHumanReadibleShortcuts) {
313
        if (shortcuts == null) {
338
        if (shortcuts == null) {
314
            sb.append ('-');
339
            sb.append ('-');
315
            return;
340
            return;
Lines 317-327 Link Here
317
        Iterator<String> it = shortcuts.iterator ();
342
        Iterator<String> it = shortcuts.iterator ();
318
        while (it.hasNext ()) {
343
        while (it.hasNext ()) {
319
            String shortcut = it.next ();
344
            String shortcut = it.next ();
320
            sb.append (shortcut);
345
	    if (displayHumanReadibleShortcuts) {
346
		//show system specific shortcuts like CTRL-SHIFT-ALT
347
		sb.append (portableRepresentationToShortcut(shortcut));
348
	    } else {
349
		//default: show portable shortcuts like D-O
350
		sb.append (shortcut);
351
	    }
321
            if (it.hasNext ()) sb.append (", ");
352
            if (it.hasNext ()) sb.append (", ");
322
        }
353
        }
323
    }
354
    }
324
    
355
    
356
    /**
357
     * Converts the portable shortcut representation to a human-readable shortcut
358
     * @param portable portable representation (the storage format for shortcuts)
359
     * @return human-readable string
360
     */
361
    static String portableRepresentationToShortcut(String portable) {
362
        assert portable != null : "The parameter must not be null"; //NOI18N
363
364
        StringBuilder buf = new StringBuilder();
365
        String delimiter = " "; //NOI18N
366
367
        for(StringTokenizer st = new StringTokenizer(portable, delimiter); st.hasMoreTokens();) { //NOI18N
368
            String ks = st.nextToken().trim();
369
370
            KeyStroke keyStroke = Utilities.stringToKey(ks);
371
372
            if (keyStroke != null) {
373
                buf.append(KeyStrokeUtils.getKeyStrokeAsText(keyStroke));
374
                if (st.hasMoreTokens())
375
                    buf.append(' ');
376
            } else {
377
                return null;
378
            }
379
        }
380
381
        return buf.toString();
382
    }
383
    
325
    private static void generateLayersXML (
384
    private static void generateLayersXML (
326
        LayersBridge layersBridge, 
385
        LayersBridge layersBridge, 
327
        Map<String, Map<String, ShortcutAction>> categoryToActions
386
        Map<String, Map<String, ShortcutAction>> categoryToActions
(-)a/options.keymap/src/org/netbeans/modules/options/keymap/KeymapPanel.form (-7 / +30 lines)
Lines 19-37 Link Here
19
          <Group type="102" alignment="1" attributes="0">
19
          <Group type="102" alignment="1" attributes="0">
20
              <Group type="103" groupAlignment="1" attributes="0">
20
              <Group type="103" groupAlignment="1" attributes="0">
21
                  <Group type="102" attributes="0">
21
                  <Group type="102" attributes="0">
22
                      <EmptySpace max="-2" attributes="0"/>
22
                      <EmptySpace min="-2" max="-2" attributes="0"/>
23
                      <Group type="103" groupAlignment="1" attributes="0">
23
                      <Group type="103" groupAlignment="0" attributes="0">
24
                          <Group type="102" alignment="0" attributes="0">
24
                          <Group type="102" alignment="0" attributes="0">
25
                              <Component id="spShortcuts" min="-2" pref="175" max="-2" attributes="0"/>
25
                              <Component id="spShortcuts" min="-2" pref="175" max="-2" attributes="0"/>
26
                              <EmptySpace min="-2" pref="83" max="-2" attributes="0"/>
26
                              <EmptySpace min="-2" pref="83" max="-2" attributes="0"/>
27
                              <Component id="filler1" min="-2" max="-2" attributes="0"/>
27
                              <Component id="filler1" min="-2" max="-2" attributes="0"/>
28
                              <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
29
                          </Group>
28
                          </Group>
30
                          <Group type="102" alignment="0" attributes="0">
29
                          <Group type="102" alignment="0" attributes="0">
31
                              <Component id="lProfile" min="-2" max="-2" attributes="0"/>
30
                              <Component id="lProfile" min="-2" max="-2" attributes="0"/>
32
                              <EmptySpace max="-2" attributes="0"/>
31
                              <EmptySpace max="-2" attributes="0"/>
33
                              <Component id="cbProfile" max="32767" attributes="0"/>
32
                              <Component id="cbProfile" max="32767" attributes="0"/>
34
                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
33
                              <EmptySpace max="-2" attributes="0"/>
34
                              <Component id="btnPrintAsHTML" min="-2" max="-2" attributes="0"/>
35
                              <EmptySpace max="-2" attributes="0"/>
36
                              <Component id="jSeparator1" min="-2" pref="2" max="-2" attributes="0"/>
37
                              <EmptySpace max="-2" attributes="0"/>
35
                              <Component id="manageButton" min="-2" max="-2" attributes="0"/>
38
                              <Component id="manageButton" min="-2" max="-2" attributes="0"/>
36
                          </Group>
39
                          </Group>
37
                      </Group>
40
                      </Group>
Lines 50-56 Link Here
50
                  </Group>
53
                  </Group>
51
                  <Component id="actionsView" max="32767" attributes="0"/>
54
                  <Component id="actionsView" max="32767" attributes="0"/>
52
              </Group>
55
              </Group>
53
              <EmptySpace max="-2" attributes="0"/>
56
              <EmptySpace min="-2" max="-2" attributes="0"/>
54
              <Component id="filler2" min="-2" max="-2" attributes="0"/>
57
              <Component id="filler2" min="-2" max="-2" attributes="0"/>
55
          </Group>
58
          </Group>
56
      </Group>
59
      </Group>
Lines 58-68 Link Here
58
    <DimensionLayout dim="1">
61
    <DimensionLayout dim="1">
59
      <Group type="103" groupAlignment="0" attributes="0">
62
      <Group type="103" groupAlignment="0" attributes="0">
60
          <Group type="102" alignment="0" attributes="0">
63
          <Group type="102" alignment="0" attributes="0">
61
              <EmptySpace min="-2" max="-2" attributes="0"/>
64
              <EmptySpace max="-2" attributes="0"/>
62
              <Group type="103" groupAlignment="3" attributes="0">
65
              <Group type="103" groupAlignment="3" attributes="0">
63
                  <Component id="lProfile" alignment="3" min="-2" max="-2" attributes="0"/>
66
                  <Component id="lProfile" alignment="3" min="-2" max="-2" attributes="0"/>
64
                  <Component id="cbProfile" alignment="3" min="-2" max="-2" attributes="0"/>
67
                  <Component id="cbProfile" alignment="3" min="-2" max="-2" attributes="0"/>
65
                  <Component id="manageButton" alignment="3" min="-2" max="-2" attributes="0"/>
68
                  <Component id="manageButton" alignment="1" max="32767" attributes="0"/>
69
                  <Component id="btnPrintAsHTML" alignment="1" min="-2" max="-2" attributes="0"/>
70
                  <Component id="jSeparator1" alignment="0" min="-2" pref="25" max="-2" attributes="0"/>
66
              </Group>
71
              </Group>
67
              <Group type="103" groupAlignment="0" attributes="0">
72
              <Group type="103" groupAlignment="0" attributes="0">
68
                  <Group type="102" attributes="0">
73
                  <Group type="102" attributes="0">
Lines 298-302 Link Here
298
        <AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalStrut"/>
303
        <AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalStrut"/>
299
      </AuxValues>
304
      </AuxValues>
300
    </Component>
305
    </Component>
306
    <Component class="javax.swing.JButton" name="btnPrintAsHTML">
307
      <Properties>
308
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
309
          <ResourceString bundle="org/netbeans/modules/options/keymap/Bundle.properties" key="KeymapPanel.btnPrintAsHTML.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
310
        </Property>
311
        <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
312
          <ResourceString bundle="org/netbeans/modules/options/keymap/Bundle.properties" key="KeymapPanel.btnPrintAsHTML.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
313
        </Property>
314
      </Properties>
315
      <Events>
316
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnPrintAsHTMLActionPerformed"/>
317
      </Events>
318
    </Component>
319
    <Component class="javax.swing.JSeparator" name="jSeparator1">
320
      <Properties>
321
        <Property name="orientation" type="int" value="1"/>
322
      </Properties>
323
    </Component>
301
  </SubComponents>
324
  </SubComponents>
302
</Form>
325
</Form>
(-)a/options.keymap/src/org/netbeans/modules/options/keymap/KeymapPanel.java (-7 / +32 lines)
Lines 484-489 Link Here
484
        actionsTable = new KeymapTable();
484
        actionsTable = new KeymapTable();
485
        filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
485
        filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
486
        filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
486
        filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
487
        btnPrintAsHTML = new javax.swing.JButton();
488
        jSeparator1 = new javax.swing.JSeparator();
487
489
488
        lProfile.setLabelFor(cbProfile);
490
        lProfile.setLabelFor(cbProfile);
489
        org.openide.awt.Mnemonics.setLocalizedText(lProfile, org.openide.util.NbBundle.getMessage(KeymapPanel.class, "CTL_Keymap_Name")); // NOI18N
491
        org.openide.awt.Mnemonics.setLocalizedText(lProfile, org.openide.util.NbBundle.getMessage(KeymapPanel.class, "CTL_Keymap_Name")); // NOI18N
Lines 550-555 Link Here
550
552
551
        actionsView.add(jScrollPane1, "actions");
553
        actionsView.add(jScrollPane1, "actions");
552
554
555
        org.openide.awt.Mnemonics.setLocalizedText(btnPrintAsHTML, org.openide.util.NbBundle.getMessage(KeymapPanel.class, "KeymapPanel.btnPrintAsHTML.text")); // NOI18N
556
        btnPrintAsHTML.setToolTipText(org.openide.util.NbBundle.getMessage(KeymapPanel.class, "KeymapPanel.btnPrintAsHTML.toolTipText")); // NOI18N
557
        btnPrintAsHTML.addActionListener(new java.awt.event.ActionListener() {
558
            public void actionPerformed(java.awt.event.ActionEvent evt) {
559
                btnPrintAsHTMLActionPerformed(evt);
560
            }
561
        });
562
563
        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
564
553
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
565
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
554
        this.setLayout(layout);
566
        this.setLayout(layout);
555
        layout.setHorizontalGroup(
567
        layout.setHorizontalGroup(
Lines 558-574 Link Here
558
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
570
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
559
                    .addGroup(layout.createSequentialGroup()
571
                    .addGroup(layout.createSequentialGroup()
560
                        .addContainerGap()
572
                        .addContainerGap()
561
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
573
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
562
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
574
                            .addGroup(layout.createSequentialGroup()
563
                                .addComponent(spShortcuts, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
575
                                .addComponent(spShortcuts, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
564
                                .addGap(83, 83, 83)
576
                                .addGap(83, 83, 83)
565
                                .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
577
                                .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
566
                                .addGap(0, 0, Short.MAX_VALUE))
578
                            .addGroup(layout.createSequentialGroup()
567
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
568
                                .addComponent(lProfile)
579
                                .addComponent(lProfile)
569
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
580
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
570
                                .addComponent(cbProfile, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
581
                                .addComponent(cbProfile, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
571
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
582
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
583
                                .addComponent(btnPrintAsHTML)
584
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
585
                                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
586
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
572
                                .addComponent(manageButton))))
587
                                .addComponent(manageButton))))
573
                    .addGroup(layout.createSequentialGroup()
588
                    .addGroup(layout.createSequentialGroup()
574
                        .addGap(0, 0, Short.MAX_VALUE)
589
                        .addGap(0, 0, Short.MAX_VALUE)
Lines 595-601 Link Here
595
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
610
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
596
                    .addComponent(lProfile)
611
                    .addComponent(lProfile)
597
                    .addComponent(cbProfile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
612
                    .addComponent(cbProfile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
598
                    .addComponent(manageButton))
613
                    .addComponent(manageButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
614
                    .addComponent(btnPrintAsHTML)
615
                    .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
599
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
616
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
600
                    .addGroup(layout.createSequentialGroup()
617
                    .addGroup(layout.createSequentialGroup()
601
                        .addGap(18, 18, 18)
618
                        .addGap(18, 18, 18)
Lines 642-656 Link Here
642
        searchPopup.show();
659
        searchPopup.show();
643
}//GEN-LAST:event_moreButtonActionPerformed
660
}//GEN-LAST:event_moreButtonActionPerformed
644
661
662
    private void btnPrintAsHTMLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintAsHTMLActionPerformed
663
	if (getMutableModel().getCurrentProfile()!=null){
664
	    ExportShortcutsAction.exportShortcutsOfProfileToHTML(getMutableModel().getCurrentProfile());
665
	}        
666
    }//GEN-LAST:event_btnPrintAsHTMLActionPerformed
667
645
    // Variables declaration - do not modify//GEN-BEGIN:variables
668
    // Variables declaration - do not modify//GEN-BEGIN:variables
646
    private javax.swing.JProgressBar actionProgress;
669
    private javax.swing.JProgressBar actionProgress;
647
    private javax.swing.JTable actionsTable;
670
    private javax.swing.JTable actionsTable;
648
    private javax.swing.JPanel actionsView;
671
    private javax.swing.JPanel actionsView;
672
    private javax.swing.JButton btnPrintAsHTML;
649
    private javax.swing.JComboBox cbProfile;
673
    private javax.swing.JComboBox cbProfile;
650
    private javax.swing.Box.Filler filler1;
674
    private javax.swing.Box.Filler filler1;
651
    private javax.swing.Box.Filler filler2;
675
    private javax.swing.Box.Filler filler2;
652
    private javax.swing.JPanel jPanel1;
676
    private javax.swing.JPanel jPanel1;
653
    private javax.swing.JScrollPane jScrollPane1;
677
    private javax.swing.JScrollPane jScrollPane1;
678
    private javax.swing.JSeparator jSeparator1;
654
    private javax.swing.JLabel lProfile;
679
    private javax.swing.JLabel lProfile;
655
    private javax.swing.JList liShortcuts;
680
    private javax.swing.JList liShortcuts;
656
    private javax.swing.JButton manageButton;
681
    private javax.swing.JButton manageButton;
(-)a/options.keymap/src/org/netbeans/modules/options/keymap/ProfilesPanel.java (-24 / +1 lines)
Lines 360-388 Link Here
360
        return buf.toString();
360
        return buf.toString();
361
    }
361
    }
362
362
363
    private static String portableRepresentationToShortcut(String portable) {
364
        assert portable != null : "The parameter must not be null"; //NOI18N
365
366
        StringBuilder buf = new StringBuilder();
367
        String delimiter = " "; //NOI18N
368
369
        for(StringTokenizer st = new StringTokenizer(portable, delimiter); st.hasMoreTokens();) { //NOI18N
370
            String ks = st.nextToken().trim();
371
372
            KeyStroke keyStroke = Utilities.stringToKey(ks);
373
374
            if (keyStroke != null) {
375
                buf.append(KeyStrokeUtils.getKeyStrokeAsText(keyStroke));
376
                if (st.hasMoreTokens())
377
                    buf.append(' ');
378
            } else {
379
                return null;
380
            }
381
        }
382
383
        return buf.toString();
384
    }
385
386
    private static JFileChooser getFileChooser() {
363
    private static JFileChooser getFileChooser() {
387
        final JFileChooser chooser = new JFileChooser();
364
        final JFileChooser chooser = new JFileChooser();
388
        XMLFileFilter filter = new XMLFileFilter();
365
        XMLFileFilter filter = new XMLFileFilter();
Lines 425-431 Link Here
425
                        NamedNodeMap attrs = childList.item(j).getAttributes();
402
                        NamedNodeMap attrs = childList.item(j).getAttributes();
426
                        if (attrs != null) {
403
                        if (attrs != null) {
427
                            String sc = attrs.item(0).getNodeValue();
404
                            String sc = attrs.item(0).getNodeValue();
428
                            shortcuts.add(portableRepresentationToShortcut(sc));
405
                            shortcuts.add(ExportShortcutsAction.portableRepresentationToShortcut(sc));
429
                        }
406
                        }
430
                    }
407
                    }
431
                    if (sca == null) {
408
                    if (sca == null) {

Return to bug 226955