Remove bundle activator.

Change-Id: I4f3ba49f003d884e0439eacfc359778b25505f1e
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.test.performance.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.test.performance.ui/META-INF/MANIFEST.MF
index c41b334..8499858 100644
--- a/bundles/org.eclipse.test.performance.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.test.performance.ui/META-INF/MANIFEST.MF
@@ -4,7 +4,6 @@
 Bundle-SymbolicName: org.eclipse.test.performance.ui; singleton:=true
 Bundle-Version: 3.10.0.qualifier
 Bundle-ClassPath: .
-Bundle-Activator: org.eclipse.test.performance.ui.UiPlugin
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %Bundle-Vendor
 Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java
index d5e1a51..27b0855 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java
@@ -35,6 +35,7 @@
 import org.eclipse.test.internal.performance.results.db.ScenarioResults;
 import org.eclipse.test.internal.performance.results.utils.Util;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
 
 /**
  * Main class to generate performance results of all scenarios matching a given pattern
@@ -255,9 +256,9 @@
 			buffer.append("	").append(arg).append(" = ");
 			String[] ids = idPrefixList.split(",");
 			this.currentBuildPrefixes = new ArrayList<>();
-			for (int j = 0; j < ids.length; j++) {
-				this.currentBuildPrefixes.add(ids[j]);
-				buffer.append(ids[j]);
+			for (String id : ids) {
+				this.currentBuildPrefixes.add(id);
+				buffer.append(id);
 			}
 			buffer.append('\n');
 			i++;
@@ -865,63 +866,13 @@
 		printSummary(/*performanceResults*/);
 
 		// Copy images and scripts to output dir
-		Bundle bundle = UiPlugin.getDefault().getBundle();
-//		URL images = bundle.getEntry("images");
-//		if (images != null) {
-//			images = FileLocator.resolve(images);
-//			Utils.copyImages(new File(images.getPath()), this.outputDir);
-//		}
-		/* New way to get images
-		File content = FileLocator.getBundleFile(bundle);
-		BundleFile bundleFile;
-		if (content.isDirectory()) {
-			bundleFile = new DirBundleFile(content);
-			Utils.copyImages(bundleFile.getFile("images", true), this.outputDir);
-		} else {
-			bundleFile = new ZipBundleFile(content, null);
-			Enumeration imageFiles = bundle.findEntries("images", "*.gif", false);
-			while (imageFiles.hasMoreElements()) {
-				URL url = (URL) imageFiles.nextElement();
-				Utils.copyFile(bundleFile.getFile("images"+File.separator+, true), this.outputDir);
-			}
-		}
-		*/
+		Bundle bundle = FrameworkUtil.getBundle(GenerateResults.class);
 		// Copy bundle files
 		Utils.copyBundleFiles(bundle, "images", "*.gif", this.outputDir); // images
 		Utils.copyBundleFiles(bundle, "scripts", "*.js", this.outputDir); // java scripts
 		Utils.copyBundleFiles(bundle, "scripts", "*.css", this.outputDir); // styles
 		Utils.copyBundleFiles(bundle, "doc", "*.html", this.outputDir); // doc
 		Utils.copyBundleFiles(bundle, "doc/images", "*.png", this.outputDir); // images for doc
-		/*
-		URL doc = bundle.getEntry("doc");
-		if (doc != null) {
-			doc = FileLocator.resolve(doc);
-			File docDir = new File(doc.getPath());
-			FileFilter filter = new FileFilter() {
-				public boolean accept(File pathname) {
-		            return !pathname.getName().equals("CVS");
-	            }
-			};
-			File[] docFiles = docDir.listFiles(filter);
-			for (int i=0; i<docFiles.length; i++) {
-				File file = docFiles[i];
-				if (file.isDirectory()) {
-					File subdir = new File(this.outputDir, file.getName());
-					subdir.mkdir();
-					File[] subdirFiles = file.listFiles(filter);
-					for (int j=0; j<subdirFiles.length; j++) {
-						if (subdirFiles[i].isDirectory()) {
-							// expect only one sub-directory
-						} else {
-							Util.copyFile(subdirFiles[j], new File(subdir, subdirFiles[j].getName()));
-						}
-					}
-				} else {
-					Util.copyFile(file, new File(this.outputDir, file.getName()));
-				}
-			}
-		}
-		*/
 
 		// Print HTML pages and all linked files
 		if (this.printStream != null) {
@@ -929,8 +880,6 @@
 			this.printStream.print("	- components main page");
 		}
 		long start = System.currentTimeMillis();
-//		subMonitor.setTaskName("Write fingerprints: 0%");
-//		subMonitor.subTask("Global...");
 		subMonitor.subTask("Write fingerprints: global (0%)...");
 		printComponent(/*performanceResults, */"global_fp");
 		subMonitor.worked(100);
@@ -941,8 +890,6 @@
 		int progress = 0;
 		for (int i=0; i<length; i++) {
 			int percentage = (int) ((progress / ((double) length)) * 100);
-//			subMonitor.setTaskName("Write fingerprints: "+percentage+"%");
-//			subMonitor.subTask(components[i]+"...");
 			subMonitor.subTask("Write fingerprints: "+components[i]+" ("+percentage+"%)...");
 			printComponent(/*performanceResults, */components[i]);
 			subMonitor.worked(step);
@@ -975,13 +922,13 @@
 			String duration = Util.timeString(System.currentTimeMillis()-begin);
 			this.printStream.println("=> done in "+duration);
 		}
-		return new Status(IStatus.OK, UiPlugin.getDefault().toString(), "Everything is OK");
+		return new Status(IStatus.OK, GenerateResults.class, "Everything is OK");
 	}
 	catch (OperationCanceledException oce) {
-		return new Status(IStatus.OK, UiPlugin.getDefault().toString(), "Generation was cancelled!");
+		return new Status(IStatus.OK, GenerateResults.class, "Generation was cancelled!");
 	}
 	catch (Exception ex) {
-		return new Status(IStatus.ERROR, UiPlugin.getDefault().toString(), "An unexpected exception occurred!", ex);
+		return new Status(IStatus.ERROR, GenerateResults.class, "An unexpected exception occurred!", ex);
 	}
 	finally {
 		if (this.printStream != null) {
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/ImportDataMain.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/ImportDataMain.java
index 99defa1..717cb0b 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/ImportDataMain.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/ImportDataMain.java
@@ -82,7 +82,7 @@
       System.out.println("INFO: Connecting to database...");
 
       // import data
-      IStatus exitStatus = new Status(IStatus.OK, UiPlugin.getDefault().toString(), "Nothing to import.");
+      IStatus exitStatus = new Status(IStatus.OK, ImportDataMain.class, "Nothing to import.");
       System.out.println("INFO: Start importing " + inputFiles.size() + " performance data files.");
       for (Path inputFile : inputFiles) {
         exitStatus = importData(inputFile);
@@ -92,7 +92,7 @@
       }
       return exitStatus;
     } catch (Exception ex) {
-      return new Status(IStatus.ERROR, UiPlugin.getDefault().toString(), "Performance data import failed with exception!", ex);
+      return new Status(IStatus.ERROR, ImportDataMain.class, "Performance data import failed with exception!", ex);
     }
   }
 
@@ -141,7 +141,7 @@
       }
     } catch (EOFException ex) {
       // EOFException is the intended way to end the loop
-      return new Status(IStatus.OK, UiPlugin.getDefault().toString(), "Everything is OK");
+      return new Status(IStatus.OK, ImportDataMain.class, "Everything is OK");
     }
   }
 }
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/UiPlugin.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/UiPlugin.java
deleted file mode 100644
index 2f35a7e..0000000
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/UiPlugin.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation 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:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.test.performance.ui;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class UiPlugin extends Plugin {
-	//The shared instance.
-	private static UiPlugin plugin;
-
-	/**
-	 * The constructor.
-	 */
-	public UiPlugin() {
-		if (plugin == null) {
-			plugin = this;
-		}
-	}
-
-	/**
-	 * This method is called upon plug-in activation
-	 */
-	@Override
-  public void start(BundleContext context) throws Exception {
-		super.start(context);
-	}
-
-	/**
-	 * This method is called when the plug-in is stopped
-	 */
-	@Override
-  public void stop(BundleContext context) throws Exception {
-		super.stop(context);
-		plugin = null;
-	}
-
-	/**
-	 * Returns the shared instance.
-	 */
-	public static UiPlugin getDefault() {
-		return plugin;
-	}
-
-
-}