Example usage for java.awt Event CTRL_MASK

List of usage examples for java.awt Event CTRL_MASK

Introduction

In this page you can find the example usage for java.awt Event CTRL_MASK.

Prototype

int CTRL_MASK

To view the source code for java.awt Event CTRL_MASK.

Click Source Link

Document

This flag indicates that the Control key was down when the event occurred.

Usage

From source file:org.zaproxy.zap.extension.soap.ExtensionImportWSDL.java

private ZapMenuItem getMenuImportLocalWSDL() {
    if (menuImportLocalWSDL == null) {
        menuImportLocalWSDL = new ZapMenuItem("soap.topmenu.tools.importWSDL",
                KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.CTRL_MASK, false));
        menuImportLocalWSDL/*from  ww  w.j a  v a2  s  .co  m*/
                .setToolTipText(Constant.messages.getString("soap.topmenu.tools.importWSDL.tooltip"));

        menuImportLocalWSDL.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
                // Prompt for a WSDL file.
                final JFileChooser chooser = new JFileChooser(
                        Model.getSingleton().getOptionsParam().getUserDirectory());
                FileNameExtensionFilter filter = new FileNameExtensionFilter("WSDL File", "wsdl", "wsdl");
                chooser.setFileFilter(filter);
                int rc = chooser.showOpenDialog(View.getSingleton().getMainFrame());
                if (rc == JFileChooser.APPROVE_OPTION) {

                    Thread t = new Thread() {
                        @Override
                        public void run() {
                            this.setName(THREAD_PREFIX + threadId++);
                            parseWSDLFile(chooser.getSelectedFile());
                        }

                    };
                    t.start();
                }

            }
        });
    }
    return menuImportLocalWSDL;
}

From source file:org.zaproxy.zap.extension.soap.ExtensionImportWSDL.java

private ZapMenuItem getMenuImportUrlWSDL() {
    if (menuImportUrlWSDL == null) {
        menuImportUrlWSDL = new ZapMenuItem("soap.topmenu.tools.importRemoteWSDL",
                KeyStroke.getKeyStroke(KeyEvent.VK_J, Event.CTRL_MASK, false));
        menuImportUrlWSDL//from   w w  w.  ja  v  a 2  s . co  m
                .setToolTipText(Constant.messages.getString("soap.topmenu.tools.importRemoteWSDL.tooltip"));

        final ExtensionImportWSDL shadowCopy = this;
        menuImportUrlWSDL.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        new ImportFromUrlDialog(View.getSingleton().getMainFrame(), shadowCopy);
                    }
                });
            }
        });
    }
    return menuImportUrlWSDL;
}

From source file:unikn.dbis.univis.explorer.VExplorer.java

License:asdf

private void initMenuBar() {

    JMenuBar menuBar = new JMenuBar();

    VMenu program = new VMenu(Constants.PROGRAM);

    VMenuItem schemaImport = new VMenuItem(Constants.SCHEMA_IMPORT, VIcons.SCHEMA_IMPORT);
    schemaImport.setAccelerator(KeyStroke.getKeyStroke('I', Event.CTRL_MASK));
    schemaImport.addActionListener(new ActionListener() {
        /**//from   w ww .j a  v  a 2 s  .  co  m
         * Invoked when an action occurs.
         */
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser = new JFileChooser();

            fileChooser.addChoosableFileFilter(new FileFilter() {

                /**
                 * Whether the given file is accepted by this filter.
                 */
                public boolean accept(File f) {
                    return f.getName().endsWith(".vs.xml") || f.isDirectory();
                }

                /**
                 * The description of this filter. For example: "JPG and GIF Images"
                 *
                 * @see javax.swing.filechooser.FileView#getName
                 */
                public String getDescription() {
                    return "UniVis Schema (*.vs.xml)";
                }
            });

            int option = fileChooser.showOpenDialog(VExplorer.this);

            if (option == JFileChooser.APPROVE_OPTION) {
                File file = fileChooser.getSelectedFile();
                new SchemaImport(file);
                refreshTree();
                JOptionPane.showMessageDialog(VExplorer.this, "Schema Import erfolgreich beendet.",
                        "Schema Import", JOptionPane.INFORMATION_MESSAGE);
            }
        }
    });
    program.add(schemaImport);
    program.addSeparator();

    VMenuItem exit = new VMenuItem(Constants.EXIT, VIcons.EXIT);
    exit.setAccelerator(KeyStroke.getKeyStroke('Q', Event.ALT_MASK));
    exit.addActionListener(new ActionListener() {
        /**
         * Invoked when an action occurs.
         */
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    program.add(exit);

    VMenu lafMenu = new VMenu(Constants.LOOK_AND_FEEL);

    ButtonGroup lafGroup = new ButtonGroup();
    for (final UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
        JRadioButtonMenuItem lafMenuItem = new JRadioButtonMenuItem(laf.getName());

        // Set the current Look And Feel as selected.
        if (UIManager.getLookAndFeel().getName().equals(laf.getName())) {
            lafMenuItem.setSelected(true);
        }

        lafMenuItem.addActionListener(new ActionListener() {
            /**
             * Invoked when an action occurs.
             */
            public void actionPerformed(ActionEvent e) {
                updateLookAndFeel(laf.getClassName());
            }
        });

        lafGroup.add(lafMenuItem);
        lafMenu.add(lafMenuItem);
    }

    JMenu questionMark = new JMenu("?");

    VMenuItem license = new VMenuItem(Constants.LICENSE);
    license.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            new LicenseDialog(VExplorer.this);
        }
    });
    questionMark.add(license);

    final VMenuItem about = new VMenuItem(Constants.ABOUT, VIcons.INFORMATION);
    about.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            new AboutPanel(VExplorer.this);
        }
    });
    questionMark.add(about);

    menuBar.add(program);
    menuBar.add(lafMenu);
    menuBar.add(questionMark);

    setJMenuBar(menuBar);
}