Project: JDT
Bug 176282 Link With Editor in Navigator and Project Explorer should work for IEditInput that can adapt to IFile
Reported: 2007-03-03 08:46:59 | Status: verified fixed

If I define an IEditorInput implementation that returns an IFile when asked for an IFile.class adapter, the Link With Editor capability of the Navigator or Project Explorer should work properly. But it appears that this capability is supported by doing an instanceof IFileEditorInput test instead. That's far less flexible and doesn't seem like the right way to implement it. I talked to Dani about this problem, and he said he fixed it right away for the Package Explorer, which currently has the same proble. Perhaps this isn't a big concern, but I also noticed problems with how equals is defined for FileEditorInput. It only considers itself equal to another IFileEditorInput, even though it implements IPathEditorInput too. Yet JavaFileEditorInput will consider itself equal to another IPathEditorInput with a matching path. So one could have a JavaFileEditorInput that's considers itself equal to a particular FileEditorInput but the opposite would not be true. I think that makes equals poorly defined. I also don't think the hashCode method for JavaFileEditorInput is properly defined to match the equality algorithm. I suppose this hasn't caused any real problems...

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/navigator/JavaFileLinkHelper.java