version 0.4.9.8
[jSite.git] / src / de / todesbaum / jsite / gui / ProjectPage.java
index 0ff7b3c..f68ec57 100644 (file)
@@ -25,6 +25,11 @@ import java.awt.FlowLayout;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.Insets;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.ClipboardOwner;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 import java.io.IOException;
@@ -40,25 +45,23 @@ import javax.swing.JList;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
-import javax.swing.JSpinner;
 import javax.swing.JTextField;
 import javax.swing.ListSelectionModel;
-import javax.swing.SpinnerNumberModel;
-import javax.swing.JSpinner.NumberEditor;
 import javax.swing.border.EmptyBorder;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
+import javax.swing.text.AbstractDocument;
+import javax.swing.text.AttributeSet;
 import javax.swing.text.BadLocationException;
 import javax.swing.text.Document;
+import javax.swing.text.DocumentFilter;
 
-import de.todesbaum.jsite.application.EditionProject;
 import de.todesbaum.jsite.application.Freenet7Interface;
 import de.todesbaum.jsite.application.Project;
 import de.todesbaum.jsite.i18n.I18n;
+import de.todesbaum.jsite.i18n.I18nContainer;
 import de.todesbaum.util.swing.SortedListModel;
 import de.todesbaum.util.swing.TLabel;
 import de.todesbaum.util.swing.TWizard;
@@ -68,17 +71,20 @@ import de.todesbaum.util.swing.TWizardPage;
  * @author David Roden <droden@gmail.com>
  * @version $Id$
  */
-public class ProjectPage extends TWizardPage implements ListSelectionListener, ChangeListener, DocumentListener {
+public class ProjectPage extends TWizardPage implements ListSelectionListener, DocumentListener, ClipboardOwner {
 
        private Freenet7Interface freenetInterface;
 
-       private Action projectLocalPathBrowseAction;
-       private Action projectAddAction;
-       private Action projectDeleteAction;
-       private Action projectCloneAction;
+       protected Action projectLocalPathBrowseAction;
+       protected Action projectAddAction;
+       protected Action projectDeleteAction;
+       protected Action projectCloneAction;
+       protected Action projectCopyURIAction;
+       protected Action projectGenerateKeyAction;
 
        private JFileChooser pathChooser;
        private SortedListModel projectListModel;
+       private JScrollPane projectScrollPane;
        private JList projectList;
        private JTextField projectNameTextField;
        private JTextField projectDescriptionTextField;
@@ -87,12 +93,20 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
        private JTextField projectPrivateKeyTextField;
        private JTextField projectPathTextField;
 
-       public ProjectPage() {
-               super();
+       public ProjectPage(final TWizard wizard) {
+               super(wizard);
                setLayout(new BorderLayout(12, 12));
                dialogInit();
                setHeading(I18n.getMessage("jsite.project.heading"));
                setDescription(I18n.getMessage("jsite.project.description"));
+
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               setHeading(I18n.getMessage("jsite.project.heading"));
+                               setDescription(I18n.getMessage("jsite.project.description"));
+                       }
+               });
        }
 
        protected void dialogInit() {
@@ -105,7 +119,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                projectList.addListSelectionListener(this);
                projectList.setPreferredSize(new Dimension(150, projectList.getPreferredSize().height));
 
-               add(new JScrollPane(projectList), BorderLayout.LINE_START);
+               add(projectScrollPane = new JScrollPane(projectList), BorderLayout.LINE_START);
                add(createInformationPanel(), BorderLayout.CENTER);
        }
 
@@ -116,7 +130,10 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
        public void pageAdded(TWizard wizard) {
                super.pageAdded(wizard);
                projectList.clearSelection();
-               wizard.setNextEnabled(false);
+               this.wizard.setPreviousName(I18n.getMessage("jsite.menu.nodes.manage-nodes"));
+               this.wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
+               this.wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
+               this.wizard.setNextEnabled(false);
        }
 
        /**
@@ -170,6 +187,46 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                projectCloneAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.clone-project.tooltip"));
                projectCloneAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_L);
                projectCloneAction.setEnabled(false);
+
+               projectCopyURIAction = new AbstractAction(I18n.getMessage("jsite.project.action.copy-uri")) {
+
+                       public void actionPerformed(ActionEvent actionEvent) {
+                               actionCopyURI();
+                       }
+               };
+               projectCopyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
+               projectCopyURIAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_U);
+               projectCopyURIAction.setEnabled(false);
+
+               projectGenerateKeyAction = new AbstractAction(I18n.getMessage("jsite.project.action.generate-new-key")) {
+
+                       public void actionPerformed(ActionEvent actionEvent) {
+                               actionGenerateNewKey();
+                       }
+               };
+               projectGenerateKeyAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.generate-new-key.tooltip"));
+               projectGenerateKeyAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_G);
+               projectGenerateKeyAction.setEnabled(false);
+
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       @SuppressWarnings("synthetic-access")
+                       public void run() {
+                               projectLocalPathBrowseAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.browse"));
+                               projectLocalPathBrowseAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.browse.tooltip"));
+                               projectAddAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.add-project"));
+                               projectAddAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.add-project.tooltip"));
+                               projectDeleteAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.delete-project"));
+                               projectDeleteAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.delete-project.tooltip"));
+                               projectCloneAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.clone-project"));
+                               projectCloneAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.clone-project.tooltip"));
+                               projectCopyURIAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.copy-uri"));
+                               projectCopyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
+                               projectGenerateKeyAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.generate-new-key"));
+                               projectGenerateKeyAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.generate-new-key.tooltip"));
+                               pathChooser.setApproveButtonText(I18n.getMessage("jsite.project.action.browse.choose"));
+                       }
+               });
        }
 
        private JComponent createInformationPanel() {
@@ -182,18 +239,21 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                functionButtons.add(new JButton(projectAddAction));
                functionButtons.add(new JButton(projectDeleteAction));
                functionButtons.add(new JButton(projectCloneAction));
+               functionButtons.add(new JButton(projectCopyURIAction));
 
                informationPanel.add(functionButtons, BorderLayout.PAGE_START);
                informationPanel.add(informationTable, BorderLayout.CENTER);
 
-               informationTable.add(new JLabel("<html><b>" + I18n.getMessage("jsite.project.project.information") + "</b></html>"), new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+               final JLabel projectInformationLabel = new JLabel("<html><b>" + I18n.getMessage("jsite.project.project.information") + "</b></html>");
+               informationTable.add(projectInformationLabel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
 
                projectNameTextField = new JTextField();
                projectNameTextField.getDocument().putProperty("name", "project.name");
                projectNameTextField.getDocument().addDocumentListener(this);
                projectNameTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.name") + ":", KeyEvent.VK_N, projectNameTextField), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectNameLabel = new TLabel(I18n.getMessage("jsite.project.project.name") + ":", KeyEvent.VK_N, projectNameTextField);
+               informationTable.add(projectNameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectNameTextField, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                projectDescriptionTextField = new JTextField();
@@ -201,7 +261,8 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                projectDescriptionTextField.getDocument().addDocumentListener(this);
                projectDescriptionTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.description") + ":", KeyEvent.VK_D, projectDescriptionTextField), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectDescriptionLabel = new TLabel(I18n.getMessage("jsite.project.project.description") + ":", KeyEvent.VK_D, projectDescriptionTextField);
+               informationTable.add(projectDescriptionLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectDescriptionTextField, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                projectLocalPathTextField = new JTextField();
@@ -209,34 +270,71 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                projectLocalPathTextField.getDocument().addDocumentListener(this);
                projectLocalPathTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.local-path") + ":", KeyEvent.VK_L, projectLocalPathTextField), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectLocalPathLabel = new TLabel(I18n.getMessage("jsite.project.project.local-path") + ":", KeyEvent.VK_L, projectLocalPathTextField);
+               informationTable.add(projectLocalPathLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectLocalPathTextField, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
                informationTable.add(new JButton(projectLocalPathBrowseAction), new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
-               informationTable.add(new JLabel("<html><b>" + I18n.getMessage("jsite.project.project.address") + "</b></html>"), new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
+               final JLabel projectAddressLabel = new JLabel("<html><b>" + I18n.getMessage("jsite.project.project.address") + "</b></html>");
+               informationTable.add(projectAddressLabel, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
 
                projectPublicKeyTextField = new JTextField(27);
                projectPublicKeyTextField.getDocument().putProperty("name", "project.publickey");
                projectPublicKeyTextField.getDocument().addDocumentListener(this);
                projectPublicKeyTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.public-key") + ":", KeyEvent.VK_U, projectPublicKeyTextField), new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
-               informationTable.add(projectPublicKeyTextField, new GridBagConstraints(1, 5, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
+               final TLabel projectPublicKeyLabel = new TLabel(I18n.getMessage("jsite.project.project.public-key") + ":", KeyEvent.VK_U, projectPublicKeyTextField);
+               informationTable.add(projectPublicKeyLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               informationTable.add(projectPublicKeyTextField, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
+               informationTable.add(new JButton(projectGenerateKeyAction), new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                projectPrivateKeyTextField = new JTextField(27);
                projectPrivateKeyTextField.getDocument().putProperty("name", "project.privatekey");
                projectPrivateKeyTextField.getDocument().addDocumentListener(this);
                projectPrivateKeyTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.private-key") + ":", KeyEvent.VK_R, projectPrivateKeyTextField), new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectPrivateKeyLabel = new TLabel(I18n.getMessage("jsite.project.project.private-key") + ":", KeyEvent.VK_R, projectPrivateKeyTextField);
+               informationTable.add(projectPrivateKeyLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectPrivateKeyTextField, new GridBagConstraints(1, 6, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                projectPathTextField = new JTextField();
                projectPathTextField.getDocument().putProperty("name", "project.path");
                projectPathTextField.getDocument().addDocumentListener(this);
+               ((AbstractDocument) projectPathTextField.getDocument()).setDocumentFilter(new DocumentFilter() {
+
+                       /**
+                        * {@inheritDoc}
+                        */
+                       @Override
+                       public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
+                               super.insertString(fb, offset, string.replaceAll("/", ""), attr);
+                       }
+
+                       /**
+                        * {@inheritDoc}
+                        */
+                       @Override
+                       public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
+                               super.replace(fb, offset, length, text.replaceAll("/", ""), attrs);
+                       }
+               });
                projectPathTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.path") + ":", KeyEvent.VK_P, projectPathTextField), new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectPathLabel = new TLabel(I18n.getMessage("jsite.project.project.path") + ":", KeyEvent.VK_P, projectPathTextField);
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               projectInformationLabel.setText("<html><b>" + I18n.getMessage("jsite.project.project.information") + "</b></html>");
+                               projectNameLabel.setText(I18n.getMessage("jsite.project.project.name") + ":");
+                               projectDescriptionLabel.setText(I18n.getMessage("jsite.project.project.description") + ":");
+                               projectLocalPathLabel.setText(I18n.getMessage("jsite.project.project.local-path") + ":");
+                               projectAddressLabel.setText("<html><b>" + I18n.getMessage("jsite.project.project.address") + "</b></html>");
+                               projectPublicKeyLabel.setText(I18n.getMessage("jsite.project.project.public-key") + ":");
+                               projectPrivateKeyLabel.setText(I18n.getMessage("jsite.project.project.private-key") + ":");
+                               projectPathLabel.setText(I18n.getMessage("jsite.project.project.path") + ":");
+                       }
+               });
+               informationTable.add(projectPathLabel, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectPathTextField, new GridBagConstraints(1, 7, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                return informationPanel;
@@ -319,12 +417,14 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                        JOptionPane.showMessageDialog(this, MessageFormat.format(I18n.getMessage("jsite.project.keygen.io-error"), ioe1.getMessage()), null, JOptionPane.ERROR_MESSAGE);
                        return;
                }
-               EditionProject newProject = new EditionProject();
+               Project newProject = new Project();
                newProject.setName(I18n.getMessage("jsite.project.new-project.name"));
                newProject.setInsertURI(keyPair[0]);
                newProject.setRequestURI(keyPair[1]);
-               newProject.setEdition(1);
+               newProject.setEdition(0);
                projectListModel.add(newProject);
+               projectScrollPane.revalidate();
+               projectScrollPane.repaint();
                projectList.setSelectedIndex(projectListModel.size() - 1);
        }
 
@@ -344,17 +444,43 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
        protected void actionClone() {
                int selectedIndex = projectList.getSelectedIndex();
                if (selectedIndex > -1) {
-                       Project newProject = null;
-                       Project selectedProject = (Project) projectList.getSelectedValue();
-                       if (selectedProject instanceof EditionProject) {
-                               newProject = new EditionProject(selectedProject);
-                       } // else { /* BUG! */ }
+                       Project newProject = new Project((Project) projectList.getSelectedValue());
                        newProject.setName(MessageFormat.format(I18n.getMessage("jsite.project.action.clone-project.copy"), newProject.getName()));
                        projectListModel.add(newProject);
                        projectList.setSelectedIndex(projectListModel.indexOf(newProject));
                }
        }
 
+       protected void actionCopyURI() {
+               int selectedIndex = projectList.getSelectedIndex();
+               if (selectedIndex > -1) {
+                       Project selectedProject = (Project) projectList.getSelectedValue();
+                       Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+                       clipboard.setContents(new StringSelection(selectedProject.getFinalRequestURI(0)), this);
+               }
+       }
+
+       protected void actionGenerateNewKey() {
+               if (JOptionPane.showConfirmDialog(this, I18n.getMessage("jsite.project.warning.generate-new-key"), null, JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
+                       return;
+               }
+               int selectedIndex = projectList.getSelectedIndex();
+               if (selectedIndex > -1) {
+                       Project selectedProject = (Project) projectList.getSelectedValue();
+                       String[] keyPair = null;
+                       try {
+                               keyPair = freenetInterface.generateKeyPair();
+                       } catch (IOException ioe1) {
+                               JOptionPane.showMessageDialog(this, MessageFormat.format(I18n.getMessage("jsite.project.keygen.io-error"), ioe1.getMessage()), null, JOptionPane.ERROR_MESSAGE);
+                               return;
+                       }
+                       selectedProject.setInsertURI(keyPair[0]);
+                       selectedProject.setRequestURI(keyPair[1]);
+                       projectPublicKeyTextField.setText(selectedProject.getRequestURI());
+                       projectPrivateKeyTextField.setText(selectedProject.getInsertURI());
+               }
+       }
+
        //
        // INTERFACE ListSelectionListener
        //
@@ -374,6 +500,8 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                projectLocalPathBrowseAction.setEnabled(selectedRow > -1);
                projectDeleteAction.setEnabled(selectedRow > -1);
                projectCloneAction.setEnabled(selectedRow > -1);
+               projectCopyURIAction.setEnabled(selectedRow > -1);
+               projectGenerateKeyAction.setEnabled(selectedRow > -1);
                if (selectedRow > -1) {
                        projectNameTextField.setText(selectedProject.getName());
                        projectDescriptionTextField.setText(selectedProject.getDescription());
@@ -381,9 +509,6 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                        projectPublicKeyTextField.setText(selectedProject.getRequestURI());
                        projectPrivateKeyTextField.setText(selectedProject.getInsertURI());
                        projectPathTextField.setText(selectedProject.getPath());
-                       if (selectedProject instanceof EditionProject) {
-                               EditionProject editionProject = (EditionProject) selectedProject;
-                       }
                } else {
                        projectNameTextField.setText("");
                        projectDescriptionTextField.setText("");
@@ -398,23 +523,6 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
        // INTERFACE ChangeListener
        //
 
-       /**
-        * {@inheritDoc}
-        */
-       public void stateChanged(ChangeEvent changeEvent) {
-               Object source = changeEvent.getSource();
-               if (source instanceof JSpinner) {
-                       JSpinner spinner = (JSpinner) source;
-                       Project currentProject = (Project) projectList.getSelectedValue();
-                       if (currentProject == null) {
-                               return;
-                       }
-                       if ("project.edition".equals(spinner.getName())) {
-                               ((EditionProject) currentProject).setEdition((Integer) spinner.getValue());
-                       }
-               }
-       }
-
        //
        // INTERFACE DocumentListener
        //
@@ -440,4 +548,14 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, C
                setTextField(documentEvent);
        }
 
+       //
+       // INTERFACE ClipboardOwner
+       //
+
+       /**
+        * {@inheritDoc}
+        */
+       public void lostOwnership(Clipboard clipboard, Transferable contents) {
+       }
+
 }