Example usage for javax.swing JPopupMenu JPopupMenu

List of usage examples for javax.swing JPopupMenu JPopupMenu

Introduction

In this page you can find the example usage for javax.swing JPopupMenu JPopupMenu.

Prototype

public JPopupMenu() 

Source Link

Document

Constructs a JPopupMenu without an "invoker".

Usage

From source file:gdt.jgui.entity.contact.JContactFacetOpenItem.java

@Override
public JPopupMenu getPopupMenu(final String digestLocator$) {
    JPopupMenu popup = new JPopupMenu();
    JMenuItem editItem = new JMenuItem("Edit");
    popup.add(editItem);/*from   w  w w  .  j  a v  a  2s  .c  om*/
    editItem.setHorizontalTextPosition(JMenuItem.RIGHT);
    editItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //System.out.println("JContactFacetOpenItem:edit:digest locator="+digestLocator$);
            try {
                Properties locator = Locator.toProperties(digestLocator$);
                String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                Entigrator entigrator = console.getEntigrator(entihome$);
                JContactEditor ce = new JContactEditor();
                String ceLocator$ = ce.getLocator();
                ceLocator$ = Locator.append(ceLocator$, Entigrator.ENTIHOME, entihome$);
                ceLocator$ = Locator.append(ceLocator$, EntityHandler.ENTITY_KEY, entityKey$);
                JConsoleHandler.execute(console, ceLocator$);

            } catch (Exception ee) {
                Logger.getLogger(JContactFacetOpenItem.class.getName()).info(ee.toString());
            }
        }
    });
    return popup;

}

From source file:com.mirth.connect.client.ui.ChannelPanel.java

public ChannelPanel() {
    this.parent = PlatformUI.MIRTH_FRAME;
    initComponents();/*  w  w  w .ja  v a 2s  .c  o  m*/
    initLayout();

    channelTasks = new JXTaskPane();
    channelTasks.setTitle("Channel Tasks");
    channelTasks.setName(TaskConstants.CHANNEL_KEY);
    channelTasks.setFocusable(false);

    channelPopupMenu = new JPopupMenu();
    channelTable.setComponentPopupMenu(channelPopupMenu);

    parent.addTask(TaskConstants.CHANNEL_REFRESH, "Refresh", "Refresh the list of channels.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/arrow_refresh.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_REDEPLOY_ALL, "Redeploy All",
            "Undeploy all channels and deploy all currently enabled channels.", "A",
            new ImageIcon(
                    com.mirth.connect.client.ui.Frame.class.getResource("images/arrow_rotate_clockwise.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_DEPLOY, "Deploy Channel", "Deploys the currently selected channel.",
            "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/arrow_redo.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_EDIT_GLOBAL_SCRIPTS, "Edit Global Scripts",
            "Edit scripts that are not channel specific.", "G",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/script_edit.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_EDIT_CODE_TEMPLATES, "Edit Code Templates",
            "Create and manage templates to be used in JavaScript throughout Mirth.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/page_edit.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_NEW_CHANNEL, "New Channel", "Create a new channel.", "N",
            new ImageIcon(
                    com.mirth.connect.client.ui.Frame.class.getResource("images/application_form_add.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_IMPORT_CHANNEL, "Import Channel", "Import a channel from an XML file.",
            "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_go.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_EXPORT_ALL_CHANNELS, "Export All Channels",
            "Export all of the channels to XML files.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_disk.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_EXPORT_CHANNEL, "Export Channel",
            "Export the currently selected channel to an XML file.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_disk.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_DELETE_CHANNEL, "Delete Channel",
            "Delete the currently selected channel.", "L",
            new ImageIcon(
                    com.mirth.connect.client.ui.Frame.class.getResource("images/application_form_delete.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_CLONE, "Clone Channel", "Clone the currently selected channel.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/page_copy.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_EDIT, "Edit Channel", "Edit the currently selected channel.", "I",
            new ImageIcon(
                    com.mirth.connect.client.ui.Frame.class.getResource("images/application_form_edit.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_ENABLE, "Enable Channel", "Enable the currently selected channel.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/control_play_blue.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_DISABLE, "Disable Channel", "Disable the currently selected channel.",
            "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/control_stop_blue.png")),
            channelTasks, channelPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_VIEW_MESSAGES, "View Messages",
            "Show the messages for the currently selected channel.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/page_white_stack.png")),
            channelTasks, channelPopupMenu, this);

    parent.setNonFocusable(channelTasks);
    parent.taskPaneContainer.add(channelTasks, parent.taskPaneContainer.getComponentCount() - 1);

    groupTasks = new JXTaskPane();
    groupTasks.setTitle("Group Tasks");
    groupTasks.setName(TaskConstants.CHANNEL_GROUP_KEY);
    groupTasks.setFocusable(false);

    groupPopupMenu = new JPopupMenu();

    parent.addTask(TaskConstants.CHANNEL_GROUP_SAVE, "Save Group Changes",
            "Save all changes made to channel groups.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/disk.png")), groupTasks,
            groupPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_GROUP_ASSIGN_CHANNEL, "Assign To Group",
            "Assign channel(s) to a group.", "A",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_go.png")),
            groupTasks, groupPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_GROUP_NEW_GROUP, "New Group", "Create a new channel group.", "N",
            new ImageIcon(
                    com.mirth.connect.client.ui.Frame.class.getResource("images/application_form_add.png")),
            groupTasks, groupPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_GROUP_EDIT_DETAILS, "Edit Group Details",
            "Edit group name and description.", "E",
            new ImageIcon(
                    com.mirth.connect.client.ui.Frame.class.getResource("images/application_form_edit.png")),
            groupTasks, groupPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_GROUP_EXPORT_ALL_GROUPS, "Export All Groups",
            "Export all of the channel groups to XML files.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_disk.png")),
            groupTasks, groupPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_GROUP_IMPORT_GROUP, "Import Group",
            "Import a channel group from an XML file.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_go.png")),
            groupTasks, groupPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_GROUP_EXPORT_GROUP, "Export Group",
            "Export the currently selected channel group to an XML file.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_disk.png")),
            groupTasks, groupPopupMenu, this);
    parent.addTask(TaskConstants.CHANNEL_GROUP_DELETE_GROUP, "Delete Group",
            "Delete the currently selected channel group.", "L",
            new ImageIcon(
                    com.mirth.connect.client.ui.Frame.class.getResource("images/application_form_delete.png")),
            groupTasks, groupPopupMenu, this);

    parent.setNonFocusable(groupTasks);
    parent.taskPaneContainer.add(groupTasks, parent.taskPaneContainer.getComponentCount() - 1);

    channelScrollPane.setComponentPopupMenu(channelPopupMenu);

    ChannelTreeTableModel model = (ChannelTreeTableModel) channelTable.getTreeTableModel();

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("channelGroupViewEnabled", true)) {
        tableModeGroupsButton.setSelected(true);
        tableModeGroupsButton.setContentFilled(true);
        tableModeChannelsButton.setContentFilled(false);
        model.setGroupModeEnabled(true);
    } else {
        tableModeChannelsButton.setSelected(true);
        tableModeChannelsButton.setContentFilled(true);
        tableModeGroupsButton.setContentFilled(false);
        model.setGroupModeEnabled(false);
    }

    updateModel(new TableState(new ArrayList<String>(), null));
    updateTasks();
}

From source file:gdt.jgui.entity.webset.JWeblinkEditor.java

private void showLoginMenu(MouseEvent e) {
    try {//from  w ww .j  av  a  2s  .  c om
        JPopupMenu logonMenu = new JPopupMenu();
        JMenuItem copyItem = new JMenuItem("Copy");
        logonMenu.add(copyItem);
        copyItem.setHorizontalTextPosition(JMenuItem.RIGHT);
        copyItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    StringSelection stringSelection = new StringSelection(loginField.getText());
                    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                    clipboard.setContents(stringSelection, JWeblinkEditor.this);
                } catch (Exception ee) {
                    Logger.getLogger(getClass().getName()).info(ee.toString());
                }
            }
        });
        logonMenu.show(e.getComponent(), e.getX(), e.getY());
    } catch (Exception ee) {
        Logger.getLogger(getClass().getName()).severe(ee.toString());
    }
}

From source file:gdt.jgui.entity.email.JEmailFacetOpenItem.java

@Override
public JPopupMenu getPopupMenu(final String digestLocator$) {

    JPopupMenu popup = new JPopupMenu();
    JMenuItem editItem = new JMenuItem("Edit");
    popup.add(editItem);// w  w  w .  ja v  a  2  s .co m
    editItem.setHorizontalTextPosition(JMenuItem.RIGHT);
    editItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //System.out.println("JEmailFacetOpenItem:edit:digest locator="+digestLocator$);
            try {
                Properties locator = Locator.toProperties(digestLocator$);
                String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                Entigrator entigrator = console.getEntigrator(entihome$);
                Sack entity = entigrator.getEntityAtKey(entityKey$);
                String email$ = entity.getProperty("email");
                JTextEditor te = new JTextEditor();
                String teLocator$ = te.getLocator();
                teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, email$);
                String foiLocator$ = getLocator();
                foiLocator$ = Locator.append(foiLocator$, BaseHandler.HANDLER_METHOD, METHOD_RESPONSE);
                foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_ACTION, ACTION_DIGEST_CALL);
                foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                        Locator.compressText(digestLocator$));
                teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                        Locator.compressText(foiLocator$));
                //System.out.println("JEmailFacetOpenItem:edit:text editor="+teLocator$);
                JConsoleHandler.execute(console, teLocator$);
            } catch (Exception ee) {
                Logger.getLogger(JEmailFacetOpenItem.class.getName()).info(ee.toString());
            }
        }
    });
    return popup;

}

From source file:com.qawaa.gui.EventWebScanGUI.java

/**
 * ??//from   ww  w .  j  av a2s.  c  o m
 */
private static void setConsoleRight() {
    consoleRight = new JPopupMenu();
    consoleRight.setBorderPainted(true);
    consoleRight.setPopupSize(new Dimension(105, 135));
    JMenuItem clear = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.clear", null, Locale.CHINA),
            KeyEvent.VK_L);
    JMenuItem copy = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.copy", null, Locale.CHINA),
            KeyEvent.VK_C);
    JMenuItem cut = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.cut", null, Locale.CHINA),
            KeyEvent.VK_X);
    JMenuItem font = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.font", null, Locale.CHINA),
            KeyEvent.VK_F);
    JMenuItem choose = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.choose", null, Locale.CHINA),
            KeyEvent.VK_O);
    JMenuItem saveas = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.saveas", null, Locale.CHINA),
            KeyEvent.VK_S);
    consoleRight.add(clear);
    consoleRight.add(copy);
    consoleRight.add(cut);
    consoleRight.add(font);
    consoleRight.add(choose);
    consoleRight.add(saveas);
    clear.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            consolePane.setText("");
            jConsole.clear();
        }
    });
    copy.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (consolePane.getText() != null && !consolePane.getText().trim().isEmpty()) {
                Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
                Transferable tText = new StringSelection(consolePane.getText());
                clip.setContents(tText, null);
            }

        }
    });
    cut.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (consolePane.getText() != null && !consolePane.getText().trim().isEmpty()) {
                Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
                Transferable tText = new StringSelection(consolePane.getText());
                clip.setContents(tText, null);
            }
            consolePane.setText("");
            jConsole.clear();
        }
    });
    saveas.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser = new JFileChooser();
            int option = fileChooser.showSaveDialog(null);
            if (option == JFileChooser.APPROVE_OPTION) {
                File file = fileChooser.getSelectedFile();
                try {
                    if (file.exists() == false) {
                        file.createNewFile();
                    }
                    FileWriter writer = new FileWriter(file);
                    char[] arry = consolePane.getText().toCharArray();
                    writer.write(arry);
                    writer.flush();
                    writer.close();
                    LOG.info(CONTEXT.getMessage("gobal.right.menu.saveas.success", null, Locale.CHINA));
                } catch (IOException ioe) {
                }
            }
        }
    });
}

From source file:edu.ku.brc.specify.tasks.RecordSetTask.java

/**
 * Adds the Context PopupMenu for the RecordSet.
 * @param roc the RolloverCommand btn to add the pop to
 *///from ww w .j  a  va  2s  . c  o m
public void addPopMenu(final RolloverCommand roc, final boolean isOKDelete, final boolean isOKModify) {
    if (roc.getLabelText() != null) {
        final JPopupMenu popupMenu = new JPopupMenu();

        if (isOKModify) {
            JMenuItem renameMenuItem = new JMenuItem(UIRegistry.getResourceString("Rename"));
            renameMenuItem.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent actionEvent) {
                    roc.startEditting(RecordSetTask.this);
                }
            });
            popupMenu.add(renameMenuItem);
        }

        if (isOKDelete) {
            JMenuItem delMenuItem = new JMenuItem(UIRegistry.getResourceString("Delete"));
            delMenuItem.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent actionEvent) {
                    CommandDispatcher.dispatch(new CommandAction(RECORD_SET, DELETE_CMD_ACT, roc));
                }
            });
            popupMenu.add(delMenuItem);
        }

        JMenuItem viewMenuItem = new JMenuItem(UIRegistry.getResourceString("View"));
        viewMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
                CommandAction cmdAction = new CommandAction("Express_Search", "ViewRecordSet", roc);
                cmdAction.setProperty("canModify", isOKDelete);
                CommandDispatcher.dispatch(cmdAction);
            }
        });
        popupMenu.add(viewMenuItem);

        MouseListener mouseListener = new MouseAdapter() {
            private boolean showIfPopupTrigger(MouseEvent mouseEvent) {
                if (roc.isEnabled() && mouseEvent.isPopupTrigger() && popupMenu.getComponentCount() > 0) {
                    popupMenu.show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
                    return true;
                }
                return false;
            }

            @Override
            public void mousePressed(MouseEvent mouseEvent) {
                if (roc.isEnabled()) {
                    showIfPopupTrigger(mouseEvent);
                }
            }

            @Override
            public void mouseReleased(MouseEvent mouseEvent) {
                if (roc.isEnabled()) {
                    showIfPopupTrigger(mouseEvent);
                }
            }
        };
        roc.addMouseListener(mouseListener);
    }
}

From source file:com.intuit.tank.proxy.ProxyApp.java

private JPanel getTransactionTable() {
    JPanel frame = new JPanel(new BorderLayout());
    model = new TransactionTableModel();
    final JTable table = new TransactionTable(model);
    final TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
    table.setRowSorter(sorter);//from  ww  w  .  j a v a 2s .com
    final JPopupMenu pm = new JPopupMenu();
    JMenuItem item = new JMenuItem("Delete Selected");
    item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            int[] selectedRows = table.getSelectedRows();
            if (selectedRows.length != 0) {
                int response = JOptionPane.showConfirmDialog(ProxyApp.this,
                        "Are you sure you want to delete " + selectedRows.length + " Transactions?",
                        "Confirm Delete", JOptionPane.YES_NO_OPTION);
                if (response == JOptionPane.YES_OPTION) {
                    int[] correctedRows = new int[selectedRows.length];
                    for (int i = selectedRows.length; --i >= 0;) {
                        int row = selectedRows[i];
                        int index = (Integer) table.getValueAt(row, 0) - 1;
                        correctedRows[i] = index;
                    }
                    Arrays.sort(correctedRows);
                    for (int i = correctedRows.length; --i >= 0;) {
                        int row = correctedRows[i];
                        Transaction transaction = model.getTransactionForIndex(row);
                        if (transaction != null) {
                            model.removeTransaction(transaction, row);
                            isDirty = true;
                            saveAction.setEnabled(isDirty && !stopAction.isEnabled());
                        }
                    }
                }
            }
        }
    });
    pm.add(item);
    table.add(pm);

    table.addMouseListener(new MouseAdapter() {
        boolean pressed = false;

        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                Point p = e.getPoint();
                int row = table.rowAtPoint(p);
                int index = (Integer) table.getValueAt(row, 0) - 1;
                Transaction transaction = model.getTransactionForIndex(index);
                if (transaction != null) {
                    detailsTF.setText(transaction.toString());
                    detailsTF.setCaretPosition(0);
                    detailsDialog.setVisible(true);
                }
            }
        }

        /**
         * @{inheritDoc
         */
        @Override
        public void mousePressed(MouseEvent e) {
            if (e.isPopupTrigger()) {
                pressed = true;
                int[] selectedRows = table.getSelectedRows();
                if (selectedRows.length != 0) {
                    pm.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }

        /**
         * @{inheritDoc
         */
        @Override
        public void mouseReleased(MouseEvent e) {
            if (!pressed && e.isPopupTrigger()) {
                int[] selectedRows = table.getSelectedRows();
                if (selectedRows.length != 0) {
                    pm.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }

    });

    JScrollPane pane = new JScrollPane(table);
    frame.add(pane, BorderLayout.CENTER);
    JPanel panel = new JPanel(new BorderLayout());
    JLabel label = new JLabel("Filter: ");
    panel.add(label, BorderLayout.WEST);
    final JLabel countLabel = new JLabel(" Count: 0 ");
    panel.add(countLabel, BorderLayout.EAST);
    final JTextField filterText = new JTextField("");
    filterText.addKeyListener(new KeyAdapter() {
        public void keyTyped(KeyEvent e) {
            String text = filterText.getText();
            if (text.length() == 0) {
                sorter.setRowFilter(null);
            } else {
                try {
                    sorter.setRowFilter(RowFilter.regexFilter(text));
                    countLabel.setText(" Count: " + sorter.getViewRowCount() + " ");
                } catch (PatternSyntaxException pse) {
                    System.err.println("Bad regex pattern");
                }
            }
        }
    });
    panel.add(filterText, BorderLayout.CENTER);

    frame.add(panel, BorderLayout.NORTH);
    return frame;
}

From source file:gdt.jgui.entity.phone.JPhoneFacetOpenItem.java

@Override
public JPopupMenu getPopupMenu(final String digestLocator$) {
    JPopupMenu popup = new JPopupMenu();
    JMenuItem editItem = new JMenuItem("Edit");
    popup.add(editItem);//from   w  w w.  j a  va 2  s .c o  m
    editItem.setHorizontalTextPosition(JMenuItem.RIGHT);
    editItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("JPhoneFacetOpenItem:edit:digest locator=" + digestLocator$);
            try {
                Properties locator = Locator.toProperties(digestLocator$);
                String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                Entigrator entigrator = console.getEntigrator(entihome$);
                Sack entity = entigrator.getEntityAtKey(entityKey$);
                String phone$ = entity.getProperty("phone");
                JTextEditor te = new JTextEditor();
                String teLocator$ = te.getLocator();
                teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, phone$);
                String foiLocator$ = getLocator();
                foiLocator$ = Locator.append(foiLocator$, BaseHandler.HANDLER_METHOD, METHOD_RESPONSE);
                foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_ACTION, ACTION_DIGEST_CALL);
                foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                        Locator.compressText(digestLocator$));
                teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                        Locator.compressText(foiLocator$));
                System.out.println("JPhoneFacetOpenItem:edit:text editor=" + teLocator$);
                JConsoleHandler.execute(console, teLocator$);
            } catch (Exception ee) {
                Logger.getLogger(JPhoneFacetOpenItem.class.getName()).info(ee.toString());
            }
        }
    });
    return popup;
}

From source file:mondrian.gui.Workbench.java

/**
 * This method is called from within the constructor to
 * initialize the form.//from   w  w  w.ja  va 2  s . com
 */
private void initComponents() {
    desktopPane = new javax.swing.JDesktopPane();
    jToolBar1 = new javax.swing.JToolBar();
    jToolBar2 = new javax.swing.JToolBar();
    toolbarNewPopupMenu = new JPopupMenu();
    toolbarNewButton = new javax.swing.JButton();
    toolbarOpenButton = new javax.swing.JButton();
    toolbarSaveButton = new javax.swing.JButton();
    toolbarSaveAsButton = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    toolbarPreferencesButton = new javax.swing.JButton();
    requireSchemaCheckboxMenuItem = new javax.swing.JCheckBoxMenuItem();
    menuBar = new javax.swing.JMenuBar();
    fileMenu = new javax.swing.JMenu();
    newMenu = new javax.swing.JMenu();
    newSchemaMenuItem = new javax.swing.JMenuItem();
    newQueryMenuItem = new javax.swing.JMenuItem();
    newJDBCExplorerMenuItem = new javax.swing.JMenuItem();
    newSchemaMenuItem2 = new javax.swing.JMenuItem();
    newQueryMenuItem2 = new javax.swing.JMenuItem();
    newJDBCExplorerMenuItem2 = new javax.swing.JMenuItem();
    openMenuItem = new javax.swing.JMenuItem();
    preferencesMenuItem = new javax.swing.JMenuItem();
    lastUsed1MenuItem = new javax.swing.JMenuItem();
    lastUsed2MenuItem = new javax.swing.JMenuItem();
    lastUsed3MenuItem = new javax.swing.JMenuItem();
    lastUsed4MenuItem = new javax.swing.JMenuItem();
    saveMenuItem = new javax.swing.JMenuItem();
    saveAsMenuItem = new javax.swing.JMenuItem();
    jSeparator1 = new javax.swing.JSeparator();
    jSeparator2 = new javax.swing.JSeparator();
    jSeparator3 = new javax.swing.JSeparator();
    exitMenuItem = new javax.swing.JMenuItem();
    windowMenu = new javax.swing.JMenu();
    helpMenu = new javax.swing.JMenu();
    editMenu = new javax.swing.JMenu();
    cutMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.CutAction());
    copyMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.CopyAction());
    pasteMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.PasteAction());
    deleteMenuItem = new javax.swing.JMenuItem(
            new AbstractAction(getResourceConverter().getString("workbench.menu.delete", "Delete")) {
                private static final long serialVersionUID = 1L;

                public void actionPerformed(ActionEvent e) {
                    JInternalFrame jf = desktopPane.getSelectedFrame();
                    if (jf != null && jf.getContentPane().getComponent(0) instanceof SchemaExplorer) {
                        SchemaExplorer se = (SchemaExplorer) jf.getContentPane().getComponent(0);
                        TreePath tpath = se.tree.getSelectionPath();
                        se.delete(tpath);
                    }
                }
            });
    aboutMenuItem = new javax.swing.JMenuItem();
    toolsMenu = new javax.swing.JMenu();
    viewMenu = new javax.swing.JMenu();
    viewXmlMenuItem = new javax.swing.JCheckBoxMenuItem();

    setTitle(getResourceConverter().getString("workbench.panel.title", "Schema Workbench"));
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
            storeWorkbenchProperties();
            storeDatabaseMeta();
            closeAllSchemaFrames(true);
        }
    });

    getContentPane().add(desktopPane, java.awt.BorderLayout.CENTER);

    newSchemaMenuItem2.setText(getResourceConverter().getString("workbench.menu.newSchema", "Schema"));
    newSchemaMenuItem2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newSchemaMenuItemActionPerformed(evt);
        }
    });

    newQueryMenuItem2.setText(getResourceConverter().getString("workbench.menu.newQuery", "MDX Query"));
    newQueryMenuItem2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newQueryMenuItemActionPerformed(evt);
        }
    });

    newJDBCExplorerMenuItem2
            .setText(getResourceConverter().getString("workbench.menu.newJDBC", "JDBC Explorer"));
    newJDBCExplorerMenuItem2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newJDBCExplorerMenuItemActionPerformed(evt);
        }
    });

    toolbarNewPopupMenu.add(newSchemaMenuItem2);
    toolbarNewPopupMenu.add(newQueryMenuItem2);
    toolbarNewPopupMenu.add(newJDBCExplorerMenuItem2);

    jPanel2.setLayout(new java.awt.BorderLayout());
    jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    jPanel2.setMaximumSize(new java.awt.Dimension(50, 28));

    toolbarNewButton.setIcon(
            new javax.swing.ImageIcon(getClass().getResource(getResourceConverter().getGUIReference("new"))));
    toolbarNewButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.new", "New"));
    toolbarNewButton.setBorderPainted(false);
    toolbarNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            toolbarNewPopupMenu.show(jPanel2, 0, jPanel2.getSize().height);
        }
    });

    jToolBar2.setFloatable(false);
    jToolBar2.add(toolbarNewButton);

    jPanel2.add(jToolBar2, java.awt.BorderLayout.CENTER);

    toolbarNewArrowButton = new BasicArrowButton(SwingConstants.SOUTH);
    toolbarNewArrowButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.newArrow", "New"));
    toolbarNewArrowButton.setBorderPainted(false);
    toolbarNewArrowButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            toolbarNewPopupMenu.show(jPanel2, 0, jPanel2.getSize().height);
        }
    });

    jPanel2.add(toolbarNewArrowButton, java.awt.BorderLayout.EAST);

    jToolBar1.add(jPanel2, 0);

    toolbarOpenButton.setIcon(
            new javax.swing.ImageIcon(getClass().getResource(getResourceConverter().getGUIReference("open"))));
    toolbarOpenButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.open", "Open"));
    toolbarOpenButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            openMenuItemActionPerformed(evt);
        }
    });

    jToolBar1.add(toolbarOpenButton);

    toolbarSaveButton.setIcon(
            new javax.swing.ImageIcon(getClass().getResource(getResourceConverter().getGUIReference("save"))));
    toolbarSaveButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.save", "Save"));
    toolbarSaveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            saveMenuItemActionPerformed(evt);
        }
    });

    jToolBar1.add(toolbarSaveButton);

    toolbarSaveAsButton.setIcon(new javax.swing.ImageIcon(
            getClass().getResource(getResourceConverter().getGUIReference("saveAs"))));
    toolbarSaveAsButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.saveAs", "Save As"));
    toolbarSaveAsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            saveAsMenuItemActionPerformed(evt);
        }
    });

    jToolBar1.add(toolbarSaveAsButton);

    jPanel1.setMaximumSize(new java.awt.Dimension(8, 8));
    jToolBar1.add(jPanel1);

    toolbarPreferencesButton.setIcon(new javax.swing.ImageIcon(
            getClass().getResource(getResourceConverter().getGUIReference("preferences"))));
    toolbarPreferencesButton
            .setToolTipText(getResourceConverter().getString("workbench.toolbar.connection", "Connection"));
    toolbarPreferencesButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            connectionButtonActionPerformed(evt);
        }
    });

    jToolBar1.add(toolbarPreferencesButton);

    getContentPane().add(jToolBar1, java.awt.BorderLayout.NORTH);

    fileMenu.setText(getResourceConverter().getString("workbench.menu.file", "File"));
    fileMenu.setMnemonic(KeyEvent.VK_F);
    newMenu.setText(getResourceConverter().getString("workbench.menu.new", "New"));

    newSchemaMenuItem.setText(getResourceConverter().getString("workbench.menu.newSchema", "Schema"));
    newSchemaMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newSchemaMenuItemActionPerformed(evt);
        }
    });

    newMenu.add(newSchemaMenuItem);

    newQueryMenuItem.setText(getResourceConverter().getString("workbench.menu.newQuery", "MDX Query"));
    newQueryMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newQueryMenuItemActionPerformed(evt);
        }
    });

    newMenu.add(newQueryMenuItem);

    newJDBCExplorerMenuItem
            .setText(getResourceConverter().getString("workbench.menu.newJDBC", "JDBC Explorer"));
    newJDBCExplorerMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newJDBCExplorerMenuItemActionPerformed(evt);
        }
    });

    newMenu.add(newJDBCExplorerMenuItem);

    fileMenu.add(newMenu);

    openMenuItem.setText(getResourceConverter().getString("workbench.menu.open", "Open"));
    openMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            openMenuItemActionPerformed(evt);
        }
    });

    fileMenu.add(openMenuItem);

    saveMenuItem.setText(getResourceConverter().getString("workbench.menu.save", "Save"));
    saveMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            saveMenuItemActionPerformed(evt);
        }
    });

    fileMenu.add(saveMenuItem);

    saveAsMenuItem.setText(getResourceConverter().getString("workbench.menu.saveAsDot", "Save As ..."));
    saveAsMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            saveAsMenuItemActionPerformed(evt);
        }
    });

    fileMenu.add(saveAsMenuItem);

    // add last used
    fileMenu.add(jSeparator2);

    lastUsed1MenuItem.setText(getWorkbenchProperty("lastUsed1"));
    lastUsed1MenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            lastUsed1MenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(lastUsed1MenuItem);

    lastUsed2MenuItem.setText(getWorkbenchProperty("lastUsed2"));
    lastUsed2MenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            lastUsed2MenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(lastUsed2MenuItem);

    lastUsed3MenuItem.setText(getWorkbenchProperty("lastUsed3"));
    lastUsed3MenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            lastUsed3MenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(lastUsed3MenuItem);

    lastUsed4MenuItem.setText(getWorkbenchProperty("lastUsed4"));
    lastUsed4MenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            lastUsed4MenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(lastUsed4MenuItem);

    updateLastUsedMenu();
    fileMenu.add(jSeparator1);

    exitMenuItem.setText(getResourceConverter().getString("workbench.menu.exit", "Exit"));
    exitMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            exitMenuItemActionPerformed(evt);
        }
    });

    fileMenu.add(exitMenuItem);

    menuBar.add(fileMenu);

    editMenu.setText(getResourceConverter().getString("workbench.menu.edit", "Edit"));
    editMenu.setMnemonic(KeyEvent.VK_E);
    cutMenuItem.setText(getResourceConverter().getString("workbench.menu.cut", "Cut"));
    editMenu.add(cutMenuItem);

    copyMenuItem.setText(getResourceConverter().getString("workbench.menu.copy", "Copy"));
    editMenu.add(copyMenuItem);

    pasteMenuItem.setText(getResourceConverter().getString("workbench.menu.paste", "Paste"));
    editMenu.add(pasteMenuItem);

    editMenu.add(deleteMenuItem);

    menuBar.add(editMenu);

    viewMenu.setText(getResourceConverter().getString("workbench.menu.view", "View"));
    viewMenu.setMnemonic(KeyEvent.VK_V);
    viewXmlMenuItem.setText(getResourceConverter().getString("workbench.menu.viewXML", "View XML"));
    viewXmlMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            viewXMLMenuItemActionPerformed(evt);
        }
    });
    viewMenu.add(viewXmlMenuItem);
    menuBar.add(viewMenu);

    toolsMenu.setText(getResourceConverter().getString("workbench.menu.options", "Options"));
    toolsMenu.setMnemonic(KeyEvent.VK_O);
    preferencesMenuItem.setText(getResourceConverter().getString("workbench.menu.connection", "Connection"));
    preferencesMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            connectionButtonActionPerformed(evt);
        }
    });
    toolsMenu.add(preferencesMenuItem);

    requireSchemaCheckboxMenuItem
            .setText(getResourceConverter().getString("workbench.menu.requireSchema", "Require Schema"));
    requireSchemaCheckboxMenuItem.setSelected(requireSchema);
    requireSchemaCheckboxMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            requireSchemaActionPerformed(e);
        }
    });

    toolsMenu.add(requireSchemaCheckboxMenuItem);
    menuBar.add(toolsMenu);

    windowMenu.setText(getResourceConverter().getString("workbench.menu.windows", "Windows"));
    windowMenu.setMnemonic(KeyEvent.VK_W);

    cascadeMenuItem = new javax.swing.JMenuItem();
    cascadeMenuItem
            .setText(getResourceConverter().getString("workbench.menu.cascadeWindows", "Cascade Windows"));
    cascadeMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            cascadeMenuItemActionPerformed(evt);
        }
    });

    tileMenuItem = new javax.swing.JMenuItem();
    tileMenuItem.setText(getResourceConverter().getString("workbench.menu.tileWindows", "Tile Windows"));
    tileMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            tileMenuItemActionPerformed(evt);
        }
    });

    closeAllMenuItem = new javax.swing.JMenuItem();
    closeAllMenuItem.setText(getResourceConverter().getString("workbench.menu.closeAll", "Close All"));
    closeAllMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            closeAllMenuItemActionPerformed(evt);
        }
    });

    minimizeMenuItem = new javax.swing.JMenuItem();
    minimizeMenuItem.setText(getResourceConverter().getString("workbench.menu.minimizeAll", "Minimize All"));
    minimizeMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            minimizeMenuItemActionPerformed(evt);
        }
    });

    maximizeMenuItem = new javax.swing.JMenuItem();
    maximizeMenuItem.setText(getResourceConverter().getString("workbench.menu.maximizeAll", "Maximize All"));
    maximizeMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            maximizeMenuItemActionPerformed(evt);
        }
    });

    menuBar.add(windowMenu);

    aboutMenuItem.setText(getResourceConverter().getString("workbench.menu.about", "About"));
    aboutMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            aboutMenuItemActionPerformed(evt);
        }
    });

    helpMenu.add(aboutMenuItem);

    helpMenu.setText(getResourceConverter().getString("workbench.menu.help", "Help"));
    helpMenu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(helpMenu);

    setJMenuBar(menuBar);

    pack();
}

From source file:display.containers.FileManager.java

public Container getPane() {
    //if (gui==null) {

    fileSystemView = FileSystemView.getFileSystemView();
    desktop = Desktop.getDesktop();

    JPanel detailView = new JPanel(new BorderLayout(3, 3));
    //fileTableModel = new FileTableModel();

    table = new JTable();
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    table.setAutoCreateRowSorter(true);/*from  w ww.  ja  v a 2 s  . com*/
    table.setShowVerticalLines(false);
    table.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            if (e.getClickCount() >= 2) {
                Point p = e.getPoint();
                int row = table.convertRowIndexToModel(table.rowAtPoint(p));
                int column = table.convertColumnIndexToModel(table.columnAtPoint(p));
                if (row >= 0 && column >= 0) {
                    mouseDblClicked(row, column);
                }
            }
        }
    });
    table.addKeyListener(new KeyListener() {

        @Override
        public void keyTyped(KeyEvent arg0) {

        }

        @Override
        public void keyReleased(KeyEvent arg0) {
            if (KeyEvent.VK_DELETE == arg0.getKeyCode()) {
                if (mode != 2) {
                    parentFrame.setLock(true);
                    parentFrame.getProgressBarPanel().setVisible(true);
                    Thread t = new Thread(new Runnable() {

                        @Override
                        public void run() {
                            try {
                                deleteSelectedFiles();
                            } catch (IOException e) {
                                JOptionPane.showMessageDialog(parentFrame, "Error during the deletion.",
                                        "Deletion error", JOptionPane.ERROR_MESSAGE);
                                WindowManager.mwLogger.log(Level.SEVERE, "Error during the deletion.", e);
                            } finally {
                                parentFrame.setLock(false);
                                refresh();
                                parentFrame.getProgressBarPanel().setVisible(false);
                            }
                        }
                    });
                    t.start();

                } else {
                    if (UserProfile.CURRENT_USER.getLevel() == 3) {
                        parentFrame.setLock(true);
                        parentFrame.getProgressBarPanel().setVisible(true);
                        Thread delThread = new Thread(new Runnable() {

                            @Override
                            public void run() {
                                int[] rows = table.getSelectedRows();
                                int[] columns = table.getSelectedColumns();
                                for (int i = 0; i < rows.length; i++) {
                                    if (!continueAction) {
                                        continueAction = true;
                                        return;
                                    }
                                    int row = table.convertRowIndexToModel(rows[i]);
                                    try {
                                        deleteServerFile(row);
                                    } catch (Exception e) {
                                        WindowManager.mwLogger.log(Level.SEVERE, "Error during the deletion.",
                                                e);
                                    }
                                }
                                refresh();
                                parentFrame.setLock(false);
                                parentFrame.getProgressBarPanel().setVisible(false);
                            }
                        });
                        delThread.start();

                    }
                }
            }
        }

        @Override
        public void keyPressed(KeyEvent arg0) {
            // TODO Auto-generated method stub

        }
    });
    table.getSelectionModel().addListSelectionListener(listSelectionListener);
    JScrollPane tableScroll = new JScrollPane(table);
    Dimension d = tableScroll.getPreferredSize();
    tableScroll.setPreferredSize(new Dimension((int) d.getWidth(), (int) d.getHeight() / 2));
    detailView.add(tableScroll, BorderLayout.CENTER);

    // the File tree
    DefaultMutableTreeNode root = new DefaultMutableTreeNode();
    treeModel = new DefaultTreeModel(root);
    table.getRowSorter().addRowSorterListener(new RowSorterListener() {

        @Override
        public void sorterChanged(RowSorterEvent e) {
            ((FileTableModel) table.getModel()).fireTableDataChanged();
        }
    });

    // show the file system roots.
    File[] roots = fileSystemView.getRoots();
    for (File fileSystemRoot : roots) {
        DefaultMutableTreeNode node = new DefaultMutableTreeNode(fileSystemRoot);
        root.add(node);
        //showChildren(node);
        //
        File[] files = fileSystemView.getFiles(fileSystemRoot, true);
        for (File file : files) {
            if (file.isDirectory()) {
                node.add(new DefaultMutableTreeNode(file));
            }
        }
        //
    }
    JScrollPane treeScroll = new JScrollPane();

    Dimension preferredSize = treeScroll.getPreferredSize();
    Dimension widePreferred = new Dimension(200, (int) preferredSize.getHeight());
    treeScroll.setPreferredSize(widePreferred);

    JPanel fileView = new JPanel(new BorderLayout(3, 3));

    detailView.add(fileView, BorderLayout.SOUTH);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScroll, detailView);

    JPanel simpleOutput = new JPanel(new BorderLayout(3, 3));
    progressBar = new JProgressBar();
    simpleOutput.add(progressBar, BorderLayout.EAST);
    progressBar.setVisible(false);
    showChildren(getCurrentDir().toPath());
    //table.setDragEnabled(true);
    table.setColumnSelectionAllowed(false);

    // Menu popup
    Pmenu = new JPopupMenu();
    changeProjectitem = new JMenuItem("Reassign");
    renameProjectitem = new JMenuItem("Rename");
    twitem = new JMenuItem("To workspace");
    tlitem = new JMenuItem("To local");
    processitem = new JMenuItem("Select for process");
    switch (mode) {
    case 0:
        Pmenu.add(twitem);
        twitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtnlocalTowork().doClick();
            }
        });
        break;
    case 1:
        Pmenu.add(tlitem);
        Pmenu.add(processitem);
        tlitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtnWorkTolocal().doClick();
            }
        });
        processitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent arg0) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        // Recupere les lignes selectionnees
                        int[] indices = table.getSelectedRows();
                        // On recupere les fichiers correspondants
                        ArrayList<File> files = new ArrayList<File>();
                        for (int i = 0; i < indices.length; i++) {
                            int row = table.convertRowIndexToModel(indices[i]);
                            File fi = ((FileTableModel) table.getModel()).getFile(row);
                            if (fi.isDirectory())
                                files.add(fi);
                        }
                        ImageProcessingFrame imf = new ImageProcessingFrame(files);
                    }
                });

            }
        });
        break;
    case 2:
        if (UserProfile.CURRENT_USER.getLevel() == 3) {
            Pmenu.add(changeProjectitem);
            Pmenu.add(renameProjectitem);
        }
        Pmenu.add(twitem);
        twitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtndistToWorkspace().doClick();
            }
        });
        Pmenu.add(tlitem);
        tlitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtndistToLocal().doClick();
            }
        });
        break;
    }
    changeProjectitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            table.setEnabled(false);
            File from = ((FileTableModel) table.getModel())
                    .getFile(table.convertRowIndexToModel(table.getSelectedRows()[0]));

            ReassignProjectPanel reas = new ReassignProjectPanel(from.toPath()); // mode creation de liens
            Popup popup = PopupFactory.getSharedInstance().getPopup(WindowManager.MAINWINDOW, reas,
                    (int) WindowManager.MAINWINDOW.getX() + 200, (int) WindowManager.MAINWINDOW.getY() + 150);
            reas.setPopupWindow(popup);
            popup.show();
            table.setEnabled(true);
        }
    });
    renameProjectitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            table.setEnabled(false);
            final File from = ((FileTableModel) table.getModel())
                    .getFile(table.convertRowIndexToModel(table.getSelectedRows()[0]));
            JDialog.setDefaultLookAndFeelDecorated(true);
            String s = (String) JOptionPane.showInputDialog(WindowManager.MAINWINDOW, "New project name ?",
                    "Rename project", JOptionPane.PLAIN_MESSAGE, null, null, from.getName());

            //If a string was returned, say so.
            if ((s != null) && (s.length() > 0)) {
                ProjectDAO pdao = new MySQLProjectDAO();
                if (new File(from.getParent() + File.separator + s).exists()) {
                    SwingUtilities.invokeLater(new Runnable() {

                        @Override
                        public void run() {
                            JDialog.setDefaultLookAndFeelDecorated(true);
                            JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                    "Couldn't rename " + from.getName()
                                            + " (A file with this filename already exists)",
                                    "Renaming error", JOptionPane.ERROR_MESSAGE);
                        }
                    });
                    WindowManager.mwLogger.log(Level.SEVERE,
                            "Error during file project renaming (" + from.getName() + "). [Duplication error]");
                } else {
                    try {
                        boolean succeed = pdao.renameProject(from.getName(), s);
                        if (!succeed) {
                            SwingUtilities.invokeLater(new Runnable() {

                                @Override
                                public void run() {
                                    JDialog.setDefaultLookAndFeelDecorated(true);
                                    JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                            "Couldn't rename " + from.getName()
                                                    + " (no project with this name)",
                                            "Renaming error", JOptionPane.ERROR_MESSAGE);
                                }
                            });
                        } else {
                            from.renameTo(new File(from.getParent() + File.separator + s));
                            // on renomme le repertoire nifti ou dicom correspondant si il existe
                            switch (from.getParentFile().getName()) {
                            case ServerInfo.NRI_ANALYSE_NAME:
                                if (new File(from.getAbsolutePath().replaceAll(ServerInfo.NRI_ANALYSE_NAME,
                                        ServerInfo.NRI_DICOM_NAME)).exists())
                                    try {
                                        Files.move(Paths.get(from.getAbsolutePath().replaceAll(
                                                ServerInfo.NRI_ANALYSE_NAME, ServerInfo.NRI_DICOM_NAME)),
                                                Paths.get(from.getParent().replaceAll(
                                                        ServerInfo.NRI_ANALYSE_NAME, ServerInfo.NRI_DICOM_NAME)
                                                        + File.separator + s));
                                    } catch (IOException e) {
                                        e.printStackTrace();
                                        SwingUtilities.invokeLater(new Runnable() {

                                            @Override
                                            public void run() {
                                                JDialog.setDefaultLookAndFeelDecorated(true);
                                                JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                                        "Couldn't rename " + from.getName()
                                                                + " (error with file system)",
                                                        "Renaming error", JOptionPane.ERROR_MESSAGE);
                                            }
                                        });
                                        WindowManager.mwLogger.log(Level.SEVERE,
                                                "Error during file project renaming (" + from.getName() + ")",
                                                e);
                                    } //from.renameTo(new File(from.getParent().replaceAll(ServerInfo.NRI_ANALYSE_NAME, ServerInfo.NRI_DICOM_NAME)+File.separator+s));
                                break;
                            case ServerInfo.NRI_DICOM_NAME:
                                if (new File(from.getAbsolutePath().replaceAll(ServerInfo.NRI_DICOM_NAME,
                                        ServerInfo.NRI_ANALYSE_NAME)).exists())
                                    try {
                                        Files.move(Paths.get(from.getAbsolutePath().replaceAll(
                                                ServerInfo.NRI_DICOM_NAME, ServerInfo.NRI_ANALYSE_NAME)),
                                                Paths.get(from.getParent().replaceAll(ServerInfo.NRI_DICOM_NAME,
                                                        ServerInfo.NRI_ANALYSE_NAME) + File.separator + s));
                                    } catch (IOException e) {
                                        SwingUtilities.invokeLater(new Runnable() {

                                            @Override
                                            public void run() {
                                                JDialog.setDefaultLookAndFeelDecorated(true);
                                                JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                                        "Couldn't rename " + from.getName()
                                                                + " (error with file system)",
                                                        "Renaming error", JOptionPane.ERROR_MESSAGE);
                                            }
                                        });
                                        e.printStackTrace();
                                        WindowManager.mwLogger.log(Level.SEVERE,
                                                "Error during file project renaming (" + from.getName() + ")",
                                                e);
                                    } //from.renameTo(new File(from.getParent().replaceAll(ServerInfo.NRI_DICOM_NAME, ServerInfo.NRI_ANALYSE_NAME)+File.separator+s));
                                break;
                            }
                            refresh();
                        }
                    } catch (final SQLException e) {
                        WindowManager.mwLogger.log(Level.SEVERE, "Error during SQL project renaming", e);
                        SwingUtilities.invokeLater(new Runnable() {

                            @Override
                            public void run() {
                                JDialog.setDefaultLookAndFeelDecorated(true);
                                JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                        "Exception : " + e.toString(), "Openning error",
                                        JOptionPane.ERROR_MESSAGE);
                            }
                        });
                    }
                }
            }
            table.setEnabled(true);
        }
    });
    table.addMouseListener(new MouseListener() {

        public void mouseClicked(MouseEvent me) {

        }

        public void mouseEntered(MouseEvent e) {
        }

        public void mouseExited(MouseEvent e) {
        }

        public void mousePressed(MouseEvent e) {
        }

        public void mouseReleased(MouseEvent me) {
            if (me.getButton() == 3 && table.getSelectedRowCount() > 0) {
                int row = table.convertRowIndexToModel(table.rowAtPoint(me.getPoint()));
                changeProjectitem.setVisible(isPatient(((FileTableModel) table.getModel()).getFile(row)));
                renameProjectitem.setVisible(isProject(((FileTableModel) table.getModel()).getFile(row)));
                Pmenu.show(me.getComponent(), me.getX(), me.getY());
            }
        }
    });
    //

    //}
    return tableScroll;
}