/** * Action to create a new bucket in S3 after prompting the user for a bucket name. * */ private void createBucketAction() { String proposedNewName = s3ServiceMulti.getAWSCredentials().getAccessKey().toLowerCase() + "." + "bucket-name"; CreateBucketDialog dialog = new CreateBucketDialog(proposedNewName, ownerFrame, this); dialog.setVisible(true); if (!dialog.getOkClicked()) { return; } final S3Bucket newBucket = new S3Bucket(dialog.getBucketName(), dialog.getBucketLocation()); dialog.dispose(); runInBackgroundThread(new Runnable() { public void run() { if (s3ServiceMulti.createBuckets(new S3Bucket[] { newBucket })) { int modelIndex = bucketTableModel.getBucketIndexByName(newBucket.getName()); int viewIndex = bucketTableModelSorter.viewIndex(modelIndex); bucketsTable.setRowSelectionInterval(viewIndex, viewIndex); } } }); }
this.getRootPane().setDefaultButton(okButton); this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() { private static final long serialVersionUID = -6225706489569112809L; panel.add(buttonsPanel, new GridBagConstraints(0, ++row, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); this.getContentPane().setLayout(new GridBagLayout()); this.getContentPane().add(panel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); this.pack(); this.setResizable(false); this.setLocationRelativeTo(ownerFrame);
this.getRootPane().setDefaultButton(okButton); this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() { private static final long serialVersionUID = -6225706489569112809L; panel.add(buttonsPanel, new GridBagConstraints(0, ++row, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); this.getContentPane().setLayout(new GridBagLayout()); this.getContentPane().add(panel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); this.pack(); this.setResizable(false); this.setLocationRelativeTo(ownerFrame);
/** * Action to create a new bucket in S3 after prompting the user for a bucket name. * */ private void createBucketAction() { String proposedNewName = s3ServiceMulti.getAWSCredentials().getAccessKey().toLowerCase() + "." + "bucket-name"; CreateBucketDialog dialog = new CreateBucketDialog(proposedNewName, ownerFrame, this); dialog.setVisible(true); if (!dialog.getOkClicked()) { return; } final S3Bucket newBucket = new S3Bucket(dialog.getBucketName(), dialog.getBucketLocation()); dialog.dispose(); runInBackgroundThread(new Runnable() { public void run() { if (s3ServiceMulti.createBuckets(new S3Bucket[] { newBucket })) { int modelIndex = bucketTableModel.getBucketIndexByName(newBucket.getName()); int viewIndex = bucketTableModelSorter.viewIndex(modelIndex); bucketsTable.setRowSelectionInterval(viewIndex, viewIndex); } } }); }