Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 209066 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCache.java (-28 / +5 lines)
Lines 16-22 Link Here
16
import java.util.Vector;
16
import java.util.Vector;
17
import java.util.concurrent.Executor;
17
import java.util.concurrent.Executor;
18
18
19
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.dd.dsf.concurrent.ConfinedToDsfExecutor;
19
import org.eclipse.dd.dsf.concurrent.ConfinedToDsfExecutor;
21
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
20
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
22
import org.eclipse.dd.dsf.concurrent.DefaultDsfExecutor;
21
import org.eclipse.dd.dsf.concurrent.DefaultDsfExecutor;
Lines 358-393 Link Here
358
    	else
357
    	else
359
    	{
358
    	{
360
	    	service.getModelData(dmc, 
359
	    	service.getModelData(dmc, 
361
	    		new DataRequestMonitor<IDMData>(executor, null) {
360
	    		new DataRequestMonitor<IDMData>(executor, rm) {
362
		            @Override
361
		            @Override
363
					protected void handleCompleted() {
362
					protected void handleOK() {
364
		            	if(getStatus().isOK())
363
		            	if(isCacheWriteEnabled())
365
		            	{
364
		            		fData.put(dmc, getData());
366
		            		if(isCacheWriteEnabled())
365
		            	rm.setData(getData());
367
			            		fData.put(dmc, getData());
368
			            	rm.setData(getData());
369
		            	}
370
	    				rm.done();
366
	    				rm.done();
371
					}
367
					}
372
373
					@Override
374
					public synchronized void setCanceled(boolean canceled) {
375
						rm.setCanceled(canceled);
376
						super.setCanceled(canceled);
377
					}
378
379
					@Override
380
					public void setMultiStatus(String pluginId, int code,
381
							String message, IStatus subStatus) {
382
						rm.setMultiStatus(pluginId, code, message, subStatus);
383
						super.setMultiStatus(pluginId, code, message, subStatus);
384
					}
385
386
					@Override
387
					public synchronized void setStatus(IStatus status) {
388
						rm.setStatus(status);
389
						super.setStatus(status);
390
					}
391
		        }		
368
		        }		
392
	    	);
369
	    	);
393
    	}
370
    	}
(-)src/org/eclipse/dd/dsf/concurrent/RequestMonitor.java (-19 / +5 lines)
Lines 156-175 Link Here
156
            handleRejectedExecutionException();
156
            handleRejectedExecutionException();
157
        }
157
        }
158
    }
158
    }
159
    
160
    /**
161
     * Convenience method for setting the status using a status object of a 
162
     * sub-command.
163
     * @param pluginId plugin id of the invoked method 
164
     * @param code status code
165
     * @param message message to include
166
     * @param subStatus status object to base the RequestMonitor status on
167
     */
168
    public void setMultiStatus(String pluginId, int code, String message, final IStatus subStatus) {
169
        MultiStatus status = new MultiStatus(pluginId, code, message, null);
170
        status.merge(subStatus);
171
        fStatus = status;
172
    }
173
159
174
    @Override
160
    @Override
175
    public String toString() {
161
    public String toString() {
Lines 178-184 Link Here
178
    
164
    
179
    /**
165
    /**
180
     * Default handler for the completion of a request.  The implementation
166
     * Default handler for the completion of a request.  The implementation
181
     * calls {@link #handleOK()} if the request succeded, and calls 
167
     * calls {@link #handleOK()} if the request succeeded, and calls 
182
     * {@link #handleErrorOrCancel()} or cancel otherwise.
168
     * {@link #handleErrorOrCancel()} or cancel otherwise.
183
     * <br>
169
     * <br>
184
     * Note: Sub-classes may override this method.
170
     * Note: Sub-classes may override this method.
Lines 235-241 Link Here
235
     */    
221
     */    
236
    protected void handleError() {
222
    protected void handleError() {
237
        if (fParentRequestMonitor != null) {
223
        if (fParentRequestMonitor != null) {
238
            fParentRequestMonitor.setMultiStatus(DsfPlugin.PLUGIN_ID, getStatus().getCode(), "Failed: " + toString(), getStatus()); //$NON-NLS-1$
224
            fParentRequestMonitor.setStatus(getStatus());
239
            fParentRequestMonitor.done();
225
            fParentRequestMonitor.done();
240
        } else {
226
        } else {
241
            MultiStatus logStatus = new MultiStatus(DsfPlugin.PLUGIN_ID, IDsfService.INTERNAL_ERROR, "Request for monitor: '" + toString() + "' resulted in an error.", null); //$NON-NLS-1$ //$NON-NLS-2$
227
            MultiStatus logStatus = new MultiStatus(DsfPlugin.PLUGIN_ID, IDsfService.INTERNAL_ERROR, "Request for monitor: '" + toString() + "' resulted in an error.", null); //$NON-NLS-1$ //$NON-NLS-2$
Lines 253-271 Link Here
253
     */
239
     */
254
    protected void handleCancel() {
240
    protected void handleCancel() {
255
        if (fParentRequestMonitor != null) {
241
        if (fParentRequestMonitor != null) {
256
            fParentRequestMonitor.setMultiStatus(DsfPlugin.PLUGIN_ID, getStatus().getCode(), "Canceled: " + toString(), getStatus()); //$NON-NLS-1$
242
            fParentRequestMonitor.setStatus(getStatus());
257
            fParentRequestMonitor.done();
243
            fParentRequestMonitor.done();
258
        }
244
        }
259
    }
245
    }
260
    
246
    
261
    /**
247
    /**
262
     * Default handler for when the executor supplied in the constructor 
248
     * Default handler for when the executor supplied in the constructor 
263
     * rejects the runnable that is submitted invoke this requrest monitor.
249
     * rejects the runnable that is submitted invoke this request monitor.
264
     * This usually happens only when the executor is shutting down.
250
     * This usually happens only when the executor is shutting down.
265
     */
251
     */
266
    protected void handleRejectedExecutionException() {
252
    protected void handleRejectedExecutionException() {
267
        if (fParentRequestMonitor != null) {
253
        if (fParentRequestMonitor != null) {
268
            fParentRequestMonitor.setMultiStatus(DsfPlugin.PLUGIN_ID, IDsfService.INVALID_STATE, "Rejected execution exception when trying to complete the request monitor: " + toString(), getStatus()); //$NON-NLS-1$
254
            fParentRequestMonitor.setStatus(getStatus());
269
            fParentRequestMonitor.done();
255
            fParentRequestMonitor.done();
270
        } else {
256
        } else {
271
            MultiStatus logStatus = new MultiStatus(DsfPlugin.PLUGIN_ID, IDsfService.INTERNAL_ERROR, "Request for monitor: '" + toString() + "' resulted in a rejected execution exception.", null); //$NON-NLS-1$ //$NON-NLS-2$
257
            MultiStatus logStatus = new MultiStatus(DsfPlugin.PLUGIN_ID, IDsfService.INTERNAL_ERROR, "Request for monitor: '" + toString() + "' resulted in a rejected execution exception.", null); //$NON-NLS-1$ //$NON-NLS-2$

Return to bug 209066