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 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 ppRefresh_actionPerformed(ActionEvent e) { resourcesTable.tableChanged(); }