Skip to main content


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] Wed, 04 August 2010 00:15 Go to next message
Ohanes Dadian is currently offline Ohanes DadianFriend
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 05:47 Go to previous message
Shawn Spiars is currently offline Shawn SpiarsFriend
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: Fri Apr 19 08:53:47 GMT 2024

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

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

Back to the top