* only" IStorageEditorInput, for the ActiveScript debugger. But this
* means sometimes the ActiveScript provider might get an input from
* CVS or something that is not related to debugging.
*/
ITextEditor editor = getTextEditor();
IEditorInput input = editor.getEditorInput();
IDocument document = editor.getDocumentProvider().getDocument(input);
if (document == null)
return false;
String contentType = getContentType(document);
IBreakpointProvider[] providers = BreakpointProviderBuilder.getInstance().getBreakpointProviders(editor, contentType, getFileExtension(input));
int pos = -1;
ISourceEditingTextTools tools = (ISourceEditingTextTools) editor.getAdapter(ISourceEditingTextTools.class);
if (tools != null) {
pos = tools.getCaretOffset();
}
final int n = providers.length;
List errors = new ArrayList(0);
for (int i = 0; i < n; i++) {
try {
if (Debug.debugBreakpoints)
System.out.println(providers[i].getClass().getName() + " adding breakpoint to line " + lineNumber); //$NON-NLS-1$
IStatus status = providers[i].addBreakpoint(document, input, lineNumber, pos);
if (status != null && !status.isOK()) {
errors.add(status);
}
}
catch (CoreException e) {
errors.add(e.getStatus());
}
catch (Exception t) {
Logger.logException("exception while adding breakpoint", t); //$NON-NLS-1$
}
}
IStatus status = null;
if (errors.size() > 0) {
Shell shell = editor.getSite().getShell();
if (errors.size() > 1) {
status = new MultiStatus(SSEUIPlugin.ID, IStatus.OK, (IStatus[]) errors.toArray(new IStatus[0]), SSEUIMessages.ManageBreakpoints_error_adding_message1, null); //$NON-NLS-1$
}
else {
status = (IStatus) errors.get(0);