Author: vrubezhny
Date: 2010-09-30 11:53:01 -0400 (Thu, 30 Sep 2010)
New Revision: 25342
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
Log:
JBIDE-7196
An exception occurres while validating the CDI project
The Busy Cursor While dialog is not shown in case there is no display defined (Validation
case)
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-09-30
15:31:22 UTC (rev 25341)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-09-30
15:53:01 UTC (rev 25342)
@@ -34,6 +34,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.jboss.tools.cdi.internal.core.impl.ClassBean;
@@ -764,20 +765,24 @@
public static CDICoreNature getCDINatureWithProgress(final IProject project){
final CDICoreNature cdiNature = CDICorePlugin.getCDI(project, false);
if(cdiNature != null && !cdiNature.isStorageResolved()){
- try{
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new
IRunnableWithProgress(){
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- monitor.beginTask(CDICoreMessages.CDI_UTIL_BUILD_CDI_MODEL, 10);
- monitor.worked(3);
- cdiNature.resolve();
- monitor.worked(7);
- }
- });
- }catch(InterruptedException ie){
- CDICorePlugin.getDefault().logError(ie);
- }catch(InvocationTargetException ite){
- CDICorePlugin.getDefault().logError(ite);
+ if (Display.getCurrent() != null) {
+ try{
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new
IRunnableWithProgress(){
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ monitor.beginTask(CDICoreMessages.CDI_UTIL_BUILD_CDI_MODEL, 10);
+ monitor.worked(3);
+ cdiNature.resolve();
+ monitor.worked(7);
+ }
+ });
+ }catch(InterruptedException ie){
+ CDICorePlugin.getDefault().logError(ie);
+ }catch(InvocationTargetException ite){
+ CDICorePlugin.getDefault().logError(ite);
+ }
+ } else {
+ cdiNature.resolve();
}
}
Show replies by date