Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » How to Convert a java file to "IType" ?
How to Convert a java file to "IType" ? [message #142775] Wed, 07 November 2007 08:12 Go to next message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

Hi:
I'm confusing in the following problems:
There's a java file ,I can use Java I/O Stream to read it into a String
Objecet.But I want to analyze it to know the methods and fields in this java
file ,just like the Java Refelction Mechanism. And I found that in eclipse
there's an type called "IType" could do this thing,but I
don't know how to establish such an IType object and set the data(String
object) to it.Please help me ,or give me some other suggestions to this
subject!
Thank you!
robbin
from China
Re: How to Convert a java file to "IType" ? [message #142786 is a reply to message #142775] Thu, 08 November 2007 00:15 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
This question is about JDT. You need know JDT and Eclipse. The main path is
to get IProject and convert it to IJavaProject by
JavaCore.getCore.createProject(IProject). And then you can use the method
findType() of IJavaProject.

Regards
Yves YANG
---
http://www.soyatec.com/eface

"robbin" <lgw198412@gmail.com> wrote in message
news:fgrs0o$86i$1@build.eclipse.org...
> Hi:
> I'm confusing in the following problems:
> There's a java file ,I can use Java I/O Stream to read it into a String
> Objecet.But I want to analyze it to know the methods and fields in this
> java file ,just like the Java Refelction Mechanism. And I found that in
> eclipse there's an type called "IType" could do this thing,but I
> don't know how to establish such an IType object and set the data(String
> object) to it.Please help me ,or give me some other suggestions to this
> subject!
> Thank you!
> robbin
> from China
Re: How to Convert a java file to "IType" ? [message #142813 is a reply to message #142786] Thu, 08 November 2007 02:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

I don't know how to create a IProject ,as I know there's one way to create
it :
IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
IJavaProject javaProject = JavaCore.create(project);But there's a new
problem ,my java file is only a java file ,not in any Eclipse Project.So
what should I do?Thank you!"Yves YANG" <yves.yang@soyatec.com> wrote in
message news:fgtkfn$hk0$1@build.eclipse.org...
> This question is about JDT. You need know JDT and Eclipse. The main path
> is to get IProject and convert it to IJavaProject by
> JavaCore.getCore.createProject(IProject). And then you can use the method
> findType() of IJavaProject.
>
> Regards
> Yves YANG
> ---
> http://www.soyatec.com/eface
>
> "robbin" <lgw198412@gmail.com> wrote in message
> news:fgrs0o$86i$1@build.eclipse.org...
>> Hi:
>> I'm confusing in the following problems:
>> There's a java file ,I can use Java I/O Stream to read it into a String
>> Objecet.But I want to analyze it to know the methods and fields in this
>> java file ,just like the Java Refelction Mechanism. And I found that in
>> eclipse there's an type called "IType" could do this thing,but I
>> don't know how to establish such an IType object and set the data(String
>> object) to it.Please help me ,or give me some other suggestions to this
>> subject!
>> Thank you!
>> robbin
>> from China
>
>
Re: How to Convert a java file to "IType" ? [message #142823 is a reply to message #142813] Thu, 08 November 2007 09:08 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
If the file is not in workspace, in general, AFAIK, you cannot use IType.

Best regards
Yves YANG
---
http://www.soyatec.com/eface

"robbin" <lgw198412@gmail.com> wrote in message
news:fgttqa$sto$1@build.eclipse.org...
>I don't know how to create a IProject ,as I know there's one way to create
>it :
> IProject project =
> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
> IJavaProject javaProject = JavaCore.create(project);But there's a new
> problem ,my java file is only a java file ,not in any Eclipse Project.So
> what should I do?Thank you!"Yves YANG" <yves.yang@soyatec.com> wrote in
> message news:fgtkfn$hk0$1@build.eclipse.org...
>> This question is about JDT. You need know JDT and Eclipse. The main path
>> is to get IProject and convert it to IJavaProject by
>> JavaCore.getCore.createProject(IProject). And then you can use the method
>> findType() of IJavaProject.
>>
>> Regards
>> Yves YANG
>> ---
>> http://www.soyatec.com/eface
>>
>> "robbin" <lgw198412@gmail.com> wrote in message
>> news:fgrs0o$86i$1@build.eclipse.org...
>>> Hi:
>>> I'm confusing in the following problems:
>>> There's a java file ,I can use Java I/O Stream to read it into a
>>> String Objecet.But I want to analyze it to know the methods and fields
>>> in this java file ,just like the Java Refelction Mechanism. And I found
>>> that in eclipse there's an type called "IType" could do this thing,but I
>>> don't know how to establish such an IType object and set the data(String
>>> object) to it.Please help me ,or give me some other suggestions to this
>>> subject!
>>> Thank you!
>>> robbin
>>> from China
>>
>>
>
Re: How to Convert a java file to "IType" ? [message #142833 is a reply to message #142823] Thu, 08 November 2007 10:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

Thank You Very Much!
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:fgujlh$hhn$1@build.eclipse.org...
> If the file is not in workspace, in general, AFAIK, you cannot use IType.
>
> Best regards
> Yves YANG
> ---
> http://www.soyatec.com/eface
>
> "robbin" <lgw198412@gmail.com> wrote in message
> news:fgttqa$sto$1@build.eclipse.org...
>>I don't know how to create a IProject ,as I know there's one way to create
>>it :
>> IProject project =
>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>> IJavaProject javaProject = JavaCore.create(project);But there's a new
>> problem ,my java file is only a java file ,not in any Eclipse Project.So
>> what should I do?Thank you!"Yves YANG" <yves.yang@soyatec.com> wrote in
>> message news:fgtkfn$hk0$1@build.eclipse.org...
>>> This question is about JDT. You need know JDT and Eclipse. The main path
>>> is to get IProject and convert it to IJavaProject by
>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>> method findType() of IJavaProject.
>>>
>>> Regards
>>> Yves YANG
>>> ---
>>> http://www.soyatec.com/eface
>>>
>>> "robbin" <lgw198412@gmail.com> wrote in message
>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>> Hi:
>>>> I'm confusing in the following problems:
>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>> String Objecet.But I want to analyze it to know the methods and fields
>>>> in this java file ,just like the Java Refelction Mechanism. And I found
>>>> that in eclipse there's an type called "IType" could do this thing,but
>>>> I
>>>> don't know how to establish such an IType object and set the
>>>> data(String object) to it.Please help me ,or give me some other
>>>> suggestions to this subject!
>>>> Thank you!
>>>> robbin
>>>> from China
>>>
>>>
>>
>
>
Re: How to Convert a java file to "IType" ? [message #142843 is a reply to message #142823] Thu, 08 November 2007 10:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

Another problem:
Now I've Known your means , and I used the follwoing way to get an IProject
Object
IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
But I don't know how to convert a java file under this Project("stupid") to
an IFile type, Is the following right?
IFile ifile = project.getFile("xxxx .java")
Thank you !

"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:fgujlh$hhn$1@build.eclipse.org...
> If the file is not in workspace, in general, AFAIK, you cannot use IType.
>
> Best regards
> Yves YANG
> ---
> http://www.soyatec.com/eface
>
> "robbin" <lgw198412@gmail.com> wrote in message
> news:fgttqa$sto$1@build.eclipse.org...
>>I don't know how to create a IProject ,as I know there's one way to create
>>it :
>> IProject project =
>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>> IJavaProject javaProject = JavaCore.create(project);But there's a new
>> problem ,my java file is only a java file ,not in any Eclipse Project.So
>> what should I do?Thank you!"Yves YANG" <yves.yang@soyatec.com> wrote in
>> message news:fgtkfn$hk0$1@build.eclipse.org...
>>> This question is about JDT. You need know JDT and Eclipse. The main path
>>> is to get IProject and convert it to IJavaProject by
>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>> method findType() of IJavaProject.
>>>
>>> Regards
>>> Yves YANG
>>> ---
>>> http://www.soyatec.com/eface
>>>
>>> "robbin" <lgw198412@gmail.com> wrote in message
>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>> Hi:
>>>> I'm confusing in the following problems:
>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>> String Objecet.But I want to analyze it to know the methods and fields
>>>> in this java file ,just like the Java Refelction Mechanism. And I found
>>>> that in eclipse there's an type called "IType" could do this thing,but
>>>> I
>>>> don't know how to establish such an IType object and set the
>>>> data(String object) to it.Please help me ,or give me some other
>>>> suggestions to this subject!
>>>> Thank you!
>>>> robbin
>>>> from China
>>>
>>>
>>
>
>
Re: How to Convert a java file to "IType" ? [message #142853 is a reply to message #142843] Thu, 08 November 2007 13:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Robbin,

Yes, but beware that this is a file handle object so you might find that
project.getFile("xxx.java").exists() is false. Keep in mind that you
might want to use project.getFile(new Path("src/com/example/xxx.java"))
instead and that you still need to check for exists. The findMember
methods will return null if the member doesn't exist, but in that case
you have to determine wither it's a file or a folder.


robbin wrote:
> Another problem:
> Now I've Known your means , and I used the follwoing way to get an
> IProject Object
> IProject project =
> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
> But I don't know how to convert a java file under this
> Project("stupid") to an IFile type, Is the following right?
> IFile ifile = project.getFile("xxxx .java")
> Thank you !
>
> "Yves YANG" <yves.yang@soyatec.com> wrote in message
> news:fgujlh$hhn$1@build.eclipse.org...
>> If the file is not in workspace, in general, AFAIK, you cannot use
>> IType.
>>
>> Best regards
>> Yves YANG
>> ---
>> http://www.soyatec.com/eface
>>
>> "robbin" <lgw198412@gmail.com> wrote in message
>> news:fgttqa$sto$1@build.eclipse.org...
>>> I don't know how to create a IProject ,as I know there's one way to
>>> create it :
>>> IProject project =
>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>> IJavaProject javaProject = JavaCore.create(project);But there's a
>>> new problem ,my java file is only a java file ,not in any Eclipse
>>> Project.So what should I do?Thank you!"Yves YANG"
>>> <yves.yang@soyatec.com> wrote in message
>>> news:fgtkfn$hk0$1@build.eclipse.org...
>>>> This question is about JDT. You need know JDT and Eclipse. The main
>>>> path is to get IProject and convert it to IJavaProject by
>>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>>> method findType() of IJavaProject.
>>>>
>>>> Regards
>>>> Yves YANG
>>>> ---
>>>> http://www.soyatec.com/eface
>>>>
>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>>> Hi:
>>>>> I'm confusing in the following problems:
>>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>>> String Objecet.But I want to analyze it to know the methods and
>>>>> fields in this java file ,just like the Java Refelction Mechanism.
>>>>> And I found that in eclipse there's an type called "IType" could
>>>>> do this thing,but I
>>>>> don't know how to establish such an IType object and set the
>>>>> data(String object) to it.Please help me ,or give me some other
>>>>> suggestions to this subject!
>>>>> Thank you!
>>>>> robbin
>>>>> from China
>>>>
>>>>
>>>
>>
>>
>
Re: How to Convert a java file to "IType" ? [message #142900 is a reply to message #142853] Fri, 09 November 2007 08:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

Ed Merks:
Thanks for the last answer.
Now I want to get all the files under a project,because I want to use the
method "project.getFile(path)" to get a IFile Type.
So how to get the path?(
Assume that I don't know any files under the current project ,but I want to
use method to get all the files and its full path like
"src/.../.../xxx.java")

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:fgv291$ar$1@build.eclipse.org...
> Robbin,
>
> Yes, but beware that this is a file handle object so you might find that
> project.getFile("xxx.java").exists() is false. Keep in mind that you
> might want to use project.getFile(new Path("src/com/example/xxx.java"))
> instead and that you still need to check for exists. The findMember
> methods will return null if the member doesn't exist, but in that case
> you have to determine wither it's a file or a folder.
>
>
> robbin wrote:
>> Another problem:
>> Now I've Known your means , and I used the follwoing way to get an
>> IProject Object
>> IProject project =
>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>> But I don't know how to convert a java file under this
>> Project("stupid") to an IFile type, Is the following right?
>> IFile ifile = project.getFile("xxxx .java")
>> Thank you !
>>
>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>> news:fgujlh$hhn$1@build.eclipse.org...
>>> If the file is not in workspace, in general, AFAIK, you cannot use
>>> IType.
>>>
>>> Best regards
>>> Yves YANG
>>> ---
>>> http://www.soyatec.com/eface
>>>
>>> "robbin" <lgw198412@gmail.com> wrote in message
>>> news:fgttqa$sto$1@build.eclipse.org...
>>>> I don't know how to create a IProject ,as I know there's one way to
>>>> create it :
>>>> IProject project =
>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>> IJavaProject javaProject = JavaCore.create(project);But there's a
>>>> new problem ,my java file is only a java file ,not in any Eclipse
>>>> Project.So what should I do?Thank you!"Yves YANG"
>>>> <yves.yang@soyatec.com> wrote in message
>>>> news:fgtkfn$hk0$1@build.eclipse.org...
>>>>> This question is about JDT. You need know JDT and Eclipse. The main
>>>>> path is to get IProject and convert it to IJavaProject by
>>>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>>>> method findType() of IJavaProject.
>>>>>
>>>>> Regards
>>>>> Yves YANG
>>>>> ---
>>>>> http://www.soyatec.com/eface
>>>>>
>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>>>> Hi:
>>>>>> I'm confusing in the following problems:
>>>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>>>> String Objecet.But I want to analyze it to know the methods and
>>>>>> fields in this java file ,just like the Java Refelction Mechanism.
>>>>>> And I found that in eclipse there's an type called "IType" could
>>>>>> do this thing,but I
>>>>>> don't know how to establish such an IType object and set the
>>>>>> data(String object) to it.Please help me ,or give me some other
>>>>>> suggestions to this subject!
>>>>>> Thank you!
>>>>>> robbin
>>>>>> from China
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
Re: How to Convert a java file to "IType" ? [message #142954 is a reply to message #142900] Fri, 09 November 2007 12:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------090509050601010401000305
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit

Robbin,

Here's an answer to a different question I posted in the platform newsgroup:

You can use ResourcesPlugin.getWorkspace().getRoot() to get the root
IContainer for the whole workspace. You could use
IWorkspaceRoot.getProjects(), to get all the projects, which are
also IContainers. And generally you can use IContainer.members(), to
recursively walk the tree. Given an IResource, you can use getType
to figure out what kind it is. You can use
IResource.accept(IResourceVisitor,...) to visit resources.


robbin wrote:
> Ed Merks:
> Thanks for the last answer.
> Now I want to get all the files under a project,because I want to use
> the method "project.getFile(path)" to get a IFile Type.
> So how to get the path?(
> Assume that I don't know any files under the current project ,but I
> want to use method to get all the files and its full path like
> "src/.../.../xxx.java")
>
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:fgv291$ar$1@build.eclipse.org...
>> Robbin,
>>
>> Yes, but beware that this is a file handle object so you might find that
>> project.getFile("xxx.java").exists() is false. Keep in mind that you
>> might want to use project.getFile(new Path("src/com/example/xxx.java"))
>> instead and that you still need to check for exists. The findMember
>> methods will return null if the member doesn't exist, but in that case
>> you have to determine wither it's a file or a folder.
>>
>>
>> robbin wrote:
>>> Another problem:
>>> Now I've Known your means , and I used the follwoing way to get an
>>> IProject Object
>>> IProject project =
>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>> But I don't know how to convert a java file under this
>>> Project("stupid") to an IFile type, Is the following right?
>>> IFile ifile = project.getFile("xxxx .java")
>>> Thank you !
>>>
>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>> news:fgujlh$hhn$1@build.eclipse.org...
>>>> If the file is not in workspace, in general, AFAIK, you cannot use
>>>> IType.
>>>>
>>>> Best regards
>>>> Yves YANG
>>>> ---
>>>> http://www.soyatec.com/eface
>>>>
>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>> news:fgttqa$sto$1@build.eclipse.org...
>>>>> I don't know how to create a IProject ,as I know there's one way to
>>>>> create it :
>>>>> IProject project =
>>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>>> IJavaProject javaProject = JavaCore.create(project);But there's a
>>>>> new problem ,my java file is only a java file ,not in any Eclipse
>>>>> Project.So what should I do?Thank you!"Yves YANG"
>>>>> <yves.yang@soyatec.com> wrote in message
>>>>> news:fgtkfn$hk0$1@build.eclipse.org...
>>>>>> This question is about JDT. You need know JDT and Eclipse. The main
>>>>>> path is to get IProject and convert it to IJavaProject by
>>>>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>>>>> method findType() of IJavaProject.
>>>>>>
>>>>>> Regards
>>>>>> Yves YANG
>>>>>> ---
>>>>>> http://www.soyatec.com/eface
>>>>>>
>>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>>>>> Hi:
>>>>>>> I'm confusing in the following problems:
>>>>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>>>>> String Objecet.But I want to analyze it to know the methods and
>>>>>>> fields in this java file ,just like the Java Refelction Mechanism.
>>>>>>> And I found that in eclipse there's an type called "IType" could
>>>>>>> do this thing,but I
>>>>>>> don't know how to establish such an IType object and set the
>>>>>>> data(String object) to it.Please help me ,or give me some other
>>>>>>> suggestions to this subject!
>>>>>>> Thank you!
>>>>>>> robbin
>>>>>>> from China
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>


--------------090509050601010401000305
Content-Type: text/html; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-2022-JP"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Robbin,<br>
<br>
Here's an answer to a different question I posted in the platform
newsgroup:<br>
<blockquote>You can use ResourcesPlugin.getWorkspace().getRoot() to get
the root IContainer for the whole workspace.&nbsp; You could use
IWorkspaceRoot.getProjects(), to get all the projects, which are also
IContainers. And generally you can use IContainer.members(), to
recursively walk the tree.&nbsp; Given an IResource, you can use getType to
figure out what kind it is.&nbsp; You can use
IResource.accept(IResourceVisitor,...) to visit resources.
<br>
</blockquote>
<br>
robbin wrote:
<blockquote cite="mid:fh15ql$jrj$1@build.eclipse.org" type="cite">Ed
Merks:
<br>
&nbsp;Thanks for the last answer.
<br>
&nbsp; Now I want to get all the files under a project,because I want to use
the method "project.getFile(path)" to get a IFile Type.
<br>
&nbsp; So how to get the path?(
<br>
Assume that I don't know any files under the current project ,but I
want to use method to get all the files and its full path like
"src/.../.../xxx.java")
<br>
<br>
"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:fgv291$ar$1@build.eclipse.org">news:fgv291$ar$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">Robbin,
<br>
<br>
Yes, but beware that this is a file handle object so you might find
that
<br>
project.getFile("xxx.java").exists() is false. Keep in mind that you
<br>
might want to use project.getFile(new Path("src/com/example/xxx.java"))
<br>
instead and that you still need to check for exists. The findMember
<br>
methods will return null if the member doesn't exist, but in that case
<br>
you have to determine wither it's a file or a folder.
<br>
<br>
<br>
robbin wrote:
<br>
<blockquote type="cite">Another problem:
<br>
Now I've Known your means , and I used the follwoing way to get an
<br>
IProject Object
<br>
IProject project =
<br>
ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
<br>
But I don't know how to convert a java file under this
<br>
Project("stupid") to an IFile type, Is the following right?
<br>
IFile ifile = project.getFile("xxxx .java")
<br>
Thank you !
<br>
<br>
"Yves YANG" <a class="moz-txt-link-rfc2396E" href="mailto:yves.yang@soyatec.com">&lt;yves.yang@soyatec.com&gt;</a> wrote in message
<br>
<a class="moz-txt-link-freetext" href="news:fgujlh$hhn$1@build.eclipse.org">news:fgujlh$hhn$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">If the file is not in workspace, in
general, AFAIK, you cannot use
<br>
IType.
<br>
<br>
Best regards
<br>
Yves YANG
<br>
---
<br>
<a class="moz-txt-link-freetext" href="http://www.soyatec.com/eface">http://www.soyatec.com/eface</a>
<br>
<br>
"robbin" <a class="moz-txt-link-rfc2396E" href="mailto:lgw198412@gmail.com">&lt;lgw198412@gmail.com&gt;</a> wrote in message
<br>
<a class="moz-txt-link-freetext" href="news:fgttqa$sto$1@build.eclipse.org">news:fgttqa$sto$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">I don't know how to create a IProject
,as I know there's one way to
<br>
create it :
<br>
IProject project =
<br>
ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
<br>
IJavaProject javaProject = JavaCore.create(project);But there's a
<br>
new problem ,my java file is only a java file ,not in any Eclipse
<br>
Project.So what should I do?Thank you!"Yves YANG"
<br>
<a class="moz-txt-link-rfc2396E" href="mailto:yves.yang@soyatec.com">&lt;yves.yang@soyatec.com&gt;</a> wrote in message
<br>
<a class="moz-txt-link-freetext" href="news:fgtkfn$hk0$1@build.eclipse.org">news:fgtkfn$hk0$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">This question is about JDT. You need
know JDT and Eclipse. The main
<br>
path is to get IProject and convert it to IJavaProject by
<br>
JavaCore.getCore.createProject(IProject). And then you can use the
<br>
method findType() of IJavaProject.
<br>
<br>
Regards
<br>
Yves YANG
<br>
---
<br>
<a class="moz-txt-link-freetext" href="http://www.soyatec.com/eface">http://www.soyatec.com/eface</a>
<br>
<br>
"robbin" <a class="moz-txt-link-rfc2396E" href="mailto:lgw198412@gmail.com">&lt;lgw198412@gmail.com&gt;</a> wrote in message
<br>
<a class="moz-txt-link-freetext" href="news:fgrs0o$86i$1@build.eclipse.org">news:fgrs0o$86i$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">Hi:
<br>
I'm confusing in the following problems:
<br>
There's a java file ,I can use Java I/O Stream to read it into a
<br>
String Objecet.But I want to analyze it to know the methods and
<br>
fields in this java file ,just like the Java Refelction Mechanism.
<br>
And I found that in eclipse there's an type called "IType" could
<br>
do this thing,but I
<br>
don't know how to establish such an IType object and set the
<br>
data(String object) to it.Please help me ,or give me some other
<br>
suggestions to this subject!
<br>
Thank you!
<br>
robbin
<br>
from China
<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>

--------------090509050601010401000305--
Re: How to Convert a java file to "IType" ? [message #143004 is a reply to message #142954] Sun, 11 November 2007 13:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

IResource[] resources = myProject.members();

for(int i =0;i<resources.length;i++){
if(resources[i].getType()==IResource.FOLDER){
IResourceProxyVisitor visitor = new IResourceProxyVisitor(){
public boolean visit( IResourceProxy proxy){
proxy.requestResource();
return true;
};
};
resources[i].accept(visitor,IResource.NONE);
}
}
My code is Above.
I don't know how to traversing the tree under the resources[i]?

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:fh1jb9$jqa$1@build.eclipse.org...
> Robbin,
>
> Here's an answer to a different question I posted in the platform
> newsgroup:
>
> You can use ResourcesPlugin.getWorkspace().getRoot() to get the root
> IContainer for the whole workspace. You could use
> IWorkspaceRoot.getProjects(), to get all the projects, which are
> also IContainers. And generally you can use IContainer.members(), to
> recursively walk the tree. Given an IResource, you can use getType
> to figure out what kind it is. You can use
> IResource.accept(IResourceVisitor,...) to visit resources.
>
>
> robbin wrote:
>> Ed Merks:
>> Thanks for the last answer.
>> Now I want to get all the files under a project,because I want to use
>> the method "project.getFile(path)" to get a IFile Type.
>> So how to get the path?(
>> Assume that I don't know any files under the current project ,but I
>> want to use method to get all the files and its full path like
>> "src/.../.../xxx.java")
>>
>> "Ed Merks" <merks@ca.ibm.com> wrote in message
>> news:fgv291$ar$1@build.eclipse.org...
>>> Robbin,
>>>
>>> Yes, but beware that this is a file handle object so you might find that
>>> project.getFile("xxx.java").exists() is false. Keep in mind that you
>>> might want to use project.getFile(new Path("src/com/example/xxx.java"))
>>> instead and that you still need to check for exists. The findMember
>>> methods will return null if the member doesn't exist, but in that case
>>> you have to determine wither it's a file or a folder.
>>>
>>>
>>> robbin wrote:
>>>> Another problem:
>>>> Now I've Known your means , and I used the follwoing way to get an
>>>> IProject Object
>>>> IProject project =
>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>> But I don't know how to convert a java file under this
>>>> Project("stupid") to an IFile type, Is the following right?
>>>> IFile ifile = project.getFile("xxxx .java")
>>>> Thank you !
>>>>
>>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>>> news:fgujlh$hhn$1@build.eclipse.org...
>>>>> If the file is not in workspace, in general, AFAIK, you cannot use
>>>>> IType.
>>>>>
>>>>> Best regards
>>>>> Yves YANG
>>>>> ---
>>>>> http://www.soyatec.com/eface
>>>>>
>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>> news:fgttqa$sto$1@build.eclipse.org...
>>>>>> I don't know how to create a IProject ,as I know there's one way to
>>>>>> create it :
>>>>>> IProject project =
>>>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>>>> IJavaProject javaProject = JavaCore.create(project);But there's a
>>>>>> new problem ,my java file is only a java file ,not in any Eclipse
>>>>>> Project.So what should I do?Thank you!"Yves YANG"
>>>>>> <yves.yang@soyatec.com> wrote in message
>>>>>> news:fgtkfn$hk0$1@build.eclipse.org...
>>>>>>> This question is about JDT. You need know JDT and Eclipse. The main
>>>>>>> path is to get IProject and convert it to IJavaProject by
>>>>>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>>>>>> method findType() of IJavaProject.
>>>>>>>
>>>>>>> Regards
>>>>>>> Yves YANG
>>>>>>> ---
>>>>>>> http://www.soyatec.com/eface
>>>>>>>
>>>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>>>>>> Hi:
>>>>>>>> I'm confusing in the following problems:
>>>>>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>>>>>> String Objecet.But I want to analyze it to know the methods and
>>>>>>>> fields in this java file ,just like the Java Refelction Mechanism.
>>>>>>>> And I found that in eclipse there's an type called "IType" could
>>>>>>>> do this thing,but I
>>>>>>>> don't know how to establish such an IType object and set the
>>>>>>>> data(String object) to it.Please help me ,or give me some other
>>>>>>>> suggestions to this subject!
>>>>>>>> Thank you!
>>>>>>>> robbin
>>>>>>>> from China
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
>
Re: How to Convert a java file to "IType" ? [message #143016 is a reply to message #143004] Sun, 11 November 2007 13:44 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Robbin,

Doesn't it strike you that IResource.NONE might well not be a good flag
to use? Don't you want to specify a flag for the type of resource you
want to visit?

I would suggest you ask general question on the platform or newcomers
newsgroup. I won't answer your non-VE questions on this newsgroup anymore.


robbin wrote:
>
> IResource[] resources = myProject.members();
>
> for(int i =0;i<resources.length;i++){
> if(resources[i].getType()==IResource.FOLDER){
> IResourceProxyVisitor visitor = new IResourceProxyVisitor(){
> public boolean visit( IResourceProxy proxy){
> proxy.requestResource();
> return true;
> };
> };
> resources[i].accept(visitor,IResource.NONE);
> }
> }
> My code is Above.
> I don't know how to traversing the tree under the resources[i]?
>
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:fh1jb9$jqa$1@build.eclipse.org...
>> Robbin,
>>
>> Here's an answer to a different question I posted in the platform
>> newsgroup:
>>
>> You can use ResourcesPlugin.getWorkspace().getRoot() to get the root
>> IContainer for the whole workspace. You could use
>> IWorkspaceRoot.getProjects(), to get all the projects, which are
>> also IContainers. And generally you can use IContainer.members(), to
>> recursively walk the tree. Given an IResource, you can use getType
>> to figure out what kind it is. You can use
>> IResource.accept(IResourceVisitor,...) to visit resources.
>>
>>
>> robbin wrote:
>>> Ed Merks:
>>> Thanks for the last answer.
>>> Now I want to get all the files under a project,because I want to use
>>> the method "project.getFile(path)" to get a IFile Type.
>>> So how to get the path?(
>>> Assume that I don't know any files under the current project ,but I
>>> want to use method to get all the files and its full path like
>>> "src/.../.../xxx.java")
>>>
>>> "Ed Merks" <merks@ca.ibm.com> wrote in message
>>> news:fgv291$ar$1@build.eclipse.org...
>>>> Robbin,
>>>>
>>>> Yes, but beware that this is a file handle object so you might find
>>>> that
>>>> project.getFile("xxx.java").exists() is false. Keep in mind that you
>>>> might want to use project.getFile(new
>>>> Path("src/com/example/xxx.java"))
>>>> instead and that you still need to check for exists. The findMember
>>>> methods will return null if the member doesn't exist, but in that case
>>>> you have to determine wither it's a file or a folder.
>>>>
>>>>
>>>> robbin wrote:
>>>>> Another problem:
>>>>> Now I've Known your means , and I used the follwoing way to get an
>>>>> IProject Object
>>>>> IProject project =
>>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>>> But I don't know how to convert a java file under this
>>>>> Project("stupid") to an IFile type, Is the following right?
>>>>> IFile ifile = project.getFile("xxxx .java")
>>>>> Thank you !
>>>>>
>>>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>>>> news:fgujlh$hhn$1@build.eclipse.org...
>>>>>> If the file is not in workspace, in general, AFAIK, you cannot use
>>>>>> IType.
>>>>>>
>>>>>> Best regards
>>>>>> Yves YANG
>>>>>> ---
>>>>>> http://www.soyatec.com/eface
>>>>>>
>>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>>> news:fgttqa$sto$1@build.eclipse.org...
>>>>>>> I don't know how to create a IProject ,as I know there's one way to
>>>>>>> create it :
>>>>>>> IProject project =
>>>>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>>>>> IJavaProject javaProject = JavaCore.create(project);But there's a
>>>>>>> new problem ,my java file is only a java file ,not in any Eclipse
>>>>>>> Project.So what should I do?Thank you!"Yves YANG"
>>>>>>> <yves.yang@soyatec.com> wrote in message
>>>>>>> news:fgtkfn$hk0$1@build.eclipse.org...
>>>>>>>> This question is about JDT. You need know JDT and Eclipse. The
>>>>>>>> main
>>>>>>>> path is to get IProject and convert it to IJavaProject by
>>>>>>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>>>>>>> method findType() of IJavaProject.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Yves YANG
>>>>>>>> ---
>>>>>>>> http://www.soyatec.com/eface
>>>>>>>>
>>>>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>>>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>>>>>>> Hi:
>>>>>>>>> I'm confusing in the following problems:
>>>>>>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>>>>>>> String Objecet.But I want to analyze it to know the methods and
>>>>>>>>> fields in this java file ,just like the Java Refelction
>>>>>>>>> Mechanism.
>>>>>>>>> And I found that in eclipse there's an type called "IType" could
>>>>>>>>> do this thing,but I
>>>>>>>>> don't know how to establish such an IType object and set the
>>>>>>>>> data(String object) to it.Please help me ,or give me some other
>>>>>>>>> suggestions to this subject!
>>>>>>>>> Thank you!
>>>>>>>>> robbin
>>>>>>>>> from China
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>
Re: How to Convert a java file to "IType" ? [message #616852 is a reply to message #142775] Thu, 08 November 2007 00:15 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
This question is about JDT. You need know JDT and Eclipse. The main path is
to get IProject and convert it to IJavaProject by
JavaCore.getCore.createProject(IProject). And then you can use the method
findType() of IJavaProject.

Regards
Yves YANG
---
http://www.soyatec.com/eface

"robbin" <lgw198412@gmail.com> wrote in message
news:fgrs0o$86i$1@build.eclipse.org...
> Hi:
> I'm confusing in the following problems:
> There's a java file ,I can use Java I/O Stream to read it into a String
> Objecet.But I want to analyze it to know the methods and fields in this
> java file ,just like the Java Refelction Mechanism. And I found that in
> eclipse there's an type called "IType" could do this thing,but I
> don't know how to establish such an IType object and set the data(String
> object) to it.Please help me ,or give me some other suggestions to this
> subject!
> Thank you!
> robbin
> from China
Re: How to Convert a java file to "IType" ? [message #616855 is a reply to message #142786] Thu, 08 November 2007 02:55 Go to previous message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

I don't know how to create a IProject ,as I know there's one way to create
it :
IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
IJavaProject javaProject = JavaCore.create(project);But there's a new
problem ,my java file is only a java file ,not in any Eclipse Project.So
what should I do?Thank you!"Yves YANG" <yves.yang@soyatec.com> wrote in
message news:fgtkfn$hk0$1@build.eclipse.org...
> This question is about JDT. You need know JDT and Eclipse. The main path
> is to get IProject and convert it to IJavaProject by
> JavaCore.getCore.createProject(IProject). And then you can use the method
> findType() of IJavaProject.
>
> Regards
> Yves YANG
> ---
> http://www.soyatec.com/eface
>
> "robbin" <lgw198412@gmail.com> wrote in message
> news:fgrs0o$86i$1@build.eclipse.org...
>> Hi:
>> I'm confusing in the following problems:
>> There's a java file ,I can use Java I/O Stream to read it into a String
>> Objecet.But I want to analyze it to know the methods and fields in this
>> java file ,just like the Java Refelction Mechanism. And I found that in
>> eclipse there's an type called "IType" could do this thing,but I
>> don't know how to establish such an IType object and set the data(String
>> object) to it.Please help me ,or give me some other suggestions to this
>> subject!
>> Thank you!
>> robbin
>> from China
>
>
Re: How to Convert a java file to "IType" ? [message #616856 is a reply to message #142813] Thu, 08 November 2007 09:08 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
If the file is not in workspace, in general, AFAIK, you cannot use IType.

Best regards
Yves YANG
---
http://www.soyatec.com/eface

"robbin" <lgw198412@gmail.com> wrote in message
news:fgttqa$sto$1@build.eclipse.org...
>I don't know how to create a IProject ,as I know there's one way to create
>it :
> IProject project =
> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
> IJavaProject javaProject = JavaCore.create(project);But there's a new
> problem ,my java file is only a java file ,not in any Eclipse Project.So
> what should I do?Thank you!"Yves YANG" <yves.yang@soyatec.com> wrote in
> message news:fgtkfn$hk0$1@build.eclipse.org...
>> This question is about JDT. You need know JDT and Eclipse. The main path
>> is to get IProject and convert it to IJavaProject by
>> JavaCore.getCore.createProject(IProject). And then you can use the method
>> findType() of IJavaProject.
>>
>> Regards
>> Yves YANG
>> ---
>> http://www.soyatec.com/eface
>>
>> "robbin" <lgw198412@gmail.com> wrote in message
>> news:fgrs0o$86i$1@build.eclipse.org...
>>> Hi:
>>> I'm confusing in the following problems:
>>> There's a java file ,I can use Java I/O Stream to read it into a
>>> String Objecet.But I want to analyze it to know the methods and fields
>>> in this java file ,just like the Java Refelction Mechanism. And I found
>>> that in eclipse there's an type called "IType" could do this thing,but I
>>> don't know how to establish such an IType object and set the data(String
>>> object) to it.Please help me ,or give me some other suggestions to this
>>> subject!
>>> Thank you!
>>> robbin
>>> from China
>>
>>
>
Re: How to Convert a java file to "IType" ? [message #616857 is a reply to message #142823] Thu, 08 November 2007 10:23 Go to previous message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

Thank You Very Much!
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:fgujlh$hhn$1@build.eclipse.org...
> If the file is not in workspace, in general, AFAIK, you cannot use IType.
>
> Best regards
> Yves YANG
> ---
> http://www.soyatec.com/eface
>
> "robbin" <lgw198412@gmail.com> wrote in message
> news:fgttqa$sto$1@build.eclipse.org...
>>I don't know how to create a IProject ,as I know there's one way to create
>>it :
>> IProject project =
>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>> IJavaProject javaProject = JavaCore.create(project);But there's a new
>> problem ,my java file is only a java file ,not in any Eclipse Project.So
>> what should I do?Thank you!"Yves YANG" <yves.yang@soyatec.com> wrote in
>> message news:fgtkfn$hk0$1@build.eclipse.org...
>>> This question is about JDT. You need know JDT and Eclipse. The main path
>>> is to get IProject and convert it to IJavaProject by
>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>> method findType() of IJavaProject.
>>>
>>> Regards
>>> Yves YANG
>>> ---
>>> http://www.soyatec.com/eface
>>>
>>> "robbin" <lgw198412@gmail.com> wrote in message
>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>> Hi:
>>>> I'm confusing in the following problems:
>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>> String Objecet.But I want to analyze it to know the methods and fields
>>>> in this java file ,just like the Java Refelction Mechanism. And I found
>>>> that in eclipse there's an type called "IType" could do this thing,but
>>>> I
>>>> don't know how to establish such an IType object and set the
>>>> data(String object) to it.Please help me ,or give me some other
>>>> suggestions to this subject!
>>>> Thank you!
>>>> robbin
>>>> from China
>>>
>>>
>>
>
>
Re: How to Convert a java file to "IType" ? [message #616858 is a reply to message #142823] Thu, 08 November 2007 10:53 Go to previous message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

Another problem:
Now I've Known your means , and I used the follwoing way to get an IProject
Object
IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
But I don't know how to convert a java file under this Project("stupid") to
an IFile type, Is the following right?
IFile ifile = project.getFile("xxxx .java")
Thank you !

"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:fgujlh$hhn$1@build.eclipse.org...
> If the file is not in workspace, in general, AFAIK, you cannot use IType.
>
> Best regards
> Yves YANG
> ---
> http://www.soyatec.com/eface
>
> "robbin" <lgw198412@gmail.com> wrote in message
> news:fgttqa$sto$1@build.eclipse.org...
>>I don't know how to create a IProject ,as I know there's one way to create
>>it :
>> IProject project =
>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>> IJavaProject javaProject = JavaCore.create(project);But there's a new
>> problem ,my java file is only a java file ,not in any Eclipse Project.So
>> what should I do?Thank you!"Yves YANG" <yves.yang@soyatec.com> wrote in
>> message news:fgtkfn$hk0$1@build.eclipse.org...
>>> This question is about JDT. You need know JDT and Eclipse. The main path
>>> is to get IProject and convert it to IJavaProject by
>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>> method findType() of IJavaProject.
>>>
>>> Regards
>>> Yves YANG
>>> ---
>>> http://www.soyatec.com/eface
>>>
>>> "robbin" <lgw198412@gmail.com> wrote in message
>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>> Hi:
>>>> I'm confusing in the following problems:
>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>> String Objecet.But I want to analyze it to know the methods and fields
>>>> in this java file ,just like the Java Refelction Mechanism. And I found
>>>> that in eclipse there's an type called "IType" could do this thing,but
>>>> I
>>>> don't know how to establish such an IType object and set the
>>>> data(String object) to it.Please help me ,or give me some other
>>>> suggestions to this subject!
>>>> Thank you!
>>>> robbin
>>>> from China
>>>
>>>
>>
>
>
Re: How to Convert a java file to "IType" ? [message #616859 is a reply to message #142843] Thu, 08 November 2007 13:17 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Robbin,

Yes, but beware that this is a file handle object so you might find that
project.getFile("xxx.java").exists() is false. Keep in mind that you
might want to use project.getFile(new Path("src/com/example/xxx.java"))
instead and that you still need to check for exists. The findMember
methods will return null if the member doesn't exist, but in that case
you have to determine wither it's a file or a folder.


robbin wrote:
> Another problem:
> Now I've Known your means , and I used the follwoing way to get an
> IProject Object
> IProject project =
> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
> But I don't know how to convert a java file under this
> Project("stupid") to an IFile type, Is the following right?
> IFile ifile = project.getFile("xxxx .java")
> Thank you !
>
> "Yves YANG" <yves.yang@soyatec.com> wrote in message
> news:fgujlh$hhn$1@build.eclipse.org...
>> If the file is not in workspace, in general, AFAIK, you cannot use
>> IType.
>>
>> Best regards
>> Yves YANG
>> ---
>> http://www.soyatec.com/eface
>>
>> "robbin" <lgw198412@gmail.com> wrote in message
>> news:fgttqa$sto$1@build.eclipse.org...
>>> I don't know how to create a IProject ,as I know there's one way to
>>> create it :
>>> IProject project =
>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>> IJavaProject javaProject = JavaCore.create(project);But there's a
>>> new problem ,my java file is only a java file ,not in any Eclipse
>>> Project.So what should I do?Thank you!"Yves YANG"
>>> <yves.yang@soyatec.com> wrote in message
>>> news:fgtkfn$hk0$1@build.eclipse.org...
>>>> This question is about JDT. You need know JDT and Eclipse. The main
>>>> path is to get IProject and convert it to IJavaProject by
>>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>>> method findType() of IJavaProject.
>>>>
>>>> Regards
>>>> Yves YANG
>>>> ---
>>>> http://www.soyatec.com/eface
>>>>
>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>>> Hi:
>>>>> I'm confusing in the following problems:
>>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>>> String Objecet.But I want to analyze it to know the methods and
>>>>> fields in this java file ,just like the Java Refelction Mechanism.
>>>>> And I found that in eclipse there's an type called "IType" could
>>>>> do this thing,but I
>>>>> don't know how to establish such an IType object and set the
>>>>> data(String object) to it.Please help me ,or give me some other
>>>>> suggestions to this subject!
>>>>> Thank you!
>>>>> robbin
>>>>> from China
>>>>
>>>>
>>>
>>
>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to Convert a java file to "IType" ? [message #616864 is a reply to message #142853] Fri, 09 November 2007 08:30 Go to previous message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

Ed Merks:
Thanks for the last answer.
Now I want to get all the files under a project,because I want to use the
method "project.getFile(path)" to get a IFile Type.
So how to get the path?(
Assume that I don't know any files under the current project ,but I want to
use method to get all the files and its full path like
"src/.../.../xxx.java")

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:fgv291$ar$1@build.eclipse.org...
> Robbin,
>
> Yes, but beware that this is a file handle object so you might find that
> project.getFile("xxx.java").exists() is false. Keep in mind that you
> might want to use project.getFile(new Path("src/com/example/xxx.java"))
> instead and that you still need to check for exists. The findMember
> methods will return null if the member doesn't exist, but in that case
> you have to determine wither it's a file or a folder.
>
>
> robbin wrote:
>> Another problem:
>> Now I've Known your means , and I used the follwoing way to get an
>> IProject Object
>> IProject project =
>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>> But I don't know how to convert a java file under this
>> Project("stupid") to an IFile type, Is the following right?
>> IFile ifile = project.getFile("xxxx .java")
>> Thank you !
>>
>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>> news:fgujlh$hhn$1@build.eclipse.org...
>>> If the file is not in workspace, in general, AFAIK, you cannot use
>>> IType.
>>>
>>> Best regards
>>> Yves YANG
>>> ---
>>> http://www.soyatec.com/eface
>>>
>>> "robbin" <lgw198412@gmail.com> wrote in message
>>> news:fgttqa$sto$1@build.eclipse.org...
>>>> I don't know how to create a IProject ,as I know there's one way to
>>>> create it :
>>>> IProject project =
>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>> IJavaProject javaProject = JavaCore.create(project);But there's a
>>>> new problem ,my java file is only a java file ,not in any Eclipse
>>>> Project.So what should I do?Thank you!"Yves YANG"
>>>> <yves.yang@soyatec.com> wrote in message
>>>> news:fgtkfn$hk0$1@build.eclipse.org...
>>>>> This question is about JDT. You need know JDT and Eclipse. The main
>>>>> path is to get IProject and convert it to IJavaProject by
>>>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>>>> method findType() of IJavaProject.
>>>>>
>>>>> Regards
>>>>> Yves YANG
>>>>> ---
>>>>> http://www.soyatec.com/eface
>>>>>
>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>>>> Hi:
>>>>>> I'm confusing in the following problems:
>>>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>>>> String Objecet.But I want to analyze it to know the methods and
>>>>>> fields in this java file ,just like the Java Refelction Mechanism.
>>>>>> And I found that in eclipse there's an type called "IType" could
>>>>>> do this thing,but I
>>>>>> don't know how to establish such an IType object and set the
>>>>>> data(String object) to it.Please help me ,or give me some other
>>>>>> suggestions to this subject!
>>>>>> Thank you!
>>>>>> robbin
>>>>>> from China
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
Re: How to Convert a java file to "IType" ? [message #616869 is a reply to message #142900] Fri, 09 November 2007 12:20 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090509050601010401000305
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit

Robbin,

Here's an answer to a different question I posted in the platform newsgroup:

You can use ResourcesPlugin.getWorkspace().getRoot() to get the root
IContainer for the whole workspace. You could use
IWorkspaceRoot.getProjects(), to get all the projects, which are
also IContainers. And generally you can use IContainer.members(), to
recursively walk the tree. Given an IResource, you can use getType
to figure out what kind it is. You can use
IResource.accept(IResourceVisitor,...) to visit resources.


robbin wrote:
> Ed Merks:
> Thanks for the last answer.
> Now I want to get all the files under a project,because I want to use
> the method "project.getFile(path)" to get a IFile Type.
> So how to get the path?(
> Assume that I don't know any files under the current project ,but I
> want to use method to get all the files and its full path like
> "src/.../.../xxx.java")
>
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:fgv291$ar$1@build.eclipse.org...
>> Robbin,
>>
>> Yes, but beware that this is a file handle object so you might find that
>> project.getFile("xxx.java").exists() is false. Keep in mind that you
>> might want to use project.getFile(new Path("src/com/example/xxx.java"))
>> instead and that you still need to check for exists. The findMember
>> methods will return null if the member doesn't exist, but in that case
>> you have to determine wither it's a file or a folder.
>>
>>
>> robbin wrote:
>>> Another problem:
>>> Now I've Known your means , and I used the follwoing way to get an
>>> IProject Object
>>> IProject project =
>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>> But I don't know how to convert a java file under this
>>> Project("stupid") to an IFile type, Is the following right?
>>> IFile ifile = project.getFile("xxxx .java")
>>> Thank you !
>>>
>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>> news:fgujlh$hhn$1@build.eclipse.org...
>>>> If the file is not in workspace, in general, AFAIK, you cannot use
>>>> IType.
>>>>
>>>> Best regards
>>>> Yves YANG
>>>> ---
>>>> http://www.soyatec.com/eface
>>>>
>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>> news:fgttqa$sto$1@build.eclipse.org...
>>>>> I don't know how to create a IProject ,as I know there's one way to
>>>>> create it :
>>>>> IProject project =
>>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>>> IJavaProject javaProject = JavaCore.create(project);But there's a
>>>>> new problem ,my java file is only a java file ,not in any Eclipse
>>>>> Project.So what should I do?Thank you!"Yves YANG"
>>>>> <yves.yang@soyatec.com> wrote in message
>>>>> news:fgtkfn$hk0$1@build.eclipse.org...
>>>>>> This question is about JDT. You need know JDT and Eclipse. The main
>>>>>> path is to get IProject and convert it to IJavaProject by
>>>>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>>>>> method findType() of IJavaProject.
>>>>>>
>>>>>> Regards
>>>>>> Yves YANG
>>>>>> ---
>>>>>> http://www.soyatec.com/eface
>>>>>>
>>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>>>>> Hi:
>>>>>>> I'm confusing in the following problems:
>>>>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>>>>> String Objecet.But I want to analyze it to know the methods and
>>>>>>> fields in this java file ,just like the Java Refelction Mechanism.
>>>>>>> And I found that in eclipse there's an type called "IType" could
>>>>>>> do this thing,but I
>>>>>>> don't know how to establish such an IType object and set the
>>>>>>> data(String object) to it.Please help me ,or give me some other
>>>>>>> suggestions to this subject!
>>>>>>> Thank you!
>>>>>>> robbin
>>>>>>> from China
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>


--------------090509050601010401000305
Content-Type: text/html; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-2022-JP"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Robbin,<br>
<br>
Here's an answer to a different question I posted in the platform
newsgroup:<br>
<blockquote>You can use ResourcesPlugin.getWorkspace().getRoot() to get
the root IContainer for the whole workspace.&nbsp; You could use
IWorkspaceRoot.getProjects(), to get all the projects, which are also
IContainers. And generally you can use IContainer.members(), to
recursively walk the tree.&nbsp; Given an IResource, you can use getType to
figure out what kind it is.&nbsp; You can use
IResource.accept(IResourceVisitor,...) to visit resources.
<br>
</blockquote>
<br>
robbin wrote:
<blockquote cite="mid:fh15ql$jrj$1@build.eclipse.org" type="cite">Ed
Merks:
<br>
&nbsp;Thanks for the last answer.
<br>
&nbsp; Now I want to get all the files under a project,because I want to use
the method "project.getFile(path)" to get a IFile Type.
<br>
&nbsp; So how to get the path?(
<br>
Assume that I don't know any files under the current project ,but I
want to use method to get all the files and its full path like
"src/.../.../xxx.java")
<br>
<br>
"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:fgv291$ar$1@build.eclipse.org">news:fgv291$ar$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">Robbin,
<br>
<br>
Yes, but beware that this is a file handle object so you might find
that
<br>
project.getFile("xxx.java").exists() is false. Keep in mind that you
<br>
might want to use project.getFile(new Path("src/com/example/xxx.java"))
<br>
instead and that you still need to check for exists. The findMember
<br>
methods will return null if the member doesn't exist, but in that case
<br>
you have to determine wither it's a file or a folder.
<br>
<br>
<br>
robbin wrote:
<br>
<blockquote type="cite">Another problem:
<br>
Now I've Known your means , and I used the follwoing way to get an
<br>
IProject Object
<br>
IProject project =
<br>
ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
<br>
But I don't know how to convert a java file under this
<br>
Project("stupid") to an IFile type, Is the following right?
<br>
IFile ifile = project.getFile("xxxx .java")
<br>
Thank you !
<br>
<br>
"Yves YANG" <a class="moz-txt-link-rfc2396E" href="mailto:yves.yang@soyatec.com">&lt;yves.yang@soyatec.com&gt;</a> wrote in message
<br>
<a class="moz-txt-link-freetext" href="news:fgujlh$hhn$1@build.eclipse.org">news:fgujlh$hhn$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">If the file is not in workspace, in
general, AFAIK, you cannot use
<br>
IType.
<br>
<br>
Best regards
<br>
Yves YANG
<br>
---
<br>
<a class="moz-txt-link-freetext" href="http://www.soyatec.com/eface">http://www.soyatec.com/eface</a>
<br>
<br>
"robbin" <a class="moz-txt-link-rfc2396E" href="mailto:lgw198412@gmail.com">&lt;lgw198412@gmail.com&gt;</a> wrote in message
<br>
<a class="moz-txt-link-freetext" href="news:fgttqa$sto$1@build.eclipse.org">news:fgttqa$sto$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">I don't know how to create a IProject
,as I know there's one way to
<br>
create it :
<br>
IProject project =
<br>
ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
<br>
IJavaProject javaProject = JavaCore.create(project);But there's a
<br>
new problem ,my java file is only a java file ,not in any Eclipse
<br>
Project.So what should I do?Thank you!"Yves YANG"
<br>
<a class="moz-txt-link-rfc2396E" href="mailto:yves.yang@soyatec.com">&lt;yves.yang@soyatec.com&gt;</a> wrote in message
<br>
<a class="moz-txt-link-freetext" href="news:fgtkfn$hk0$1@build.eclipse.org">news:fgtkfn$hk0$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">This question is about JDT. You need
know JDT and Eclipse. The main
<br>
path is to get IProject and convert it to IJavaProject by
<br>
JavaCore.getCore.createProject(IProject). And then you can use the
<br>
method findType() of IJavaProject.
<br>
<br>
Regards
<br>
Yves YANG
<br>
---
<br>
<a class="moz-txt-link-freetext" href="http://www.soyatec.com/eface">http://www.soyatec.com/eface</a>
<br>
<br>
"robbin" <a class="moz-txt-link-rfc2396E" href="mailto:lgw198412@gmail.com">&lt;lgw198412@gmail.com&gt;</a> wrote in message
<br>
<a class="moz-txt-link-freetext" href="news:fgrs0o$86i$1@build.eclipse.org">news:fgrs0o$86i$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">Hi:
<br>
I'm confusing in the following problems:
<br>
There's a java file ,I can use Java I/O Stream to read it into a
<br>
String Objecet.But I want to analyze it to know the methods and
<br>
fields in this java file ,just like the Java Refelction Mechanism.
<br>
And I found that in eclipse there's an type called "IType" could
<br>
do this thing,but I
<br>
don't know how to establish such an IType object and set the
<br>
data(String object) to it.Please help me ,or give me some other
<br>
suggestions to this subject!
<br>
Thank you!
<br>
robbin
<br>
from China
<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>

--------------090509050601010401000305--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to Convert a java file to "IType" ? [message #616874 is a reply to message #142954] Sun, 11 November 2007 13:35 Go to previous message
Eclipse UserFriend
Originally posted by: lgw198412.gmail.com

IResource[] resources = myProject.members();

for(int i =0;i<resources.length;i++){
if(resources[i].getType()==IResource.FOLDER){
IResourceProxyVisitor visitor = new IResourceProxyVisitor(){
public boolean visit( IResourceProxy proxy){
proxy.requestResource();
return true;
};
};
resources[i].accept(visitor,IResource.NONE);
}
}
My code is Above.
I don't know how to traversing the tree under the resources[i]?

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:fh1jb9$jqa$1@build.eclipse.org...
> Robbin,
>
> Here's an answer to a different question I posted in the platform
> newsgroup:
>
> You can use ResourcesPlugin.getWorkspace().getRoot() to get the root
> IContainer for the whole workspace. You could use
> IWorkspaceRoot.getProjects(), to get all the projects, which are
> also IContainers. And generally you can use IContainer.members(), to
> recursively walk the tree. Given an IResource, you can use getType
> to figure out what kind it is. You can use
> IResource.accept(IResourceVisitor,...) to visit resources.
>
>
> robbin wrote:
>> Ed Merks:
>> Thanks for the last answer.
>> Now I want to get all the files under a project,because I want to use
>> the method "project.getFile(path)" to get a IFile Type.
>> So how to get the path?(
>> Assume that I don't know any files under the current project ,but I
>> want to use method to get all the files and its full path like
>> "src/.../.../xxx.java")
>>
>> "Ed Merks" <merks@ca.ibm.com> wrote in message
>> news:fgv291$ar$1@build.eclipse.org...
>>> Robbin,
>>>
>>> Yes, but beware that this is a file handle object so you might find that
>>> project.getFile("xxx.java").exists() is false. Keep in mind that you
>>> might want to use project.getFile(new Path("src/com/example/xxx.java"))
>>> instead and that you still need to check for exists. The findMember
>>> methods will return null if the member doesn't exist, but in that case
>>> you have to determine wither it's a file or a folder.
>>>
>>>
>>> robbin wrote:
>>>> Another problem:
>>>> Now I've Known your means , and I used the follwoing way to get an
>>>> IProject Object
>>>> IProject project =
>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>> But I don't know how to convert a java file under this
>>>> Project("stupid") to an IFile type, Is the following right?
>>>> IFile ifile = project.getFile("xxxx .java")
>>>> Thank you !
>>>>
>>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>>> news:fgujlh$hhn$1@build.eclipse.org...
>>>>> If the file is not in workspace, in general, AFAIK, you cannot use
>>>>> IType.
>>>>>
>>>>> Best regards
>>>>> Yves YANG
>>>>> ---
>>>>> http://www.soyatec.com/eface
>>>>>
>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>> news:fgttqa$sto$1@build.eclipse.org...
>>>>>> I don't know how to create a IProject ,as I know there's one way to
>>>>>> create it :
>>>>>> IProject project =
>>>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>>>> IJavaProject javaProject = JavaCore.create(project);But there's a
>>>>>> new problem ,my java file is only a java file ,not in any Eclipse
>>>>>> Project.So what should I do?Thank you!"Yves YANG"
>>>>>> <yves.yang@soyatec.com> wrote in message
>>>>>> news:fgtkfn$hk0$1@build.eclipse.org...
>>>>>>> This question is about JDT. You need know JDT and Eclipse. The main
>>>>>>> path is to get IProject and convert it to IJavaProject by
>>>>>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>>>>>> method findType() of IJavaProject.
>>>>>>>
>>>>>>> Regards
>>>>>>> Yves YANG
>>>>>>> ---
>>>>>>> http://www.soyatec.com/eface
>>>>>>>
>>>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>>>>>> Hi:
>>>>>>>> I'm confusing in the following problems:
>>>>>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>>>>>> String Objecet.But I want to analyze it to know the methods and
>>>>>>>> fields in this java file ,just like the Java Refelction Mechanism.
>>>>>>>> And I found that in eclipse there's an type called "IType" could
>>>>>>>> do this thing,but I
>>>>>>>> don't know how to establish such an IType object and set the
>>>>>>>> data(String object) to it.Please help me ,or give me some other
>>>>>>>> suggestions to this subject!
>>>>>>>> Thank you!
>>>>>>>> robbin
>>>>>>>> from China
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
>
Re: How to Convert a java file to "IType" ? [message #616875 is a reply to message #143004] Sun, 11 November 2007 13:44 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Robbin,

Doesn't it strike you that IResource.NONE might well not be a good flag
to use? Don't you want to specify a flag for the type of resource you
want to visit?

I would suggest you ask general question on the platform or newcomers
newsgroup. I won't answer your non-VE questions on this newsgroup anymore.


robbin wrote:
>
> IResource[] resources = myProject.members();
>
> for(int i =0;i<resources.length;i++){
> if(resources[i].getType()==IResource.FOLDER){
> IResourceProxyVisitor visitor = new IResourceProxyVisitor(){
> public boolean visit( IResourceProxy proxy){
> proxy.requestResource();
> return true;
> };
> };
> resources[i].accept(visitor,IResource.NONE);
> }
> }
> My code is Above.
> I don't know how to traversing the tree under the resources[i]?
>
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:fh1jb9$jqa$1@build.eclipse.org...
>> Robbin,
>>
>> Here's an answer to a different question I posted in the platform
>> newsgroup:
>>
>> You can use ResourcesPlugin.getWorkspace().getRoot() to get the root
>> IContainer for the whole workspace. You could use
>> IWorkspaceRoot.getProjects(), to get all the projects, which are
>> also IContainers. And generally you can use IContainer.members(), to
>> recursively walk the tree. Given an IResource, you can use getType
>> to figure out what kind it is. You can use
>> IResource.accept(IResourceVisitor,...) to visit resources.
>>
>>
>> robbin wrote:
>>> Ed Merks:
>>> Thanks for the last answer.
>>> Now I want to get all the files under a project,because I want to use
>>> the method "project.getFile(path)" to get a IFile Type.
>>> So how to get the path?(
>>> Assume that I don't know any files under the current project ,but I
>>> want to use method to get all the files and its full path like
>>> "src/.../.../xxx.java")
>>>
>>> "Ed Merks" <merks@ca.ibm.com> wrote in message
>>> news:fgv291$ar$1@build.eclipse.org...
>>>> Robbin,
>>>>
>>>> Yes, but beware that this is a file handle object so you might find
>>>> that
>>>> project.getFile("xxx.java").exists() is false. Keep in mind that you
>>>> might want to use project.getFile(new
>>>> Path("src/com/example/xxx.java"))
>>>> instead and that you still need to check for exists. The findMember
>>>> methods will return null if the member doesn't exist, but in that case
>>>> you have to determine wither it's a file or a folder.
>>>>
>>>>
>>>> robbin wrote:
>>>>> Another problem:
>>>>> Now I've Known your means , and I used the follwoing way to get an
>>>>> IProject Object
>>>>> IProject project =
>>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>>> But I don't know how to convert a java file under this
>>>>> Project("stupid") to an IFile type, Is the following right?
>>>>> IFile ifile = project.getFile("xxxx .java")
>>>>> Thank you !
>>>>>
>>>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>>>> news:fgujlh$hhn$1@build.eclipse.org...
>>>>>> If the file is not in workspace, in general, AFAIK, you cannot use
>>>>>> IType.
>>>>>>
>>>>>> Best regards
>>>>>> Yves YANG
>>>>>> ---
>>>>>> http://www.soyatec.com/eface
>>>>>>
>>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>>> news:fgttqa$sto$1@build.eclipse.org...
>>>>>>> I don't know how to create a IProject ,as I know there's one way to
>>>>>>> create it :
>>>>>>> IProject project =
>>>>>>> ResourcesPlugin.getWorkspace().getRoot().getProject("stupid ");
>>>>>>> IJavaProject javaProject = JavaCore.create(project);But there's a
>>>>>>> new problem ,my java file is only a java file ,not in any Eclipse
>>>>>>> Project.So what should I do?Thank you!"Yves YANG"
>>>>>>> <yves.yang@soyatec.com> wrote in message
>>>>>>> news:fgtkfn$hk0$1@build.eclipse.org...
>>>>>>>> This question is about JDT. You need know JDT and Eclipse. The
>>>>>>>> main
>>>>>>>> path is to get IProject and convert it to IJavaProject by
>>>>>>>> JavaCore.getCore.createProject(IProject). And then you can use the
>>>>>>>> method findType() of IJavaProject.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Yves YANG
>>>>>>>> ---
>>>>>>>> http://www.soyatec.com/eface
>>>>>>>>
>>>>>>>> "robbin" <lgw198412@gmail.com> wrote in message
>>>>>>>> news:fgrs0o$86i$1@build.eclipse.org...
>>>>>>>>> Hi:
>>>>>>>>> I'm confusing in the following problems:
>>>>>>>>> There's a java file ,I can use Java I/O Stream to read it into a
>>>>>>>>> String Objecet.But I want to analyze it to know the methods and
>>>>>>>>> fields in this java file ,just like the Java Refelction
>>>>>>>>> Mechanism.
>>>>>>>>> And I found that in eclipse there's an type called "IType" could
>>>>>>>>> do this thing,but I
>>>>>>>>> don't know how to establish such an IType object and set the
>>>>>>>>> data(String object) to it.Please help me ,or give me some other
>>>>>>>>> suggestions to this subject!
>>>>>>>>> Thank you!
>>>>>>>>> robbin
>>>>>>>>> from China
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Open Source Software Research
Next Topic:Adding feature of control-lock
Goto Forum:
  


Current Time: Thu Mar 28 15:59:18 GMT 2024

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

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

Back to the top