Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2014-01-19 21:23:31 +0000
committerFrank Becker2014-02-12 20:48:21 +0000
commit73aca745728a52143df46137519f68e63889926c (patch)
tree98bc75eb5ef43498fb48e5270ac3bdcf178765d5
parent36670c42232938eb07abff1bab488a4bcaa7a3f8 (diff)
downloadorg.eclipse.mylyn.tasks-73aca745728a52143df46137519f68e63889926c.tar.gz
org.eclipse.mylyn.tasks-73aca745728a52143df46137519f68e63889926c.tar.xz
org.eclipse.mylyn.tasks-73aca745728a52143df46137519f68e63889926c.zip
414360: add BugzillaRestRepositorySettingsPage to Rest Connector
Change-Id: I54d39dfbb2d85b189550215e8da234f2f56116dc Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=414360
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/plugin.xml14
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/META-INF/MANIFEST.MF12
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/src/org/eclipse/mylyn/bugzilla/rest/tests/tck/AbstractRepositoryConnectorTest.java39
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/src/org/eclipse/mylyn/bugzilla/rest/tests/tck/ui/AbstractRepositorySettingsPageTest.java57
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/META-INF/MANIFEST.MF7
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/icons/eview16/bugzilla-logo.gifbin0 -> 1026 bytes
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/icons/eview16/overlay-bugzilla.gifbin0 -> 275 bytes
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/plugin.xml14
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestRepositoryConnectorUi.java56
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestRepositorySettingsPage.java44
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java12
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java32
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java77
15 files changed, 318 insertions, 49 deletions
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/plugin.xml b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/plugin.xml
new file mode 100644
index 000000000..2f245fea1
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/plugin.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="org.eclipse.mylyn.bugzilla.rest.repository"
+ name="Bugzilla REST Repository"
+ point="org.eclipse.mylyn.tasks.core.repositories">
+ <connectorCore
+ class="org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestConnector"
+ id="org.eclipse.mylyn.bugzilla.rest"
+ name="Bugzilla REST Repository Connector">
+ </connectorCore>
+ </extension>
+</plugin> \ No newline at end of file
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/META-INF/MANIFEST.MF b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/META-INF/MANIFEST.MF
index 155b54d02..524afa81f 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/META-INF/MANIFEST.MF
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/META-INF/MANIFEST.MF
@@ -6,13 +6,17 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Eclipse Mylyn
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit;bundle-version="4.8.2",
- org.eclipse.mylyn.commons.sdk.util;bundle-version="3.11.0",
- org.eclipse.mylyn.tasks.core;bundle-version="3.11.0",
org.eclipse.equinox.common,
- org.eclipse.mylyn.bugzilla.rest.core,
+ org.eclipse.jface,
+ org.eclipse.ui.workbench,
+ org.eclipse.mylyn.commons.sdk.util;bundle-version="3.11.0",
org.eclipse.mylyn.commons.net,
org.eclipse.mylyn.commons.repositories.core,
org.eclipse.mylyn.commons.core,
- org.eclipse.mylyn.commons.repositories.http.core;bundle-version="1.3.0"
+ org.eclipse.mylyn.commons.repositories.http.core;bundle-version="1.3.0",
+ org.eclipse.mylyn.tasks.ui,
+ org.eclipse.mylyn.tasks.core;bundle-version="3.11.0",
+ org.eclipse.mylyn.bugzilla.rest.core,
+ org.eclipse.mylyn.bugzilla.rest.ui
Export-Package: org.eclipse.mylyn.bugzilla.rest.tests;x-internal:=true,
org.eclipse.mylyn.bugzilla.rest.tests.tck;x-internal:=true
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/src/org/eclipse/mylyn/bugzilla/rest/tests/tck/AbstractRepositoryConnectorTest.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/src/org/eclipse/mylyn/bugzilla/rest/tests/tck/AbstractRepositoryConnectorTest.java
new file mode 100644
index 000000000..ff5825ee5
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/src/org/eclipse/mylyn/bugzilla/rest/tests/tck/AbstractRepositoryConnectorTest.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Frank Becker 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:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.bugzilla.rest.tests.tck;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.eclipse.mylyn.bugzilla.rest.tests.AbstractTckTest;
+import org.eclipse.mylyn.bugzilla.rest.tests.TckFixture;
+import org.eclipse.mylyn.commons.sdk.util.Junit4TestFixtureRunner.FixtureDefinition;
+import org.eclipse.mylyn.commons.sdk.util.Junit4TestFixtureRunner.RunOnlyWhenProperty;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.junit.Test;
+
+@FixtureDefinition(fixtureClass = TckFixture.class, fixtureType = "bugzillaREST")
+@RunOnlyWhenProperty(property = "default", value = "1")
+public class AbstractRepositoryConnectorTest extends AbstractTckTest {
+
+ public AbstractRepositoryConnectorTest(TckFixture fixture) {
+ super(fixture);
+ }
+
+ @Test
+ public void testApplyDefaultCategory() throws Exception {
+ TaskRepository repository = fixture().repository();
+ assertNull("repository.getCategory() should be null", repository.getCategory());
+ fixture().connector().applyDefaultCategory(repository);
+ assertNotNull("repository.getCategory() should not be null", repository.getCategory());
+ }
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/src/org/eclipse/mylyn/bugzilla/rest/tests/tck/ui/AbstractRepositorySettingsPageTest.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/src/org/eclipse/mylyn/bugzilla/rest/tests/tck/ui/AbstractRepositorySettingsPageTest.java
new file mode 100644
index 000000000..d76e46f22
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.tests/src/org/eclipse/mylyn/bugzilla/rest/tests/tck/ui/AbstractRepositorySettingsPageTest.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Frank Becker 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:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.bugzilla.rest.tests.tck.ui;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.mylyn.bugzilla.rest.tests.AbstractTckTest;
+import org.eclipse.mylyn.bugzilla.rest.tests.TckFixture;
+import org.eclipse.mylyn.commons.sdk.util.Junit4TestFixtureRunner.FixtureDefinition;
+import org.eclipse.mylyn.commons.sdk.util.Junit4TestFixtureRunner.RunOnlyWhenProperty;
+import org.eclipse.mylyn.internal.tasks.ui.wizards.EditRepositoryWizard;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Test;
+
+@FixtureDefinition(fixtureClass = TckFixture.class, fixtureType = "bugzillaREST")
+@RunOnlyWhenProperty(property = "default", value = "1")
+public class AbstractRepositorySettingsPageTest extends AbstractTckTest {
+ private WizardDialog dialog;
+
+ public AbstractRepositorySettingsPageTest(TckFixture fixture) {
+ super(fixture);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (dialog != null) {
+ dialog.close();
+ }
+ }
+
+ @Test
+ public void testApplyTo() {
+ TaskRepository repository = fixture().repository();
+ EditRepositoryWizard wizard = new EditRepositoryWizard(repository);
+ dialog = new WizardDialog(new Shell(), wizard);
+ dialog.create();
+ ITaskRepositoryPage page = wizard.getSettingsPage();
+ assertNull("repository.getCategory() should be null", repository.getCategory());
+ page.applyTo(repository);
+ assertEquals(TaskRepository.CATEGORY_BUGS, repository.getCategory());
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/META-INF/MANIFEST.MF b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/META-INF/MANIFEST.MF
index bd6bfd7a5..1b1906edd 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/META-INF/MANIFEST.MF
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/META-INF/MANIFEST.MF
@@ -4,7 +4,12 @@ Bundle-Name: org.eclipse.mylyn.bugzilla.rest.ui
Bundle-SymbolicName: org.eclipse.mylyn.bugzilla.rest.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.ui
+ org.eclipse.ui,
+ org.eclipse.ui.forms,
+ org.eclipse.mylyn.commons.ui;bundle-version="3.11.0",
+ org.eclipse.mylyn.tasks.ui;bundle-version="3.11.0",
+ org.eclipse.mylyn.tasks.core;bundle-version="3.11.0",
+ org.eclipse.mylyn.bugzilla.rest.core;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Vendor: Eclipse Mylyn
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/icons/eview16/bugzilla-logo.gif b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/icons/eview16/bugzilla-logo.gif
new file mode 100644
index 000000000..1ac3a0327
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/icons/eview16/bugzilla-logo.gif
Binary files differ
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/icons/eview16/overlay-bugzilla.gif b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/icons/eview16/overlay-bugzilla.gif
new file mode 100644
index 000000000..f220eebc4
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/icons/eview16/overlay-bugzilla.gif
Binary files differ
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/plugin.xml b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/plugin.xml
new file mode 100644
index 000000000..242cceaa4
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/plugin.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="org.eclipse.mylyn.bugzilla.rest.repository"
+ name="Bugzilla REST Respository"
+ point="org.eclipse.mylyn.tasks.ui.repositories">
+ <connectorUi
+ brandingIcon="icons/eview16/bugzilla-logo.gif"
+ class="org.eclipse.mylyn.internal.bugzilla.rest.ui.BugzillaRestRepositoryConnectorUi"
+ overlayIcon="icons/eview16/overlay-bugzilla.gif">
+ </connectorUi>
+ </extension>
+</plugin>
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestRepositoryConnectorUi.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestRepositoryConnectorUi.java
new file mode 100644
index 000000000..752c3e208
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestRepositoryConnectorUi.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Frank Becker 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:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.bugzilla.rest.ui;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestCore;
+import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
+import org.eclipse.mylyn.tasks.core.ITaskMapping;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
+import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
+
+public class BugzillaRestRepositoryConnectorUi extends AbstractRepositoryConnectorUi {
+
+ public BugzillaRestRepositoryConnectorUi() {
+ // ignore
+ }
+
+ @Override
+ public String getConnectorKind() {
+ return BugzillaRestCore.CONNECTOR_KIND;
+ }
+
+ @Override
+ public ITaskRepositoryPage getSettingsPage(TaskRepository repository) {
+ return new BugzillaRestRepositorySettingsPage(repository);
+ }
+
+ @Override
+ public IWizard getQueryWizard(TaskRepository repository, IRepositoryQuery query) {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public IWizard getNewTaskWizard(TaskRepository repository, ITaskMapping selection) {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public boolean hasSearchPage() {
+ // ignore
+ return false;
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestRepositorySettingsPage.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestRepositorySettingsPage.java
new file mode 100644
index 000000000..78c336c82
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestRepositorySettingsPage.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Frank Becker 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:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.bugzilla.rest.ui;
+
+import java.text.MessageFormat;
+
+import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestCore;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
+import org.eclipse.swt.widgets.Composite;
+
+public class BugzillaRestRepositorySettingsPage extends AbstractRepositorySettingsPage {
+ private static final String LABEL_VERSION_NUMBER = "5.0"; //$NON-NLS-1$
+
+ private static final String DESCRIPTION = MessageFormat.format(
+ "Supports Bugzilla {0} Example: https://bugs.eclipse.org/bugs/ (do not include rest.cgi)",
+ LABEL_VERSION_NUMBER);
+
+ public BugzillaRestRepositorySettingsPage(TaskRepository taskRepository) {
+ super("Bugzilla REST Repository Settings", DESCRIPTION, taskRepository);
+ setNeedsAnonymousLogin(true);
+ setNeedsValidateOnFinish(true);
+ }
+
+ @Override
+ public String getConnectorKind() {
+ return BugzillaRestCore.CONNECTOR_KIND;
+ }
+
+ @Override
+ protected void createAdditionalControls(Composite parent) {
+ // ignore
+
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
index 65ba2e22d..f9fd5247a 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
@@ -633,4 +633,16 @@ public abstract class AbstractRepositoryConnector {
throw new UnsupportedOperationException();
}
+ /**
+ * Set the category of the {@code repository} to the default TaskRepository.CATEGORY_BUGS.
+ * <p>
+ * Subclasses may override.
+ *
+ * @param repository
+ * the repository
+ * @since 3.11
+ */
+ public void applyDefaultCategory(TaskRepository repository) {
+ repository.setCategory(TaskRepository.CATEGORY_BUGS);
+ }
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
index 4dc4d7995..4374dff8a 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
@@ -53,7 +53,7 @@ import org.eclipse.mylyn.internal.tasks.core.RepositoryPerson;
* <li>The solution we have come up with thus far is not to interpret the date as a DATE object but rather simply use
* the date string given to us by the repository itself.</li>
* </ul>
- *
+ *
* @author Mik Kersten
* @author Rob Elves
* @author Eugene Kuleshov
@@ -149,7 +149,7 @@ public final class TaskRepository extends PlatformObject {
/**
* Category for repositories that manage tasks.
- *
+ *
* @see #setCategory(String)
* @since 3.9
*/
@@ -157,7 +157,7 @@ public final class TaskRepository extends PlatformObject {
/**
* Category for repositories that manage bugs.
- *
+ *
* @see #setCategory(String)
* @since 3.9
*/
@@ -165,7 +165,7 @@ public final class TaskRepository extends PlatformObject {
/**
* Category for repositories that manage builds.
- *
+ *
* @see #setCategory(String)
* @since 3.9
*/
@@ -173,7 +173,7 @@ public final class TaskRepository extends PlatformObject {
/**
* Category for repositories that manage reviews.
- *
+ *
* @see #setCategory(String)
* @since 3.9
*/
@@ -485,7 +485,7 @@ public final class TaskRepository extends PlatformObject {
/**
* Returns {@code} if credentials persisted in the platform keystore.
- *
+ *
* @since 3.10
* @see #setShouldPersistCredentials(boolean)
*/
@@ -498,7 +498,7 @@ public final class TaskRepository extends PlatformObject {
* will not be persisted in the platform keystore.
* <p>
* This flag does not have any effect if not running in an OSGi environment.
- *
+ *
* @since 3.10
* @see #shouldPersistCredentials()
*/
@@ -513,7 +513,7 @@ public final class TaskRepository extends PlatformObject {
/**
* Get the last refresh date as initialized {@link Date} object, null if not set<br />
- *
+ *
* @return {@link Date} configuration date, null if not set
*/
public Date getConfigurationDate() {
@@ -542,7 +542,7 @@ public final class TaskRepository extends PlatformObject {
/**
* Returns the credentials for an authentication type.
- *
+ *
* @param authType
* the type of authentication
* @return null, if no credentials are set for <code>authType</code>
@@ -684,7 +684,7 @@ public final class TaskRepository extends PlatformObject {
// NOTE: if anonymous, user name is "" string so we won't go to keyring
if (!isCachedUserName) {
if (useSecureStorage()) {
- // do not open secure store for username to avoid prompting user for password during initialization
+ // do not open secure store for username to avoid prompting user for password during initialization
cachedUserName = getProperty(getKeyPrefix(AuthenticationType.REPOSITORY) + USERNAME);
} else {
cachedUserName = getUserName(AuthenticationType.REPOSITORY);
@@ -769,12 +769,12 @@ public final class TaskRepository extends PlatformObject {
public void setCharacterEncoding(String characterEncoding) {
properties.put(IRepositoryConstants.PROPERTY_ENCODING, characterEncoding == null
? DEFAULT_CHARACTER_ENCODING
- : characterEncoding);
+ : characterEncoding);
}
/**
* Set the Configuration date to the {@link Date} indicated.
- *
+ *
* @param configuration
* date {@link {@link Date}
*/
@@ -786,7 +786,7 @@ public final class TaskRepository extends PlatformObject {
/**
* Sets the credentials for <code>authType</code>.
- *
+ *
* @param authType
* the type of authentication
* @param credentials
@@ -891,7 +891,7 @@ public final class TaskRepository extends PlatformObject {
public void setTimeZoneId(String timeZoneId) {
setProperty(IRepositoryConstants.PROPERTY_TIMEZONE, timeZoneId == null
? TimeZone.getDefault().getID()
- : timeZoneId);
+ : timeZoneId);
}
/**
@@ -977,7 +977,7 @@ public final class TaskRepository extends PlatformObject {
/**
* If this repository was automatically created from a template <code>value</code> should be set to true.
- *
+ *
* @since 3.5
* @see #isCreatedFromTemplate()
*/
@@ -987,7 +987,7 @@ public final class TaskRepository extends PlatformObject {
/**
* Returns true, if this repository was automatically created from a template.
- *
+ *
* @since 3.5
* @see #setCreatedFromTemplate(boolean)
*/
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java
index e43408344..0da5966a3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java
@@ -235,6 +235,8 @@ public class Messages extends NLS {
public static String AbstractRepositorySettingsPage_Server_;
+ public static String AbstractRepositorySettingsPage_Settings_are_valid_version;
+
public static String AbstractRepositorySettingsPage_Unable_to_authenticate_with_repository;
public static String AbstractRepositorySettingsPage_Use_global_Network_Connections_preferences;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties
index 8233fce49..36155f61a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties
@@ -127,6 +127,7 @@ AbstractRepositorySettingsPage_Repository_is_valid=Repository is valid.
AbstractRepositorySettingsPage_Repository_url_is_invalid=Repository url is invalid.
AbstractRepositorySettingsPage_Save_Password=Save Password
AbstractRepositorySettingsPage_Server_=Server\:\
+AbstractRepositorySettingsPage_Settings_are_valid_version=Settings are valid (repository has version {0})
AbstractRepositorySettingsPage_Unable_to_authenticate_with_repository=Unable to authenticate with repository. Login credentials invalid.
AbstractRepositorySettingsPage_Use_global_Network_Connections_preferences=Use global Network Connections preferences
AbstractRepositorySettingsPage_User_ID_=User ID\:\
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 7e5b30330..8f81a5852 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2013 Tasktop Technologies and others.
+ * Copyright (c) 2004, 2013 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
@@ -53,9 +53,11 @@ import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
+import org.eclipse.mylyn.tasks.core.RepositoryInfo;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
@@ -88,7 +90,7 @@ import org.eclipse.ui.statushandlers.StatusManager;
/**
* Extend to provide custom repository settings. This page is typically invoked by the user requesting properties via
* the Task Repositories view.
- *
+ *
* @author Mik Kersten
* @author Rob Elves
* @author Steffen Pingel
@@ -99,7 +101,7 @@ import org.eclipse.ui.statushandlers.StatusManager;
* @since 2.0
*/
public abstract class AbstractRepositorySettingsPage extends AbstractTaskRepositoryPage implements ITaskRepositoryPage,
- IAdaptable {
+IAdaptable {
protected static final String PREFS_PAGE_ID_NET_PROXY = "org.eclipse.ui.net.NetPreferences"; //$NON-NLS-1$
@@ -411,10 +413,10 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
});
GridDataFactory.fillDefaults()
- .hint(300, SWT.DEFAULT)
- .grab(true, false)
- .span(2, SWT.DEFAULT)
- .applyTo(serverUrlCombo);
+ .hint(300, SWT.DEFAULT)
+ .grab(true, false)
+ .span(2, SWT.DEFAULT)
+ .applyTo(serverUrlCombo);
repositoryLabelEditor = new StringFieldEditor("", LABEL_REPOSITORY_LABEL, StringFieldEditor.UNLIMITED, //$NON-NLS-1$
compositeContainer) {
@@ -702,7 +704,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
} catch (LinkageError e) {
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
Messages.AbstractRepositorySettingsPage_Problems_encountered_determining_available_charsets, e));
- // bug 237972: 3rd party encodings can cause availableCharsets() to fail
+ // bug 237972: 3rd party encodings can cause availableCharsets() to fail
otherEncoding.setEnabled(false);
otherEncodingCombo.setEnabled(false);
}
@@ -756,10 +758,10 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
certAuthButton = new Button(certAuthComp, SWT.CHECK);
GridDataFactory.fillDefaults()
- .indent(0, 5)
- .align(SWT.LEFT, SWT.TOP)
- .span(3, SWT.DEFAULT)
- .applyTo(certAuthButton);
+ .indent(0, 5)
+ .align(SWT.LEFT, SWT.TOP)
+ .span(3, SWT.DEFAULT)
+ .applyTo(certAuthButton);
certAuthButton.setText(Messages.AbstractRepositorySettingsPage_Enable_certificate_authentification);
@@ -851,10 +853,10 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
httpAuthButton = new Button(httpAuthComp, SWT.CHECK);
GridDataFactory.fillDefaults()
- .indent(0, 5)
- .align(SWT.LEFT, SWT.TOP)
- .span(3, SWT.DEFAULT)
- .applyTo(httpAuthButton);
+ .indent(0, 5)
+ .align(SWT.LEFT, SWT.TOP)
+ .span(3, SWT.DEFAULT)
+ .applyTo(httpAuthButton);
httpAuthButton.setText(Messages.AbstractRepositorySettingsPage_Enable_http_authentication);
@@ -1605,7 +1607,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
/**
* Returns true, if credentials are incomplete. Clients may override this method.
- *
+ *
* @since 3.4
*/
protected boolean isMissingCredentials() {
@@ -1691,7 +1693,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
* Note: The credentials of the created repository are not persisted in the platform keystore. When overriding,
* subclasses must either call super or call {@link TaskRepository#setShouldPersistCredentials(boolean)
* setShouldPersistCredentials(false)} before calling {@link #applyTo(TaskRepository)}.
- *
+ *
* @since 2.0
*/
public TaskRepository createTaskRepository() {
@@ -1707,6 +1709,10 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
*/
@Override
public void applyTo(@NonNull TaskRepository repository) {
+ String category = repository.getCategory();
+ if (category == null || category.length() == 0) {
+ connector.applyDefaultCategory(repository);
+ }
repository.setVersion(getVersion());
if (needsEncoding()) {
repository.setCharacterEncoding(getCharacterEncoding());
@@ -1890,7 +1896,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
* <p>
* This information is typically used by the wizard to set the enablement of the validation UI affordance.
* </p>
- *
+ *
* @return <code>true</code> if this page can be validated, and <code>false</code> otherwise
* @see #needsValidation()
* @see IWizardContainer#updateButtons()
@@ -1909,7 +1915,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
/**
* Public for testing.
- *
+ *
* @since 2.0
*/
public void setUrl(String url) {
@@ -1918,7 +1924,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
/**
* Public for testing.
- *
+ *
* @since 2.0
*/
public void setUserId(String id) {
@@ -1927,7 +1933,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
/**
* Public for testing.
- *
+ *
* @since 2.0
*/
public void setPassword(String pass) {
@@ -1976,7 +1982,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
/**
* Validate settings provided by the {@link #getValidator(TaskRepository) validator}, typically the server settings.
- *
+ *
* @since 2.0
*/
protected void validateSettings() {
@@ -2012,7 +2018,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
StatusManager.getManager().handle(
new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
Messages.AbstractRepositorySettingsPage_Internal_error_validating_repository, e),
- StatusManager.SHOW | StatusManager.LOG);
+ StatusManager.SHOW | StatusManager.LOG);
return;
} catch (InterruptedException e) {
// canceled
@@ -2070,13 +2076,28 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
}
/**
+ * For version 3.11 we change the abstract implementation to a default implementation. The default implementation
+ * creates an {@link Validator} and deligate the work to
+ * {@link AbstractRepositoryConnector#validateRepository(TaskRepository, IProgressMonitor)}
+ *
* @since 2.0
*/
- protected abstract Validator getValidator(@NonNull TaskRepository repository);
+
+ protected Validator getValidator(final TaskRepository repository) {
+ return new org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.Validator() {
+
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ RepositoryInfo repositoryInfo = connector.validateRepository(repository, monitor);
+ setStatus(new Status(IStatus.OK, TasksUiPlugin.ID_PLUGIN, NLS.bind(
+ Messages.AbstractRepositorySettingsPage_Settings_are_valid_version, repositoryInfo.getVersion())));
+ }
+ };
+ }
/**
* Public for testing.
- *
+ *
* @since 2.0
*/
public abstract class Validator {
@@ -2097,7 +2118,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
/**
* Provides an adapter for the {@link IValidatable} interface.
- *
+ *
* @since 3.7
* @see IAdaptable#getAdapter(Class)
*/
@@ -2159,7 +2180,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
/**
* Returns the toolkit used to construct sections and hyperlinks.
- *
+ *
* @return the toolkit
* @throws IllegalStateException
* if the toolkit has not been initialized

Back to the top