Bug 67046 Exception when dragging a method to another class using the package explorer
a. Create a new Java project b. Create 3 new packages c. Create a new class in each of the first 2 packages d. Add 2 methods to the class in the second package and save it e. Move the previous class with the 2 methods to the third package f. Try to drag and drop a method from the previous class in the package explorer to the first class (in order to move this method to the first class) g. Notice that the method is still visible in both classes h. Try to drag it again from the second class to the first one i. An exception occurs since the second class no longer contained that method Here is the session data: eclipse.buildId=I200406111814 java.version=1.4.2_03 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Here is the stack trace: Java Model Exception: Java Model Status [c() [in a2 [in [Working copy] a2.java [in p3 [in <project root> [in SWTTest]]]]] does not exist] at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException (JavaElement.java:561) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed (JavaElement.java:583) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo (JavaElement.java:309) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo (JavaElement.java:295) at org.eclipse.jdt.internal.core.Member.getFlags(Member.java:154) at org.eclipse.jdt.internal.corext.util.JdtFlags.isPrivate (JdtFlags.java:82) at org.eclipse.jdt.internal.corext.refactoring.participants.JavaProcessors.compute AffectedNatures(JavaProcessors.java:32) at org.eclipse.jdt.internal.corext.refactoring.participants.JavaProcessors.compute AffectedNaturs(JavaProcessors.java:43) at org.eclipse.jdt.internal.corext.refactoring.reorg.JavaMoveProcessor.getAffected ProjectNatures(JavaMoveProcessor.java:115) at org.eclipse.jdt.internal.corext.refactoring.reorg.JavaMoveProcessor.loadPartici pants(JavaMoveProcessor.java:111) at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFi nalConditions(ProcessorBasedRefactoring.java:142) at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions (Refactoring.java:126) at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.ru n(RefactoringExecutionHelper.java:65) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation (BatchOperation.java:34) at org.eclipse.jdt.internal.core.JavaModelOperation.run (JavaModelOperation.java:700) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1673) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:3246) at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run (WorkbenchRunnableAdapter.java:65) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:303) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:253) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run (ProgressMonitorDialog.java:397) at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper.perform (RefactoringExecutionHelper.java:116) at org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgMoveStarter.run (ReorgMoveStarter.java:78) at org.eclipse.jdt.internal.ui.packageview.SelectionTransferDropAdapter.handleDrop Move(SelectionTransferDropAdapter.java:208) at org.eclipse.jdt.internal.ui.packageview.SelectionTransferDropAdapter.drop (SelectionTransferDropAdapter.java:132) at org.eclipse.jdt.internal.ui.dnd.JdtViewerDropAdapter.drop (JdtViewerDropAdapter.java:112) at org.eclipse.jdt.internal.ui.dnd.DelegatingDropAdapter.drop (DelegatingDropAdapter.java:79) at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:65) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:613) at org.eclipse.swt.dnd.DropTarget.notifyListeners(DropTarget.java:507) at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:428) at org.eclipse.swt.dnd.DropTarget.access$7(DropTarget.java:363) at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:232) at org.eclipse.swt.internal.ole.win32.COMObject.callback6 (COMObject.java:115) at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method) at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:277) at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:263) at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java:157) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2732) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2398) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1362) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1333) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:252) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:334) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:272) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:128) 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:185) at org.eclipse.core.launcher.Main.run(Main.java:638) at org.eclipse.core.launcher.Main.main(Main.java:622)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
IDocument document= textViewer.getDocument();
			
			if (document == null)
				return -1;		
			try {
				int widgetLocation= styledText.getOffsetAtLocation(new Point(x, y));
				if (textViewer instanceof ITextViewerExtension5) {
					ITextViewerExtension5 extension= (ITextViewerExtension5) textViewer;
					return extension.widgetOffset2ModelOffset(widgetLocation);
				} else {
					IRegion visibleRegion= textViewer.getVisibleRegion();
					return widgetLocation + visibleRegion.getOffset();
				}
			} catch (IllegalArgumentException e) {
				return -1;	
			}
		}
	}
	/**
	 * This action implements smart home.
	 * 
	 * Instead of going to the start of a line it does the following:
	 * 
	 * - if smart home/end is enabled and the caret is after the line's first non-whitespace then the caret is moved directly before it, taking JavaDoc and multi-line comments into account.
	 * - if the caret is before the line's first non-whitespace the caret is moved to the beginning of the line
	 * - if the caret is at the beginning of the line see first case.
	 * 
	 * @since 3.0
	 */
	protected class SmartLineStartAction extends LineStartAction {