summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2012-11-19 19:33:09 (EST)
committerSteffen Pingel2013-01-04 05:19:36 (EST)
commitf78c4908d6d921cf478e581a6a88bd2ae9f88b16 (patch)
tree5016d97414fe9f5553b003f87a19a89882999671
parentcb026ddb1f13f2677458723331293c32f4a24440 (diff)
downloadorg.eclipse.mylyn.builds-f78c4908d6d921cf478e581a6a88bd2ae9f88b16.zip
org.eclipse.mylyn.builds-f78c4908d6d921cf478e581a6a88bd2ae9f88b16.tar.gz
org.eclipse.mylyn.builds-f78c4908d6d921cf478e581a6a88bd2ae9f88b16.tar.bz2
383012: builds opened from URL cannot be opened in web ui
Change-Id: Ibd8005c241e6639fdba630c6f586e17ff1af335b Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=383012
-rw-r--r--org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/BuildEditor.java10
-rw-r--r--org.eclipse.mylyn.hudson.core/src/org/eclipse/mylyn/internal/hudson/core/HudsonConnector.java12
-rw-r--r--org.eclipse.mylyn.hudson.tests/src/org/eclipse/mylyn/hudson/tests/core/HudsonConnectorTest.java4
3 files changed, 20 insertions, 6 deletions
diff --git a/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/BuildEditor.java b/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/BuildEditor.java
index e7a510b..6404d90 100644
--- a/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/BuildEditor.java
+++ b/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/BuildEditor.java
@@ -21,6 +21,7 @@ import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.mylyn.builds.core.IBuild;
import org.eclipse.mylyn.builds.core.IBuildPlan;
import org.eclipse.mylyn.builds.ui.BuildsUi;
import org.eclipse.mylyn.builds.ui.BuildsUiConstants;
@@ -51,6 +52,8 @@ public class BuildEditor extends SharedHeaderFormEditor {
private IBuildPlan plan;
+ private IBuild build;
+
@Override
protected void addPages() {
BuildDetailsPage buildDetailsPage = new BuildDetailsPage(this, "Details");
@@ -97,6 +100,7 @@ public class BuildEditor extends SharedHeaderFormEditor {
super.init(site, input);
this.plan = ((BuildEditorInput) input).getPlan();
+ this.build = ((BuildEditorInput) input).getBuild();
setPartName(input.getName());
}
@@ -149,7 +153,11 @@ public class BuildEditor extends SharedHeaderFormEditor {
Action openWithBrowserAction = new Action() {
@Override
public void run() {
- BrowserUtil.openUrl(plan.getUrl());
+ if (build != null) {
+ BrowserUtil.openUrl(build.getUrl(), BrowserUtil.NO_RICH_EDITOR);
+ } else {
+ BrowserUtil.openUrl(plan.getUrl(), BrowserUtil.NO_RICH_EDITOR);
+ }
}
};
openWithBrowserAction.setImageDescriptor(CommonImages.WEB);
diff --git a/org.eclipse.mylyn.hudson.core/src/org/eclipse/mylyn/internal/hudson/core/HudsonConnector.java b/org.eclipse.mylyn.hudson.core/src/org/eclipse/mylyn/internal/hudson/core/HudsonConnector.java
index fa446ac..5ad7fa4 100644
--- a/org.eclipse.mylyn.hudson.core/src/org/eclipse/mylyn/internal/hudson/core/HudsonConnector.java
+++ b/org.eclipse.mylyn.hudson.core/src/org/eclipse/mylyn/internal/hudson/core/HudsonConnector.java
@@ -66,18 +66,20 @@ public class HudsonConnector extends BuildConnector {
public IBuildElement getBuildElementFromUrl(IBuildServer server, String url) {
if (url.startsWith(server.getUrl())) {
String path = url.substring(server.getUrl().length());
- Pattern p = Pattern.compile(".*/job/(.*)/(\\d+)");
+ Pattern p = Pattern.compile("(.*/job/(.*)/)(\\d+)");
Matcher matcher = p.matcher(url);
if (matcher.find()) {
IBuildPlan plan = IBuildFactory.INSTANCE.createBuildPlan();
plan.setServer(server);
- plan.setName(matcher.group(1));
- plan.setId(matcher.group(1));
+ plan.setName(matcher.group(2));
+ plan.setId(matcher.group(2));
+ plan.setUrl(matcher.group(1));
IBuild build = IBuildFactory.INSTANCE.createBuild();
- build.setId(matcher.group(2));
- build.setLabel(matcher.group(2));
+ build.setId(matcher.group(3));
+ build.setLabel(matcher.group(3));
build.setPlan(plan);
+ build.setUrl(url);
return build;
}
}
diff --git a/org.eclipse.mylyn.hudson.tests/src/org/eclipse/mylyn/hudson/tests/core/HudsonConnectorTest.java b/org.eclipse.mylyn.hudson.tests/src/org/eclipse/mylyn/hudson/tests/core/HudsonConnectorTest.java
index 9705c16..2e610c6 100644
--- a/org.eclipse.mylyn.hudson.tests/src/org/eclipse/mylyn/hudson/tests/core/HudsonConnectorTest.java
+++ b/org.eclipse.mylyn.hudson.tests/src/org/eclipse/mylyn/hudson/tests/core/HudsonConnectorTest.java
@@ -34,6 +34,8 @@ public class HudsonConnectorTest extends TestCase {
IBuild build = (IBuild) element;
assertEquals("3", build.getId());
assertEquals("my-plan", build.getPlan().getId());
+ assertEquals("http://server/job/my-plan/3/", build.getUrl());
+ assertEquals("http://server/job/my-plan/", build.getPlan().getUrl());
}
public void testBuildElementFromUrlViewsUrl() throws Exception {
@@ -46,6 +48,8 @@ public class HudsonConnectorTest extends TestCase {
IBuild build = (IBuild) element;
assertEquals("3", build.getId());
assertEquals("my-plan", build.getPlan().getId());
+ assertEquals("http://server/me/my-view/All/job/my-plan/3/", build.getUrl());
+ assertEquals("http://server/me/my-view/All/job/my-plan/", build.getPlan().getUrl());
}
public void testBuildElementFromUrlUserUrl() throws Exception {