Source Code Cross Referenced for GUIRegistrationPanel.java in  » IDE-Netbeans » api » org » netbeans » modules » apisupport » project » ui » wizard » action » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » api » org.netbeans.modules.apisupport.project.ui.wizard.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common
0008:         * Development and Distribution License("CDDL") (collectively, the
0009:         * "License"). You may not use this file except in compliance with the
0010:         * License. You can obtain a copy of the License at
0011:         * http://www.netbeans.org/cddl-gplv2.html
0012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013:         * specific language governing permissions and limitations under the
0014:         * License.  When distributing the software, include this License Header
0015:         * Notice in each file and include the License file at
0016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
0017:         * particular file as subject to the "Classpath" exception as provided
0018:         * by Sun in the GPL Version 2 section of the License file that
0019:         * accompanied this code. If applicable, add the following below the
0020:         * License Header, with the fields enclosed by brackets [] replaced by
0021:         * your own identifying information:
0022:         * "Portions Copyrighted [year] [name of copyright owner]"
0023:         *
0024:         * Contributor(s):
0025:         *
0026:         * The Original Software is NetBeans. The Initial Developer of the Original
0027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
0028:         * Microsystems, Inc. All Rights Reserved.
0029:         *
0030:         * If you wish your version of this file to be governed by only the CDDL
0031:         * or only the GPL Version 2, indicate your decision by adding
0032:         * "[Contributor] elects to include this software in this distribution
0033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034:         * single choice of license, a recipient has the option to distribute
0035:         * your version of this file under either the CDDL, the GPL Version 2 or
0036:         * to extend the choice of license to its licensees as provided above.
0037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0038:         * Version 2 license, then the option applies only if the new code is
0039:         * made subject to such option by the copyright holder.
0040:         */
0041:
0042:        package org.netbeans.modules.apisupport.project.ui.wizard.action;
0043:
0044:        import java.awt.Component;
0045:        import java.awt.EventQueue;
0046:        import java.io.IOException;
0047:        import java.util.ArrayList;
0048:        import java.util.Collection;
0049:        import java.util.Iterator;
0050:        import java.util.LinkedHashSet;
0051:        import java.util.List;
0052:        import javax.swing.DefaultComboBoxModel;
0053:        import javax.swing.DefaultListModel;
0054:        import javax.swing.JCheckBox;
0055:        import javax.swing.JComboBox;
0056:        import javax.swing.JComponent;
0057:        import javax.swing.JLabel;
0058:        import javax.swing.JList;
0059:        import javax.swing.JTextField;
0060:        import javax.swing.KeyStroke;
0061:        import javax.swing.ListCellRenderer;
0062:        import javax.swing.event.DocumentEvent;
0063:        import javax.swing.event.PopupMenuEvent;
0064:        import javax.swing.event.PopupMenuListener;
0065:        import javax.swing.plaf.UIResource;
0066:        import org.netbeans.modules.apisupport.project.Util;
0067:        import org.netbeans.modules.apisupport.project.layers.LayerUtils;
0068:        import org.netbeans.modules.apisupport.project.ui.UIUtil;
0069:        import org.netbeans.modules.apisupport.project.ui.UIUtil.LayerItemPresenter;
0070:        import org.netbeans.modules.apisupport.project.ui.customizer.CustomizerComponentFactory;
0071:        import org.netbeans.modules.apisupport.project.ui.wizard.BasicWizardIterator;
0072:        import org.netbeans.modules.apisupport.project.ui.wizard.action.DataModel.Position;
0073:        import org.openide.WizardDescriptor;
0074:        import org.openide.filesystems.FileObject;
0075:        import org.openide.filesystems.FileSystem;
0076:        import org.openide.filesystems.FileUtil;
0077:        import org.openide.loaders.DataFolder;
0078:        import org.openide.loaders.DataObject;
0079:        import org.openide.util.HelpCtx;
0080:        import org.openide.util.NbBundle;
0081:        import org.openide.util.RequestProcessor;
0082:
0083:        /**
0084:         * The second panel in the <em>New Action Wizard</em>.
0085:         *
0086:         * @author Martin Krauskopf
0087:         */
0088:        final class GUIRegistrationPanel extends BasicWizardIterator.Panel {
0089:
0090:            private final RequestProcessor SFS_RP = new RequestProcessor(
0091:                    GUIRegistrationPanel.class.getName());
0092:            private static final String ACTIONS_DIR = "Actions"; // NOI18N
0093:
0094:            private FileSystem sfs;
0095:
0096:            private final ListCellRenderer POSITION_RENDERER = new PositionRenderer();
0097:            private static final String POSITION_HERE = getMessage("CTL_PositionHere");
0098:            private static final String POSITION_SEPARATOR = " - "; // NOI18N
0099:
0100:            private DataModel data;
0101:
0102:            private final JComponent[] gmiGroup;
0103:            private final JComponent[] toolbarGroup;
0104:            private final JComponent[] shortcutGroup;
0105:            private final JComponent[] fileTypeGroup;
0106:            private final JComponent[] editorGroup;
0107:
0108:            public GUIRegistrationPanel(final WizardDescriptor setting,
0109:                    final DataModel data) {
0110:                super (setting);
0111:                this .data = data;
0112:                initComponents();
0113:                putClientProperty("NewFileWizard_Title",
0114:                        getMessage("LBL_ActionWizardTitle"));
0115:
0116:                menu.addPopupMenuListener(new PML(menu, menuPosition));
0117:                toolbar.addPopupMenuListener(new PML(toolbar, toolbarPosition));
0118:                ftContentType.addPopupMenuListener(new PML(ftContentType,
0119:                        ftPosition));
0120:                edContentType.addPopupMenuListener(new PML(edContentType,
0121:                        edPosition));
0122:                gmiGroup = new JComponent[] { menu, menuTxt, menuPosition,
0123:                        menuPositionTxt, menuSeparatorAfter,
0124:                        menuSeparatorBefore };
0125:                toolbarGroup = new JComponent[] { toolbar, toolbarTxt,
0126:                        toolbarPosition, toolbarPositionTxt };
0127:                shortcutGroup = new JComponent[] { shortcutsList, keyStrokeTxt,
0128:                        keyStrokeChange, keyStrokeRemove };
0129:                fileTypeGroup = new JComponent[] { ftContentType,
0130:                        ftContentTypeTxt, ftPosition, ftPositionTxt,
0131:                        ftSeparatorAfter, ftSeparatorBefore };
0132:                editorGroup = new JComponent[] { edContentType,
0133:                        edContentTypeTxt, edPosition, edPositionTxt,
0134:                        edSeparatorAfter, edSeparatorBefore };
0135:                readSFS();
0136:            }
0137:
0138:            private void setEditable(final JComboBox combo) {
0139:                combo.setEditable(true);
0140:                if (combo.getEditor().getEditorComponent() instanceof  JTextField) {
0141:                    JTextField txt = (JTextField) combo.getEditor()
0142:                            .getEditorComponent();
0143:                    // XXX check if there are not multiple (--> redundant) listeners
0144:                    txt.getDocument().addDocumentListener(
0145:                            new UIUtil.DocumentAdapter() {
0146:                                public void insertUpdate(DocumentEvent e) {
0147:                                    if (!CustomizerComponentFactory
0148:                                            .isWaitModel(combo.getModel())) {
0149:                                        checkValidity();
0150:                                    }
0151:                                }
0152:                            });
0153:                }
0154:            }
0155:
0156:            protected String getPanelName() {
0157:                return getMessage("LBL_GUIRegistration_Title");
0158:            }
0159:
0160:            private String getCategoryPath() {
0161:                String path = UIUtil.getSFSPath(category, ACTIONS_DIR);
0162:                return path == null ? ACTIONS_DIR + '/' + "Tools" : path; // NOI18N
0163:            }
0164:
0165:            protected void storeToDataModel() {
0166:                // XXX this is just a prevention for the case when the user press Back button - should be ensured by a wizard (issue 63142)
0167:                if (!checkValidity()) {
0168:                    return;
0169:                }
0170:                // second panel data (GUI Registration)
0171:                data.setCategory(getCategoryPath());
0172:                // global menu item
0173:                data.setGlobalMenuItemEnabled(globalMenuItem.isSelected());
0174:                if (globalMenuItem.isSelected()) {
0175:                    data.setGMIParentMenu(getSelectedLayerPresenter(menu)
0176:                            .getFullPath());
0177:                    data.setGMIPosition((Position) menuPosition
0178:                            .getSelectedItem());
0179:                    data.setGMISeparatorAfter(menuSeparatorAfter.isSelected());
0180:                    data
0181:                            .setGMISeparatorBefore(menuSeparatorBefore
0182:                                    .isSelected());
0183:                }
0184:                // global toolbar button
0185:                data.setToolbarEnabled(globalToolbarButton.isSelected());
0186:                if (globalToolbarButton.isSelected()) {
0187:                    data.setToolbar(getSelectedLayerPresenter(toolbar)
0188:                            .getFullPath());
0189:                    data.setToolbarPosition((Position) toolbarPosition
0190:                            .getSelectedItem());
0191:                }
0192:                // global keyboard shortcut
0193:                data.setKeyboardShortcutEnabled(globalKeyboardShortcut
0194:                        .isSelected());
0195:                // file type context menu item
0196:                data.setFileTypeContextEnabled(fileTypeContext.isSelected());
0197:                if (fileTypeContext.isSelected()) {
0198:                    data.setFTContextType(getSelectedLayerPresenter(
0199:                            ftContentType).getFullPath());
0200:                    data.setFTContextPosition((Position) ftPosition
0201:                            .getSelectedItem());
0202:                    data.setFTContextSeparatorBefore(ftSeparatorBefore
0203:                            .isSelected());
0204:                    data.setFTContextSeparatorAfter(ftSeparatorAfter
0205:                            .isSelected());
0206:                }
0207:                // editor context menu item
0208:                data.setEditorContextEnabled(editorContext.isSelected());
0209:                if (editorContext.isSelected()) {
0210:                    data.setEdContextType(getSelectedLayerPresenter(
0211:                            edContentType).getFullPath());
0212:                    data.setEdContextPosition((Position) edPosition
0213:                            .getSelectedItem());
0214:                    data.setEdContextSeparatorBefore(edSeparatorBefore
0215:                            .isSelected());
0216:                    data.setEdContextSeparatorAfter(edSeparatorAfter
0217:                            .isSelected());
0218:                }
0219:            }
0220:
0221:            protected void readFromDataModel() {
0222:                initializeGlobalAction();
0223:                checkValidity();
0224:            }
0225:
0226:            private void initializeGlobalAction() {
0227:                globalMenuItem.setSelected(true);
0228:
0229:                globalMenuItem.setEnabled(true);
0230:                setGroupEnabled(gmiGroup, globalMenuItem.isSelected());
0231:
0232:                globalToolbarButton.setEnabled(true);
0233:                setGroupEnabled(toolbarGroup, globalToolbarButton.isSelected());
0234:
0235:                boolean alwaysEnabled = data.isAlwaysEnabled();
0236:                globalKeyboardShortcut.setEnabled(alwaysEnabled);
0237:                setShortcutGroupEnabled();
0238:
0239:                if (alwaysEnabled) {
0240:                    fileTypeContext.setSelected(false);
0241:                    editorContext.setSelected(false);
0242:                }
0243:                fileTypeContext.setEnabled(!alwaysEnabled);
0244:                setGroupEnabled(fileTypeGroup, fileTypeContext.isSelected());
0245:
0246:                editorContext.setEnabled(!alwaysEnabled);
0247:                setGroupEnabled(editorGroup, editorContext.isSelected());
0248:            }
0249:
0250:            /** Package private for unit tests only. */
0251:            boolean checkValidity() {
0252:                boolean result = false;
0253:                if (globalKeyboardShortcut.isSelected()
0254:                        && ((DefaultListModel) shortcutsList.getModel())
0255:                                .isEmpty()) { // NOI18N
0256:                    setError(getMessage("MSG_YouMustSpecifyShortcut"));
0257:                } else if (!check(globalMenuItem, menu, menuPosition)
0258:                        || !check(globalToolbarButton, toolbar, toolbarPosition)
0259:                        || !check(fileTypeContext, ftContentType, ftPosition)
0260:                        || !check(editorContext, edContentType, edPosition)) {
0261:                    markInvalid();
0262:                } else if (!Util.isValidSFSPath(getCategoryPath())) {
0263:                    setError(getMessage("ERR_Category_Invalid"));
0264:                } else {
0265:                    markValid();
0266:                    result = true;
0267:                }
0268:                return result;
0269:            }
0270:
0271:            private boolean check(JCheckBox groupCheckBox, JComboBox menu,
0272:                    JComboBox position) {
0273:                boolean result = !groupCheckBox.isSelected()
0274:                        || (getSelectedItem(menu) != null && getSelectedItem(position) != null);
0275:                return result;
0276:            }
0277:
0278:            private void setGroupEnabled(JComponent[] group, boolean enabled) {
0279:                for (int i = 0; i < group.length; i++) {
0280:                    if (group[i] != null) {
0281:                        group[i].setEnabled(enabled && !isEmptyCombo(group[i]));
0282:                    }
0283:                }
0284:            }
0285:
0286:            private void setShortcutGroupEnabled() {
0287:                boolean isEnabled = globalKeyboardShortcut.isSelected();
0288:                setGroupEnabled(shortcutGroup, isEnabled);
0289:                isEnabled = isEnabled
0290:                        && shortcutsList.getSelectedValues().length > 0;
0291:                keyStrokeRemove.setEnabled(isEnabled);
0292:            }
0293:
0294:            private boolean isEmptyCombo(JComponent c) {
0295:                return c instanceof  JComboBox
0296:                        && CustomizerComponentFactory.hasOnlyValue(
0297:                                ((JComboBox) c).getModel(),
0298:                                CustomizerComponentFactory.EMPTY_VALUE);
0299:            }
0300:
0301:            private void readSFS() {
0302:                markInvalid();
0303:                loadComboAndPositions(ACTIONS_DIR, category, null, null, true);
0304:                loadComboAndPositions("Menu", menu, menuPosition, null); // NOI18N
0305:                loadComboAndPositions("Toolbars", toolbar, toolbarPosition,
0306:                        null); // NOI18N
0307:                loadComboAndPositions("Loaders", ftContentType, ftPosition,
0308:                        "Actions"); // NOI18N
0309:                loadComboAndPositions("Editors", edContentType, edPosition,
0310:                        "Popup"); // NOI18N
0311:            }
0312:
0313:            private void loadComboAndPositions(final String startFolder,
0314:                    final JComboBox combo, final JComboBox comboPositions,
0315:                    final String subFolderName) {
0316:                loadComboAndPositions(startFolder, combo, comboPositions,
0317:                        subFolderName, false);
0318:            }
0319:
0320:            /** See {@link #getFoldersByName(DataFolder, String)} for subFolderName explanation . */
0321:            private void loadComboAndPositions(final String startFolder,
0322:                    final JComboBox combo, final JComboBox comboPositions,
0323:                    final String subFolderName, final boolean editable) {
0324:                combo.setModel(CustomizerComponentFactory
0325:                        .createComboWaitModel());
0326:                SFS_RP.post(new Runnable() {
0327:                    public void run() {
0328:                        Util.err
0329:                                .log("Loading " + startFolder + " from SFS...."); // NOI18N
0330:                        final FileObject parent = getSFS().getRoot()
0331:                                .getFileObject(startFolder);
0332:                        final DataFolder parentDF = (parent != null ? DataFolder
0333:                                .findFolder(parent)
0334:                                : null);
0335:                        if (parentDF == null) {
0336:                            Util.err.log("Could not find " + startFolder);
0337:                            setEmptyModel(combo);
0338:                            setEmptyModel(comboPositions);
0339:                            return;
0340:                        }
0341:                        final List<DataFolder> folders = subFolderName == null ? getFolders(parentDF)
0342:                                : getFoldersByName(parentDF, subFolderName);
0343:                        EventQueue.invokeLater(new Runnable() {
0344:                            public void run() {
0345:                                Collection<LayerItemPresenter> sorted = new LinkedHashSet<LayerItemPresenter>();
0346:                                for (DataFolder folder : folders) {
0347:                                    sorted.add(new LayerItemPresenter(folder
0348:                                            .getPrimaryFile(), parent,
0349:                                            subFolderName != null));
0350:                                }
0351:                                if (sorted.size() == 0) {
0352:                                    setEmptyModel(combo);
0353:                                    setEmptyModel(comboPositions);
0354:                                } else {
0355:                                    // create model
0356:                                    DefaultComboBoxModel model = new DefaultComboBoxModel();
0357:                                    for (Iterator it = sorted.iterator(); it
0358:                                            .hasNext();) {
0359:                                        model.addElement(it.next());
0360:                                    }
0361:                                    combo.setModel(model);
0362:                                    if (editable) {
0363:                                        setEditable(combo);
0364:                                    }
0365:                                    // load positions combo
0366:                                    if (comboPositions != null) {
0367:                                        loadPositionsCombo(
0368:                                                (LayerItemPresenter) combo
0369:                                                        .getSelectedItem(),
0370:                                                comboPositions);
0371:                                    }
0372:                                }
0373:                            }
0374:                        });
0375:                    }
0376:                });
0377:            }
0378:
0379:            private void loadPositionsCombo(final LayerItemPresenter parent,
0380:                    final JComboBox positionsCombo) {
0381:
0382:                assert parent != null;
0383:                assert positionsCombo != null;
0384:                positionsCombo.setModel(CustomizerComponentFactory
0385:                        .createComboWaitModel());
0386:                SFS_RP.post(new Runnable() {
0387:                    public void run() {
0388:                        DataObject[] kids = DataFolder.findFolder(
0389:                                parent.getFileObject()).getChildren(); // #71820: sort!
0390:                        final FileObject[] files = new FileObject[kids.length];
0391:                        for (int i = 0; i < kids.length; i++) {
0392:                            files[i] = kids[i].getPrimaryFile();
0393:                        }
0394:                        EventQueue.invokeLater(new Runnable() {
0395:                            public void run() {
0396:                                createPositionModel(positionsCombo, files,
0397:                                        parent);
0398:                            }
0399:                        });
0400:                    }
0401:                });
0402:            }
0403:
0404:            private void createPositionModel(final JComboBox positionsCombo,
0405:                    final FileObject[] files, final LayerItemPresenter parent) {
0406:                DefaultComboBoxModel newModel = new DefaultComboBoxModel();
0407:                LayerItemPresenter previous = null;
0408:                for (int i = 0; i < files.length; i++) {
0409:                    LayerItemPresenter current = new LayerItemPresenter(
0410:                            files[i], parent.getFileObject());
0411:                    newModel.addElement(createPosition(previous, current));
0412:                    previous = current;
0413:                }
0414:                newModel.addElement(createPosition(previous, null));
0415:                positionsCombo.setModel(newModel);
0416:                checkValidity();
0417:            }
0418:
0419:            private static Object getSelectedItem(final JComboBox combo) {
0420:                Object item = combo.getSelectedItem();
0421:                return (item == CustomizerComponentFactory.WAIT_VALUE || item == CustomizerComponentFactory.EMPTY_VALUE) ? null
0422:                        : item;
0423:            }
0424:
0425:            private static LayerItemPresenter getSelectedLayerPresenter(
0426:                    final JComboBox combo) {
0427:                return (LayerItemPresenter) getSelectedItem(combo);
0428:            }
0429:
0430:            private static Position createPosition(LayerItemPresenter first,
0431:                    LayerItemPresenter second) {
0432:                return new Position(first == null ? null : first
0433:                        .getFileObject().getNameExt(), second == null ? null
0434:                        : second.getFileObject().getNameExt(),
0435:                        first == null ? null : first.getDisplayName(),
0436:                        second == null ? null : second.getDisplayName());
0437:            }
0438:
0439:            private void setEmptyModel(JComboBox combo) {
0440:                if (combo != null) {
0441:                    combo.setModel(CustomizerComponentFactory
0442:                            .createComboEmptyModel());
0443:                    combo.setEnabled(false);
0444:                    combo.setEditable(false);
0445:                    checkValidity();
0446:                }
0447:            }
0448:
0449:            protected HelpCtx getHelp() {
0450:                return new HelpCtx(GUIRegistrationPanel.class);
0451:            }
0452:
0453:            private static String getMessage(String key) {
0454:                return NbBundle.getMessage(GUIRegistrationPanel.class, key);
0455:            }
0456:
0457:            /** This method is called from within the constructor to
0458:             * initialize the form.
0459:             * WARNING: Do NOT modify this code. The content of this method is
0460:             * always regenerated by the Form Editor.
0461:             */
0462:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
0463:            private void initComponents() {
0464:                java.awt.GridBagConstraints gridBagConstraints;
0465:
0466:                categoryTxt = new javax.swing.JLabel();
0467:                category = new javax.swing.JComboBox();
0468:                globalMenuItem = new javax.swing.JCheckBox();
0469:                menuTxt = new javax.swing.JLabel();
0470:                menu = new javax.swing.JComboBox();
0471:                menuPositionTxt = new javax.swing.JLabel();
0472:                menuPosition = new javax.swing.JComboBox();
0473:                menuSeparatorPanel = new javax.swing.JPanel();
0474:                menuSeparatorBefore = new javax.swing.JCheckBox();
0475:                menuSeparatorAfter = new javax.swing.JCheckBox();
0476:                globalToolbarButton = new javax.swing.JCheckBox();
0477:                toolbarTxt = new javax.swing.JLabel();
0478:                toolbar = new javax.swing.JComboBox();
0479:                toolbarPositionTxt = new javax.swing.JLabel();
0480:                toolbarPosition = new javax.swing.JComboBox();
0481:                globalKeyboardShortcut = new javax.swing.JCheckBox();
0482:                keyStrokeTxt = new javax.swing.JLabel();
0483:                jScrollPane1 = new javax.swing.JScrollPane();
0484:                shortcutsList = new JList(new DefaultListModel());
0485:                keyStrokeChange = new javax.swing.JButton();
0486:                keyStrokeRemove = new javax.swing.JButton();
0487:                filler = new javax.swing.JLabel();
0488:                fileTypeContext = new javax.swing.JCheckBox();
0489:                ftContentTypeTxt = new javax.swing.JLabel();
0490:                ftContentType = new javax.swing.JComboBox();
0491:                ftPositionTxt = new javax.swing.JLabel();
0492:                ftPosition = new javax.swing.JComboBox();
0493:                ftSeparatorPanel = new javax.swing.JPanel();
0494:                ftSeparatorBefore = new javax.swing.JCheckBox();
0495:                ftSeparatorAfter = new javax.swing.JCheckBox();
0496:                editorContext = new javax.swing.JCheckBox();
0497:                edContentTypeTxt = new javax.swing.JLabel();
0498:                edContentType = new javax.swing.JComboBox();
0499:                edPositionTxt = new javax.swing.JLabel();
0500:                edPosition = new javax.swing.JComboBox();
0501:                edSeparatorPanel = new javax.swing.JPanel();
0502:                edSeparatorBefore = new javax.swing.JCheckBox();
0503:                edSeparatorAfter = new javax.swing.JCheckBox();
0504:
0505:                setLayout(new java.awt.GridBagLayout());
0506:
0507:                categoryTxt.setLabelFor(category);
0508:                org.openide.awt.Mnemonics.setLocalizedText(categoryTxt,
0509:                        org.openide.util.NbBundle.getMessage(
0510:                                GUIRegistrationPanel.class, "LBL_Category")); // NOI18N
0511:                gridBagConstraints = new java.awt.GridBagConstraints();
0512:                gridBagConstraints.gridx = 0;
0513:                gridBagConstraints.gridy = 0;
0514:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
0515:                add(categoryTxt, gridBagConstraints);
0516:                gridBagConstraints = new java.awt.GridBagConstraints();
0517:                gridBagConstraints.gridx = 1;
0518:                gridBagConstraints.gridy = 0;
0519:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0520:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0521:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0522:                gridBagConstraints.weightx = 1.0;
0523:                gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
0524:                add(category, gridBagConstraints);
0525:                category.getAccessibleContext()
0526:                        .setAccessibleDescription(
0527:                                org.openide.util.NbBundle.getMessage(
0528:                                        GUIRegistrationPanel.class,
0529:                                        "ACS_CTL_Category")); // NOI18N
0530:
0531:                org.openide.awt.Mnemonics.setLocalizedText(globalMenuItem,
0532:                        org.openide.util.NbBundle.getMessage(
0533:                                GUIRegistrationPanel.class,
0534:                                "LBL_GlobalMenuItem")); // NOI18N
0535:                globalMenuItem.setBorder(javax.swing.BorderFactory
0536:                        .createEmptyBorder(0, 0, 0, 0));
0537:                globalMenuItem
0538:                        .addActionListener(new java.awt.event.ActionListener() {
0539:                            public void actionPerformed(
0540:                                    java.awt.event.ActionEvent evt) {
0541:                                globalMenuItemActionPerformed(evt);
0542:                            }
0543:                        });
0544:                gridBagConstraints = new java.awt.GridBagConstraints();
0545:                gridBagConstraints.gridx = 0;
0546:                gridBagConstraints.gridy = 1;
0547:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0548:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0549:                gridBagConstraints.insets = new java.awt.Insets(18, 0, 3, 0);
0550:                add(globalMenuItem, gridBagConstraints);
0551:                globalMenuItem.getAccessibleContext().setAccessibleDescription(
0552:                        org.openide.util.NbBundle.getMessage(
0553:                                GUIRegistrationPanel.class,
0554:                                "ACS_CTL_globalMenuItem")); // NOI18N
0555:
0556:                menuTxt.setLabelFor(menu);
0557:                org.openide.awt.Mnemonics.setLocalizedText(menuTxt,
0558:                        org.openide.util.NbBundle.getMessage(
0559:                                GUIRegistrationPanel.class, "LBL_Menu")); // NOI18N
0560:                gridBagConstraints = new java.awt.GridBagConstraints();
0561:                gridBagConstraints.gridx = 0;
0562:                gridBagConstraints.gridy = 2;
0563:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0564:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 3, 0);
0565:                add(menuTxt, gridBagConstraints);
0566:                gridBagConstraints = new java.awt.GridBagConstraints();
0567:                gridBagConstraints.gridx = 1;
0568:                gridBagConstraints.gridy = 2;
0569:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0570:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0571:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0572:                gridBagConstraints.weightx = 1.0;
0573:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
0574:                add(menu, gridBagConstraints);
0575:                menu.getAccessibleContext().setAccessibleDescription(
0576:                        org.openide.util.NbBundle.getMessage(
0577:                                GUIRegistrationPanel.class, "ACS_CTL_menu")); // NOI18N
0578:
0579:                menuPositionTxt.setLabelFor(menuPosition);
0580:                org.openide.awt.Mnemonics.setLocalizedText(menuPositionTxt,
0581:                        org.openide.util.NbBundle.getMessage(
0582:                                GUIRegistrationPanel.class, "LBL_Position")); // NOI18N
0583:                gridBagConstraints = new java.awt.GridBagConstraints();
0584:                gridBagConstraints.gridx = 0;
0585:                gridBagConstraints.gridy = 3;
0586:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0587:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 3, 0);
0588:                add(menuPositionTxt, gridBagConstraints);
0589:
0590:                menuPosition.setRenderer(POSITION_RENDERER);
0591:                gridBagConstraints = new java.awt.GridBagConstraints();
0592:                gridBagConstraints.gridx = 1;
0593:                gridBagConstraints.gridy = 3;
0594:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0595:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0596:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0597:                gridBagConstraints.weightx = 1.0;
0598:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
0599:                add(menuPosition, gridBagConstraints);
0600:                menuPosition.getAccessibleContext().setAccessibleDescription(
0601:                        org.openide.util.NbBundle.getMessage(
0602:                                GUIRegistrationPanel.class,
0603:                                "ACS_CTL_menuPosition")); // NOI18N
0604:
0605:                menuSeparatorPanel.setLayout(new java.awt.FlowLayout(
0606:                        java.awt.FlowLayout.CENTER, 0, 0));
0607:
0608:                org.openide.awt.Mnemonics.setLocalizedText(menuSeparatorBefore,
0609:                        org.openide.util.NbBundle.getMessage(
0610:                                GUIRegistrationPanel.class,
0611:                                "LBL_SeparatorBefore")); // NOI18N
0612:                menuSeparatorPanel.add(menuSeparatorBefore);
0613:                menuSeparatorBefore.getAccessibleContext()
0614:                        .setAccessibleDescription(
0615:                                org.openide.util.NbBundle.getMessage(
0616:                                        GUIRegistrationPanel.class,
0617:                                        "ACS_CTL_menuSeparatorBefore")); // NOI18N
0618:
0619:                org.openide.awt.Mnemonics.setLocalizedText(menuSeparatorAfter,
0620:                        org.openide.util.NbBundle.getMessage(
0621:                                GUIRegistrationPanel.class,
0622:                                "LBL_SeparatorAfter")); // NOI18N
0623:                menuSeparatorAfter.setBorder(javax.swing.BorderFactory
0624:                        .createEmptyBorder(0, 6, 0, 0));
0625:                menuSeparatorPanel.add(menuSeparatorAfter);
0626:                menuSeparatorAfter.getAccessibleContext()
0627:                        .setAccessibleDescription(
0628:                                org.openide.util.NbBundle.getMessage(
0629:                                        GUIRegistrationPanel.class,
0630:                                        "ACS_CTL_menuSeparatorAfter")); // NOI18N
0631:
0632:                gridBagConstraints = new java.awt.GridBagConstraints();
0633:                gridBagConstraints.gridx = 0;
0634:                gridBagConstraints.gridy = 4;
0635:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0636:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0637:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 0, 0);
0638:                add(menuSeparatorPanel, gridBagConstraints);
0639:
0640:                org.openide.awt.Mnemonics.setLocalizedText(globalToolbarButton,
0641:                        org.openide.util.NbBundle.getMessage(
0642:                                GUIRegistrationPanel.class,
0643:                                "LBL_GlobalToolbarButton")); // NOI18N
0644:                globalToolbarButton.setBorder(javax.swing.BorderFactory
0645:                        .createEmptyBorder(0, 0, 0, 0));
0646:                globalToolbarButton
0647:                        .addActionListener(new java.awt.event.ActionListener() {
0648:                            public void actionPerformed(
0649:                                    java.awt.event.ActionEvent evt) {
0650:                                globalToolbarButtonActionPerformed(evt);
0651:                            }
0652:                        });
0653:                gridBagConstraints = new java.awt.GridBagConstraints();
0654:                gridBagConstraints.gridx = 0;
0655:                gridBagConstraints.gridy = 5;
0656:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0657:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0658:                gridBagConstraints.insets = new java.awt.Insets(18, 0, 3, 0);
0659:                add(globalToolbarButton, gridBagConstraints);
0660:                globalToolbarButton.getAccessibleContext()
0661:                        .setAccessibleDescription(
0662:                                org.openide.util.NbBundle.getMessage(
0663:                                        GUIRegistrationPanel.class,
0664:                                        "ACS_CTL_globalToolbarButton")); // NOI18N
0665:
0666:                toolbarTxt.setLabelFor(toolbar);
0667:                org.openide.awt.Mnemonics.setLocalizedText(toolbarTxt,
0668:                        org.openide.util.NbBundle.getMessage(
0669:                                GUIRegistrationPanel.class, "LBL_Toolbar")); // NOI18N
0670:                gridBagConstraints = new java.awt.GridBagConstraints();
0671:                gridBagConstraints.gridx = 0;
0672:                gridBagConstraints.gridy = 6;
0673:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0674:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 3, 0);
0675:                add(toolbarTxt, gridBagConstraints);
0676:                gridBagConstraints = new java.awt.GridBagConstraints();
0677:                gridBagConstraints.gridx = 1;
0678:                gridBagConstraints.gridy = 6;
0679:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0680:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0681:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0682:                gridBagConstraints.weightx = 1.0;
0683:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
0684:                add(toolbar, gridBagConstraints);
0685:                toolbar.getAccessibleContext().setAccessibleDescription(
0686:                        org.openide.util.NbBundle.getMessage(
0687:                                GUIRegistrationPanel.class, "ACS_CTL_toolbar")); // NOI18N
0688:
0689:                toolbarPositionTxt.setLabelFor(toolbarPosition);
0690:                org.openide.awt.Mnemonics.setLocalizedText(toolbarPositionTxt,
0691:                        org.openide.util.NbBundle.getMessage(
0692:                                GUIRegistrationPanel.class, "LBL_Position")); // NOI18N
0693:                gridBagConstraints = new java.awt.GridBagConstraints();
0694:                gridBagConstraints.gridx = 0;
0695:                gridBagConstraints.gridy = 7;
0696:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0697:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 3, 0);
0698:                add(toolbarPositionTxt, gridBagConstraints);
0699:
0700:                toolbarPosition.setRenderer(POSITION_RENDERER);
0701:                gridBagConstraints = new java.awt.GridBagConstraints();
0702:                gridBagConstraints.gridx = 1;
0703:                gridBagConstraints.gridy = 7;
0704:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0705:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0706:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0707:                gridBagConstraints.weightx = 1.0;
0708:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
0709:                add(toolbarPosition, gridBagConstraints);
0710:                toolbarPosition.getAccessibleContext()
0711:                        .setAccessibleDescription(
0712:                                org.openide.util.NbBundle.getMessage(
0713:                                        GUIRegistrationPanel.class,
0714:                                        "ACS_CTL_toolbarPosition")); // NOI18N
0715:
0716:                org.openide.awt.Mnemonics.setLocalizedText(
0717:                        globalKeyboardShortcut, org.openide.util.NbBundle
0718:                                .getMessage(GUIRegistrationPanel.class,
0719:                                        "LBL_GlobalKeyboardShortcut")); // NOI18N
0720:                globalKeyboardShortcut.setBorder(javax.swing.BorderFactory
0721:                        .createEmptyBorder(0, 0, 0, 0));
0722:                globalKeyboardShortcut
0723:                        .addActionListener(new java.awt.event.ActionListener() {
0724:                            public void actionPerformed(
0725:                                    java.awt.event.ActionEvent evt) {
0726:                                globalKeyboardShortcutActionPerformed(evt);
0727:                            }
0728:                        });
0729:                gridBagConstraints = new java.awt.GridBagConstraints();
0730:                gridBagConstraints.gridx = 0;
0731:                gridBagConstraints.gridy = 8;
0732:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0733:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0734:                gridBagConstraints.insets = new java.awt.Insets(18, 0, 3, 0);
0735:                add(globalKeyboardShortcut, gridBagConstraints);
0736:                globalKeyboardShortcut.getAccessibleContext()
0737:                        .setAccessibleDescription(
0738:                                org.openide.util.NbBundle.getMessage(
0739:                                        GUIRegistrationPanel.class,
0740:                                        "ACS_CTL_globalKeyboardShortcut")); // NOI18N
0741:
0742:                keyStrokeTxt.setLabelFor(menuPosition);
0743:                org.openide.awt.Mnemonics.setLocalizedText(keyStrokeTxt,
0744:                        org.openide.util.NbBundle.getMessage(
0745:                                GUIRegistrationPanel.class, "LBL_KeyStroke")); // NOI18N
0746:                gridBagConstraints = new java.awt.GridBagConstraints();
0747:                gridBagConstraints.gridx = 0;
0748:                gridBagConstraints.gridy = 9;
0749:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0750:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 3, 0);
0751:                add(keyStrokeTxt, gridBagConstraints);
0752:                keyStrokeTxt.getAccessibleContext().setAccessibleDescription(
0753:                        org.openide.util.NbBundle.getMessage(
0754:                                GUIRegistrationPanel.class,
0755:                                "ACS_CTL_keyStrokeDef")); // NOI18N
0756:
0757:                shortcutsList.setVisibleRowCount(3);
0758:                shortcutsList
0759:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0760:                            public void valueChanged(
0761:                                    javax.swing.event.ListSelectionEvent evt) {
0762:                                shortcutsListChanged(evt);
0763:                            }
0764:                        });
0765:                jScrollPane1.setViewportView(shortcutsList);
0766:                shortcutsList.getAccessibleContext().setAccessibleDescription(
0767:                        org.openide.util.NbBundle.getMessage(
0768:                                GUIRegistrationPanel.class,
0769:                                "ACS_CTL_keyStrokeList")); // NOI18N
0770:
0771:                gridBagConstraints = new java.awt.GridBagConstraints();
0772:                gridBagConstraints.gridx = 1;
0773:                gridBagConstraints.gridy = 9;
0774:                gridBagConstraints.gridheight = 2;
0775:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0776:                gridBagConstraints.weightx = 1.0;
0777:                gridBagConstraints.weighty = 1.0;
0778:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
0779:                add(jScrollPane1, gridBagConstraints);
0780:
0781:                org.openide.awt.Mnemonics.setLocalizedText(keyStrokeChange,
0782:                        org.openide.util.NbBundle.getMessage(
0783:                                GUIRegistrationPanel.class, "CTL_Change")); // NOI18N
0784:                keyStrokeChange
0785:                        .addActionListener(new java.awt.event.ActionListener() {
0786:                            public void actionPerformed(
0787:                                    java.awt.event.ActionEvent evt) {
0788:                                keyStrokeChangeActionPerformed(evt);
0789:                            }
0790:                        });
0791:                gridBagConstraints = new java.awt.GridBagConstraints();
0792:                gridBagConstraints.gridx = 2;
0793:                gridBagConstraints.gridy = 9;
0794:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0795:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0796:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0797:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
0798:                add(keyStrokeChange, gridBagConstraints);
0799:                keyStrokeChange.getAccessibleContext()
0800:                        .setAccessibleDescription(
0801:                                org.openide.util.NbBundle.getMessage(
0802:                                        GUIRegistrationPanel.class,
0803:                                        "ACS_CTL_keyStrokeChange")); // NOI18N
0804:
0805:                java.util.ResourceBundle bundle = java.util.ResourceBundle
0806:                        .getBundle("org/netbeans/modules/apisupport/project/ui/wizard/action/Bundle"); // NOI18N
0807:                org.openide.awt.Mnemonics.setLocalizedText(keyStrokeRemove,
0808:                        bundle.getString("CTL_Remove")); // NOI18N
0809:                keyStrokeRemove
0810:                        .addActionListener(new java.awt.event.ActionListener() {
0811:                            public void actionPerformed(
0812:                                    java.awt.event.ActionEvent evt) {
0813:                                keyStrokeRemoveActionPerformed(evt);
0814:                            }
0815:                        });
0816:                gridBagConstraints = new java.awt.GridBagConstraints();
0817:                gridBagConstraints.gridx = 2;
0818:                gridBagConstraints.gridy = 10;
0819:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0820:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0821:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0822:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
0823:                add(keyStrokeRemove, gridBagConstraints);
0824:                keyStrokeRemove.getAccessibleContext()
0825:                        .setAccessibleDescription(
0826:                                org.openide.util.NbBundle.getMessage(
0827:                                        GUIRegistrationPanel.class,
0828:                                        "ACS_CTL_keyStrokeRemove")); // NOI18N
0829:
0830:                gridBagConstraints = new java.awt.GridBagConstraints();
0831:                gridBagConstraints.gridx = 1;
0832:                gridBagConstraints.gridy = 19;
0833:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0834:                gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
0835:                gridBagConstraints.weightx = 1.0;
0836:                gridBagConstraints.weighty = 1.0;
0837:                add(filler, gridBagConstraints);
0838:
0839:                org.openide.awt.Mnemonics.setLocalizedText(fileTypeContext,
0840:                        org.openide.util.NbBundle.getMessage(
0841:                                GUIRegistrationPanel.class,
0842:                                "LBL_FileTypeContextMenuItem")); // NOI18N
0843:                fileTypeContext.setBorder(javax.swing.BorderFactory
0844:                        .createEmptyBorder(0, 0, 0, 0));
0845:                fileTypeContext
0846:                        .addActionListener(new java.awt.event.ActionListener() {
0847:                            public void actionPerformed(
0848:                                    java.awt.event.ActionEvent evt) {
0849:                                fileTypeContextActionPerformed(evt);
0850:                            }
0851:                        });
0852:                gridBagConstraints = new java.awt.GridBagConstraints();
0853:                gridBagConstraints.gridx = 0;
0854:                gridBagConstraints.gridy = 11;
0855:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0856:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0857:                gridBagConstraints.insets = new java.awt.Insets(18, 0, 3, 0);
0858:                add(fileTypeContext, gridBagConstraints);
0859:                fileTypeContext.getAccessibleContext()
0860:                        .setAccessibleDescription(
0861:                                org.openide.util.NbBundle.getMessage(
0862:                                        GUIRegistrationPanel.class,
0863:                                        "ACS_CTL_FileTypeContext")); // NOI18N
0864:
0865:                ftContentTypeTxt.setLabelFor(ftContentType);
0866:                org.openide.awt.Mnemonics.setLocalizedText(ftContentTypeTxt,
0867:                        org.openide.util.NbBundle.getMessage(
0868:                                GUIRegistrationPanel.class, "LBL_ContentType")); // NOI18N
0869:                gridBagConstraints = new java.awt.GridBagConstraints();
0870:                gridBagConstraints.gridx = 0;
0871:                gridBagConstraints.gridy = 12;
0872:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0873:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 3, 0);
0874:                add(ftContentTypeTxt, gridBagConstraints);
0875:                gridBagConstraints = new java.awt.GridBagConstraints();
0876:                gridBagConstraints.gridx = 1;
0877:                gridBagConstraints.gridy = 12;
0878:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0879:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0880:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0881:                gridBagConstraints.weightx = 1.0;
0882:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
0883:                add(ftContentType, gridBagConstraints);
0884:                ftContentType.getAccessibleContext().setAccessibleDescription(
0885:                        org.openide.util.NbBundle.getMessage(
0886:                                GUIRegistrationPanel.class,
0887:                                "ACS_CTL_ftContentType")); // NOI18N
0888:
0889:                ftPositionTxt.setLabelFor(ftPosition);
0890:                org.openide.awt.Mnemonics.setLocalizedText(ftPositionTxt,
0891:                        org.openide.util.NbBundle.getMessage(
0892:                                GUIRegistrationPanel.class, "LBL_Position")); // NOI18N
0893:                gridBagConstraints = new java.awt.GridBagConstraints();
0894:                gridBagConstraints.gridx = 0;
0895:                gridBagConstraints.gridy = 13;
0896:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0897:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 3, 0);
0898:                add(ftPositionTxt, gridBagConstraints);
0899:
0900:                ftPosition.setRenderer(POSITION_RENDERER);
0901:                gridBagConstraints = new java.awt.GridBagConstraints();
0902:                gridBagConstraints.gridx = 1;
0903:                gridBagConstraints.gridy = 13;
0904:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0905:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0906:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0907:                gridBagConstraints.weightx = 1.0;
0908:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
0909:                add(ftPosition, gridBagConstraints);
0910:                ftPosition.getAccessibleContext().setAccessibleDescription(
0911:                        org.openide.util.NbBundle.getMessage(
0912:                                GUIRegistrationPanel.class,
0913:                                "ACS_CTL_ftPosition")); // NOI18N
0914:
0915:                ftSeparatorPanel.setLayout(new java.awt.FlowLayout(
0916:                        java.awt.FlowLayout.CENTER, 0, 0));
0917:
0918:                org.openide.awt.Mnemonics.setLocalizedText(ftSeparatorBefore,
0919:                        org.openide.util.NbBundle.getMessage(
0920:                                GUIRegistrationPanel.class,
0921:                                "LBL_SeparatorBefore")); // NOI18N
0922:                ftSeparatorPanel.add(ftSeparatorBefore);
0923:                ftSeparatorBefore.getAccessibleContext()
0924:                        .setAccessibleDescription(
0925:                                org.openide.util.NbBundle.getMessage(
0926:                                        GUIRegistrationPanel.class,
0927:                                        "ACS_CTL_ftSeparatorBefore")); // NOI18N
0928:
0929:                org.openide.awt.Mnemonics.setLocalizedText(ftSeparatorAfter,
0930:                        org.openide.util.NbBundle.getMessage(
0931:                                GUIRegistrationPanel.class,
0932:                                "LBL_SeparatorAfter")); // NOI18N
0933:                ftSeparatorAfter.setBorder(javax.swing.BorderFactory
0934:                        .createEmptyBorder(0, 6, 0, 0));
0935:                ftSeparatorPanel.add(ftSeparatorAfter);
0936:                ftSeparatorAfter.getAccessibleContext()
0937:                        .setAccessibleDescription(
0938:                                org.openide.util.NbBundle.getMessage(
0939:                                        GUIRegistrationPanel.class,
0940:                                        "ACS_CTL_ftSeparatorAfter")); // NOI18N
0941:
0942:                gridBagConstraints = new java.awt.GridBagConstraints();
0943:                gridBagConstraints.gridx = 0;
0944:                gridBagConstraints.gridy = 14;
0945:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0946:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0947:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 0, 0);
0948:                add(ftSeparatorPanel, gridBagConstraints);
0949:
0950:                org.openide.awt.Mnemonics.setLocalizedText(editorContext,
0951:                        org.openide.util.NbBundle.getMessage(
0952:                                GUIRegistrationPanel.class,
0953:                                "LBL_EditorContextMenuItem")); // NOI18N
0954:                editorContext.setBorder(javax.swing.BorderFactory
0955:                        .createEmptyBorder(0, 0, 0, 0));
0956:                editorContext
0957:                        .addActionListener(new java.awt.event.ActionListener() {
0958:                            public void actionPerformed(
0959:                                    java.awt.event.ActionEvent evt) {
0960:                                editorContextActionPerformed(evt);
0961:                            }
0962:                        });
0963:                gridBagConstraints = new java.awt.GridBagConstraints();
0964:                gridBagConstraints.gridx = 0;
0965:                gridBagConstraints.gridy = 15;
0966:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0967:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0968:                gridBagConstraints.insets = new java.awt.Insets(18, 0, 3, 0);
0969:                add(editorContext, gridBagConstraints);
0970:                editorContext.getAccessibleContext().setAccessibleDescription(
0971:                        org.openide.util.NbBundle.getMessage(
0972:                                GUIRegistrationPanel.class,
0973:                                "ACS_CTL_EditorContext")); // NOI18N
0974:
0975:                edContentTypeTxt.setLabelFor(edContentType);
0976:                org.openide.awt.Mnemonics.setLocalizedText(edContentTypeTxt,
0977:                        org.openide.util.NbBundle.getMessage(
0978:                                GUIRegistrationPanel.class, "LBL_ContentType")); // NOI18N
0979:                gridBagConstraints = new java.awt.GridBagConstraints();
0980:                gridBagConstraints.gridx = 0;
0981:                gridBagConstraints.gridy = 16;
0982:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0983:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 3, 0);
0984:                add(edContentTypeTxt, gridBagConstraints);
0985:                gridBagConstraints = new java.awt.GridBagConstraints();
0986:                gridBagConstraints.gridx = 1;
0987:                gridBagConstraints.gridy = 16;
0988:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
0989:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0990:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0991:                gridBagConstraints.weightx = 1.0;
0992:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
0993:                add(edContentType, gridBagConstraints);
0994:                edContentType.getAccessibleContext().setAccessibleDescription(
0995:                        org.openide.util.NbBundle.getMessage(
0996:                                GUIRegistrationPanel.class,
0997:                                "ACS_CTL_edContentType")); // NOI18N
0998:
0999:                edPositionTxt.setLabelFor(edPosition);
1000:                org.openide.awt.Mnemonics.setLocalizedText(edPositionTxt,
1001:                        org.openide.util.NbBundle.getMessage(
1002:                                GUIRegistrationPanel.class, "LBL_Position")); // NOI18N
1003:                gridBagConstraints = new java.awt.GridBagConstraints();
1004:                gridBagConstraints.gridx = 0;
1005:                gridBagConstraints.gridy = 17;
1006:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1007:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 3, 0);
1008:                add(edPositionTxt, gridBagConstraints);
1009:
1010:                edPosition.setRenderer(POSITION_RENDERER);
1011:                gridBagConstraints = new java.awt.GridBagConstraints();
1012:                gridBagConstraints.gridx = 1;
1013:                gridBagConstraints.gridy = 17;
1014:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
1015:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1016:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1017:                gridBagConstraints.weightx = 1.0;
1018:                gridBagConstraints.insets = new java.awt.Insets(3, 12, 3, 0);
1019:                add(edPosition, gridBagConstraints);
1020:                edPosition.getAccessibleContext().setAccessibleDescription(
1021:                        org.openide.util.NbBundle.getMessage(
1022:                                GUIRegistrationPanel.class,
1023:                                "ACS_CTL_edPosition")); // NOI18N
1024:
1025:                edSeparatorPanel.setLayout(new java.awt.FlowLayout(
1026:                        java.awt.FlowLayout.CENTER, 0, 0));
1027:
1028:                org.openide.awt.Mnemonics.setLocalizedText(edSeparatorBefore,
1029:                        org.openide.util.NbBundle.getMessage(
1030:                                GUIRegistrationPanel.class,
1031:                                "LBL_SeparatorBefore")); // NOI18N
1032:                edSeparatorPanel.add(edSeparatorBefore);
1033:                edSeparatorBefore.getAccessibleContext()
1034:                        .setAccessibleDescription(
1035:                                org.openide.util.NbBundle.getMessage(
1036:                                        GUIRegistrationPanel.class,
1037:                                        "ACS_CTL_edSeparatorBefore")); // NOI18N
1038:
1039:                org.openide.awt.Mnemonics.setLocalizedText(edSeparatorAfter,
1040:                        org.openide.util.NbBundle.getMessage(
1041:                                GUIRegistrationPanel.class,
1042:                                "LBL_SeparatorAfter")); // NOI18N
1043:                edSeparatorAfter.setBorder(javax.swing.BorderFactory
1044:                        .createEmptyBorder(0, 6, 0, 0));
1045:                edSeparatorPanel.add(edSeparatorAfter);
1046:                edSeparatorAfter.getAccessibleContext()
1047:                        .setAccessibleDescription(
1048:                                org.openide.util.NbBundle.getMessage(
1049:                                        GUIRegistrationPanel.class,
1050:                                        "ACS_CTL_edSeparatorAfter")); // NOI18N
1051:
1052:                gridBagConstraints = new java.awt.GridBagConstraints();
1053:                gridBagConstraints.gridx = 0;
1054:                gridBagConstraints.gridy = 18;
1055:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
1056:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1057:                gridBagConstraints.insets = new java.awt.Insets(3, 18, 0, 0);
1058:                add(edSeparatorPanel, gridBagConstraints);
1059:
1060:                getAccessibleContext().setAccessibleDescription(
1061:                        org.openide.util.NbBundle.getMessage(
1062:                                GUIRegistrationPanel.class,
1063:                                "ACS_GuiRegistrationPanel")); // NOI18N
1064:            }// </editor-fold>//GEN-END:initComponents
1065:
1066:            private void shortcutsListChanged(
1067:                    javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_shortcutsListChanged
1068:                setShortcutGroupEnabled();
1069:            }//GEN-LAST:event_shortcutsListChanged
1070:
1071:            private void keyStrokeRemoveActionPerformed(
1072:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keyStrokeRemoveActionPerformed
1073:                DefaultListModel lm = (DefaultListModel) shortcutsList
1074:                        .getModel();
1075:                Object[] selected = shortcutsList.getSelectedValues();
1076:                if (selected.length > 0) {
1077:                    int idx = shortcutsList.getSelectionModel()
1078:                            .getMinSelectionIndex();
1079:                    for (int i = 0; i < selected.length; i++) {
1080:                        lm.removeElement(selected[i]);
1081:                    }
1082:                    if (lm.getSize() > 0) {
1083:                        idx = (idx > 0) ? idx - 1 : 0;
1084:                        shortcutsList.setSelectedIndex(idx);
1085:                    }
1086:                }
1087:                checkValidity();
1088:            }//GEN-LAST:event_keyStrokeRemoveActionPerformed
1089:
1090:            private void editorContextActionPerformed(
1091:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editorContextActionPerformed
1092:                setGroupEnabled(editorGroup, editorContext.isSelected());
1093:                checkValidity();
1094:            }//GEN-LAST:event_editorContextActionPerformed
1095:
1096:            private void fileTypeContextActionPerformed(
1097:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileTypeContextActionPerformed
1098:                setGroupEnabled(fileTypeGroup, fileTypeContext.isSelected());
1099:                checkValidity();
1100:            }//GEN-LAST:event_fileTypeContextActionPerformed
1101:
1102:            private void globalMenuItemActionPerformed(
1103:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_globalMenuItemActionPerformed
1104:                setGroupEnabled(gmiGroup, globalMenuItem.isSelected());
1105:
1106:                checkValidity();
1107:            }//GEN-LAST:event_globalMenuItemActionPerformed
1108:
1109:            private void globalToolbarButtonActionPerformed(
1110:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_globalToolbarButtonActionPerformed
1111:                setGroupEnabled(toolbarGroup, globalToolbarButton.isSelected());
1112:                checkValidity();
1113:            }//GEN-LAST:event_globalToolbarButtonActionPerformed
1114:
1115:            private void globalKeyboardShortcutActionPerformed(
1116:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_globalKeyboardShortcutActionPerformed
1117:                setShortcutGroupEnabled();
1118:                checkValidity();
1119:            }//GEN-LAST:event_globalKeyboardShortcutActionPerformed
1120:
1121:            private void keyStrokeChangeActionPerformed(
1122:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keyStrokeChangeActionPerformed
1123:                KeyStroke[] keyStrokes = ShortcutEnterPanel.showDialog();
1124:                if (keyStrokes != null && keyStrokes.length > 0) {
1125:                    String newShortcut = UIUtil.keyStrokesToString(keyStrokes);
1126:                    DefaultListModel lm = (DefaultListModel) shortcutsList
1127:                            .getModel();
1128:                    if (!lm.contains(newShortcut)) {
1129:                        lm.addElement(newShortcut);
1130:                        data.setKeyStroke(UIUtil
1131:                                .keyStrokesToLogicalString(keyStrokes));
1132:                        shortcutsList.setSelectedValue(newShortcut, true);
1133:                        checkValidity();
1134:                    }
1135:                }
1136:            }//GEN-LAST:event_keyStrokeChangeActionPerformed
1137:
1138:            // Variables declaration - do not modify//GEN-BEGIN:variables
1139:            private javax.swing.JComboBox category;
1140:            private javax.swing.JLabel categoryTxt;
1141:            private javax.swing.JComboBox edContentType;
1142:            private javax.swing.JLabel edContentTypeTxt;
1143:            private javax.swing.JComboBox edPosition;
1144:            private javax.swing.JLabel edPositionTxt;
1145:            private javax.swing.JCheckBox edSeparatorAfter;
1146:            private javax.swing.JCheckBox edSeparatorBefore;
1147:            private javax.swing.JPanel edSeparatorPanel;
1148:            javax.swing.JCheckBox editorContext;
1149:            javax.swing.JCheckBox fileTypeContext;
1150:            private javax.swing.JLabel filler;
1151:            private javax.swing.JComboBox ftContentType;
1152:            private javax.swing.JLabel ftContentTypeTxt;
1153:            private javax.swing.JComboBox ftPosition;
1154:            private javax.swing.JLabel ftPositionTxt;
1155:            private javax.swing.JCheckBox ftSeparatorAfter;
1156:            private javax.swing.JCheckBox ftSeparatorBefore;
1157:            private javax.swing.JPanel ftSeparatorPanel;
1158:            private javax.swing.JCheckBox globalKeyboardShortcut;
1159:            javax.swing.JCheckBox globalMenuItem;
1160:            javax.swing.JCheckBox globalToolbarButton;
1161:            private javax.swing.JScrollPane jScrollPane1;
1162:            private javax.swing.JButton keyStrokeChange;
1163:            private javax.swing.JButton keyStrokeRemove;
1164:            private javax.swing.JLabel keyStrokeTxt;
1165:            private javax.swing.JComboBox menu;
1166:            private javax.swing.JComboBox menuPosition;
1167:            private javax.swing.JLabel menuPositionTxt;
1168:            private javax.swing.JCheckBox menuSeparatorAfter;
1169:            private javax.swing.JCheckBox menuSeparatorBefore;
1170:            private javax.swing.JPanel menuSeparatorPanel;
1171:            private javax.swing.JLabel menuTxt;
1172:            private javax.swing.JList shortcutsList;
1173:            private javax.swing.JComboBox toolbar;
1174:            private javax.swing.JComboBox toolbarPosition;
1175:            private javax.swing.JLabel toolbarPositionTxt;
1176:            private javax.swing.JLabel toolbarTxt;
1177:
1178:            // End of variables declaration//GEN-END:variables
1179:
1180:            /** Don't call me from EDT! */
1181:            private FileSystem getSFS() {
1182:                assert !EventQueue.isDispatchThread() : "Called from ETD!"; // NOI18N
1183:                if (sfs == null) {
1184:                    try {
1185:                        // XXX takes very long time. Consider to call it when e.g. module is loaded
1186:                        sfs = LayerUtils.getEffectiveSystemFilesystem(data
1187:                                .getProject());
1188:                    } catch (IOException ex) {
1189:                        Util.err.notify(ex);
1190:                        sfs = FileUtil.createMemoryFileSystem();
1191:                    }
1192:                }
1193:                return sfs;
1194:            }
1195:
1196:            /**
1197:             * Actually really dedicated for Loader&hellip;Actions and
1198:             * Editors&hellip;Popup.
1199:             */
1200:            private List<DataFolder> getFoldersByName(
1201:                    final DataFolder startFolder, final String subFoldersName) {
1202:                List<DataFolder> result = new ArrayList<DataFolder>();
1203:                for (DataFolder dObj : getFolders(startFolder)) {
1204:                    if (subFoldersName.equals(dObj.getName())
1205:                            && dObj.getPrimaryFile().getParent() != startFolder
1206:                                    .getPrimaryFile()) {
1207:                        result.add(dObj);
1208:                    }
1209:                }
1210:                return result;
1211:            }
1212:
1213:            private static List<DataFolder> getFolders(DataFolder folder) {
1214:                List<DataFolder> folders = new ArrayList<DataFolder>();
1215:                getFolders(folder, folders); // #66144: depth-first, not breadth-first, search appropriate here
1216:                return folders;
1217:            }
1218:
1219:            private static void getFolders(DataFolder folder,
1220:                    List<DataFolder> folders) {
1221:                for (DataObject d : folder.getChildren()) {
1222:                    if (d instanceof  DataFolder) {
1223:                        DataFolder f = (DataFolder) d;
1224:                        folders.add(f);
1225:                        getFolders(f, folders);
1226:                    }
1227:                }
1228:            }
1229:
1230:            private static class PositionRenderer extends JLabel implements 
1231:                    ListCellRenderer, UIResource {
1232:
1233:                public PositionRenderer() {
1234:                    setOpaque(true);
1235:                }
1236:
1237:                public Component getListCellRendererComponent(JList list,
1238:                        Object value, int index, boolean isSelected,
1239:                        boolean cellHasFocus) {
1240:                    // #93658: GTK needs name to render cell renderer "natively"
1241:                    setName("ComboBox.listRenderer"); // NOI18N
1242:
1243:                    String text;
1244:                    if (value == null
1245:                            || value == CustomizerComponentFactory.WAIT_VALUE) {
1246:                        text = CustomizerComponentFactory.WAIT_VALUE;
1247:                    } else if (value == CustomizerComponentFactory.EMPTY_VALUE) {
1248:                        text = CustomizerComponentFactory.EMPTY_VALUE;
1249:                    } else {
1250:                        Position pos = (Position) value;
1251:                        String before = pos.getBeforeName() == null ? "" : pos
1252:                                .getBeforeName()
1253:                                + POSITION_SEPARATOR;
1254:                        String after = pos.getAfterName() == null ? ""
1255:                                : POSITION_SEPARATOR + pos.getAfterName();
1256:                        text = before + POSITION_HERE + after;
1257:                    }
1258:                    setText(text);
1259:
1260:                    if (isSelected) {
1261:                        setBackground(list.getSelectionBackground());
1262:                        setForeground(list.getSelectionForeground());
1263:                    } else {
1264:                        setBackground(list.getBackground());
1265:                        setForeground(list.getForeground());
1266:                    }
1267:
1268:                    return this ;
1269:                }
1270:
1271:                // #93658: GTK needs name to render cell renderer "natively"
1272:                public String getName() {
1273:                    String name = super .getName();
1274:                    return name == null ? "ComboBox.renderer" : name; // NOI18N
1275:                }
1276:
1277:            }
1278:
1279:            private class PML implements  PopupMenuListener {
1280:
1281:                private JComboBox menu;
1282:                private JComboBox position;
1283:
1284:                PML(JComboBox menu, JComboBox position) {
1285:                    this .menu = menu;
1286:                    this .position = position;
1287:                }
1288:
1289:                public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
1290:                    LayerItemPresenter item = getSelectedLayerPresenter(menu);
1291:                    if (item != null) {
1292:                        loadPositionsCombo(item, position);
1293:                    }
1294:                }
1295:
1296:                public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
1297:                    // we don't care
1298:                }
1299:
1300:                public void popupMenuCanceled(PopupMenuEvent e) {
1301:                    popupMenuWillBecomeInvisible(null);
1302:                }
1303:
1304:            }
1305:
1306:        }
w___w_w_.__j___a__v_a__2s.___c_om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.