Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Unable to see line numbers / editor image for editor backed with IStorageEditorInput
Unable to see line numbers / editor image for editor backed with IStorageEditorInput [message #238464] Wed, 29 November 2006 09:46 Go to next message
Eclipse UserFriend
Originally posted by: gareth.matthews.nospam.uk.ibm.com

Hi all,

I have written a plugin which grabs the contents of a Java file from across
the network and I want to display it in a read-only Java editor. Thus far, I
can do this by opening the CU editor and passing it an IStorageEditorInput
instance which allows the actual java to be displayed to be read in from an
in-memory buffer.

However, there are a couple of things that don't appear to work right. The
first is that no line numbers appear - even though line numbers appear for
local Java files loaded from the package explorer for example. In fact I
get no left-hand ruler at all.

Secondly the editor Image is the default 'I dont know' image from Eclipse
(i.e. the white window with the blue title image) despite the fact that I
have returned an image from my getImageDescriptor() method in the editor
input instance.

Here is my editor input instance:

IStorageEditorInput editorInput = new IStorageEditorInput() {
public boolean exists()
{
return true;
}

public ImageDescriptor getImageDescriptor()
{
// TODO Why doesn't this work??
return
JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IM G_OBJS_CUNIT);
}

public String getName()
{
return record.getFileName();
}

public IPersistableElement getPersistable()
{
return null;
}

public String getToolTipText()
{
return record.getLocation() + " from Index " + record.getIndex();
}

public Object getAdapter(Class adapter)
{
return null;
}

public IStorage getStorage() throws CoreException
{
return new IStorage() {

public InputStream getContents() throws CoreException
{
return inputStream;
}

public IPath getFullPath()
{
return null;
}

public String getName()
{
return record.getLocation();
}

public boolean isReadOnly()
{
return true;
}

public Object getAdapter(Class adapter)
{
return null;
}

};
}

Does anyone have any ideas why this doesn't work? Is there a better way of
doing it?
Gareth
Re: Unable to see line numbers / editor image for editor backed with IStorageEditorInput [message #238481 is a reply to message #238464] Thu, 30 November 2006 06:11 Go to previous messageGo to next message
Eclipse UserFriend
Hi Gareth,

the reason for this is that the Java editor currently doesn't support a
genereal IStorageEditorInput: since it cannot create the Java Element
you don't see the right image (which is computed from the Java element)
and don't get the ruler.

There's currently not much you can do. Once Platform Text supports
FileStoreEditorInput (3.3) you could create a temporary file and open it.

Dani
Re: Unable to see line numbers / editor image for editor backed with IStorageEditorInput [message #238505 is a reply to message #238481] Fri, 01 December 2006 05:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gareth.matthews.nospam.uk.ibm.com

Not sure I quite follow - the CVS editor seems to be able to do this ok (in
3.2 anyway) and looking at the code it appears that they do a similar thing
(i.e. there is IStorageEditorInput backing it under the covers). I haven't
delved into why they seem to be able to launch the editor in the right way
and I can't, but I guess I'll figure it out eventually.

It would be nice if there was some documentation on how to do this kind of
thing - I can't think I am the first person to want to do it...

"Daniel Megert" <daniel_megert@ch.ibm.com> wrote in message
news:ekmea2$s54$1@utils.eclipse.org...
> Hi Gareth,
>
> the reason for this is that the Java editor currently doesn't support a
> genereal IStorageEditorInput: since it cannot create the Java Element you
> don't see the right image (which is computed from the Java element) and
> don't get the ruler.
>
> There's currently not much you can do. Once Platform Text supports
> FileStoreEditorInput (3.3) you could create a temporary file and open it.
>
> Dani
Re: Unable to see line numbers / editor image for editor backed with IStorageEditorInput [message #238521 is a reply to message #238505] Fri, 01 December 2006 10:47 Go to previous message
Eclipse UserFriend
Gareth Matthews wrote:

>Not sure I quite follow - the CVS editor seems to be able to do this ok (in
>3.2 anyway) and looking at the code it appears that they do a similar thing
>
Yeah, but in the case where it works we (can) map the storage path back
to the project and hence have a build path and hence can create the Java
element.

Dani

>
>(i.e. there is IStorageEditorInput backing it under the covers). I haven't
>
>
>delved into why they seem to be able to launch the editor in the right way
>and I can't, but I guess I'll figure it out eventually.
>
>It would be nice if there was some documentation on how to do this kind of
>thing - I can't think I am the first person to want to do it...
>
>"Daniel Megert" <daniel_megert@ch.ibm.com> wrote in message
>news:ekmea2$s54$1@utils.eclipse.org...
>
>
>>Hi Gareth,
>>
>>the reason for this is that the Java editor currently doesn't support a
>>genereal IStorageEditorInput: since it cannot create the Java Element you
>>don't see the right image (which is computed from the Java element) and
>>don't get the ruler.
>>
>>There's currently not much you can do. Once Platform Text supports
>>FileStoreEditorInput (3.3) you could create a temporary file and open it.
>>
>>Dani
>>
>>
>
>
>
>
Previous Topic:How to filter java file with annotation in it?
Next Topic:MethodInvocation Node
Goto Forum:
  


Current Time: Wed Jul 16 10:20:30 EDT 2025

Powered by FUDForum. Page generated in 0.30618 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top