Project: JDT
Bug 133824 Extract Supertype action can take a long time and is not cancellable
Reported: 2006-03-29 08:38:48 | Status: verified fixed

I20060329-0010 Extract Supertype action can take a long time and is not cancellable. The problem seems to be in ExtractSupertypeMemberPage$6.run(IProgressMonitor) line: 323 , which can take a long time if the indexes are not up-to-date. The runnable is not cancellable and runs in the UI thread, so Eclipse appears locked. Such long running operation should be done in checkInitialConditions(..), which is run in the background and is cancellable. Thread [main] (Suspended) FileInputStream.open(String) line: not available [native method] FileInputStream.<init>(File) line: 135 LocalFile.openInputStream(int, IProgressMonitor) line: 318 ContentDescriptionManager$LazyFileInputStream.ensureOpened() line: 154 ContentDescriptionManager$LazyFileInputStream.read(byte[], int, int) line: 166 ContentDescriptionManager$LazyFileInputStream(InputStream).read(byte[]) line: 112 LazyInputStream.loadBlock() line: 99 LazyInputStream.ensureAvailable(long) line: 64 LazyInputStream.read() line: 119 TextContentDescriber.getByteOrderMark(InputStream) line: 65 TextContentDescriber.describe(InputStream, IContentDescription) line: 49 ContentType.describe(IContentDescriber, ILazySource, ContentDescription) line: 161 ContentType.internalGetDescriptionFor(ILazySource, QualifiedName[]) line: 458 ContentTypeCatalog.getDescriptionFor(ContentTypeMatcher, ILazySource, String, QualifiedName[]) line: 314 ContentTypeCatalog.getDescriptionFor(ContentTypeMatcher, InputStream, String, QualifiedName[]) line: 318 ContentTypeMatcher.getDescriptionFor(InputStream, String, QualifiedName[]) line: 86 ContentDescriptionManager.readDescription(File) line: 400 ContentDescriptionManager.getDescriptionFor(File, ResourceInfo) line: 339 File.internalGetCharset(boolean, ResourceInfo) line: 253 File.getCharset(boolean) line: 214 File.getCharset() line: 201 Util.getResourceContentsAsCharArray(IFile) line: 1029 HierarchyBuilder$1(ResourceCompilationUnit).getContents() line: 38 Parser.parse(ICompilationUnit, CompilationResult, int, int) line: 9047 Parser.parse(ICompilationUnit, CompilationResult) line: 9019 Parser.dietParse(ICompilationUnit, CompilationResult) line: 7707 HierarchyResolver.resolve(Openable[], HashSet, IProgressMonitor) line: 568 IndexBasedHierarchyBuilder.buildForProject(JavaProject, ArrayList, ICompilationUnit[], HashSet, IProgressMonitor) line: 199 IndexBasedHierarchyBuilder.buildFromPotentialSubtypes(String[], HashSet, IProgressMonitor) line: 284 IndexBasedHierarchyBuilder.build(boolean) line: 129 TypeHierarchy.compute() line: 300 TypeHierarchy.refresh(IProgressMonitor) line: 1235 CreateTypeHierarchyOperation.executeOperation() line: 90 CreateTypeHierarchyOperation(JavaModelOperation).run(IProgressMonitor) line: 720 CreateTypeHierarchyOperation(JavaModelOperation).runOperation(IProgressMonitor) line: 779 ResolvedBinaryType(BinaryType).newTypeHierarchy(WorkingCopyOwner, IProgressMonitor) line: 907 ExtractSupertypeProcessor.getCandidateTypes(RefactoringStatus, IProgressMonitor) line: 853 ExtractSupertypeMemberPage$6.run(IProgressMonitor) line: 323 ModalContext.runInCurrentThread(IRunnableWithProgress, IProgressMonitor) line: 369 ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display) line: 313 ApplicationWindow$1.run() line: 763 BusyIndicator.showWhile(Display, Runnable) line: 69 WorkbenchWindow(ApplicationWindow).run(boolean, boolean, IRunnableWithProgress) line: 760 WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress) line: 2272 ExtractSupertypeMemberPage.createSuperTypeControl(Composite) line: 319 ExtractSupertypeMemberPage.createControl(Composite) line: 293 ExtractSupertypeWizard(Wizard).createPageControls(Composite) line: 180 RefactoringWizardDialog(WizardDialog).createPageControls() line: 614 RefactoringWizardDialog(WizardDialog).createContents(Composite) line: 502 RefactoringWizardDialog(Window).create() line: 426 RefactoringWizardDialog(Dialog).create() line: 1116 RefactoringWizardDialog(Window).open() line: 785 RefactoringWizardOpenOperation$1.run() line: 132 BusyIndicator.showWhile(Display, Runnable) line: 69 RefactoringWizardOpenOperation.run(Shell, String) line: 145 RefactoringStarter.activate(Refactoring, RefactoringWizard, Shell, String, boolean) line: 40 RefactoringExecutionStarter.startExtractSupertypeRefactoring(IMember[], Shell) line: 343 ExtractSuperTypeAction.run(ITextSelection) line: 146 ExtractSuperTypeAction(SelectionDispatchAction).dispatchRun(ISelection) line: 271 ExtractSuperTypeAction(SelectionDispatchAction).run() line: 243 ExtractSuperTypeAction(Action).runWithEvent(Event) line: 499 ActionContributionItem.handleWidgetSelection(Event, boolean) line: 539 ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 488 ActionContributionItem$5.handleEvent(Event) line: 400 EventTable.sendEvent(Event) line: 66 MenuItem(Widget).sendEvent(Event) line: 925 Display.runDeferredEvents() line: 3346 Display.readAndDispatch() line: 2966 RefactorActionGroup$RefactorQuickAccessAction(QuickMenuAction).run() line: 77 RefactorActionGroup$RefactorQuickAccessAction(Action).runWithEvent(Event) line: 499 ActionHandler.execute(Map) line: 185 LegacyHandlerWrapper.execute(ExecutionEvent) line: 109 Command.executeWithChecks(ExecutionEvent) line: 460 ParameterizedCommand.executeWithChecks(Object, Object) line: 424 HandlerService.executeCommand(ParameterizedCommand, Event) line: 160 WorkbenchKeyboard.executeCommand(Binding, Event) line: 466

Files changed in fix:
org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/ExtractSupertypeMemberPage.java org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/PullUpMemberPage.java