Author: xcoulon
Date: 2012-01-04 04:08:21 -0500 (Wed, 04 Jan 2012)
New Revision: 37630
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java
Log:
Handling Cancelled Operation
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java 2012-01-04
08:43:37 UTC (rev 37629)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java 2012-01-04
09:08:21 UTC (rev 37630)
@@ -42,24 +42,32 @@
try {
progressMonitor.beginTask("Building JAX-RS Metamodel", 4 * SCALE);
progressMonitor.worked(SCALE);
- Logger.debug("Building JAX-RS Metamodel...", event);
+ Logger.debug("Building JAX-RS Metamodel...");
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
// create fake event at the JavaProject level:
// scan and filter delta, retrieve a list of java changes
final List<JavaElementChangedEvent> events = new
JavaElementChangedEventScanner().scanAndFilterEvent(event,
new SubProgressMonitor(progressMonitor, SCALE));
- if (events == null || events.isEmpty()) {
- Logger.debug("** No Java change to apply on the JAX-RS Metamodel **");
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ final List<JaxrsElementChangedEvent> jaxrsElementChanges =
javaElementChangedProcessor.processEvents(
+ events, new SubProgressMonitor(progressMonitor, SCALE));
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ final List<JaxrsEndpointChangedEvent> jaxrsEndpointChanges =
jaxrsElementChangedProcessor.processEvents(
+ jaxrsElementChanges, new SubProgressMonitor(progressMonitor, SCALE));
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ if (jaxrsEndpointChanges == null || jaxrsEndpointChanges.isEmpty()) {
+ Logger.debug("*** No JAX-RS change to publish to the UI ***");
} else {
- final List<JaxrsElementChangedEvent> jaxrsElementChanges =
javaElementChangedProcessor.processEvents(
- events, new SubProgressMonitor(progressMonitor, SCALE));
- final List<JaxrsEndpointChangedEvent> jaxrsEndpointChanges =
jaxrsElementChangedProcessor
- .processEvents(jaxrsElementChanges, new SubProgressMonitor(progressMonitor,
SCALE));
- if (jaxrsEndpointChanges == null || jaxrsEndpointChanges.isEmpty()) {
- Logger.debug("*** No JAX-RS change to publish to the UI ***");
- } else {
- for (JaxrsEndpointChangedEvent change : jaxrsEndpointChanges) {
- EventService.getInstance().publish(change);
- }
+ for (JaxrsEndpointChangedEvent change : jaxrsEndpointChanges) {
+ EventService.getInstance().publish(change);
}
}
} catch (Throwable e) {
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java 2012-01-04
08:43:37 UTC (rev 37629)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java 2012-01-04
09:08:21 UTC (rev 37630)
@@ -63,8 +63,13 @@
* the throwable cause
*/
public static void error(final String message, final Throwable t) {
+ if(JBossJaxrsCorePlugin.getDefault() != null) {
JBossJaxrsCorePlugin.getDefault().getLog()
.log(new Status(Status.ERROR, JBossJaxrsCorePlugin.PLUGIN_ID, message, t));
+ } else {
+ // at least write in the .log file
+ t.printStackTrace();
+ }
}
/**
Show replies by date