Skip to main content
summaryrefslogtreecommitdiffstats
blob: 20200b09d9ddb82da5443af0cd64690af589a762 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Copyright (c) 2012 Robert Bosch Engineering and Business Solutions Ltd India. 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
 */
package org.eclipse.osee.reports.efficiency.ui;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.birt.report.viewer.utilities.WebViewer;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
import org.eclipse.osee.reports.efficiency.Activator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.Composite;
import org.osgi.framework.Bundle;

/**
 * Class to create the tab in UI
 * 
 * @author Praveen Joseph
 */
public class TeamEfficiencyTab implements IResultsEditorTab {

   private Browser browser;

   @SuppressWarnings("deprecation")
   @Override
   public Composite createTab(final Composite parent, final ResultsEditor resultsEditor) throws OseeCoreException {

      String path = getReportPath();
      this.browser = new Browser(parent, SWT.NONE);
      WebViewer.display(path, WebViewer.HTML, this.browser, "frameset");
      this.browser.refresh();
      return this.browser;
   }

   /**
    * Method to return the report path
    * 
    * @return the report path
    */
   public String getReportPath() {
      String path = null;
      try {
         Bundle bundle = Platform.getBundle(getPluginID());
         URL url = FileLocator.find(bundle, new Path("reports/" + getReport()), null);
         path = FileLocator.toFileURL(url).getPath();
      } catch (MalformedURLException me) {
         System.out.println("Fehler bei URL " + me.getStackTrace());
         return null;
      } catch (IOException e) {
         e.printStackTrace();
         return null;
      }
      return path;
   }

   /**
    * @return the plugin ID
    */
   public String getPluginID() {
      return Activator.PLUGIN_ID;
   }

   /**
    * @return the report name
    */
   public String getReport() {
      return "TeamEfficiencyBar.rptdesign";
   }

   @Override
   public String getTabName() {
      return "Team Efficiency";
   }

}

Back to the top