Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2014-11-20 11:52:04 +0000
committerMarvin Mueller2014-11-20 12:46:28 +0000
commitd2fdab93b844a44dca3c35e56452f4fe0f235b54 (patch)
treeb1b3c0048291ed7978b54acbdba26306af7e8aaf /org.eclipse.jubula.client.ui.rap
parentbc24cadb2fd317595fc43868ed4d7610ee027026 (diff)
downloadorg.eclipse.jubula.core-d2fdab93b844a44dca3c35e56452f4fe0f235b54.tar.gz
org.eclipse.jubula.core-d2fdab93b844a44dca3c35e56452f4fe0f235b54.tar.xz
org.eclipse.jubula.core-d2fdab93b844a44dca3c35e56452f4fe0f235b54.zip
Sprint task - update dashboard target platform to luna
Diffstat (limited to 'org.eclipse.jubula.client.ui.rap')
-rw-r--r--org.eclipse.jubula.client.ui.rap/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.jubula.client.ui.rap/src/org/eclipse/jubula/client/ui/rap/handler/ExportTestResultsHandler.java32
-rw-r--r--org.eclipse.jubula.client.ui.rap/src/org/eclipse/jubula/client/ui/rap/servicehandler/DownloadTestResultsServiceHandler.java34
3 files changed, 32 insertions, 38 deletions
diff --git a/org.eclipse.jubula.client.ui.rap/META-INF/MANIFEST.MF b/org.eclipse.jubula.client.ui.rap/META-INF/MANIFEST.MF
index 1f3599232..81b32694b 100644
--- a/org.eclipse.jubula.client.ui.rap/META-INF/MANIFEST.MF
+++ b/org.eclipse.jubula.client.ui.rap/META-INF/MANIFEST.MF
@@ -10,8 +10,8 @@ Require-Bundle: ch.qos.logback.core;bundle-version="[1.0.0,2.0.0)",
org.slf4j.api;bundle-version="[1.7.2,2.0.0)",
org.eclipse.equinox.common;bundle-version="[3.6.0,4.0.0)",
org.eclipse.core.commands;bundle-version="[3.6.0,4.0.0)",
- org.eclipse.rap.jface;bundle-version="[1.4.0,2.0.0)",
- org.eclipse.rap.ui;bundle-version="[1.4.0,2.0.0)",
+ org.eclipse.rap.jface;bundle-version="[2.3.0,3.0.0)",
+ org.eclipse.rap.ui;bundle-version="[2.3.0,3.0.0)",
org.eclipse.jubula.client.core;bundle-version="[3.0.0,3.1.0)",
org.eclipse.jubula.client.ui;bundle-version="[3.0.0,3.1.0)"
Bundle-ClassPath: .
diff --git a/org.eclipse.jubula.client.ui.rap/src/org/eclipse/jubula/client/ui/rap/handler/ExportTestResultsHandler.java b/org.eclipse.jubula.client.ui.rap/src/org/eclipse/jubula/client/ui/rap/handler/ExportTestResultsHandler.java
index 400321845..9a5e32c63 100644
--- a/org.eclipse.jubula.client.ui.rap/src/org/eclipse/jubula/client/ui/rap/handler/ExportTestResultsHandler.java
+++ b/org.eclipse.jubula.client.ui.rap/src/org/eclipse/jubula/client/ui/rap/handler/ExportTestResultsHandler.java
@@ -28,7 +28,6 @@ import javax.servlet.http.HttpServletResponse;
import org.dom4j.Document;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -50,10 +49,8 @@ import org.eclipse.jubula.client.ui.editors.TestResultViewer.GenerateTestResultT
import org.eclipse.jubula.client.ui.rap.constants.IdConstants;
import org.eclipse.jubula.client.ui.rap.servicehandler.DownloadTestResultsServiceHandler;
import org.eclipse.jubula.client.ui.utils.JobUtils;
-import org.eclipse.rwt.RWT;
-import org.eclipse.rwt.service.IServiceHandler;
-import org.eclipse.rwt.widgets.ExternalBrowser;
-import org.eclipse.swt.SWT;
+import org.eclipse.rap.rwt.RWT;
+import org.eclipse.rap.rwt.client.service.UrlLauncher;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.handlers.HandlerUtil;
import org.slf4j.Logger;
@@ -83,7 +80,7 @@ public class ExportTestResultsHandler extends AbstractHandler {
/** the display to use for UI operations */
private Display m_display;
- /** the base Dashboard URL */
+ /** the base URL including service url */
private String m_baseUrl;
/** the response to use for encoding the download link */
@@ -94,7 +91,7 @@ public class ExportTestResultsHandler extends AbstractHandler {
*
* @param summariesToExport The Test Result Summaries for which to
* export Test Results.
- * @param baseUrl The display to use for UI operations.
+ * @param baseUrl The base URL including service url
* @param display The base Dashboard URL.
* @param response The response to use for encoding the download link.
*/
@@ -115,10 +112,9 @@ public class ExportTestResultsHandler extends AbstractHandler {
try {
URI downloadFileUri =
performExport(m_summariesToExport, monitor).toURI();
-
+
final StringBuilder urlBuilder = new StringBuilder();
- urlBuilder.append(m_baseUrl).append("?").append(IServiceHandler.REQUEST_PARAM) //$NON-NLS-1$
- .append("=").append(DownloadTestResultsServiceHandler.SERVICE_HANDLER_ID) //$NON-NLS-1$
+ urlBuilder.append(m_baseUrl)
.append("&").append(DownloadTestResultsServiceHandler.PARAM_FILENAME) //$NON-NLS-1$
.append("="); //$NON-NLS-1$
urlBuilder.append(URLEncoder.encode(downloadFileUri.toString(),
@@ -129,10 +125,10 @@ public class ExportTestResultsHandler extends AbstractHandler {
m_display.asyncExec(new Runnable() {
public void run() {
- ExternalBrowser.open("_blank", //$NON-NLS-1$
- m_response.encodeURL(
- uri.toASCIIString()),
- SWT.NONE);
+ UrlLauncher launcher = RWT.getClient()
+ .getService(UrlLauncher.class);
+ launcher.openURL(m_response.encodeURL(
+ uri.toASCIIString()));
}
});
} else {
@@ -235,7 +231,7 @@ public class ExportTestResultsHandler extends AbstractHandler {
*
* {@inheritDoc}
*/
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ public Object execute(ExecutionEvent event) {
ISelection selection = HandlerUtil.getCurrentSelection(event);
IStructuredSelection structuredSelection = null;
if (selection instanceof IStructuredSelection) {
@@ -269,10 +265,10 @@ public class ExportTestResultsHandler extends AbstractHandler {
"No Test Results were selected for export."); //$NON-NLS-1$
return null;
}
-
+ String url = RWT.getServiceManager().getServiceHandlerUrl(
+ DownloadTestResultsServiceHandler.SERVICE_HANDLER_ID);
Job exportJob = new ExportTestResultsJob(selectedSummaries,
- RWT.getRequest().getContextPath()
- + RWT.getRequest().getServletPath(),
+ url,
Display.getCurrent(),
RWT.getResponse());
exportJob.setUser(true);
diff --git a/org.eclipse.jubula.client.ui.rap/src/org/eclipse/jubula/client/ui/rap/servicehandler/DownloadTestResultsServiceHandler.java b/org.eclipse.jubula.client.ui.rap/src/org/eclipse/jubula/client/ui/rap/servicehandler/DownloadTestResultsServiceHandler.java
index aa9130ef2..97c1d77b5 100644
--- a/org.eclipse.jubula.client.ui.rap/src/org/eclipse/jubula/client/ui/rap/servicehandler/DownloadTestResultsServiceHandler.java
+++ b/org.eclipse.jubula.client.ui.rap/src/org/eclipse/jubula/client/ui/rap/servicehandler/DownloadTestResultsServiceHandler.java
@@ -18,11 +18,10 @@ import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
-import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.eclipse.rwt.RWT;
-import org.eclipse.rwt.service.IServiceHandler;
+import org.eclipse.rap.rwt.service.ServiceHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,7 +33,7 @@ import org.slf4j.LoggerFactory;
* </ul>
* @author BREDEX GmbH
*/
-public class DownloadTestResultsServiceHandler implements IServiceHandler {
+public class DownloadTestResultsServiceHandler implements ServiceHandler {
/** service handler ID */
public static final String SERVICE_HANDLER_ID =
@@ -46,27 +45,26 @@ public class DownloadTestResultsServiceHandler implements IServiceHandler {
/** the logger */
private static final Logger LOG =
LoggerFactory.getLogger(DownloadTestResultsServiceHandler.class);
-
+
/**
- *
* {@inheritDoc}
*/
- public void service() throws IOException, ServletException {
+ public void service(HttpServletRequest request,
+ HttpServletResponse response)
+ throws IOException {
File downloadFile;
try {
- downloadFile = new File(
- new URI(RWT.getRequest().getParameter(PARAM_FILENAME))
- .toURL().getFile());
- HttpServletResponse response = RWT.getResponse();
+ downloadFile = new File(new URI(request.getParameter(
+ PARAM_FILENAME)).toURL().getFile());
response.setContentType("application/octet-stream"); //$NON-NLS-1$
- response.setContentLength((int)downloadFile.length());
- response.setHeader("Content-Disposition", //$NON-NLS-1$
+ response.setContentLength((int) downloadFile.length());
+ response.setHeader("Content-Disposition", //$NON-NLS-1$
"attachment; filename=\"" + downloadFile.getName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
- BufferedOutputStream outputStream =
- new BufferedOutputStream(response.getOutputStream());
- BufferedInputStream inputStream =
- new BufferedInputStream(new FileInputStream(downloadFile));
-
+ BufferedOutputStream outputStream = new BufferedOutputStream(
+ response.getOutputStream());
+ BufferedInputStream inputStream = new BufferedInputStream(
+ new FileInputStream(downloadFile));
+
try {
int b;
while ((b = inputStream.read()) != -1) {

Back to the top