From 480acd6c333fdb27e934b1d1f71d87f2198da5cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 14 Jan 2010 14:14:33 +0100 Subject: [PATCH] Update complete URI after keys or paths change. --- src/de/todesbaum/jsite/gui/ProjectPage.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/de/todesbaum/jsite/gui/ProjectPage.java b/src/de/todesbaum/jsite/gui/ProjectPage.java index 770828d..eedb91a 100644 --- a/src/de/todesbaum/jsite/gui/ProjectPage.java +++ b/src/de/todesbaum/jsite/gui/ProjectPage.java @@ -367,16 +367,30 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D * {@inheritDoc} */ @Override + @SuppressWarnings("synthetic-access") public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException { super.insertString(fb, offset, string.replaceAll("/", ""), attr); + updateCompleteURI(); } /** * {@inheritDoc} */ @Override + @SuppressWarnings("synthetic-access") public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException { super.replace(fb, offset, length, text.replaceAll("/", ""), attrs); + updateCompleteURI(); + } + + /** + * {@inheritDoc} + */ + @Override + @SuppressWarnings("synthetic-access") + public void remove(FilterBypass fb, int offset, int length) throws BadLocationException { + super.remove(fb, offset, length); + updateCompleteURI(); } }); projectPathTextField.setEnabled(false); @@ -597,6 +611,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D if (!keyDialog.wasCancelled()) { selectedProject.setInsertURI(keyDialog.getPrivateKey()); selectedProject.setRequestURI(keyDialog.getPublicKey()); + updateCompleteURI(); } } } @@ -612,6 +627,18 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D if (selectedIndex > -1) { Project selectedProject = (Project) projectList.getSelectedValue(); selectedProject.setEdition(-1); + updateCompleteURI(); + } + } + + /** + * Updates the complete URI text field. + */ + private void updateCompleteURI() { + int selectedIndex = projectList.getSelectedIndex(); + if (selectedIndex > -1) { + Project selectedProject = (Project) projectList.getSelectedValue(); + projectCompleteUriTextField.setText(selectedProject.getFinalRequestURI(0)); } } -- 2.7.4