void removeResB_actionPerformed(ActionEvent e) {
   int[] toRemove = resourcesTable.getSelectedRows();
   String msg = "";
   if (toRemove.length == 1)
     msg =
         Local.getString("Remove the shortcut to resource")
             + "\n'"
             + resourcesTable.getModel().getValueAt(toRemove[0], 0)
             + "'";
   else
     msg = Local.getString("Remove") + " " + toRemove.length + " " + Local.getString("shortcuts");
   msg += "\n" + Local.getString("Are you sure?");
   int n =
       JOptionPane.showConfirmDialog(
           App.getFrame(), msg, Local.getString("Remove resource"), JOptionPane.YES_NO_OPTION);
   if (n != JOptionPane.YES_OPTION) return;
   for (int i = 0; i < toRemove.length; i++) {
     CurrentProject.getResourcesList()
         .removeResource(
             ((Resource)
                     resourcesTable.getModel().getValueAt(toRemove[i], ResourcesTable._RESOURCE))
                 .getPath());
   }
   resourcesTable.tableChanged();
 }
  void newResB_actionPerformed(ActionEvent e) {
    AddResourceDialog dlg = new AddResourceDialog(App.getFrame(), Local.getString("New resource"));
    Dimension frmSize = App.getFrame().getSize();
    Point loc = App.getFrame().getLocation();
    dlg.setLocation(
        (frmSize.width - dlg.getSize().width) / 2 + loc.x,
        (frmSize.height - dlg.getSize().height) / 2 + loc.y);
    dlg.setVisible(true);
    if (dlg.CANCELLED) return;
    if (dlg.localFileRB.isSelected()) {
      String fpath = dlg.pathField.getText();
      MimeType mt = MimeTypesList.getMimeTypeForFile(fpath);
      if (mt.getMimeTypeId().equals("__UNKNOWN")) {
        mt = addResourceType(fpath);
        if (mt == null) return;
      }
      if (!checkApp(mt)) return;
      // if file if projectFile, than copy the file and change url.
      if (dlg.projectFileCB.isSelected()) {
        fpath = copyFileToProjectDir(fpath);
        CurrentProject.getResourcesList().addResource(fpath, false, true);
      } else CurrentProject.getResourcesList().addResource(fpath);

      resourcesTable.tableChanged();
    } else {
      if (!Util.checkBrowser()) return;
      CurrentProject.getResourcesList().addResource(dlg.urlField.getText(), true, false);
      resourcesTable.tableChanged();
    }
  }
 void ppRun_actionPerformed(ActionEvent e) {
   String path = (String) resourcesTable.getValueAt(resourcesTable.getSelectedRow(), 3);
   if (path.length() > 0) runApp(path);
   else
     try {
       runBrowser((String) resourcesTable.getValueAt(resourcesTable.getSelectedRow(), 0));
     } catch (IOException ex) {
       Logger.getLogger(ResourcesPanel.class.getName()).log(Level.SEVERE, null, ex);
     }
 }
  void jbInit() throws Exception {
    toolBar.setFloatable(false);
    this.setLayout(borderLayout1);
    newResB.setIcon(
        new ImageIcon(
            net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/addresource.png")));
    newResB.setEnabled(true);
    newResB.setMaximumSize(new Dimension(24, 24));
    newResB.setMinimumSize(new Dimension(24, 24));
    newResB.setToolTipText(Local.getString("New resource"));
    newResB.setRequestFocusEnabled(false);
    newResB.setPreferredSize(new Dimension(24, 24));
    newResB.setFocusable(false);
    newResB.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            newResB_actionPerformed(e);
          }
        });
    newResB.setBorderPainted(false);
    resourcesTable.setMaximumSize(new Dimension(32767, 32767));
    resourcesTable.setRowHeight(24);
    removeResB.setBorderPainted(false);
    removeResB.setFocusable(false);
    removeResB.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            removeResB_actionPerformed(e);
          }
        });
    removeResB.setPreferredSize(new Dimension(24, 24));
    removeResB.setRequestFocusEnabled(false);
    removeResB.setToolTipText(Local.getString("Remove resource"));
    removeResB.setMinimumSize(new Dimension(24, 24));
    removeResB.setMaximumSize(new Dimension(24, 24));
    removeResB.setIcon(
        new ImageIcon(
            net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/removeresource.png")));
    removeResB.setEnabled(false);
    scrollPane.getViewport().setBackground(Color.white);
    toolBar.addSeparator(new Dimension(8, 24));
    toolBar.addSeparator(new Dimension(8, 24));

    PopupListener ppListener = new PopupListener();
    scrollPane.addMouseListener(ppListener);
    resourcesTable.addMouseListener(ppListener);

    resourcesTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent e) {
                boolean enbl =
                    (resourcesTable.getRowCount() > 0) && (resourcesTable.getSelectedRow() > -1);

                removeResB.setEnabled(enbl);
                ppRemoveRes.setEnabled(enbl);
                ppRun.setEnabled(enbl);
              }
            });
    refreshB.setBorderPainted(false);
    refreshB.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            refreshB_actionPerformed(e);
          }
        });
    refreshB.setFocusable(false);
    refreshB.setPreferredSize(new Dimension(24, 24));
    refreshB.setRequestFocusEnabled(false);
    refreshB.setToolTipText(Local.getString("Refresh"));
    refreshB.setMinimumSize(new Dimension(24, 24));
    refreshB.setMaximumSize(new Dimension(24, 24));
    refreshB.setEnabled(true);
    refreshB.setIcon(
        new ImageIcon(
            net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/refreshres.png")));
    resPPMenu.setFont(new java.awt.Font("Dialog", 1, 10));
    ppRun.setFont(new java.awt.Font("Dialog", 1, 11));
    ppRun.setText(Local.getString("Open resource") + "...");
    ppRun.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ppRun_actionPerformed(e);
          }
        });
    ppRun.setEnabled(false);

    ppRemoveRes.setFont(new java.awt.Font("Dialog", 1, 11));
    ppRemoveRes.setText(Local.getString("Remove resource"));
    ppRemoveRes.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ppRemoveRes_actionPerformed(e);
          }
        });
    ppRemoveRes.setIcon(
        new ImageIcon(
            net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/removeresource.png")));
    ppRemoveRes.setEnabled(false);
    ppNewRes.setFont(new java.awt.Font("Dialog", 1, 11));
    ppNewRes.setText(Local.getString("New resource") + "...");
    ppNewRes.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ppNewRes_actionPerformed(e);
          }
        });
    ppNewRes.setIcon(
        new ImageIcon(
            net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/addresource.png")));

    ppRefresh.setFont(new java.awt.Font("Dialog", 1, 11));
    ppRefresh.setText(Local.getString("Refresh"));
    ppRefresh.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ppRefresh_actionPerformed(e);
          }
        });
    ppRefresh.setIcon(
        new ImageIcon(
            net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/refreshres.png")));

    toolBar.add(newResB, null);
    toolBar.add(removeResB, null);
    toolBar.addSeparator();
    toolBar.add(refreshB, null);
    this.add(scrollPane, BorderLayout.CENTER);
    scrollPane.getViewport().add(resourcesTable, null);
    this.add(toolBar, BorderLayout.NORTH);
    resPPMenu.add(ppRun);
    resPPMenu.addSeparator();
    resPPMenu.add(ppNewRes);
    resPPMenu.add(ppRemoveRes);
    resPPMenu.addSeparator();
    resPPMenu.add(ppRefresh);

    // remove resources using the DEL key
    resourcesTable.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent e) {
            if (resourcesTable.getSelectedRows().length > 0 && e.getKeyCode() == KeyEvent.VK_DELETE)
              ppRemoveRes_actionPerformed(null);
          }

          public void keyReleased(KeyEvent e) {}

          public void keyTyped(KeyEvent e) {}
        });
  }
 void ppRefresh_actionPerformed(ActionEvent e) {
   resourcesTable.tableChanged();
 }