Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.tasks.tests/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.mylyn.tasks.ui.tests/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java71
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java13
4 files changed, 89 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.tests/META-INF/MANIFEST.MF
index 4cfc80a41..d83c642fd 100644
--- a/org.eclipse.mylyn.tasks.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.tests/META-INF/MANIFEST.MF
@@ -32,7 +32,7 @@ Require-Bundle: org.junit;bundle-version="4.8.2",
org.eclipse.mylyn.tests.util
Export-Package: org.eclipse.mylyn.tasks.tests;x-internal:=true,
org.eclipse.mylyn.tasks.tests.bugs;x-internal:=true,
- org.eclipse.mylyn.tasks.tests.connector;x-internal:=true,
+ org.eclipse.mylyn.tasks.tests.connector;x-friends:="org.eclipse.mylyn.tasks.ui.tests",
org.eclipse.mylyn.tasks.tests.core;x-internal:=true,
org.eclipse.mylyn.tasks.tests.data;x-internal:=true,
org.eclipse.mylyn.tasks.tests.support;x-internal:=true,
diff --git a/org.eclipse.mylyn.tasks.ui.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.ui.tests/META-INF/MANIFEST.MF
index bd0e75a54..f9a867559 100644
--- a/org.eclipse.mylyn.tasks.ui.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.ui.tests/META-INF/MANIFEST.MF
@@ -11,6 +11,8 @@ Require-Bundle: org.junit;bundle-version="4.8.2",
org.objenesis;bundle-version="[1.0.0,2.0.0)",
org.hamcrest;bundle-version="[1.0.0,2.0.0)",
org.eclipse.equinox.security,
- org.eclipse.mylyn.tasks.core
+ org.eclipse.mylyn.tasks.core,
+ org.eclipse.mylyn.tasks.tests
Export-Package: org.eclipse.mylyn.internal.tasks.ui.editors;x-internal:=true,
- org.eclipse.mylyn.tasks.ui.editors;x-internal:=true
+ org.eclipse.mylyn.tasks.ui.editors;x-internal:=true,
+ org.eclipse.mylyn.tasks.ui.wizards;x-internal:=true
diff --git a/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java
new file mode 100644
index 000000000..96281a19c
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.ui.wizards;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.junit.Test;
+
+public class RepositorySettingsPageTest {
+
+ public static class TestRepositorySettingsPage extends AbstractRepositorySettingsPage {
+
+ public TestRepositorySettingsPage() {
+ super("Title", "Description", new TaskRepository("mock", "url"), MockRepositoryConnector.getDefault());
+ setNeedsProxy(true);
+ }
+
+ @Override
+ protected Validator getValidator(TaskRepository repository) {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public String getConnectorKind() {
+ return MockRepositoryConnector.CONNECTOR_KIND;
+ }
+
+ @Override
+ protected void createAdditionalControls(Composite parent) {
+ // ignore
+ }
+ }
+
+ @Test
+ public void proxyPortTriggersValidation() throws Exception {
+ TestRepositorySettingsPage page = new TestRepositorySettingsPage();
+ IWizardContainer container = applyWizardContainer(page);
+ page.createControl(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ verify(container, times(1)).updateButtons();
+
+ page.proxyPortEditor.setStringValue("123");
+ verify(container, times(2)).updateButtons();
+ }
+
+ private IWizardContainer applyWizardContainer(TestRepositorySettingsPage page) {
+ IWizard wizard = mock(IWizard.class);
+ IWizardContainer container = mock(IWizardContainer.class);
+ when(wizard.getContainer()).thenReturn(container);
+ page.setWizard(wizard);
+ return container;
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
index 8346d71ce..7e5b30330 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
@@ -1062,6 +1062,19 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
proxyAuthComp) {
@Override
+ protected boolean doCheckState() {
+ return true;
+ }
+
+ @Override
+ protected void valueChanged() {
+ super.valueChanged();
+ if (getWizard() != null) {
+ getWizard().getContainer().updateButtons();
+ }
+ }
+
+ @Override
public int getNumberOfControls() {
return 3;
}

Back to the top