cloudSelector.addItem(c);
}
}
if (cloudId != null) {
CloudPlugin c = DetectorFactoryCollection.instance().getRegisteredClouds().get(project.getCloudId());
cloudSelector.setSelectedItem(c);
}
JPanel buttons = new JPanel();
buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
if (MainFrameHelper.isMacLookAndFeel()) {
buttons.add(Box.createHorizontalStrut(5));
buttons.add(cancelButton);
buttons.add(Box.createHorizontalStrut(5));
buttons.add(finishButton);
} else {
buttons.add(Box.createHorizontalStrut(5));
buttons.add(finishButton);
buttons.add(Box.createHorizontalStrut(5));
buttons.add(cancelButton);
}
finishButton.addActionListener(new ActionListener() {
boolean keepGoing = false;
private boolean displayWarningAndAskIfWeShouldContinue(String msg, String title) {
if (keepGoing) {
return true;
}
boolean result = JOptionPane.showConfirmDialog(NewProjectWizard.this, msg, title, JOptionPane.OK_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION;
if (result) {
keepGoing = true;
}
return result;
}
@Override
public void actionPerformed(ActionEvent evt) {
if (displayWarnings()) {
return;
}
Project p;
String oldCloudId = null;
p = project;
oldCloudId = project.getCloudId();
p.setGuiCallback(MainFrame.getInstance().getGuiCallback());
clearProjectSettings(p);
// Now that p is cleared, we can add in all the correct files.
for (int i = 0; i < analyzeModel.getSize(); i++) {
p.addFile(analyzeModel.get(i));
}
for (int i = 0; i < auxModel.getSize(); i++) {
p.addAuxClasspathEntry(auxModel.get(i));
}
for (int i = 0; i < sourceModel.getSize(); i++) {
p.addSourceDir(sourceModel.get(i));
}
p.setProjectName(projectName.getText());
CloudPlugin cloudPlugin = (CloudPlugin) cloudSelector.getSelectedItem();
String newCloudId;
if (cloudPlugin == null || cloudSelector.getSelectedIndex() == 0) {
newCloudId = null;
} else {
newCloudId = cloudPlugin.getId();
}
p.setCloudId(newCloudId);
MainFrame mainFrame = MainFrame.getInstance();
if (keepGoing) {