[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: Opening a file on the editor

sakhi wrote:


Hi,

I have the following code..
public boolean setDocumentContent(IDocument document, IEditorInput input)
throws CoreException
{
try
{
if (input instanceof IPathEditorInput)
{
reader = new FileReader(((IPathEditorInput) input).getPath()
.toFile());
//reader = new StringReader(input.toString()); } I run this code and when i try to open a file which is on the desktop with its associated editor using file ->open ,it fails in the if check "instanceOf iPathEditorInput" the same check works when i try to open a file which is in the workspace.Iam presently running this code in the officially releases eclipse 3.3.But if i run this code in eclipse 3.3 m5 it works fine and the check returns true,even for a file which is on the desktop.


What modification do i need to do to the above code to make it work in eclipse 3.3?

What document provider are you using and from which editor class do you inherit? Please post the stack trace that shows who calls setDocumentContent and hence who creates the editor input.


Note that there was no official API to open external files before 3.3 and hence it probably worked because you made some assumptions that are now no longer valid. Also, opening external editors became much easier with 3.3 as there is now API.

Dani


Br, Sakhi