import java.util.logging.LogRecord;
import java.util.logging.Logger;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
}
/**
+ * Inserts the given project.
+ *
+ * @param project
+ * The project to insert
+ */
+ private void insertProject(Project project) {
+ Node targetNode = project.getNode();
+ if (targetNode == null) {
+ JComboBox nodeComboBox = new JComboBox();
+ for (Node node : nodeList) {
+ ((DefaultComboBoxModel) nodeComboBox.getModel()).addElement(node.getName() + " (" + node.getHostname() + ":" + node.getPort() + ")");
+ }
+ int selectedOption = JOptionPane.showConfirmDialog(mainWindow, new Object[] { I18n.get("nodeSelectionDialog.selectNode.text"), nodeComboBox }, I18n.get("nodeSelectionDialog.noNodeSelected.text"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
+ if (selectedOption == JOptionPane.CANCEL_OPTION) {
+ return;
+ }
+ int selectedNodeIndex = nodeComboBox.getSelectedIndex();
+ logger.log(Level.FINE, "selected node index: " + selectedNodeIndex);
+ targetNode = nodeList.get(selectedNodeIndex);
+ }
+ logger.log(Level.INFO, "Inserting project “" + project.getName() + "” to node “" + targetNode.getName() + "”...");
+ }
+
+ /**
* Clones a project.
*
* @param project
* @param switchToProject
*/
private void projectAdded(final Project project, boolean switchToProject) {
+ insertProjectActions.put(project, new I18nAction("mainWindow.button.insertProject") {
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("synthetic-access")
+ public void actionPerformed(ActionEvent actionEvent) {
+ insertProject(project);
+ }
+ });
cloneProjectActions.put(project, new I18nAction("mainWindow.button.cloneProject") {
/**
mainWindow.button.addProject.shortDescription: Add a project
mainWindow.button.addProject.longDescription: Adds a project
+mainWindow.button.insertProject.name: Insert Project
+mainWindow.button.insertProject.mnemonic: VK_I
+mainWindow.button.insertProject.accelerator: Ctrl-VK_I
+mainWindow.button.insertProject.shortDescription: Inserts the selected project
+mainWindow.button.insertProject.longDescription: Inserts the selected project
+
mainWindow.button.cloneProject.name: Clone Project
mainWindow.button.cloneProject.mnemonic: VK_L
mainWindow.button.cloneProject.accelerator: Ctrl-VK_L
fileManager.dialog.removeOverride.title: Remove Override?
fileManager.dialog.removeOverride.message: You are about to remove the override for the {0} selected file{0,choice,0#s|1#|2#s}.
+
+#
+# the node selection dialog
+#
+nodeSelectionDialog.noNodeSelected.text: No node selected
+nodeSelectionDialog.selectNode.text: Please select a node.
mainWindow.button.addProject.shortDescription: Erstellt ein neues Projekt
mainWindow.button.addProject.longDescription: Erstellt ein neues Projekt
+mainWindow.button.insertProject.name: Projekt hoch laden
+mainWindow.button.insertProject.mnemonic: VK_H
+mainWindow.button.insertProject.accelerator: Ctrl-VK_H
+mainWindow.button.insertProject.shortDescription: L\u00e4dt das angezeigte Projekt hoch
+mainWindow.button.insertProject.longDescription: L\u00e4dt das angezeigte Projekt hoch
+
mainWindow.button.cloneProject.name: Projekt klonen
mainWindow.button.cloneProject.mnemonic: VK_K
mainWindow.button.cloneProject.accelerator: Ctrl-VK_K
fileManager.dialog.removeOverride.title: \u00dcberschreibungen entfernen?
fileManager.dialog.removeOverride.message: Die \u00dcberschreibungen f\u00fcr {0} Datei{0,choice,0#en|1#|2#en} werden entfernt.
+
+#
+# the node selection dialog
+#
+nodeSelectionDialog.noNodeSelected.text: Kein Node ausgew\u00e4hlt
+nodeSelectionDialog.selectNode.text: Bitte einen Node ausw\u00e4hlen.