Community
Participate
Working Groups
Eclipse 3.0 M6 (with new-look UI jars) 1) Selected the class org.eclipse.swt.custom.ViewForm in the Pacakge Explorer. 2) Selected the package org.eclipse.swt.custom in the Package Explorer 3) Choose "paste" from the context menu. 4) Named the class ViewForm2 Got the following error: org.eclipse.jface.text.Assert$AssertionFailedException: Assertion failed: at org.eclipse.jface.text.Assert.isTrue(Assert.java:175) at org.eclipse.jface.text.Assert.isTrue(Assert.java:160) at org.eclipse.text.edits.TextEdit.<init>(TextEdit.java:137) at org.eclipse.text.edits.ReplaceEdit.<init>(ReplaceEdit.java:35) at org.eclipse.jdt.internal.corext.refactoring.reorg.CreateCopyOfCompilationUnitCh ange.createChangeManager(CreateCopyOfCompilationUnitChange.java:103) at org.eclipse.jdt.internal.corext.refactoring.reorg.CreateCopyOfCompilationUnitCh ange.getCopiedFileSource(CreateCopyOfCompilationUnitChange.java:81) at org.eclipse.jdt.internal.corext.refactoring.reorg.CreateCopyOfCompilationUnitCh ange.getOldFile(CreateCopyOfCompilationUnitChange.java:63) at org.eclipse.jdt.internal.corext.refactoring.nls.changes.CreateFileChange.perfor m(CreateFileChange.java:79) at org.eclipse.jdt.internal.corext.refactoring.CompositeChange.createUndoList (CompositeChange.java:122) at org.eclipse.jdt.internal.corext.refactoring.CompositeChange.perform (CompositeChange.java:149) at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$1.run (RefactoringExecutionHelper.java:81) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation (BatchOperation.java:34) at org.eclipse.jdt.internal.core.JavaModelOperation.execute (JavaModelOperation.java:364) at org.eclipse.jdt.internal.core.JavaModelOperation.run (JavaModelOperation.java:703) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1555) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1574) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:3129) at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.ru n(RefactoringExecutionHelper.java:79) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:302) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:252) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run (ProgressMonitorDialog.java:394) at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper.perform (RefactoringExecutionHelper.java:131) at org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgCopyStarter.run (ReorgCopyStarter.java:70) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$JavaElementAndResourc ePaster.paste(PasteAction.java:402) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction.run (PasteAction.java:189) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:212) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:188) at org.eclipse.jface.action.Action.runWithEvent(Action.java:842) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:510) at org.eclipse.jface.action.ActionContributionItem.access$2 (ActionContributionItem.java:462) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent (ActionContributionItem.java:409) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:847) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2311) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1992) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1506) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1482) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:246) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:47) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:279) at org.eclipse.core.launcher.Main.run(Main.java:742) at org.eclipse.core.launcher.Main.main(Main.java:581)
Markus, can you please investigate. I wasn't able to reproduce with a simple example so this has something to do with the File that got copied. Note that the code int offset= searchResult.getEnd() - oldName.length(); in CreateCopyOfCompilationUnitChange.createChangeManager is there since the search result match can contain a leading package name.
I can reproduce with org.eclipse.swt from CVS and old-look UI. This is a dup of bug 49994: The search for references to the old type name returns a match with start:0, end:1. In this case, it's not even a potential match. Added temporary protection for this case in CreateCopyOfCompilationUnitChange#createChangeManager(.).
Fixed by jdt-core. Removed workaround in jdt-ui.