Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java8
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/Messages.java3
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java47
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java6
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/Messages.java2
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java35
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/messages.properties1
7 files changed, 74 insertions, 28 deletions
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java
index f223687b0..23a579c56 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java
@@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.mylyn.internal.trac.core.model.TracComponent;
import org.eclipse.mylyn.internal.trac.core.model.TracMilestone;
import org.eclipse.mylyn.internal.trac.core.model.TracPriority;
+import org.eclipse.mylyn.internal.trac.core.model.TracRepositoryInfo;
import org.eclipse.mylyn.internal.trac.core.model.TracSearch;
import org.eclipse.mylyn.internal.trac.core.model.TracSeverity;
import org.eclipse.mylyn.internal.trac.core.model.TracTicket;
@@ -51,9 +52,9 @@ public interface ITracClient {
public String toString() {
switch (this) {
case TRAC_0_9:
- return "Web (Trac 0.9 or 0.10)"; //$NON-NLS-1$
+ return "Web"; //$NON-NLS-1$
case XML_RPC:
- return "XML-RPC Plugin (Rev. " + TracXmlRpcClient.REQUIRED_REVISION + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ return "XML-RPC"; //$NON-NLS-1$
default:
return null;
}
@@ -138,10 +139,11 @@ public interface ITracClient {
/**
* Validates the repository connection.
*
+ * @return information about the repository
* @throws TracException
* thrown in case of a connection error
*/
- void validate(IProgressMonitor monitor) throws TracException;
+ TracRepositoryInfo validate(IProgressMonitor monitor) throws TracException;
/**
* Returns true, if the repository details are cached. If this method returns true, invoking
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/Messages.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/Messages.java
index ebad0a702..2bb978305 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/Messages.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/Messages.java
@@ -27,5 +27,8 @@ public class Messages extends NLS {
}
public static String TracWebClient_Updating_attributes;
+ public static String TracXmlRpcClient_API_version_unsupported_Error;
+ public static String TracXmlRpcClient_API_version_X_unsupported_Error;
+ public static String TracXmlRpcClient_Required_API_calls_missing_Error;
}
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java
index c506bd963..bd8b4b822 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java
@@ -53,6 +53,7 @@ import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
import org.eclipse.mylyn.internal.trac.core.model.TracComponent;
import org.eclipse.mylyn.internal.trac.core.model.TracMilestone;
import org.eclipse.mylyn.internal.trac.core.model.TracPriority;
+import org.eclipse.mylyn.internal.trac.core.model.TracRepositoryInfo;
import org.eclipse.mylyn.internal.trac.core.model.TracSearch;
import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter;
import org.eclipse.mylyn.internal.trac.core.model.TracSeverity;
@@ -394,7 +395,7 @@ public class TracWebClient extends AbstractTracClient {
return values;
}
- public void validate(IProgressMonitor monitor) throws TracException {
+ public TracRepositoryInfo validate(IProgressMonitor monitor) throws TracException {
GetMethod method = connect(repositoryUrl + "/", monitor); //$NON-NLS-1$
try {
InputStream in = WebUtil.getResponseBodyAsStream(method, monitor);
@@ -423,14 +424,24 @@ public class TracWebClient extends AbstractTracClient {
}
}
- if (version != null && !(version.startsWith("Trac 0.9") || version.startsWith("Trac 0.10"))) { //$NON-NLS-1$ //$NON-NLS-2$
- throw new TracException("The Trac version " + version //$NON-NLS-1$
- + " is unsupported. Please use version 0.9.x or 0.10.x."); //$NON-NLS-1$
+ if (version != null) {
+ if (version.startsWith("Trac 0.9")) { //$NON-NLS-1$
+ return new TracRepositoryInfo(0, 0, 0, version);
+ } else if (version.startsWith("Trac 0.10")) { //$NON-NLS-1$
+ return new TracRepositoryInfo(0, 1, 0, version);
+ } else if (version.startsWith("Trac 0.11")) { //$NON-NLS-1$
+ return new TracRepositoryInfo(1, 0, 0, version);
+ } else {
+ throw new TracException("The Trac version " + version //$NON-NLS-1$
+ + " is unsupported. Please use version 0.9, 0.10. or 0.11"); //$NON-NLS-1$
+ }
}
if (!valid) {
throw new TracException("Not a valid Trac repository"); //$NON-NLS-1$
}
+
+ return new TracRepositoryInfo(version);
} finally {
in.close();
}
@@ -688,18 +699,22 @@ public class TracWebClient extends AbstractTracClient {
}
private void addResolutionAndStatus() {
- data.ticketResolutions = new ArrayList<TracTicketResolution>(5);
- data.ticketResolutions.add(new TracTicketResolution("fixed", 1)); //$NON-NLS-1$
- data.ticketResolutions.add(new TracTicketResolution("invalid", 2)); //$NON-NLS-1$
- data.ticketResolutions.add(new TracTicketResolution("wontfix", 3)); //$NON-NLS-1$
- data.ticketResolutions.add(new TracTicketResolution("duplicate", 4)); //$NON-NLS-1$
- data.ticketResolutions.add(new TracTicketResolution("worksforme", 5)); //$NON-NLS-1$
-
- data.ticketStatus = new ArrayList<TracTicketStatus>(4);
- data.ticketStatus.add(new TracTicketStatus("new", 1)); //$NON-NLS-1$
- data.ticketStatus.add(new TracTicketStatus("assigned", 2)); //$NON-NLS-1$
- data.ticketStatus.add(new TracTicketStatus("reopened", 3)); //$NON-NLS-1$
- data.ticketStatus.add(new TracTicketStatus("closed", 4)); //$NON-NLS-1$
+ if (data.ticketResolutions == null || data.ticketResolutions.isEmpty()) {
+ data.ticketResolutions = new ArrayList<TracTicketResolution>(5);
+ data.ticketResolutions.add(new TracTicketResolution("fixed", 1)); //$NON-NLS-1$
+ data.ticketResolutions.add(new TracTicketResolution("invalid", 2)); //$NON-NLS-1$
+ data.ticketResolutions.add(new TracTicketResolution("wontfix", 3)); //$NON-NLS-1$
+ data.ticketResolutions.add(new TracTicketResolution("duplicate", 4)); //$NON-NLS-1$
+ data.ticketResolutions.add(new TracTicketResolution("worksforme", 5)); //$NON-NLS-1$
+ }
+
+ if (data.ticketStatus == null || data.ticketStatus.isEmpty()) {
+ data.ticketStatus = new ArrayList<TracTicketStatus>(4);
+ data.ticketStatus.add(new TracTicketStatus("new", 1)); //$NON-NLS-1$
+ data.ticketStatus.add(new TracTicketStatus("assigned", 2)); //$NON-NLS-1$
+ data.ticketStatus.add(new TracTicketStatus("reopened", 3)); //$NON-NLS-1$
+ data.ticketStatus.add(new TracTicketStatus("closed", 4)); //$NON-NLS-1$
+ }
}
private List<String> getOptionValues(HtmlStreamTokenizer tokenizer) throws IOException, ParseException {
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java
index 80ea25b65..11921d212 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java
@@ -53,7 +53,11 @@ public class TracTaskEditorPageFactory extends AbstractTaskEditorPageFactory {
@Override
public String[] getConflictingIds(TaskEditorInput input) {
- return new String[] { ITasksUiConstants.ID_PAGE_PLANNING };
+ if (TracRepositoryConnector.hasRichEditor(input.getTaskRepository())) {
+ return new String[] { ITasksUiConstants.ID_PAGE_PLANNING };
+ } else {
+ return super.getConflictingIds(input);
+ }
}
@Override
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/Messages.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/Messages.java
index 3df17dd34..0d40bbbc3 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/Messages.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/Messages.java
@@ -101,6 +101,8 @@ public class Messages extends NLS {
public static String TracRepositorySettingsPage_Authentication_credentials_are_valid;
+ public static String TracRepositorySettingsPage_Authentication_credentials_valid_Update_to_latest_XmlRpcPlugin_Warning;
+
public static String TracRepositorySettingsPage_Automatic__Use_Validate_Settings_;
public static String TracRepositorySettingsPage_EXAMPLE_HTTP_TRAC_EDGEWALL_ORG;
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 5952282d4..79366bbc9 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
@@ -17,6 +17,9 @@ import java.net.URL;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.net.AbstractWebLocation;
import org.eclipse.mylyn.internal.trac.core.TracClientFactory;
import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
@@ -25,12 +28,14 @@ import org.eclipse.mylyn.internal.trac.core.client.TracException;
import org.eclipse.mylyn.internal.trac.core.client.TracLoginException;
import org.eclipse.mylyn.internal.trac.core.client.TracPermissionDeniedException;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient.Version;
+import org.eclipse.mylyn.internal.trac.core.model.TracRepositoryInfo;
import org.eclipse.mylyn.internal.trac.ui.TracUiPlugin;
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.TaskRepositoryLocationFactory;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -162,7 +167,7 @@ public class TracRepositorySettingsPage extends AbstractRepositorySettingsPage {
private final TaskRepository taskRepository;
- private final Version version;
+ private Version version;
private Version result;
@@ -199,21 +204,22 @@ public class TracRepositorySettingsPage extends AbstractRepositorySettingsPage {
public void validate(IProgressMonitor monitor) throws MalformedURLException, TracException {
AbstractWebLocation location = new TaskRepositoryLocationFactory().createWebLocation(taskRepository);
+ TracRepositoryInfo info;
if (version != null) {
ITracClient client = TracClientFactory.createClient(location, version);
- client.validate(monitor);
+ info = client.validate(monitor);
} else {
// probe version: XML-RPC access first, then web
// access
try {
- ITracClient client = TracClientFactory.createClient(location, Version.XML_RPC);
- client.validate(monitor);
- result = Version.XML_RPC;
+ version = Version.XML_RPC;
+ ITracClient client = TracClientFactory.createClient(location, version);
+ info = client.validate(monitor);
} catch (TracException e) {
try {
- ITracClient client = TracClientFactory.createClient(location, Version.TRAC_0_9);
- client.validate(monitor);
- result = Version.TRAC_0_9;
+ version = Version.TRAC_0_9;
+ ITracClient client = TracClientFactory.createClient(location, version);
+ info = client.validate(monitor);
if (e instanceof TracPermissionDeniedException) {
setStatus(RepositoryStatus.createStatus(repositoryUrl, IStatus.INFO,
@@ -226,7 +232,20 @@ public class TracRepositorySettingsPage extends AbstractRepositorySettingsPage {
throw new TracException();
}
}
+ result = version;
}
+
+ if (version == Version.XML_RPC && info.isApiVersion(1, 0, 0)) {
+ setStatus(RepositoryStatus.createStatus(repositoryUrl, IStatus.INFO, TracUiPlugin.ID_PLUGIN,
+ Messages.TracRepositorySettingsPage_Authentication_credentials_valid_Update_to_latest_XmlRpcPlugin_Warning));
+ }
+
+ MultiStatus status = new MultiStatus(TracUiPlugin.ID_PLUGIN, 0, NLS.bind("Validation results for {0}", //$NON-NLS-1$
+ taskRepository.getRepositoryLabel()), null);
+ status.add(new Status(IStatus.INFO, TracUiPlugin.ID_PLUGIN, NLS.bind("Version: {0}", info.toString()))); //$NON-NLS-1$
+ status.add(new Status(IStatus.INFO, TracUiPlugin.ID_PLUGIN,
+ NLS.bind("Access Type: {0}", version.toString()))); //$NON-NLS-1$
+ StatusHandler.log(status);
}
public Version getResult() {
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/messages.properties b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/messages.properties
index 5d39ba92d..b2edab1b3 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/messages.properties
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/messages.properties
@@ -38,6 +38,7 @@ TracQueryPage_Version=Version
TracRepositorySettingsPage_Access_Type_=Access Type:
TracRepositorySettingsPage_Authentication_credentials_are_valid=Authentication credentials are valid. Note: Insufficient permissions for XML-RPC access, falling back to web access.
+TracRepositorySettingsPage_Authentication_credentials_valid_Update_to_latest_XmlRpcPlugin_Warning=Authentication credentials are valid. Note: An update to the latest version of Trac's XmlRpcPlugin is recommended.
TracRepositorySettingsPage_Automatic__Use_Validate_Settings_=Automatic (Use Validate Settings)
TracRepositorySettingsPage_EXAMPLE_HTTP_TRAC_EDGEWALL_ORG=Example: http://trac.edgewall.org
TracRepositorySettingsPage_No_Trac_repository_found_at_url=No Trac repository found at url

Back to the top