Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » File Browser in ViewPart or Editor?
File Browser in ViewPart or Editor? [message #550638] Tue, 03 August 2010 20:15 Go to next message
Ohanes Dadian is currently offline Ohanes Dadian
Messages: 2
Registered: March 2010
Junior Member
I am implementing a file browser, in Eclipse RCP, using a TreeViewer. Would it be best to put it in an Editor or ViewPart. I ask because, I need to be able to pass the root path for the browser and do not know of a way to do so with a view. As views are not instantiated directly.
Re: File Browser in ViewPart or Editor? [message #550662 is a reply to message #550638] Wed, 04 August 2010 01:47 Go to previous message
Shawn Spiars is currently offline Shawn Spiars
Messages: 22
Registered: July 2009
Junior Member
ohanes.dadian@gmail.com wrote:
> I am implementing a file browser, in Eclipse RCP, using a TreeViewer.
> Would it be best to put it in an Editor or ViewPart. I ask because, I
> need to be able to pass the root path for the browser and do not know of
> a way to do so with a view. As views are not instantiated directly.

Editors are best when you want to edit something using the life-cycle of
clean, dirty, save. For your File Browser I would recommend using a
view. You can create a public method in your view and call it after
launching to initialize the TreeViewer. Here is an example:

private void openTreeView(String name, TreeNode root) {
IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();

try {
IViewPart part = page.showView(TreeView.ID, name,
IWorkbenchPage.VIEW_CREATE);
TreeView treeView = (TreeView)part;
treeView.initialize(name, root);
page.activate(part);
} catch (PartInitException e) {
logger.error("Error opening TreeView", e);
}
}
Previous Topic:Problem with Bundle-NativeCode and macosx
Next Topic:JAAS in RCP - Unable to locate a login configuration
Goto Forum:
  


Current Time: Sat Jul 26 13:14:56 EDT 2014

Powered by FUDForum. Page generated in 0.15272 seconds