Reading and Writing to/from external file [message #260342] |
Tue, 08 July 2008 08:42  |
Eclipse User |
|
|
|
Originally posted by: gang.xu.delphi.com
Hi,
I was wondering if anyone knew of a tutorial or could explain here how to
read and write to a .txt or .xml file using eclipse. Basically, I am
allowing the user to make a tree, and I would like for him to be able to
save and reload it later.
How do I read/write, and what do I use to specify location for save/load?
I am used to command prompt world so this is a bit new for me.
Thanks!
|
|
|
Re: Reading and Writing to/from external file [message #260346 is a reply to message #260342] |
Tue, 08 July 2008 09:03   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------000209050003040806020300
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Dan,
This tutorial will generate a fully functional editor that does pretty
much exactly what you describe:
< http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html>
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html
If you can define your tree structure with an XML Schema, you'd
basically be done.
Dan Xu wrote:
> Hi,
> I was wondering if anyone knew of a tutorial or could explain here how
> to read and write to a .txt or .xml file using eclipse. Basically, I
> am allowing the user to make a tree, and I would like for him to be
> able to save and reload it later. How do I read/write, and what do I
> use to specify location for save/load? I am used to command prompt
> world so this is a bit new for me.
>
> Thanks!
>
--------------000209050003040806020300
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Dan,<br>
<br>
This tutorial will generate a fully functional editor that does pretty
much exactly what you describe:<a
href=" http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html"><br>
</a>
<blockquote><a
href=" http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html"> http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html</a><br>
</blockquote>
If you can define your tree structure with an XML Schema, you'd
basically be done.<br>
<br>
<br>
Dan Xu wrote:
<blockquote
cite="mid:3c89e502ab4eaabc4016a70ac2db12d9$1@www.eclipse.org"
type="cite">Hi,
<br>
I was wondering if anyone knew of a tutorial or could explain here how
to read and write to a .txt or .xml file using eclipse. Basically, I am
allowing the user to make a tree, and I would like for him to be able
to save and reload it later. How do I read/write, and what do I use to
specify location for save/load? I am used to command prompt world so
this is a bit new for me.
<br>
<br>
Thanks!
<br>
<br>
</blockquote>
</body>
</html>
--------------000209050003040806020300--
|
|
|
|
|
Re: Reading and Writing to/from external file [message #260420 is a reply to message #260407] |
Tue, 08 July 2008 15:22   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------000405020702040303000605
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Dan,
The hard-to-find modeling package has it all:
http://www.eclipse.org/downloads/packages/
But you should be able to add it to any installation you already have
using Help->Software Updates...-> Available Software->Ganymede Update
Site->Models and Model Development->XSD SDK; of course you'll want to
install the EMF SDK as well.
Dan Xu wrote:
> Thanks, but for some reason I don't have all the components (plug-ins)
> that are mentioned in the tutorial. For instance, I don't even see XML
> Schema as a selection option from "Select a model importer"
>
> I googled it and this led me to dowloading from
> http://www.eclipse.org/modeling/mdt/downloads/?project=xsd , but I
> still don't see it appearing.
> I have the latest release of Ganymede, so are there additional
> plug-ins that are required for me to build this model?
>
--------------000405020702040303000605
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Dan,<br>
<br>
The hard-to-find modeling package has it all:<br>
<blockquote><a href="http://www.eclipse.org/downloads/packages/">http://www.eclipse.org/downloads/packages/</a><br>
</blockquote>
But you should be able to add it to any installation you already have
using Help->Software Updates...-> Available Software->Ganymede
Update Site->Models and Model Development->XSD SDK; of course
you'll want to install the EMF SDK as well.<br>
<br>
<br>
Dan Xu wrote:
<blockquote
cite="mid:2f7b27212c78573e83d010af53cfefc8$1@www.eclipse.org"
type="cite">Thanks, but for some reason I don't have all the
components (plug-ins) that are mentioned in the tutorial. For instance,
I don't even see XML Schema as a selection option from "Select a model
importer"
<br>
<br>
I googled it and this led me to dowloading from
<a class="moz-txt-link-freetext" href="http://www.eclipse.org/modeling/mdt/downloads/?project=xsd">http://www.eclipse.org/modeling/mdt/downloads/?project=xsd</a> , but I
still don't see it appearing. <br>
I have the latest release of Ganymede, so are there additional plug-ins
that are required for me to build this model?
<br>
<br>
</blockquote>
</body>
</html>
--------------000405020702040303000605--
|
|
|
|
|
|
|
Re: Reading and Writing to/from external file [message #260485 is a reply to message #260465] |
Tue, 08 July 2008 22:36   |
Eclipse User |
|
|
|
Originally posted by: codeslave.ca.ibm.com
You might want to try getting individual jars from an FTP mirror such as
this one:
ftp://eclipse.mirrors.tds.net/pub/eclipse.org/releases/ganym ede/
Here's the full list:
http://www.eclipse.org/downloads/download.php?file=/releases /ganymede/&protocol=ftp
Here's the minimum list of jars (5) you need for XSD support w/ EMF:
http://wiki.eclipse.org/XSD-FAQ#I_want_to_use_XSD_in_my_stan dalone_project.2C_or_include_only_a_working_subset_of_the_co de._What_libraries_.28jar_files.29_do_I_need_in_my_CLASSPATH .3F
That's cumbersome, but small files might come down the pipe easier than
large ones for you, and you can use a download manager to enforce
multiple concurrent downloads and start/resume capability. I use the
"Download Them All" plugin for Firefox, FWIW.
If you find that your nearest mirror doesn't provide FTP downloads or
their downloads are corrupted, please report it to webmaster@eclipse.org
so they can contact the mirror and get the broken file(s) fixed.
Here's the FTP mirror list for the Ganymede Modeling package for Win32:
http://www.eclipse.org/downloads/download.php?file=/technolo gy/epp/downloads/release/ganymede/R/eclipse-modeling-ganymed e-incubation-win32.zip&protocol=ftp
Nick
Ed Merks wrote:
> Dan,
>
> It sounds like it might have been corrupted during download. I just
> tried it with my friends of Eclipse mirror (which took 7 minutes) and it
> unzipped okay.
>
>
> Dan Xu wrote:
>> Ah-that must be it. Unfortunately I can't fiddle with the firewall, so
>> I will manually download everything.
>>
>> By the way, after I downloaded the 300 MB
>> eclipse-modeling-ganymede-incubation-win32.zip folder, WinZip tells me:
>>
>> "Cannot open file: it does not appear to be a valid archive.
>> If you downloaded this file, try downloading the file again."
>>
>> Since it took an hour to download (This time the silly antivirus
>> software had to scan it as it downloaded), I don't think I will try it
>> again. Did I grab the wrong thing?
>>
>> Thanks again for everything!
>>
--
Nick Boldt :: Release Engineer, IBM Toronto Lab
Eclipse Modeling :: http://www.eclipse.org/modeling
http://wiki.eclipse.org/index.php/User:Nickb
|
|
|
|
|
|
|
Re: Reading and Writing to/from external file [message #260832 is a reply to message #260665] |
Fri, 11 July 2008 17:22  |
Eclipse User |
|
|
|
Originally posted by: gang.xu.delphi.com
I am going to use the FileDialog class to specify location to save/load
the external xml file (which does not have to be in the workspace).
Basically, I just need a way to convert my treeView into an xml file of
the sort (see below) and back again.
<Root
name = "root"
assoc = "C:\projects\CProject1">
<ChildNode
name = "son"
value = "1">
<GrandChildNode
name = "grandkid"
value = "0.4">
</GrandChildNode>
<ChildNode>
<ChildNode
name = "daughter"
value = "2">
<ChildNode>
</Root>
Right now, I'm about to write my own class to take my object model and
convert it into such an xml file, and also to parse it back. This is where
I'm open to suggestions :)
|
|
|
Powered by
FUDForum. Page generated in 0.13163 seconds