Bug 9537 IllegalArg exception in edtior when doing cut in Outline view
IllegalArg exception in edtior when doing delete in Outline view (or any other view with J elements - see depending bug). 1. Make RepeatedTest.java read-only 2. Open RepeatedTest.java 3. Delete "toString" in Outline view 4. Delete "toString" in Outline view ==> org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalArgumentException: Index out of bounds) at org.eclipse.swt.SWT.error(SWT.java:1887) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:96) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1390) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1208) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:788) at org.eclipse.ui.internal.Workbench.run(Workbench.java:771) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:777) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.Main.main(Main.java:362) *** Stack trace of contained exception *** java.lang.IllegalArgumentException: Index out of bounds at org.eclipse.swt.SWT.error(SWT.java:1873) at org.eclipse.swt.SWT.error(SWT.java:1819) at org.eclipse.swt.custom.StyledText.redrawRange(StyledText.java:5899) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$BracketHighlighter$HighlightBrackets.draw(CompilationUnitEditor.java:232) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$BracketHighlighter$HighlightBrackets.handleDrawRequest(CompilationUnitEditor.java:217) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$BracketHighlighter$HighlightBrackets.deactivate(CompilationUnitEditor.java:154) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$BracketHighlighter$HighlightBrackets.run(CompilationUnitEditor.java:168) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$BracketHighlighter.selectionChanged(CompilationUnitEditor.java:393) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147) at org.eclipse.jface.text.TextViewer.selectionChanged(TextViewer.java:999) at org.eclipse.jface.text.TextViewer.setSelectedRange(TextViewer.java:890) at org.eclipse.jface.text.source.SourceViewer.setRangeIndication(SourceViewer.java:415) at org.eclipse.ui.texteditor.AbstractTextEditor.setHighlightRange(AbstractTextEditor.java:2137) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.adjustHighlightRange(JavaEditor.java:425) at org.eclipse.ui.texteditor.AbstractTextEditor.selectAndReveal(AbstractTextEditor.java:2194) at org.eclipse.ui.texteditor.AbstractTextEditor.restoreSelection(AbstractTextEditor.java:718) at org.eclipse.ui.texteditor.AbstractTextEditor$ElementStateListener.elementContentReplaced(AbstractTextEditor.java:195) at org.eclipse.ui.texteditor.AbstractDocumentProvider.fireElementContentReplaced(AbstractDocumentProvider.java:446) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.resetDocument(CompilationUnitDocumentProvider.java:351) at org.eclipse.ui.texteditor.AbstractTextEditor.doRevertToSaved(AbstractTextEditor.java:1656) at org.eclipse.ui.texteditor.AbstractTextEditor$1.run(AbstractTextEditor.java:156) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:29) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:93) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1390) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1208) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:788) at org.eclipse.ui.internal.Workbench.run(Workbench.java:771) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:777) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.Main.main(Main.java:362)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitEditor.java
IFile original= null;
		if (input instanceof IFileEditorInput)
			original= ((IFileEditorInput) input).getFile();
			
		if (original != null)
			dialog.setOriginalFile(original);
			
		if (dialog.open() == Dialog.CANCEL) {
			if (progressMonitor != null)
				progressMonitor.setCanceled(true);
			return;
		}
			
		IPath filePath= dialog.getResult();
		if (filePath == null) {
			if (progressMonitor != null)
				progressMonitor.setCanceled(true);
			return;
		}
			
		filePath= filePath.removeTrailingSeparator();
		final String fileName= filePath.lastSegment();
		IPath folderPath= filePath.removeLastSegments(1);
		if (folderPath == null) {
			if (progressMonitor != null)
				progressMonitor.setCanceled(true);			
			return;
		}