From f528bc84defc313792d3df93603e4604eb9296ee Mon Sep 17 00:00:00 2001 From: mkersten Date: Fri, 14 Jul 2006 20:19:32 +0000 Subject: Completed: 150677: Trac connector: add repository templates https://bugs.eclipse.org/bugs/show_bug.cgi?id=150677 --- .../trac/ui/wizard/TracRepositorySettingsPage.java | 53 +++++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) (limited to 'org.eclipse.mylyn.trac.ui') diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java index 906b84cb2..8b99736de 100644 --- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java +++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java @@ -27,6 +27,7 @@ import org.eclipse.mylar.internal.trac.core.TracLoginException; import org.eclipse.mylar.internal.trac.core.ITracClient.Version; import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnector; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.widgets.Combo; @@ -46,6 +47,12 @@ public class TracRepositorySettingsPage extends AbstractRepositorySettingsPage { private Combo accessTypeCombo; + private static TracRepositoryInfo[] REPOSITORY_TEMPLATES = { new TracRepositoryInfo("Edgewall", + "http://trac.edgewall.org", true, Version.TRAC_0_9), + // new TracRepositoryInfo("Mylar Trac Client", + // "http://mylar.eclipse.org/mylar-trac-client", true, Version.XML_RPC), + }; + /** Supported access types. */ private Version[] versions; @@ -58,6 +65,25 @@ public class TracRepositorySettingsPage extends AbstractRepositorySettingsPage { } protected void createAdditionalControls(final Composite parent) { + for (TracRepositoryInfo info : REPOSITORY_TEMPLATES) { + repositoryLabelCombo.add(info.label); + } + repositoryLabelCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + String text = repositoryLabelCombo.getText(); + for (TracRepositoryInfo info : REPOSITORY_TEMPLATES) { + if (info.label.equals(text)) { + setUrl(info.url); + setAnonymous(info.anonymous); + setTracVersion(info.version); + getContainer().updateButtons(); + return; + } + } + } + }); + Label accessTypeLabel = new Label(parent, SWT.NONE); accessTypeLabel.setText("Access Type: "); accessTypeCombo = new Combo(parent, SWT.READ_ONLY); @@ -153,8 +179,12 @@ public class TracRepositorySettingsPage extends AbstractRepositorySettingsPage { } }); - MessageDialog.openInformation(null, MylarTracPlugin.TITLE_MESSAGE_DIALOG, - "Authentication credentials are valid."); + if (username.length() > 0) { + MessageDialog.openInformation(null, MylarTracPlugin.TITLE_MESSAGE_DIALOG, + "Authentication credentials are valid."); + } else { + MessageDialog.openInformation(null, MylarTracPlugin.TITLE_MESSAGE_DIALOG, "Repository is valid."); + } if (result[0] != null) { setTracVersion(result[0]); @@ -178,4 +208,23 @@ public class TracRepositorySettingsPage extends AbstractRepositorySettingsPage { super.getWizard().getContainer().updateButtons(); } + private static class TracRepositoryInfo { + + final String label; + + final String url; + + final boolean anonymous; + + final Version version; + + public TracRepositoryInfo(String label, String url, boolean anonymous, Version version) { + this.label = label; + this.url = url; + this.anonymous = anonymous; + this.version = version; + } + + } + } \ No newline at end of file -- cgit v1.2.3