How do I write an editor that displays the contents of a folder in eclipse?

Motivation

I wrote an eclipse plugin that shows me a list of all files and folders with unrepeated content. When selecting a folder, I want the editor to open all the files and subfolders contained in that folder. It should work for versions as well. So I need to create editor content in my plugin (no support IResource

).

What do I have now

I am currently opening RemoteFileEditorInput

for a version file (subclipse), or I am using IWorkbenchPage.openEditor()

for FileEditorInput

.

Question

What's an easy way to render dynamic content (directory listing) inside a text editor?

EDIT 2010-04-13:

More context

I want to be able to create comments on viewing code in a directory listing. To do this, I want to be able to open the diff viewer to see which items have been removed or added between the two versions of the catalog.

I would like to enter a comment for a directory in the same way as for a text file. So I'm trying to display the contents of a directory as a text file - I've already implemented mechanisms to comment out a text file.

I am calling the contents of the directory editor "dynamic" because it is not supported by an existing directory on the file system. For older versions of the directory, I'll create the editor content in my program code.

+2


source to share


1 answer


I'm afraid I don't quite understand your question (and I am missing a representative to comment on it).

Is it correct? You want to be able to open one of three editors to support your goal:

  • Editor for unversioned files (you say you have this)
  • Editor for versioned files (you say you have)
  • Directory editor (is this what you want?)
    • What is the user doing here? What does it look like?

I am confused by "What's an easy way to render dynamic content (directory listing) inside the text editor ?"

Knowing that I have probably completely missed your point, I would have noticed that your editor can contain whatever controls you want (see some of the "forms" of editors in PDE, for example for editing a plugin manifest) - you perhaps create ManagedForm

ManagedForm

in createPartControl()

, create ListViewer

, TableViewer

or TreeViewer

there, give it an appropriate content provider and assign it an appropriate provider label.



I am also confused by "What's an easy way to render dynamic content (directory listing) inside a text editor?"

I can only assume that you want to poll or listen to some events in some way and inform your viewer update()

or refresh()

.

Finally, I would question whether the directory listing really belongs to the editor ... most of the navigation happens in views. Will the user actually perform edits in the directory in some way and perhaps "save" them at a later time?

Hope this helps us all narrow down everything that helps you.

0


source







All Articles