Author: sdzmitrovich
Date: 2007-12-27 11:27:57 -0500 (Thu, 27 Dec 2007)
New Revision: 5462
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/.classpath
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/.project
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/build.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest.jar
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportJsfComponents.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfTestPlugin.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1563
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/.classpath
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/.classpath
(rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/.classpath 2007-12-27 16:27:57 UTC
(rev 5462)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/.project
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/.project (rev
0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/.project 2007-12-27 16:27:57 UTC (rev
5462)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.jsf.vpe.jsf.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF 2007-12-27
16:27:57 UTC (rev 5462)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Jsf Test Plug-in
+Bundle-SymbolicName: org.jboss.tools.jsf.vpe.jsf.test
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.jsf.vpe.jsf.test.JsfTestPlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.vpe,
+ org.junit,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.jboss.tools.common
+Eclipse-LazyStart: true
+Bundle-ClassPath: jsf-test.jar
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/build.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/build.properties
(rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/build.properties 2007-12-27 16:27:57
UTC (rev 5462)
@@ -0,0 +1,10 @@
+bin.includes = META-INF/,\
+ jsf-test.jar,\
+ resources/
+jars.compile.order = jsf-test.jar
+source.jsf-test.jar = src/
+output.jsf-test.jar = bin/
+src.includes = META-INF/,\
+ build.properties,\
+ resources/,\
+ src/
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportJsfComponents.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportJsfComponents.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportJsfComponents.java 2007-12-27
16:27:57 UTC (rev 5462)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * 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.jsf.test;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.zip.ZipFile;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
+import org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider;
+import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+
+/**
+ * Class for importing project from jar file
+ *
+ * @author dsakharov@exadel.com,amakhtadui(a)exadel.com
+ *
+ */
+public class ImportJsfComponents {
+ private static final String PROJECT_NAME = "JsfTest"; // $NON-NLS-1$
+ private static final String COMPONENTS_PATH = "WebContent/pages"; //
$NON-NLS-1$
+
+ @SuppressWarnings("restriction")
+ static void importJsfPages(String path) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+ ZipLeveledStructureProvider zipStructureProvider;
+ try {
+ zipStructureProvider =
+ new ZipLeveledStructureProvider(new ZipFile(path));
+
+ IOverwriteQuery overwrite = new IOverwriteQuery() {
+ public String queryOverwrite(String pathString) {
+ return ALL;
+ }
+ };
+
+ ImportOperation importOp = new ImportOperation(
+ project.getFullPath(),
+ zipStructureProvider.getRoot(),
+ zipStructureProvider,
+ overwrite);
+
+ importOp.setContext(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+
+ importOp.run(new NullProgressMonitor());
+ } catch (InvocationTargetException ite) {
+ JsfTestPlugin.getPluginLog().logError(ite.getCause());
+ } catch (InterruptedException ie) {
+ JsfTestPlugin.getPluginLog().logError(ie);
+ } catch (IOException e) {
+ JsfTestPlugin.getPluginLog().logError(e);
+ }
+ }
+
+ /**
+ *
+ * @return
+ * @throws CoreException
+ */
+ static IPath getComponentPath(String componentPage) throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+ if (project != null) {
+ 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 null;
+ }
+
+ /**
+ *
+ * @throws CoreException
+ */
+ 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());
+ }
+ }
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportJsfComponents.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2007-12-27
16:27:57 UTC (rev 5462)
@@ -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.jsf.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Class for testing all RichFaces components
+ *
+ * @author sdzmitrovich
+ *
+ */
+
+public class JsfAllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Tests for Vpe Jsf components"); //
$NON-NLS-1$
+ // $JUnit-BEGIN$
+ suite.addTestSuite(JsfComponentTest.class);
+ // $JUnit-END$
+ return suite;
+
+ }
+
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java 2007-12-27
16:27:57 UTC (rev 5462)
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * 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.jsf.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.ILogListener;
+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;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * Class for testing all jsf components
+ *
+ * @author sdzmitrovich
+ *
+ */
+public class JsfComponentTest extends TestCase implements ILogListener {
+
+ private final static String EDITOR_ID =
"org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; // $NON-NLS-1$
+ private final static String TEST_PROJECT_JAR_PATH = "/jsfTest.jar"; //
$NON-NLS-1$
+
+ // check warning log
+ private final static boolean checkWarning = false;
+ private Throwable exception;
+
+ public JsfComponentTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // TODO: Use TestSetup to create and remove project once for all tests
+ // not for every one
+ if (ResourcesPlugin.getWorkspace().getRoot().findMember("JsfTest") == null)
{
+
+ ImportJsfComponents.importJsfPages(JsfTestPlugin
+ .getPluginResourcePath()
+ + TEST_PROJECT_JAR_PATH);
+
+ waitForJobs();
+ waitForJobs();
+ delay(5000);
+ }
+ Platform.addLogListener(this);
+ }
+
+ /**
+ * Perform post-test cleanup.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ // ImportRichFacesComponents.removeProject();
+ // waitForJobs();
+ Platform.removeLogListener(this);
+ }
+
+ /**
+ * Process UI input but do not return for the specified time interval.
+ *
+ * @param waitTimeMillis
+ * the number of milliseconds
+ */
+ private void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
+ }
+
+ /**
+ * Wait until all background tasks are complete.
+ */
+ public void waitForJobs() {
+ while (Job.getJobManager().currentJob() != null)
+ delay(5000);
+ }
+
+ // public void testAllComponentsOnSinglePage() throws PartInitException,
+ // Throwable {
+ // performTestForRichFacesComponent("richFacesTest.xhtml"); // $NON-NLS-1$
+ // }
+
+ public void testCommandButton() throws PartInitException, Throwable {
+ performTestForJsfComponent("commandButton.jsp"); // $NON-NLS-1$
+ }
+
+ public void testCommandLink() throws PartInitException, Throwable {
+ performTestForJsfComponent("commandLink.jsp"); // $NON-NLS-1$
+ }
+
+ public void testDataTable() throws PartInitException, Throwable {
+ performTestForJsfComponent("dataTable.jsp"); // $NON-NLS-1$
+ }
+
+ public void testForm() throws PartInitException, Throwable {
+ performTestForJsfComponent("form.jsp"); // $NON-NLS-1$
+ }
+
+ public void testGraphicImage() throws PartInitException, Throwable {
+ performTestForJsfComponent("graphicImage.jsp"); // $NON-NLS-1$
+ }
+
+ public void testInputHidden() throws PartInitException, Throwable {
+ performTestForJsfComponent("inputHidden.jsp"); // $NON-NLS-1$
+ }
+
+ public void testInputSecret() throws PartInitException, Throwable {
+ performTestForJsfComponent("inputSecret.jsp"); // $NON-NLS-1$
+ }
+
+ public void testInputText() throws PartInitException, Throwable {
+ performTestForJsfComponent("inputText.jsp"); // $NON-NLS-1$
+ }
+
+ public void testInputTextArea() throws PartInitException, Throwable {
+ performTestForJsfComponent("inputTextArea.jsp"); // $NON-NLS-1$
+ }
+
+ public void testMessage() throws PartInitException, Throwable {
+ performTestForJsfComponent("message.jsp"); // $NON-NLS-1$
+ }
+
+ public void testMessages() throws PartInitException, Throwable {
+ performTestForJsfComponent("messages.jsp"); // $NON-NLS-1$
+ }
+
+ public void testOutputFormat() throws PartInitException, Throwable {
+ performTestForJsfComponent("outputFormat.jsp"); // $NON-NLS-1$
+ }
+
+ public void testOutputLabel() throws PartInitException, Throwable {
+ performTestForJsfComponent("outputLabel.jsp"); // $NON-NLS-1$
+ }
+
+ public void testOutputLink() throws PartInitException, Throwable {
+ performTestForJsfComponent("outputLink.jsp"); // $NON-NLS-1$
+ }
+
+ public void testOutputText() throws PartInitException, Throwable {
+ performTestForJsfComponent("outputText.jsp"); // $NON-NLS-1$
+ }
+
+ public void testPanelGrid() throws PartInitException, Throwable {
+ performTestForJsfComponent("panelGrid.jsp"); // $NON-NLS-1$
+ }
+
+ public void testPanelGroup() throws PartInitException, Throwable {
+ performTestForJsfComponent("panelGroup.jsp"); // $NON-NLS-1$
+ }
+
+ public void testSelectBooleanCheckbox() throws PartInitException, Throwable {
+ performTestForJsfComponent("selectBooleanCheckbox.jsp"); // $NON-NLS-1$
+ }
+
+ public void testSelectManyCheckbox() throws PartInitException, Throwable {
+ performTestForJsfComponent("selectManyCheckbox.jsp"); // $NON-NLS-1$
+ }
+
+ public void testSelectManyListbox() throws PartInitException, Throwable {
+ performTestForJsfComponent("selectManyListbox.jsp"); // $NON-NLS-1$
+ }
+
+ public void testSelectManyMenu() throws PartInitException, Throwable {
+ performTestForJsfComponent("selectManyMenu.jsp"); // $NON-NLS-1$
+ }
+
+ public void testSelectOneListbox() throws PartInitException, Throwable {
+ performTestForJsfComponent("selectOneListbox.jsp"); // $NON-NLS-1$
+ }
+
+ public void testSelectOneMenu() throws PartInitException, Throwable {
+ performTestForJsfComponent("selectOneMenu.jsp"); // $NON-NLS-1$
+ }
+
+ public void testSelectOneRadio() throws PartInitException, Throwable {
+ performTestForJsfComponent("selectOneRadio.jsp"); // $NON-NLS-1$
+ }
+
+ private void performTestForJsfComponent(String componentPage)
+ throws PartInitException, Throwable {
+ waitForJobs();
+
+ exception = null;
+ IPath componentPath = ImportJsfComponents
+ .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);
+
+ if (exception != null) {
+ throw exception;
+ }
+ }
+
+ public void logging(IStatus status, String plugin) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ exception = status.getException();
+ break;
+ case IStatus.WARNING:
+ if (checkWarning)
+ exception = status.getException();
+ break;
+ default:
+ break;
+ }
+
+ }
+
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfTestPlugin.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfTestPlugin.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfTestPlugin.java 2007-12-27
16:27:57 UTC (rev 5462)
@@ -0,0 +1,74 @@
+package org.jboss.tools.jsf.vpe.jsf.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 JsfTestPlugin extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.jsf.vpe.jsf.test";
+
+ // The shared instance
+ private static JsfTestPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public JsfTestPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.Plugin#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 JsfTestPlugin 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();
+ }
+
+}