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/concurrent/RequestMonitor.java (-21 / +7 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-275 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() {
253
        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$
254
        logStatus.merge(getStatus());
267
        if (fParentRequestMonitor != null) {
255
        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$
256
            fParentRequestMonitor.setStatus(logStatus);
269
            fParentRequestMonitor.done();
257
            fParentRequestMonitor.done();
270
        } else {
258
        } 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$
272
            logStatus.merge(getStatus());
273
            DsfPlugin.getDefault().getLog().log(logStatus);
259
            DsfPlugin.getDefault().getLog().log(logStatus);
274
        }
260
        }
275
    }
261
    }

Return to bug 209066