Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Working with XML files
Working with XML files [message #437545] Thu, 29 September 2005 21:29 Go to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
If i wanted to have a couple of xml files defined in my RCP app and wanted to display these in a TreeViewer inside a View, what is the best approach? Would I use the workspace to physically hold these files then use the resource plugin and IProject, IWorkspace, IPath and IFile to access them? Please help and suggest!

Thanks,
Jason
Re: Working with XML files [message #437627 is a reply to message #437545] Fri, 30 September 2005 11:30 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Jason Milliron wrote:
> If i wanted to have a couple of xml files defined in my RCP app and wanted to display these in a TreeViewer inside a View, what is the best approach? Would I use the workspace to physically hold these files then use the resource plugin and IProject, IWorkspace, IPath and IFile to access them? Please help and suggest!
>
> Thanks,
> Jason

Your best bet is to use the jface TreeViewer and use the DOM (perhaps
with some adapter) after you parse the XML files.

Later,
PW


Re: Working with XML files [message #437634 is a reply to message #437627] Fri, 30 September 2005 14:08 Go to previous messageGo to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
> Jason Milliron wrote:
> > If i wanted to have a couple of xml files defined
> in my RCP app and wanted to display these in a
> TreeViewer inside a View, what is the best approach?
> Would I use the workspace to physically hold these
> files then use the resource plugin and IProject,
> IWorkspace, IPath and IFile to access them? Please
> help and suggest!
>
> Thanks,
> Jason
> Your best bet is to use the jface TreeViewer and use
> the DOM (perhaps
> with some adapter) after you parse the XML files.
>
> Later,
> PW

but what about the workspace? Is this where the xml file should be located? Do i need to import the resource plugin and hold these files in the workspace? And if so, does anyone have sample code to do this?

Thanks,
Jason
Re: Working with XML files [message #437635 is a reply to message #437634] Fri, 30 September 2005 14:33 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Jason Milliron wrote:
>
> but what about the workspace? Is this where the xml file should be located? Do i need to import the resource plugin and hold these files in the workspace? And if so, does anyone have sample code to do this?
>

You don't need to involve workspaces if you don't want to ... your app
can use the SWT File Chooser to choose a file, put it in java.io.File,
and then parse it with whatever XML parser you want. JFace doesn't
require a plugin if you don't use any features of the
org.eclipse.core.resources.

Then you deal with it in memory (work on what TreeViewer needs so that
if you give it an in-memory XML document, it displays it correctly).

Later,
PW


Re: Working with XML files [message #437658 is a reply to message #437635] Fri, 30 September 2005 16:01 Go to previous messageGo to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
> Jason Milliron wrote:
> >
> > but what about the workspace? Is this where the
> xml file should be located? Do i need to import the
> resource plugin and hold these files in the
> workspace? And if so, does anyone have sample code
> to do this?
> >
>
> You don't need to involve workspaces if you don't
> want to ... your app
> can use the SWT File Chooser to choose a file, put it
> in java.io.File,
> and then parse it with whatever XML parser you want.
> JFace doesn't
> equire a plugin if you don't use any features of the
> org.eclipse.core.resources.
>
> Then you deal with it in memory (work on what
> TreeViewer needs so that
> if you give it an in-memory XML document, it displays
> it correctly).
>
> Later,
> PW

So here is my entire scenario. I would like to have 1 perspective with 1 left view with a TreeViewer. In that treeViewer I will have Wizards and folders and some xml objects. So your saying that those xml files should be displayed using JFace but will actually be a SWT File chooser? Where does the physical file live? On the external file system since it’s not in the workspace? Or should I have these files in the workspace because they will be kind of like property files and I will need to edit them by a custom editor I will build. So when a user double clicks one of the xml objects, a custom xml editor will be displayed that I can edit and see another tree view of the xml in the outline. Does this seem feasible for an RCP application? I just want to make sure I’m heading down the correct path. Thank you PW for all your help. I deeply appreciate it.

Thanks,
Jason
Re: Working with XML files [message #437662 is a reply to message #437658] Fri, 30 September 2005 16:24 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Jason Milliron wrote:
>
>
> So here is my entire scenario. I would like to have 1 perspective with 1 left view with a TreeViewer. In that treeViewer I will have Wizards and folders and some xml objects. So your saying that those xml files should be displayed using JFace but will actually be a SWT File chooser? Where does the physical file live? On the external file system since it’s not in the workspace? Or should I have these files in the workspace because they will be kind of like property files and I will need to edit them by a custom editor I will build. So when a user double clicks one of the xml objects, a custom xml editor will be displayed that I can edit and see another tree view of the xml in the outline. Does this seem feasible for an RCP application? I just want to make sure I’m heading down the correct path. Thank you PW for all your help. I deeply appreciate it.

Sorry, I misunderstood. You want to display files in a tree viewer, and
when the user double clicks on them, then you'll move into editing mode.

If you want to role your own navigator view, you can put it together
based on SWT Tree. Check out the snippet on http://www.eclipse.org/swt/

* create a tree (lazy)

Or you can try and include org.eclipse.ide in your RCP app. You have to
initialize the workspace somehow (worst case with the command line -data
<workspace_location>)



I was talking about after a user picks a file and you want to display
the XML contents in a view, although I'm sure you can use a TreeViewer
to imlement a file navigator.

Later,
PW


Re: Working with XML files [message #437668 is a reply to message #437662] Fri, 30 September 2005 19:19 Go to previous message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
> Jason Milliron wrote:
> >
> >
> > So here is my entire scenario. I would like to have
> 1 perspective with 1 left view with a TreeViewer. In
> that treeViewer I will have Wizards and folders and
> some xml objects. So your saying that those xml
> files should be displayed using JFace but will
> actually be a SWT File chooser? Where does the
> physical file live? On the external file system
> since its not in the workspace? Or should I have
> these files in the workspace because they will be
> kind of like property files and I will need to edit
> them by a custom editor I will build. So when a user
> double clicks one of the xml objects, a custom xml
> editor will be displayed that I can edit and see
> another tree view of the xml in the outline. Does
> this seem feasible for an RCP application? I just
> want to make sure Im heading down the correct path.
> Thank you PW for all your help. I deeply appreciate
> it.
> Sorry, I misunderstood. You want to display files in
> a tree viewer, and
> when the user double clicks on them, then you'll move
> into editing mode.
>
> If you want to role your own navigator view, you can
> put it together
> based on SWT Tree. Check out the snippet on
> http://www.eclipse.org/swt/
>
> * create a tree (lazy)
>
> Or you can try and include org.eclipse.ide in your
> RCP app. You have to
> initialize the workspace somehow (worst case with the
> command line -data
> <workspace_location>)
>
>
>
> I was talking about after a user picks a file and you
> want to display
> the XML contents in a view, although I'm sure you can
> use a TreeViewer
> to imlement a file navigator.
>
> Later,
> PW

Thanks much! Have a great day!!!
Previous Topic:setting drop adapters on Window
Next Topic:coolbar icon problem
Goto Forum:
  


Current Time: Sat Dec 07 01:48:14 GMT 2024

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

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

Back to the top