Author: svasilyev
Date: 2007-10-22 19:15:47 -0400 (Mon, 22 Oct 2007)
New Revision: 4430
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesTestPlugin.java
Removed:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/AllTests.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java
Log:
RichFaces test was improved and refactored
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF 2007-10-22
19:51:33 UTC (rev 4429)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF 2007-10-22
23:15:47 UTC (rev 4430)
@@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Richfaces Plug-in
+Bundle-Name: Richfaces Test Plug-in
Bundle-SymbolicName: org.jboss.tools.jsf.vpe.richfaces.test
Bundle-Version: 1.0.0
-Bundle-Activator: org.jboss.tools.jsf.vpe.richfaces.test.Activator
+Bundle-Activator: org.jboss.tools.jsf.vpe.richfaces.test.RichFacesTestPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.jboss.tools.vpe,
Deleted:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java 2007-10-22
19:51:33 UTC (rev 4429)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java 2007-10-22
23:15:47 UTC (rev 4430)
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.richfaces.test;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.common.log.BaseUIPlugin;
-import org.jboss.tools.common.log.IPluginLog;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends BaseUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID =
"org.jboss.tools.jsf.vpe.richfaces.test";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- public static IPluginLog getPluginLog() {
- return getDefault();
- }
-
- public static String getPluginResourcePath() {
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- URL url = null;
- try {
- url = bundle == null ? null : FileLocator.resolve(bundle
- .getEntry("/resources"));
- } catch (Exception e) {
- url = bundle.getEntry("/resources");
- }
- return (url == null) ? null : url.getPath();
- }
-}
Deleted:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/AllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/AllTests.java 2007-10-22
19:51:33 UTC (rev 4429)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/AllTests.java 2007-10-22
23:15:47 UTC (rev 4430)
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.richfaces.test;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Class for testing all RichFaces components
- *
- * @author dsakovich(a)exadel.com
- *
- */
-
-public class AllTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Tests for Vpe RichFaces components");
- // $JUnit-BEGIN$
- suite.addTestSuite(RichFacesComponentTest.class);
- // $JUnit-END$
- return suite;
-
- }
-
-}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java 2007-10-22
19:51:33 UTC (rev 4429)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java 2007-10-22
23:15:47 UTC (rev 4430)
@@ -12,11 +12,8 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.zip.ZipFile;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
@@ -40,10 +37,8 @@
private static final String COMPONENTS_PATH = "WebContent/pages"; //
$NON-NLS-1$
@SuppressWarnings("restriction")
- public static boolean importRichFacesPages(String path) {
- boolean result = false;
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(PROJECT_NAME);
+ static void importRichFacesPages(String path) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
ZipLeveledStructureProvider zipStructureProvider;
try {
zipStructureProvider =
@@ -64,16 +59,13 @@
importOp.setContext(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
importOp.run(new NullProgressMonitor());
- result = true;
-
} catch (InvocationTargetException ite) {
- Activator.getPluginLog().logError(ite.getCause());
+ RichFacesTestPlugin.getPluginLog().logError(ite.getCause());
} catch (InterruptedException ie) {
- Activator.getPluginLog().logError(ie);
+ RichFacesTestPlugin.getPluginLog().logError(ie);
} catch (IOException e) {
- Activator.getPluginLog().logError(e);
+ RichFacesTestPlugin.getPluginLog().logError(e);
}
- return result;
}
/**
@@ -81,31 +73,34 @@
* @return
* @throws CoreException
*/
- public static Collection<IPath> getComponentsPaths() throws CoreException {
- Collection<IPath> result = null;
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(PROJECT_NAME);
+ static IPath getComponentPath(String componentPage) throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
if (project != null) {
- IFolder folder = project.getFolder(COMPONENTS_PATH);
- IResource[] resources = folder.members();
- if (resources != null && resources.length > 0) {
- result = new ArrayList<IPath>(resources.length);
- for (IResource res : resources) {
- result.add(res.getFullPath());
- }
+ IResource resource = project.getFolder(COMPONENTS_PATH).findMember(componentPage);
+ if (resource != null) {
+ return resource.getFullPath();
}
+// IResource[] resources = folder.members();
+// if (resources != null && resources.length > 0) {
+// result = new ArrayList<IPath>(resources.length);
+// for (IResource res : resources) {
+// result.add(res.getFullPath());
+// }
+// }
}
- return result;
+
+ return null;
}
/**
*
* @throws CoreException
*/
- public static void removeProject() throws CoreException {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(PROJECT_NAME);
- project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
- new NullProgressMonitor());
+ static void removeProject() throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+ if (project != null) {
+ project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
+ new NullProgressMonitor());
+ }
}
}
Copied:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
(from rev 4429,
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/AllTests.java)
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java 2007-10-22
23:15:47 UTC (rev 4430)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Class for testing all RichFaces components
+ *
+ * @author dsakovich(a)exadel.com
+ *
+ */
+
+public class RichFacesAllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Tests for Vpe RichFaces components"); //
$NON-NLS-1$
+ // $JUnit-BEGIN$
+ suite.addTestSuite(RichFacesComponentTest.class);
+ // $JUnit-END$
+ return suite;
+
+ }
+
+}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java 2007-10-22
19:51:33 UTC (rev 4429)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java 2007-10-22
23:15:47 UTC (rev 4430)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.test;
-import java.util.Collection;
-
import junit.framework.TestCase;
import org.eclipse.core.resources.IFile;
@@ -20,6 +18,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.PartInitException;
@@ -39,8 +38,7 @@
// check warning log
private final static boolean checkWarning = false;
- private boolean failureLog;
- private Collection<IPath> components = null;
+ private Throwable exception;
public RichFacesComponentTest(String name) {
super(name);
@@ -55,11 +53,10 @@
*/
protected void setUp() throws Exception {
super.setUp();
- if (ImportRichFacesComponents.importRichFacesPages(Activator
- .getPluginResourcePath() + TEST_PROJECT_JAR_PATH)) {
- components = ImportRichFacesComponents.getComponentsPaths();
- }
- failureLog = false;
+
+ ImportRichFacesComponents.importRichFacesPages(RichFacesTestPlugin
+ .getPluginResourcePath() + TEST_PROJECT_JAR_PATH);
+
waitForJobs();
Platform.addLogListener(this);
waitForJobs();
@@ -110,33 +107,171 @@
* Wait until all background tasks are complete.
*/
public void waitForJobs() {
- while (Platform.getJobManager().currentJob() != null)
+ while (Job.getJobManager().currentJob() != null)
delay(5000);
}
- public void testRichFacesComponent() throws PartInitException {
+ public void testAllComponentsOnSinglePage() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("richFacesTest.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testCalendar() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("calendar.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testDataDefinitionList() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("dataDefinitionList.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testDataFilterSlider() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("dataFilterSlider.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testDataGrid() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("dataGrid.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testDataList() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("dataList.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testDataOrderedList() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("dataOrderedList.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testDataScroller() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("dataScroller.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testDataTable() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("dataTable.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testDragAndDrop() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("dragAndDrop.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testDropDawnMenu() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("dropDawnMenu.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testEffect() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("effect.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testGoogleMap() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("googleMap.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testInputNumberSlider() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("inputNumberSlider.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testInputNumberSpinner() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("inputNumberSpinner.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testInsert() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("insert.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testMessage() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("message.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testMessages() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("messages.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testModalPanel() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("modalPanel.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testPaint2D() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("paint2D.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testPanel() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("panel.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testPanelBar() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("panelBar.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testPanelMenu() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("panelMenu.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testScrollableDataTable() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("scrollableDataTable.xhtml"); //
$NON-NLS-1$
+ }
+
+ public void testSeparator() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("separator.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testSimpleTogglePanel() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("simpleTogglePanel.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testSpacer() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("spacer.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testSuggestionBox() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("suggestionbox.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testTabPanel() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("tabPanel.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testTogglePanel() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("togglePanel.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testToolBar() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("toolBar.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testTree() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("tree.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testVirtualEarth() throws PartInitException, Throwable {
+ performTestForRichFacesComponent("virtualEarth.xhtml"); // $NON-NLS-1$
+ }
+
+
+ private void performTestForRichFacesComponent(String componentPage) throws
PartInitException, Throwable {
waitForJobs();
- for (IPath componentPath : components) {
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(componentPath);
- IEditorInput input = new FileEditorInput(file);
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input,
EDITOR_ID, true);
+ exception = null;
+ IPath componentPath = ImportRichFacesComponents.getComponentPath(componentPage);
+
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(componentPath);
+ IEditorInput input = new FileEditorInput(file);
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input,
EDITOR_ID, true);
- waitForJobs();
- delay(3000);
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true);
+ waitForJobs();
+ delay(3000);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true);
+
+ if (exception != null) {
+ throw exception;
}
- assertEquals(failureLog, false);
}
public void logging(IStatus status, String plugin) {
switch (status.getSeverity()) {
case IStatus.ERROR:
- failureLog = true;
+ exception = status.getException();
break;
case IStatus.WARNING:
if (checkWarning)
- failureLog = true;
+ exception = status.getException();
break;
default:
break;
Copied:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesTestPlugin.java
(from rev 4429,
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java)
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesTestPlugin.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesTestPlugin.java 2007-10-22
23:15:47 UTC (rev 4430)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.test;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.jboss.tools.common.log.IPluginLog;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class RichFacesTestPlugin extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID =
"org.jboss.tools.jsf.vpe.richfaces.test"; // $NON-NLS-1$
+
+ // The shared instance
+ private static RichFacesTestPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public RichFacesTestPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static RichFacesTestPlugin getDefault() {
+ return plugin;
+ }
+
+ public static IPluginLog getPluginLog() {
+ return getDefault();
+ }
+
+ public static String getPluginResourcePath() {
+ Bundle bundle = Platform.getBundle(PLUGIN_ID);
+ URL url = null;
+ try {
+ url = bundle == null ? null : FileLocator.resolve(bundle
+ .getEntry("/resources")); // $NON-NLS-1$
+ } catch (Exception e) {
+ url = bundle.getEntry("/resources"); // $NON-NLS-1$
+ }
+ return (url == null) ? null : url.getPath();
+ }
+}