Name of a PackageFragmentRoot [message #41840] |
Wed, 28 May 2003 11:53 |
Eclipse User |
|
|
|
Originally posted by: jmordax.terra.es
Hi, I am trying to develop a Java inspector. The plugin tries to show
all the element of a Java Project.
Using JDT, I am getting inside the Java Project but I have not found a
way to show the nema of the PackageFragmentsRoots of a Java Test Project.
What I have been able is to print its IPath beacuse getElementName
always return "".
Any idea?
Thanks in advance,
Chemi.
|
|
|
|
Re: Name of a PackageFragmentRoot [message #41933 is a reply to message #41840] |
Wed, 28 May 2003 12:13 |
Eclipse User |
|
|
|
Originally posted by: adam_kiezun.ch.ibm.spam.protection.com
> What I have been able is to print its IPath beacuse getElementName
> always return "".
are they archives?
maybe the project itself is a package fragment root
a.
|
|
|
Re: Name of a PackageFragmentRoot [message #41962 is a reply to message #41933] |
Wed, 28 May 2003 12:34 |
Eclipse User |
|
|
|
Originally posted by: jmordax.terra.es
This is a multi-part message in MIME format.
--------------030306050907020605000508
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Yes, I use that method and it returns 21 Package Fragment roots: the
project itself and 20 JAR/ZIP files under Libraries folder.
The Java Project is called MiTest.
And my problem (and question) is: how can I get that name?
getElementName returns "". Currently I am using getPath().toString()
which returns /MiTest
Thanks for your comments,
Chemi.
Adam Kiezun wrote:
>>What I have been able is to print its IPath beacuse getElementName
>>always return "".
>>
>>
>
>are they archives?
>maybe the project itself is a package fragment root
>
>a.
>
>
--------------030306050907020605000508
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
Yes, I use that method and it returns 21 Package Fragment roots: the
project itself and 20 JAR/ZIP files under Libraries folder.<br>
The Java Project is called MiTest.<br>
And my problem (and question) is: how can I get that name?
getElementName returns "". Currently I am using getPath().toString()
which returns /MiTest<br>
<br>
Thanks for your comments,<br>
<br>
Chemi.<br>
<br>
Adam Kiezun wrote:<br>
<blockquote type="cite" cite="midbb295a$qvq$1@rogue.oti.com">
<blockquote type="cite">
<pre wrap="">What I have been able is to print its IPath beacuse getElementName
always return "".
</pre>
</blockquote>
<pre wrap=""><!---->
are they archives?
maybe the project itself is a package fragment root
a.
</pre>
</blockquote>
</body>
</html>
--------------030306050907020605000508--
|
|
|
Re: Name of a PackageFragmentRoot [message #41994 is a reply to message #41962] |
Wed, 28 May 2003 12:55 |
Eclipse User |
|
|
|
Originally posted by: adam_kiezun.ch.ibm.spam.protection.com
i think you have to do the following:
check if getResource() called on the packageFragmentRoot gives you the project
and if yes, then you know that the project itself is the package fragment root
and return the name of the project in that case
when the project is a package fragment root, then there exist 2 elements - the project and the package fragment root itself
they're not equal (in the sense of equals()) but they really are
looks like the root's name is empty in that case
i think it'd be reasonable to expact that it be of the same name as the project
you could enter a bug report if you wanted (JDT CORE)
cheers
a.
--
eclipse.org
|
|
|
|
Re: Name of a PackageFragmentRoot [message #42663 is a reply to message #42603] |
Thu, 29 May 2003 06:59 |
Eclipse User |
|
|
|
Originally posted by: jmordax.terra.es
This is a multi-part message in MIME format.
--------------040508020205020207000504
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Frank, I didn't setup anything special. I just created a Java Project
and executed my inspection plugin. The result of getting the children of
the Java Project was:
- 1 Package Fragment Root which was the Java Project.
- 20 Package Fragment Roots which were the JAR files in the Library.
I am using Eclipse R2.1
Hope this helps,
Chemi.
Frank Sauer wrote:
>The project itself can be a package fragment root???
>If that is true, I'll have to deal with that in my metrics plugin.
>How do I set up a project with that behavior?
>
>Frank
>
>"Adam Kiezun" <adam_kiezun@ch.ibm.spam.protection.com> wrote in message
>news:bb2bko$tpc$1@rogue.oti.com...
>
>
>>i think you have to do the following:
>>check if getResource() called on the packageFragmentRoot gives you the
>>
>>
>project
>
>
>>and if yes, then you know that the project itself is the package fragment
>>
>>
>root
>
>
>>and return the name of the project in that case
>>
>>when the project is a package fragment root, then there exist 2 elements -
>>
>>
>the project and the package fragment root itself
>
>
>>they're not equal (in the sense of equals()) but they really are
>>looks like the root's name is empty in that case
>>i think it'd be reasonable to expact that it be of the same name as the
>>
>>
>project
>
>
>>you could enter a bug report if you wanted (JDT CORE)
>>
>>cheers
>>a.
>>--
>>eclipse.org
>>
--------------040508020205020207000504
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
Frank, I didn't setup anything special. I just created a Java Project
and executed my inspection plugin. The result of getting the children
of the Java Project was:<br>
<br>
- 1 Package Fragment Root which was the Java Project.<br>
<br>
- 20 Package Fragment Roots which were the JAR files in the Library.<br>
<br>
I am using Eclipse R2.1<br>
<br>
Hope this helps,<br>
<br>
Chemi.<br>
<br>
Frank Sauer wrote:<br>
<blockquote type="cite" cite="midbb3ilp$26e$1@rogue.oti.com">
<pre wrap="">The project itself can be a package fragment root???
If that is true, I'll have to deal with that in my metrics plugin.
How do I set up a project with that behavior?
Frank
"Adam Kiezun" <a class="moz-txt-link-rfc2396E" href="mailto:adam_kiezun@ch.ibm.spam.protection.com"><adam_kiezun@ch.ibm.spam.protection.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:bb2bko$tpc$1@rogue.oti.com">news:bb2bko$tpc$1@rogue.oti.com</a>...
</pre>
<blockquote type="cite">
<pre wrap="">i think you have to do the following:
check if getResource() called on the packageFragmentRoot gives you the
</pre>
</blockquote>
<pre wrap=""><!---->project
</pre>
<blockquote type="cite">
<pre wrap="">and if yes, then you know that the project itself is the package fragment
</pre>
</blockquote>
<pre wrap=""><!---->root
</pre>
<blockquote type="cite">
<pre wrap="">and return the name of the project in that case
when the project is a package fragment root, then there exist 2 elements -
</pre>
</blockquote>
<pre wrap=""><!---->the project and the package fragment root itself
</pre>
<blockquote type="cite">
<pre wrap="">they're not equal (in the sense of equals()) but they really are
looks like the root's name is empty in that case
i think it'd be reasonable to expact that it be of the same name as the
</pre>
</blockquote>
<pre wrap=""><!---->project
</pre>
<blockquote type="cite">
<pre wrap="">you could enter a bug report if you wanted (JDT CORE)
cheers
a.
--
eclipse.org</pre>
</blockquote>
</blockquote>
</body>
</html>
--------------040508020205020207000504--
|
|
|
Re: Name of a PackageFragmentRoot [message #42694 is a reply to message #42603] |
Thu, 29 May 2003 07:01 |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.gmx.net
Frank Sauer wrote:
>The project itself can be a package fragment root???
>
No. If you choose the have no source folders then in the model the
project contains a package fragment root which holds the source for the
project. This package fragment root's resource is the project itself:
pkgFragmentRoot.getResource().getType() == IResource.PROJECT)
As you may have noticed this package fragment root is not shown in the UI.
HTH
Dani
|
|
|
Re: Name of a PackageFragmentRoot [message #47125 is a reply to message #41840] |
Tue, 03 June 2003 08:53 |
Philippe Mulet Messages: 229 Registered: July 2009 |
Senior Member |
|
|
Just some clarification.
Package fragment roots denote classpath entries in the JavaModel. If you
choose to use the project itself as a souce folder, then the project gets a
package fragment root of relative path "" (empty - this is consistent with
default packages for PackageFragments).
When you create a Java project, by default the UI will create such a project
where project==source folder==binary output, you can change this using the
buildpath wizard.
For any element, #getElementName() is the way to go, now for this particular
one, it is indeed highly desirable you'd want to hide it in the UI and
simply show the project instead.
"Chemi" <jmordax@terra.es> wrote in message
news:bb27u1$pqh$1@rogue.oti.com...
> Hi, I am trying to develop a Java inspector. The plugin tries to show
> all the element of a Java Project.
> Using JDT, I am getting inside the Java Project but I have not found a
> way to show the nema of the PackageFragmentsRoots of a Java Test Project.
>
> What I have been able is to print its IPath beacuse getElementName
> always return "".
>
> Any idea?
>
> Thanks in advance,
>
> Chemi.
>
|
|
|
Powered by
FUDForum. Page generated in 0.04100 seconds