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 111852
Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/progress/ErrorInfo.java (-10 / +9 lines)
Lines 17-27 Link Here
17
import org.eclipse.jface.resource.JFaceResources;
17
import org.eclipse.jface.resource.JFaceResources;
18
import org.eclipse.osgi.util.NLS;
18
import org.eclipse.osgi.util.NLS;
19
import org.eclipse.swt.graphics.Image;
19
import org.eclipse.swt.graphics.Image;
20
import org.eclipse.ui.progress.IJobErrorInfo;
20
21
21
/**
22
/**
22
 * ErrorInfo is the info that displays errors.
23
 * ErrorInfo is the info that displays errors.
23
 */
24
 */
24
public class ErrorInfo extends JobTreeElement {
25
public class ErrorInfo extends JobTreeElement implements IJobErrorInfo {
25
26
26
    private final IStatus errorStatus;
27
    private final IStatus errorStatus;
27
    private final Job job;
28
    private final Job job;
Lines 81-91 Link Here
81
        return false;
82
        return false;
82
    }
83
    }
83
84
84
    /**
85
    /* (non-Javadoc)
85
     * Return the current status of the receiver. 
86
		 * @see org.eclipse.ui.internal.progress.IJobErrorInfo#getErrorStatus()
86
     * @return IStatus
87
		 */
87
     */
88
    public IStatus getErrorStatus() {
88
    IStatus getErrorStatus() {
89
        return errorStatus;
89
        return errorStatus;
90
    }
90
    }
91
91
Lines 96-105 Link Here
96
        return true;
96
        return true;
97
    }
97
    }
98
    
98
    
99
    /**
99
    /* (non-Javadoc)
100
     * Return the job that generated the error.
100
		 * @see org.eclipse.ui.internal.progress.IJobErrorInfo#getJob()
101
     * @return the job that generated the error
101
		 */
102
     */
103
    public Job getJob() {
102
    public Job getJob() {
104
        return job;
103
        return job;
105
    }
104
    }
(-)Eclipse UI/org/eclipse/ui/internal/progress/ErrorNotificationManager.java (-37 / +43 lines)
Lines 30-35 Link Here
30
import org.eclipse.ui.internal.ExceptionHandler;
30
import org.eclipse.ui.internal.ExceptionHandler;
31
import org.eclipse.ui.internal.Workbench;
31
import org.eclipse.ui.internal.Workbench;
32
import org.eclipse.ui.internal.WorkbenchPlugin;
32
import org.eclipse.ui.internal.WorkbenchPlugin;
33
import org.eclipse.ui.internal.util.BundleUtility;
34
import org.eclipse.ui.progress.IJobErrorInfo;
35
import org.eclipse.ui.progress.IJobErrorNotificationManager;
33
import org.eclipse.ui.progress.IProgressConstants;
36
import org.eclipse.ui.progress.IProgressConstants;
34
import org.eclipse.ui.progress.WorkbenchJob;
37
import org.eclipse.ui.progress.WorkbenchJob;
35
38
Lines 37-43 Link Here
37
 * The ErrorNotificationManager is the class that manages the display of
40
 * The ErrorNotificationManager is the class that manages the display of
38
 * error information.
41
 * error information.
39
 */
42
 */
40
public class ErrorNotificationManager {
43
public class ErrorNotificationManager implements IJobErrorNotificationManager {
41
44
42
    private static final String ERROR_JOB = "errorstate.gif"; //$NON-NLS-1$
45
    private static final String ERROR_JOB = "errorstate.gif"; //$NON-NLS-1$
43
46
Lines 51-65 Link Here
51
     * Create a new instance of the receiver.
54
     * Create a new instance of the receiver.
52
     */
55
     */
53
    public ErrorNotificationManager() {
56
    public ErrorNotificationManager() {
54
        //No special initialization
57
        try {
58
            setUpImages();
59
        } catch (MalformedURLException e) {
60
            ProgressManagerUtil.logException(e);
61
        }
55
    }
62
    }
56
63
57
    /**
64
    /**
58
     * Set up any images the error management needs.
65
     * Set up any images the error management needs.
59
     * @param iconsRoot
60
     * @throws MalformedURLException
66
     * @throws MalformedURLException
61
     */
67
     */
62
    void setUpImages(URL iconsRoot) throws MalformedURLException {
68
    void setUpImages() throws MalformedURLException {
69
    	URL iconsRoot = BundleUtility.find(PlatformUI.PLUGIN_ID,
70
          ProgressManager.PROGRESS_FOLDER);
71
    	
63
        JFaceResources.getImageRegistry().put(ERROR_JOB_KEY,
72
        JFaceResources.getImageRegistry().put(ERROR_JOB_KEY,
64
                ImageDescriptor.createFromURL(new URL(iconsRoot, ERROR_JOB)));
73
                ImageDescriptor.createFromURL(new URL(iconsRoot, ERROR_JOB)));
65
    }
74
    }
Lines 69-75 Link Here
69
     * @param status
78
     * @param status
70
     * @param job
79
     * @param job
71
     */
80
     */
72
    void addError(IStatus status, Job job) {
81
    public void addError(IStatus status, Job job) {
73
82
74
        //Handle out of memory errors via the workbench
83
        //Handle out of memory errors via the workbench
75
        final Throwable exception = status.getException();
84
        final Throwable exception = status.getException();
Lines 85-91 Link Here
85
94
86
            return;
95
            return;
87
        }
96
        }
88
        ErrorInfo errorInfo = new ErrorInfo(status, job);
97
        IJobErrorInfo errorInfo = new ErrorInfo(status, job);
89
        showError(errorInfo);
98
        showError(errorInfo);
90
    }
99
    }
91
100
Lines 94-100 Link Here
94
     * ensure that no errors are dropped.
103
     * ensure that no errors are dropped.
95
     * @param errorInfo the error to be displayed
104
     * @param errorInfo the error to be displayed
96
     */
105
     */
97
    private void showError(final ErrorInfo errorInfo) {
106
    private void showError(final IJobErrorInfo errorInfo) {
98
        
107
        
99
        if (!PlatformUI.isWorkbenchRunning()) {
108
        if (!PlatformUI.isWorkbenchRunning()) {
100
            //We are shutdown so just log
109
            //We are shutdown so just log
Lines 129-139 Link Here
129
        job.schedule();
138
        job.schedule();
130
    }
139
    }
131
140
132
    /**
141
    /*
133
     * Get the currently registered errors in the receiver.
142
     *  (non-Javadoc)
134
     * @return Collection of ErrorInfo
143
     * @see org.eclipse.ui.progress.IJobErrorNotificationManager#getErrors()
135
     */
144
     */
136
    Collection getErrors() {
145
    public Collection getErrors() {
137
        return errors;
146
        return errors;
138
    }
147
    }
139
148
Lines 145-151 Link Here
145
     * @param errorInfo The info the dialog is being opened for.
154
     * @param errorInfo The info the dialog is being opened for.
146
     * @return IStatus
155
     * @return IStatus
147
     */
156
     */
148
    private IStatus openErrorDialog(String title, String msg, final ErrorInfo errorInfo) {
157
    private IStatus openErrorDialog(String title, String msg, final IJobErrorInfo errorInfo) {
149
        IWorkbench workbench = PlatformUI.getWorkbench();
158
        IWorkbench workbench = PlatformUI.getWorkbench();
150
159
151
        //Abort on shutdown
160
        //Abort on shutdown
Lines 172-182 Link Here
172
     * Remove all of the errors from the finished jobs
181
     * Remove all of the errors from the finished jobs
173
	 * @param errorsToRemove The ErrorInfos that will be deleted.
182
	 * @param errorsToRemove The ErrorInfos that will be deleted.
174
	 */
183
	 */
175
	private void removeFromFinishedJobs(Collection errorsToRemove) {
184
	public static void removeFromFinishedJobs(Collection errorsToRemove) {
176
		Iterator errorIterator = errorsToRemove.iterator();
185
		Iterator errorIterator = errorsToRemove.iterator();
177
		Set errorStatuses = new HashSet();
186
		Set errorStatuses = new HashSet();
178
		while(errorIterator.hasNext()){
187
		while(errorIterator.hasNext()){
179
			ErrorInfo next = (ErrorInfo) errorIterator.next();
188
			IJobErrorInfo next = (IJobErrorInfo) errorIterator.next();
180
			errorStatuses.add(next.getErrorStatus());			
189
			errorStatuses.add(next.getErrorStatus());			
181
		}
190
		}
182
		
191
		
Lines 188-220 Link Here
188
					FinishedJobs.getInstance().remove(info);
197
					FinishedJobs.getInstance().remove(info);
189
			}
198
			}
190
		}
199
		}
191
		
192
	}
200
	}
193
201
194
	/**
202
	/**
195
     * Clear all of the errors held onto by the receiver.
203
     * Clear all of the errors held onto by the receiver.
196
     */
204
     */
197
    private void clearAllErrors() {
205
    public void clearAllErrors() {
198
    	removeFromFinishedJobs(errors);
206
    	removeFromFinishedJobs(errors);
199
        errors.clear();
207
        errors.clear();
200
    }
208
    }
201
209
202
    /**
210
    /* (non-Javadoc)
203
     * Display the error for the given job and any other errors
211
		 * @see org.eclipse.ui.internal.progress.IJobErrorNotificationManager#showErrorFor(org.eclipse.core.runtime.jobs.Job, java.lang.String, java.lang.String)
204
     * that have been accumulated. This method must be invoked
212
		 */
205
     * from the UI thread.
206
     * @param job the job whose error should be displayed
207
     * @param title The title for the dialog
208
     * @param msg The message for the dialog.
209
     * @return <code>true</code> if the info for the job was found and the error
210
     * displayed and <code>false</code> otherwise.
211
     */
212
    public boolean showErrorFor(Job job, String title, String msg) {
213
    public boolean showErrorFor(Job job, String title, String msg) {
213
        if (dialog != null) {
214
        if (dialog != null) {
214
            // The dialog is already open so the error is being displayed
215
            // The dialog is already open so the error is being displayed
215
            return true;
216
            return true;
216
        }
217
        }
217
        ErrorInfo info = getErrorInfo(job);
218
        IJobErrorInfo info = getErrorInfo(job);
218
        if (job == null) {
219
        if (job == null) {
219
            info = getMostRecentError();
220
            info = getMostRecentError();
220
        } else {
221
        } else {
Lines 230-236 Link Here
230
    /*
231
    /*
231
     * Return the most recent error.
232
     * Return the most recent error.
232
     */
233
     */
233
    private ErrorInfo getMostRecentError() {
234
    private IJobErrorInfo getMostRecentError() {
234
        ErrorInfo mostRecentInfo = null;
235
        ErrorInfo mostRecentInfo = null;
235
        for (Iterator iter = errors.iterator(); iter.hasNext();) {
236
        for (Iterator iter = errors.iterator(); iter.hasNext();) {
236
            ErrorInfo info = (ErrorInfo) iter.next();
237
            ErrorInfo info = (ErrorInfo) iter.next();
Lines 244-252 Link Here
244
    /*
245
    /*
245
     * Return the error info for the given job
246
     * Return the error info for the given job
246
     */
247
     */
247
    private ErrorInfo getErrorInfo(Job job) {
248
    private IJobErrorInfo getErrorInfo(Job job) {
248
        for (Iterator iter = errors.iterator(); iter.hasNext();) {
249
        for (Iterator iter = errors.iterator(); iter.hasNext();) {
249
            ErrorInfo info = (ErrorInfo) iter.next();
250
            IJobErrorInfo info = (IJobErrorInfo) iter.next();
250
            if (info.getJob() == job) {
251
            if (info.getJob() == job) {
251
                return info;
252
                return info;
252
            }
253
            }
Lines 254-273 Link Here
254
        return null;
255
        return null;
255
    }
256
    }
256
257
257
    /**
258
    /* (non-Javadoc)
258
     * Return whether the manager has errors to report.
259
		 * @see org.eclipse.ui.internal.progress.IJobErrorNotificationManager#hasErrors()
259
     * @return whether the manager has errors to report
260
		 */
260
     */
261
    public boolean hasErrors() {
261
    public boolean hasErrors() {
262
        return !errors.isEmpty();
262
        return !errors.isEmpty();
263
    }
263
    }
264
264
265
    /**
265
    /**
266
     * The error dialog has been closed. Clear the list of errors and
266
		 * The error dialog has been closed. Clear the stored dialog.
267
     * the stored dialog.
267
		 */
268
     */
269
	public void dialogClosed() {
268
	public void dialogClosed() {
270
        dialog = null;
269
        dialog = null;
271
        clearAllErrors();
270
        clearAllErrors();
272
	}
271
	}
272
273
	/**
274
	 * @see IJobErrorNotificationManager#clearErrors()
275
	 */
276
	public void clearErrors() {
277
		clearAllErrors();
278
	}
273
}
279
}
(-)Eclipse UI/org/eclipse/ui/internal/progress/JobErrorDialog.java (-10 / +16 lines)
Lines 45-50 Link Here
45
import org.eclipse.swt.widgets.Display;
45
import org.eclipse.swt.widgets.Display;
46
import org.eclipse.swt.widgets.Shell;
46
import org.eclipse.swt.widgets.Shell;
47
import org.eclipse.ui.internal.WorkbenchPlugin;
47
import org.eclipse.ui.internal.WorkbenchPlugin;
48
import org.eclipse.ui.progress.IJobErrorInfo;
49
import org.eclipse.ui.progress.IJobErrorNotificationManager;
48
import org.eclipse.ui.progress.IProgressConstants;
50
import org.eclipse.ui.progress.IProgressConstants;
49
51
50
/**
52
/**
Lines 66-72 Link Here
66
    private static final int GOTO_ACTION_ID = IDialogConstants.CLIENT_ID + 1;
68
    private static final int GOTO_ACTION_ID = IDialogConstants.CLIENT_ID + 1;
67
    
69
    
68
    private TableViewer jobListViewer;
70
    private TableViewer jobListViewer;
69
    private ErrorInfo selectedError;
71
    private IJobErrorInfo selectedError;
70
72
71
    /**
73
    /**
72
     * Create a new instance of the receiver.
74
     * Create a new instance of the receiver.
Lines 76-82 Link Here
76
     * @param errorInfo
78
     * @param errorInfo
77
     * @param displayMask
79
     * @param displayMask
78
     */
80
     */
79
    public JobErrorDialog(Shell parentShell, String title, String msg, ErrorInfo errorInfo, int displayMask) {
81
    public JobErrorDialog(Shell parentShell, String title, String msg, IJobErrorInfo errorInfo, int displayMask) {
80
        super(parentShell, title == null ? errorInfo.getJob().getName() : title, msg, errorInfo.getErrorStatus(), displayMask);
82
        super(parentShell, title == null ? errorInfo.getJob().getName() : title, msg, errorInfo.getErrorStatus(), displayMask);
81
        setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE |SWT.MIN | getDefaultOrientation()); // Do not want this one to be modal
83
        setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE |SWT.MIN | getDefaultOrientation()); // Do not want this one to be modal
82
        this.selectedError = errorInfo;
84
        this.selectedError = errorInfo;
Lines 244-258 Link Here
244
    /*
246
    /*
245
     * Get the notificationManager that this is being created for.
247
     * Get the notificationManager that this is being created for.
246
     */
248
     */
247
    private ErrorNotificationManager getManager() {
249
    private IJobErrorNotificationManager getManager() {
248
        return ProgressManager.getInstance().errorManager;
250
        return ProgressManager.getInstance().getErrorManager();
249
    }
251
    }
250
    
252
    
251
    /**
253
    /**
252
     * Return the selected error info.
254
     * Return the selected error info.
253
     * @return ErrorInfo
255
     * @return ErrorInfo
254
     */
256
     */
255
    public ErrorInfo getSelectedError() {
257
    public IJobErrorInfo getSelectedError() {
256
        return selectedError;
258
        return selectedError;
257
    }
259
    }
258
    
260
    
Lines 359-365 Link Here
359
             *      int)
361
             *      int)
360
             */
362
             */
361
            public Image getColumnImage(Object element, int columnIndex) {
363
            public Image getColumnImage(Object element, int columnIndex) {
362
                return getIcon(((ErrorInfo)element).getJob());
364
                return getIcon(((IJobErrorInfo)element).getJob());
363
            }
365
            }
364
366
365
            /*
367
            /*
Lines 432-444 Link Here
432
     * 
434
     * 
433
     * @return ErrorInfo or <code>null</code>.
435
     * @return ErrorInfo or <code>null</code>.
434
     */
436
     */
435
    private ErrorInfo getSingleSelection() {
437
    private IJobErrorInfo getSingleSelection() {
436
        ISelection rawSelection = jobListViewer.getSelection();
438
        ISelection rawSelection = jobListViewer.getSelection();
437
        if (rawSelection != null
439
        if (rawSelection != null
438
                && rawSelection instanceof IStructuredSelection) {
440
                && rawSelection instanceof IStructuredSelection) {
439
            IStructuredSelection selection = (IStructuredSelection) rawSelection;
441
            IStructuredSelection selection = (IStructuredSelection) rawSelection;
440
            if (selection.size() == 1)
442
            if (selection.size() == 1)
441
                return (ErrorInfo) selection.getFirstElement();
443
                return (IJobErrorInfo) selection.getFirstElement();
442
        }
444
        }
443
        return null;
445
        return null;
444
    }
446
    }
Lines 448-454 Link Here
448
        boolean result = super.close();
450
        boolean result = super.close();
449
        ProgressManagerUtil.animateDown(shellPosition);
451
        ProgressManagerUtil.animateDown(shellPosition);
450
452
451
       ProgressManager.getInstance().errorManager.dialogClosed();
453
        IJobErrorNotificationManager errorManager = ProgressManager.getInstance().getErrorManager(); 
454
        errorManager.clearAllErrors();
455
        if (errorManager instanceof ErrorNotificationManager)
456
   	        ((ErrorNotificationManager)errorManager).dialogClosed();
457
        
452
        return result;
458
        return result;
453
    }
459
    }
454
460
Lines 472-478 Link Here
472
     * Update widget enablements and repopulate the list.
478
     * Update widget enablements and repopulate the list.
473
     */
479
     */
474
    void handleSelectionChange() {
480
    void handleSelectionChange() {
475
        ErrorInfo newSelection = getSingleSelection();
481
        IJobErrorInfo newSelection = getSingleSelection();
476
        if (newSelection != null && newSelection != selectedError) {
482
        if (newSelection != null && newSelection != selectedError) {
477
            selectedError = newSelection;
483
            selectedError = newSelection;
478
            setStatus(selectedError.getErrorStatus());
484
            setStatus(selectedError.getErrorStatus());
(-)Eclipse UI/org/eclipse/ui/internal/progress/NewProgressViewer.java (-2 / +3 lines)
Lines 69-74 Link Here
69
import org.eclipse.ui.internal.WorkbenchImages;
69
import org.eclipse.ui.internal.WorkbenchImages;
70
import org.eclipse.ui.internal.WorkbenchPlugin;
70
import org.eclipse.ui.internal.WorkbenchPlugin;
71
import org.eclipse.ui.internal.misc.Assert;
71
import org.eclipse.ui.internal.misc.Assert;
72
import org.eclipse.ui.progress.IJobErrorNotificationManager;
72
import org.eclipse.ui.progress.IProgressConstants;
73
import org.eclipse.ui.progress.IProgressConstants;
73
74
74
/**
75
/**
Lines 303-310 Link Here
303
                            /*
304
                            /*
304
                             * Get the notificationManager that this is being created for.
305
                             * Get the notificationManager that this is being created for.
305
                             */
306
                             */
306
                            private ErrorNotificationManager getManager() {
307
                            private IJobErrorNotificationManager getManager() {
307
                                return ProgressManager.getInstance().errorManager;
308
                                return ProgressManager.getInstance().getErrorManager();
308
                            }
309
                            }
309
                            public void run() {
310
                            public void run() {
310
                                String title = ProgressMessages.NewProgressView_errorDialogTitle; 
311
                                String title = ProgressMessages.NewProgressView_errorDialogTitle; 
(-)Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java (-4 / +6 lines)
Lines 38-43 Link Here
38
import org.eclipse.swt.widgets.ToolItem;
38
import org.eclipse.swt.widgets.ToolItem;
39
import org.eclipse.ui.PlatformUI;
39
import org.eclipse.ui.PlatformUI;
40
import org.eclipse.ui.internal.WorkbenchImages;
40
import org.eclipse.ui.internal.WorkbenchImages;
41
import org.eclipse.ui.progress.IJobErrorInfo;
42
import org.eclipse.ui.progress.IJobErrorNotificationManager;
41
import org.eclipse.ui.progress.IProgressConstants;
43
import org.eclipse.ui.progress.IProgressConstants;
42
44
43
/**
45
/**
Lines 197-207 Link Here
197
        
199
        
198
        // If the error manager has errors, display the error indication
200
        // If the error manager has errors, display the error indication
199
        // just in case a previous job ended in error but wasn't kept
201
        // just in case a previous job ended in error but wasn't kept
200
        ErrorNotificationManager errorNotificationManager = ProgressManager.getInstance().errorManager;
202
        IJobErrorNotificationManager errorNotificationManager = ProgressManager.getInstance().getErrorManager();
201
        if (errorNotificationManager.hasErrors()) {
203
        if (errorNotificationManager.hasErrors()) {
202
            Collection errors = errorNotificationManager.getErrors();
204
            Collection errors = errorNotificationManager.getErrors();
203
            for (Iterator iter = errors.iterator(); iter.hasNext();) {
205
            for (Iterator iter = errors.iterator(); iter.hasNext();) {
204
                ErrorInfo info = (ErrorInfo) iter.next();
206
                IJobErrorInfo info = (IJobErrorInfo) iter.next();
205
	            initButton(
207
	            initButton(
206
	                    errorImage,
208
	                    errorImage,
207
	                    NLS.bind(ProgressMessages.ProgressAnimationItem_error, info.getJob().getName())); 
209
	                    NLS.bind(ProgressMessages.ProgressAnimationItem_error, info.getJob().getName())); 
Lines 342-348 Link Here
342
    /*
344
    /*
343
     * Get the notificationManager that this is being created for.
345
     * Get the notificationManager that this is being created for.
344
     */
346
     */
345
    private ErrorNotificationManager getManager() {
347
    private IJobErrorNotificationManager getManager() {
346
        return ProgressManager.getInstance().errorManager;
348
        return ProgressManager.getInstance().getErrorManager();
347
    }
349
    }
348
}
350
}
(-)Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java (-3 / +25 lines)
Lines 62-67 Link Here
62
import org.eclipse.ui.internal.dialogs.WorkbenchDialogBlockedHandler;
62
import org.eclipse.ui.internal.dialogs.WorkbenchDialogBlockedHandler;
63
import org.eclipse.ui.internal.misc.Policy;
63
import org.eclipse.ui.internal.misc.Policy;
64
import org.eclipse.ui.internal.util.BundleUtility;
64
import org.eclipse.ui.internal.util.BundleUtility;
65
import org.eclipse.ui.progress.IJobErrorNotificationManager;
65
import org.eclipse.ui.progress.IProgressConstants;
66
import org.eclipse.ui.progress.IProgressConstants;
66
import org.eclipse.ui.progress.IProgressService;
67
import org.eclipse.ui.progress.IProgressService;
67
import org.eclipse.ui.progress.WorkbenchJob;
68
import org.eclipse.ui.progress.WorkbenchJob;
Lines 93-99 Link Here
93
    
94
    
94
    final Object listenersKey = new Object();
95
    final Object listenersKey = new Object();
95
96
96
    final ErrorNotificationManager errorManager = new ErrorNotificationManager();
97
    private IJobErrorNotificationManager errorManager;
97
98
98
    IJobChangeListener changeListener;
99
    IJobChangeListener changeListener;
99
100
Lines 345-352 Link Here
345
            setUpImage(iconsRoot, SLEEPING_JOB, SLEEPING_JOB_KEY);
346
            setUpImage(iconsRoot, SLEEPING_JOB, SLEEPING_JOB_KEY);
346
            setUpImage(iconsRoot, WAITING_JOB, WAITING_JOB_KEY);
347
            setUpImage(iconsRoot, WAITING_JOB, WAITING_JOB_KEY);
347
            setUpImage(iconsRoot, BLOCKED_JOB, BLOCKED_JOB_KEY);
348
            setUpImage(iconsRoot, BLOCKED_JOB, BLOCKED_JOB_KEY);
348
            //Let the error manager set up its own icons
349
            errorManager.setUpImages(iconsRoot);
350
        } catch (MalformedURLException e) {
349
        } catch (MalformedURLException e) {
351
            ProgressManagerUtil.logException(e);
350
            ProgressManagerUtil.logException(e);
352
        }
351
        }
Lines 1244-1247 Link Here
1244
		updater.refreshAll();
1243
		updater.refreshAll();
1245
		
1244
		
1246
	}
1245
	}
1246
	
1247
	private IJobErrorNotificationManager createDefaultErrorNotificationManager() {
1248
		return new ErrorNotificationManager();
1249
	}
1250
1251
	/* (non-Javadoc)
1252
	 * @see org.eclipse.ui.progress.IProgressService#setJobErrorNotificationManager(org.eclipse.ui.progress.IJobErrorNotificationManager)
1253
	 */
1254
	public void setJobErrorNotificationManager(IJobErrorNotificationManager jobErrorNotificationManager) {
1255
		this.errorManager = jobErrorNotificationManager;
1256
	}
1257
1258
	/**
1259
	 * Returns the current error notification manager 
1260
	 * @return The current error notification manager
1261
	 */
1262
	public IJobErrorNotificationManager getErrorManager() {
1263
		if (errorManager == null)
1264
			errorManager = createDefaultErrorNotificationManager();
1265
		return errorManager;
1266
	}
1267
1268
	
1247
}
1269
}
(-)Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchSiteProgressService.java (+9 lines)
Lines 37-42 Link Here
37
import org.eclipse.ui.PlatformUI;
37
import org.eclipse.ui.PlatformUI;
38
import org.eclipse.ui.internal.PartSite;
38
import org.eclipse.ui.internal.PartSite;
39
import org.eclipse.ui.part.WorkbenchPart;
39
import org.eclipse.ui.part.WorkbenchPart;
40
import org.eclipse.ui.progress.IJobErrorNotificationManager;
40
import org.eclipse.ui.progress.IProgressService;
41
import org.eclipse.ui.progress.IProgressService;
41
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
42
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
42
import org.eclipse.ui.progress.WorkbenchJob;
43
import org.eclipse.ui.progress.WorkbenchJob;
Lines 350-353 Link Here
350
    public Image getIconFor(Job job) {
351
    public Image getIconFor(Job job) {
351
        return getWorkbenchProgressService().getIconFor(job);
352
        return getWorkbenchProgressService().getIconFor(job);
352
    }
353
    }
354
355
    /*
356
     *  (non-Javadoc)
357
     * @see org.eclipse.ui.progress.IProgressService#setJobErrorNotificationManager(org.eclipse.ui.progress.IJobErrorNotificationManager)
358
     */
359
		public void setJobErrorNotificationManager(IJobErrorNotificationManager jobErrorNotificationManager) {
360
      getWorkbenchProgressService().setJobErrorNotificationManager(jobErrorNotificationManager);
361
		}
353
}
362
}
(-)Eclipse UI/org/eclipse/ui/progress/IProgressService.java (+9 lines)
Lines 135-138 Link Here
135
     */
135
     */
136
    public void showInDialog(Shell shell, Job job);
136
    public void showInDialog(Shell shell, Job job);
137
137
138
	  /**
139
     * Sets the job error notification manager.
140
     *  
141
  	 * @param jobErrorNotificationManager The manager to set or <code>null</code> to reset to the default manager  
142
  	 * 
143
	   * @since 3.2
144
	   */
145
    public void setJobErrorNotificationManager(IJobErrorNotificationManager jobErrorNotificationManager);
146
138
}
147
}
(-)Eclipse (+29 lines)
Added Link Here
1
/*
2
 * Created 	on Oct 6, 2005
3
 */
4
package org.eclipse.ui.progress;
5
6
import org.eclipse.core.runtime.IStatus;
7
import org.eclipse.core.runtime.jobs.Job;
8
9
/**
10
 * IJobErrorInfo is used to accumulate errors that occured during job execution
11
 * within instances of {@link org.eclipse.ui.progress.IJobErrorNotificationManager}
12
 * 
13
 * @since 3.2
14
 */
15
public interface IJobErrorInfo {
16
17
	/**
18
	 * Return the current status of the receiver. 
19
	 * @return IStatus
20
	 */
21
	public abstract IStatus getErrorStatus();
22
23
	/**
24
	 * Return the job that generated the error.
25
	 * @return the job that generated the error
26
	 */
27
	public abstract Job getJob();
28
29
}
(-)Eclipse (+55 lines)
Added Link Here
1
/*
2
 * Created 	on Oct 6, 2005
3
 */
4
package org.eclipse.ui.progress;
5
6
import java.util.Collection;
7
8
import org.eclipse.core.runtime.IStatus;
9
import org.eclipse.core.runtime.jobs.Job;
10
11
/**
12
 * Instances of IJobErrorNotificationManager are responsible to manage the display of
13
 * information on errors occured during job execution.
14
 *  
15
 * @since 3.2
16
 */
17
public interface IJobErrorNotificationManager {
18
19
	/**
20
	 * Display the error for the given job and any other errors
21
	 * that have been accumulated. This method must be invoked
22
	 * from the UI thread.
23
	 * @param job the job whose error should be displayed
24
	 * @param title The title for the dialog
25
	 * @param msg The message for the dialog.
26
	 * @return <code>true</code> if the info for the job was found and the error
27
	 * displayed and <code>false</code> otherwise.
28
	 */
29
	public abstract boolean showErrorFor(Job job, String title, String msg);
30
31
	/**
32
	 * Return whether the manager has errors to report.
33
	 * @return whether the manager has errors to report
34
	 */
35
	public abstract boolean hasErrors();
36
	
37
  /**
38
   * Add a new error to the list for the supplied job.
39
   * @param status The error status of the failed job.
40
   * @param job The failed job.
41
   */
42
  public void addError(IStatus status, Job job);
43
  
44
  /**
45
   * Returns the list of accumulated errors
46
   * @return A Collection of {@link IJobErrorInfo}. The list of errors accumulated. 
47
   */
48
  public Collection getErrors();
49
  
50
  /**
51
   * Clears the list of errors. 
52
   */
53
	public void clearAllErrors();
54
55
}

Return to bug 111852