Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » File Browser in a Part
File Browser in a Part [message #873837] Sat, 19 May 2012 08:07 Go to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
Registered: March 2012
Location: Italy
Senior Member

Goodmorning,
I want to add a tree file browser in one of my application's parts.
Does someone know an useful plugin for me?

Very thank you.

PS: Compliments to all Eclipse Day's speakers. Smile
Re: File Browser in a Part [message #874409 is a reply to message #873837] Sun, 20 May 2012 20:21 Go to previous messageGo to next message
Eclipse UserFriend
Don't know about any plugins but it should not be too difficult to implement one yourself using JFace treeviewers.
Re: File Browser in a Part [message #874666 is a reply to message #873837] Mon, 21 May 2012 10:36 Go to previous messageGo to next message
Daniel Zimmermann is currently offline Daniel ZimmermannFriend
Messages: 81
Registered: July 2009
Member
Or you re-use the Common Navigator Framework - if that is not so much for your need.
I did this once to create a "plugin navigation" for a simple platform I wrote (kinda very stupid, but it was fitting my needs).
Unfortunatelly the CNF had some dependecies added in 3.6 that rendered it useless for me, since my application (for non-developers) stated to allow projects, which where quite unncessary - so I wrote my own little plugin navigation. (Ok, I do now stop fairy-telling... Smile )
Re: File Browser in a Part [message #874676 is a reply to message #874666] Mon, 21 May 2012 10:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
I guess the problem here is that it's not yet ported to e4 but that's
just a guess.

Tom

Am 21.05.12 12:36, schrieb Daniel Zimmermann:
> Or you re-use the Common Navigator Framework - if that is not so much
> for your need.
> I did this once to create a "plugin navigation" for a simple platform I
> wrote (kinda very stupid, but it was fitting my needs).
> Unfortunatelly the CNF had some dependecies added in 3.6 that rendered
> it useless for me, since my application (for non-developers) stated to
> allow projects, which where quite unncessary - so I wrote my own little
> plugin navigation. (Ok, I do now stop fairy-telling... :) )
Re: File Browser in a Part [message #874691 is a reply to message #874676] Mon, 21 May 2012 11:28 Go to previous messageGo to next message
Eclipse UserFriend
This a basic one.

@PostConstruct
	public void pc(Composite parent){
		System.err.println("pc");
		TreeViewer listViewer = new TreeViewer(parent);
		listViewer.getTree().setBounds(10, 10, 200, 200);
		listViewer.setContentProvider(new ITreeContentProvider() {
			
			@Override
			public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
				System.err.println("Changed");
			}
			
			@Override
			public void dispose() {
				
			}
			
			@Override
			public boolean hasChildren(Object element) {
				
				File file = (File) element;
				return file.isDirectory();
			}
			
			@Override
			public Object getParent(Object element) {
				File file = (File) element;
				return file.getParentFile();
			}
			
			@Override
			public Object[] getElements(Object inputElement) {
				File file = (File) inputElement;

				return file.listFiles();
			}
			
			@Override
			public Object[] getChildren(Object parentElement) {
				File file = (File) parentElement;
				return file.listFiles();

			}
		});
		
		listViewer.setLabelProvider(new LabelProvider(){
			@Override
			public String getText(Object element) {
				File file = (File) element;
				return file.getName();
			}
			
			@Override
			public Image getImage(Object element) {

				return null;
			}
		});
		listViewer.setInput(new File("C:\\"));
	}
Re: File Browser in a Part [message #906355 is a reply to message #874691] Sat, 01 September 2012 07:51 Go to previous message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
Registered: March 2012
Location: Italy
Senior Member

Solved with Sopot's code.

Very thank you.
Previous Topic:Logger and Widget Layout
Next Topic:Tray icon/menu
Goto Forum:
  


Current Time: Fri Apr 26 02:25:39 GMT 2024

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

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

Back to the top