|
Lines 27-32
Link Here
|
| 27 |
import org.eclipse.mylar.internal.trac.core.ITracClient.Version; |
27 |
import org.eclipse.mylar.internal.trac.core.ITracClient.Version; |
| 28 |
import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnector; |
28 |
import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnector; |
| 29 |
import org.eclipse.swt.SWT; |
29 |
import org.eclipse.swt.SWT; |
|
|
30 |
import org.eclipse.swt.events.SelectionAdapter; |
| 30 |
import org.eclipse.swt.events.SelectionEvent; |
31 |
import org.eclipse.swt.events.SelectionEvent; |
| 31 |
import org.eclipse.swt.events.SelectionListener; |
32 |
import org.eclipse.swt.events.SelectionListener; |
| 32 |
import org.eclipse.swt.widgets.Combo; |
33 |
import org.eclipse.swt.widgets.Combo; |
|
Lines 46-51
Link Here
|
| 46 |
|
47 |
|
| 47 |
private Combo accessTypeCombo; |
48 |
private Combo accessTypeCombo; |
| 48 |
|
49 |
|
|
|
50 |
private static TracRepositoryInfo[] REPOSITORY_TEMPLATES = { new TracRepositoryInfo("Edgewall", |
| 51 |
"http://trac.edgewall.org", true, Version.TRAC_0_9), |
| 52 |
// new TracRepositoryInfo("Mylar Trac Client", |
| 53 |
// "http://mylar.eclipse.org/mylar-trac-client", true, Version.XML_RPC), |
| 54 |
}; |
| 55 |
|
| 49 |
/** Supported access types. */ |
56 |
/** Supported access types. */ |
| 50 |
private Version[] versions; |
57 |
private Version[] versions; |
| 51 |
|
58 |
|
|
Lines 58-63
Link Here
|
| 58 |
} |
65 |
} |
| 59 |
|
66 |
|
| 60 |
protected void createAdditionalControls(final Composite parent) { |
67 |
protected void createAdditionalControls(final Composite parent) { |
|
|
68 |
for (TracRepositoryInfo info : REPOSITORY_TEMPLATES) { |
| 69 |
repositoryLabelCombo.add(info.label); |
| 70 |
} |
| 71 |
repositoryLabelCombo.addSelectionListener(new SelectionAdapter() { |
| 72 |
@Override |
| 73 |
public void widgetSelected(SelectionEvent e) { |
| 74 |
String text = repositoryLabelCombo.getText(); |
| 75 |
for (TracRepositoryInfo info : REPOSITORY_TEMPLATES) { |
| 76 |
if (info.label.equals(text)) { |
| 77 |
setUrl(info.url); |
| 78 |
setAnonymous(info.anonymous); |
| 79 |
setTracVersion(info.version); |
| 80 |
getContainer().updateButtons(); |
| 81 |
return; |
| 82 |
} |
| 83 |
} |
| 84 |
} |
| 85 |
}); |
| 86 |
|
| 61 |
Label accessTypeLabel = new Label(parent, SWT.NONE); |
87 |
Label accessTypeLabel = new Label(parent, SWT.NONE); |
| 62 |
accessTypeLabel.setText("Access Type: "); |
88 |
accessTypeLabel.setText("Access Type: "); |
| 63 |
accessTypeCombo = new Combo(parent, SWT.READ_ONLY); |
89 |
accessTypeCombo = new Combo(parent, SWT.READ_ONLY); |
|
Lines 153-160
Link Here
|
| 153 |
} |
179 |
} |
| 154 |
}); |
180 |
}); |
| 155 |
|
181 |
|
| 156 |
MessageDialog.openInformation(null, MylarTracPlugin.TITLE_MESSAGE_DIALOG, |
182 |
if (username.length() > 0) { |
| 157 |
"Authentication credentials are valid."); |
183 |
MessageDialog.openInformation(null, MylarTracPlugin.TITLE_MESSAGE_DIALOG, |
|
|
184 |
"Authentication credentials are valid."); |
| 185 |
} else { |
| 186 |
MessageDialog.openInformation(null, MylarTracPlugin.TITLE_MESSAGE_DIALOG, "Repository is valid."); |
| 187 |
} |
| 158 |
|
188 |
|
| 159 |
if (result[0] != null) { |
189 |
if (result[0] != null) { |
| 160 |
setTracVersion(result[0]); |
190 |
setTracVersion(result[0]); |
|
Lines 178-181
Link Here
|
| 178 |
super.getWizard().getContainer().updateButtons(); |
208 |
super.getWizard().getContainer().updateButtons(); |
| 179 |
} |
209 |
} |
| 180 |
|
210 |
|
|
|
211 |
private static class TracRepositoryInfo { |
| 212 |
|
| 213 |
final String label; |
| 214 |
|
| 215 |
final String url; |
| 216 |
|
| 217 |
final boolean anonymous; |
| 218 |
|
| 219 |
final Version version; |
| 220 |
|
| 221 |
public TracRepositoryInfo(String label, String url, boolean anonymous, Version version) { |
| 222 |
this.label = label; |
| 223 |
this.url = url; |
| 224 |
this.anonymous = anonymous; |
| 225 |
this.version = version; |
| 226 |
} |
| 227 |
|
| 228 |
} |
| 229 |
|
| 181 |
} |
230 |
} |