Community
Participate
Working Groups
I just saw the following exception dumped to System.err while working. Note that I am using Mylyn, which means that most of the elements in my editors are folded. I also saw some weird compression where methods were stacked on top of each other without the expected newline. Steffen mentioned that he has seen text disappear with M5 so CC'ing him as well. If we see any more clues about what could be causing this we'll post. Exception in thread "Thread-282" java.lang.NullPointerException at org.eclipse.jface.text.AbstractLineTracker.flushRewriteSession(AbstractLineTracker.java:293) at org.eclipse.jface.text.AbstractLineTracker.checkRewriteSession(AbstractLineTracker.java:315) at org.eclipse.jface.text.AbstractLineTracker.getLineNumberOfOffset(AbstractLineTracker.java:160) at org.eclipse.jface.text.AbstractDocument.getLineOfOffset(AbstractDocument.java:842) at org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$JavaElementPosition.computeProjectionRegions(DefaultJavaFoldingStructureProvider.java:592) at org.eclipse.jface.text.source.projection.ProjectionViewer.computeCollapsedRegions(ProjectionViewer.java:1126) at org.eclipse.jface.text.source.projection.ProjectionSummary.createSummaries(ProjectionSummary.java:228) at org.eclipse.jface.text.source.projection.ProjectionSummary.internalUpdateSummaries(ProjectionSummary.java:167) at org.eclipse.jface.text.source.projection.ProjectionSummary.access$3(ProjectionSummary.java:148) at org.eclipse.jface.text.source.projection.ProjectionSummary$Summarizer.run(ProjectionSummary.java:70)
Mik, does Mylyn register its own folding provider(s)?
What Mylyn does is to grab the provider from the editor: Object adapter = editor.getAdapter(IJavaFoldingStructureProvider.class); if (adapter instanceof IJavaFoldingStructureProviderExtension) { updater = (IJavaFoldingStructureProviderExtension) adapter; } And then when needed it uses that to force an update of the folding. So no, it does not use it's own provider but drives the existing provider. It does this for the given element when that element is selected, and for the entire editor when the action is toggled or a context is activated. Here's the code for the latter. List<IJavaElement> toExpand = new ArrayList<IJavaElement>(); List<IJavaElement> toCollapse = new ArrayList<IJavaElement>(); IJavaElement element = JavaUI.getEditorInputJavaElement(editor.getEditorInput()); if (element instanceof ICompilationUnit) { ICompilationUnit compilationUnit = (ICompilationUnit) element; List<IJavaElement> allChildren = getAllChildren(compilationUnit); for (IJavaElement child : allChildren) { IInteractionElement interactionElement = ContextCorePlugin.getContextManager().getElement( bridge.getHandleIdentifier(child)); if (interactionElement != null && interactionElement.getInterest().isInteresting()) { toExpand.add(child); } else { toCollapse.add(child); } } } if (updater != null) { updater.collapseMembers(); updater.expandElements(toExpand.toArray(new IJavaElement[toExpand.size()])); }
Though not intended to be used like that from the outside the code looks OK. Probably a dup of bug 182935. *** This bug has been marked as a duplicate of bug 182935 ***