Author: sdzmitrovich
Date: 2007-12-29 06:16:12 -0500 (Sat, 29 Dec 2007)
New Revision: 5481
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/JBIDE-1467.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportProvider.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfUtil.java
Removed:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfComponentsUtil.java
Modified:
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
Log:
junit tests was updated
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/JBIDE-1467.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/JBIDE-1467.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/JBIDE-1467.jsp 2007-12-29
11:16:12 UTC (rev 5481)
@@ -0,0 +1,22 @@
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+
+<html>
+<head>
+</head>
+<body>
+
+<f:view>
+
+ <h:selectOneRadio>
+
+ <f:selectItem itemLabel="value1" />
+ <f:selectItem itemLabel="value2" />
+ <f:selectItem itemLabel="value3" />
+ <f:selectItem itemLabel="value4" />
+
+ </h:selectOneRadio>
+
+</f:view>
+</body>
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportProvider.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportProvider.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportProvider.java 2007-12-29
11:16:12 UTC (rev 5481)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * 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.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
+
+/**
+ * @author sdzmitrovich
+ *
+ */
+public class ImportProvider implements IImportStructureProvider {
+
+ /**
+ * list of files which will not be imported
+ */
+ List unimportedFiles = new ArrayList();
+
+ /**
+ * Creates an instance of <code>ImportProvider</code>.
+ */
+ public ImportProvider() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public List getChildren(Object element) {
+ File folder = (File) element;
+ String[] children = folder.list();
+ int childrenLength = children == null ? 0 : children.length;
+ List result = new ArrayList(childrenLength);
+
+ for (int i = 0; i < childrenLength; i++) {
+ if (!unimportedFiles.contains(children[i]))
+ result.add(new File(folder, children[i]));
+ }
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public InputStream getContents(Object element) {
+ try {
+ return new FileInputStream((File) element);
+ } catch (FileNotFoundException e) {
+ IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e);
+ return null;
+ }
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public String getFullPath(Object element) {
+ return ((File) element).getPath();
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public String getLabel(Object element) {
+
+ // Get the name - if it is empty then return the path as it is a file
+ // root
+ File file = (File) element;
+ String name = file.getName();
+ if (name.length() == 0) {
+ return file.getPath();
+ }
+ return name;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public boolean isFolder(Object element) {
+ return ((File) element).isDirectory();
+ }
+
+ public List getUnimportedFiles() {
+ return unimportedFiles;
+ }
+
+ public void setUnimportedFiles(List unimportedFiles) {
+ this.unimportedFiles = unimportedFiles;
+ }
+
+}
Modified:
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 2007-12-29
01:50:30 UTC (rev 5480)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2007-12-29
11:16:12 UTC (rev 5481)
@@ -26,7 +26,7 @@
private static void prepareTests() {
- TestJsfComponentsUtil.importJsfPages(JsfTestPlugin
+ TestJsfUtil.importJsfPages(JsfTestPlugin
.getPluginResourcePath()
+ TEST_PROJECT_PATH);
@@ -40,6 +40,7 @@
// $JUnit-BEGIN$
suite.addTestSuite(JsfComponentTest.class);
+// suite.addTestSuite(JsfJideTest.class);
// $JUnit-END$
return suite;
Modified:
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 2007-12-29
01:50:30 UTC (rev 5480)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java 2007-12-29
11:16:12 UTC (rev 5481)
@@ -13,9 +13,7 @@
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.ui.IEditorInput;
@@ -32,7 +30,6 @@
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
@@ -54,19 +51,6 @@
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);
}
@@ -79,8 +63,6 @@
*/
protected void tearDown() throws Exception {
super.tearDown();
- // ImportJsfComponents.removeProject();
- // waitForJobs();
Platform.removeLogListener(this);
}
@@ -271,21 +253,26 @@
private void performTestForJsfComponent(String componentPage)
throws PartInitException, Throwable {
- TestJsfComponentsUtil.waitForJobs();
+ TestJsfUtil.waitForJobs();
exception = null;
- IPath componentPath = TestJsfComponentsUtil
+
+ // IPath componentPath = TestJsfComponentsUtil
+ // .getComponentPath(componentPage);
+ //
+ // IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
+ // componentPath);
+
+ IFile file = (IFile) TestJsfUtil
.getComponentPath(componentPage);
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
- componentPath);
IEditorInput input = new FileEditorInput(file);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.openEditor(input, EDITOR_ID, true);
- TestJsfComponentsUtil.waitForJobs();
- TestJsfComponentsUtil.delay(3000);
+ TestJsfUtil.waitForJobs();
+ TestJsfUtil.delay(3000);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.closeAllEditors(true);
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java 2007-12-29
11:16:12 UTC (rev 5481)
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * 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.runtime.ILogListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * Class for testing all jsf components
+ *
+ * @author sdzmitrovich
+ *
+ */
+public class JsfJbideTest extends TestCase implements ILogListener {
+
+ private final static String EDITOR_ID =
"org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; // $NON-NLS-1$
+ // $NON-NLS-1$
+
+ // check warning log
+ private final static boolean checkWarning = false;
+ private Throwable exception;
+
+ public JsfJbideTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#setUp()
+ */
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ Platform.addLogListener(this);
+ }
+
+ /**
+ * Perform post-test cleanup.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ Platform.removeLogListener(this);
+ }
+
+ /*
+ * JBIDE's test cases
+ */
+
+ public void testJBIDE_1467() throws PartInitException, Throwable {
+ String path = "JBIDE/JBIDE-1467.jsp";
+
+ }
+
+ /*private void performTestForJsfComponent(String componentPage)
+ throws PartInitException, Throwable {
+ TestJsfComponentsUtil.waitForJobs();
+
+ exception = null;
+ IPath componentPath = TestJsfComponentsUtil
+ .getComponentPath(componentPage);
+
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
+ componentPath);
+ IEditorInput input = new FileEditorInput(file);
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .openEditor(input, EDITOR_ID, true);
+
+ TestJsfComponentsUtil.waitForJobs();
+ TestJsfComponentsUtil.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;
+ }
+
+ }
+
+}
Deleted:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfComponentsUtil.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfComponentsUtil.java 2007-12-29
01:50:30 UTC (rev 5480)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfComponentsUtil.java 2007-12-29
11:16:12 UTC (rev 5481)
@@ -1,156 +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.jsf.test;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-
-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.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
-import org.eclipse.ui.wizards.datatransfer.ImportOperation;
-
-/**
- * Class for importing project from jar file
- *
- * @author sdzmitrovich
- *
- */
-public class TestJsfComponentsUtil {
- 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) {
-
- if (ResourcesPlugin.getWorkspace().getRoot().findMember(
- TestJsfComponentsUtil.PROJECT_NAME) != null) {
- waitForJobs();
-
- try {
- removeProject();
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- PROJECT_NAME);
-
- try {
-
- IOverwriteQuery overwrite = new IOverwriteQuery() {
- public String queryOverwrite(String pathString) {
- return ALL;
- }
- };
-
- // source file
- File source = new File(path);
-
- // create import operation
- ImportOperation importOp = new ImportOperation(project
- .getFullPath(), null, FileSystemStructureProvider.INSTANCE,
- overwrite, Arrays.asList(source.listFiles()));
-
- // import files just to project folder ( without old structure )
- importOp.setCreateContainerStructure(false);
-
- importOp.setContext(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell());
-
- // run import
- importOp.run(new NullProgressMonitor());
-
- } catch (InvocationTargetException ite) {
- JsfTestPlugin.getPluginLog().logError(ite.getCause());
- } catch (InterruptedException ie) {
- JsfTestPlugin.getPluginLog().logError(ie);
- }
- }
-
- /**
- *
- * @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();
- }
-
- }
-
- 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());
- }
- }
-
- /**
- * Process UI input but do not return for the specified time interval.
- *
- * @param waitTimeMillis
- * the number of milliseconds
- */
- public static 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 static void waitForJobs() {
- while (Job.getJobManager().currentJob() != null)
- delay(5000);
- }
-
-}
Copied:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfUtil.java
(from rev 5472,
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfComponentsUtil.java)
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfUtil.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfUtil.java 2007-12-29
11:16:12 UTC (rev 5481)
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * 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.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+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.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
+import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+
+/**
+ * Class for importing project from jar file
+ *
+ * @author sdzmitrovich
+ *
+ */
+public class TestJsfUtil {
+ 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) {
+
+ if (ResourcesPlugin.getWorkspace().getRoot().findMember(
+ TestJsfUtil.PROJECT_NAME) != null) {
+ waitForJobs();
+
+ try {
+ removeProject();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ PROJECT_NAME);
+
+ try {
+
+ IOverwriteQuery overwrite = new IOverwriteQuery() {
+ public String queryOverwrite(String pathString) {
+ return ALL;
+ }
+ };
+
+ ImportProvider importProvider = new ImportProvider();
+
+ // need to remove from imported project "svn" files
+ List<String> unimportedFiles = new ArrayList<String>();
+ unimportedFiles.add(".svn");
+
+ importProvider.setUnimportedFiles(unimportedFiles);
+
+ // create import operation
+ ImportOperation importOp = new ImportOperation(project
+ .getFullPath(), new File(path), importProvider, overwrite);
+
+ // import files just to project folder ( without old structure )
+ importOp.setCreateContainerStructure(false);
+
+ importOp.setContext(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell());
+
+ // run import
+ importOp.run(new NullProgressMonitor());
+
+ } catch (InvocationTargetException ite) {
+ JsfTestPlugin.getPluginLog().logError(ite.getCause());
+ } catch (InterruptedException ie) {
+ JsfTestPlugin.getPluginLog().logError(ie);
+ }
+ }
+
+ /**
+ *
+ * @return
+ * @throws CoreException
+ */
+ static IResource getComponentPath(String componentPage)
+ throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ PROJECT_NAME);
+ if (project != null) {
+ return project.getFolder(COMPONENTS_PATH).findMember(componentPage);
+ // if (resource != null) {
+ // return resource.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());
+ }
+ }
+
+ /**
+ * Process UI input but do not return for the specified time interval.
+ *
+ * @param waitTimeMillis
+ * the number of milliseconds
+ */
+ public static 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 static void waitForJobs() {
+ while (Job.getJobManager().currentJob() != null)
+ delay(5000);
+ }
+
+}