Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Name of a PackageFragmentRoot
Name of a PackageFragmentRoot [message #41840] Wed, 28 May 2003 11:53 Go to next message
Eclipse UserFriend
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 #41903 is a reply to message #41840] Wed, 28 May 2003 12:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adam_kiezun.ch.ibm.spam.protection.com

IJavaProject::getPackageFragmentRoots() does not for you?

a.
--
eclipse.org
Re: Name of a PackageFragmentRoot [message #41933 is a reply to message #41840] Wed, 28 May 2003 12:13 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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>
&nbsp;&nbsp;&nbsp; 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 Go to previous messageGo to next message
Eclipse UserFriend
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 #42603 is a reply to message #41994] Wed, 28 May 2003 23:56 Go to previous messageGo to next message
Frank Sauer is currently offline Frank SauerFriend
Messages: 36
Registered: July 2009
Member
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
>
>
>
Re: Name of a PackageFragmentRoot [message #42663 is a reply to message #42603] Thu, 29 May 2003 06:59 Go to previous messageGo to next message
Eclipse UserFriend
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>
&nbsp;&nbsp;&nbsp; - 1 Package Fragment Root which was the Java Project.<br>
<br>
&nbsp;&nbsp;&nbsp; - 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>
&nbsp;&nbsp;&nbsp; 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">&lt;adam_kiezun@ch.ibm.spam.protection.com&gt;</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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Philippe Mulet is currently offline Philippe MuletFriend
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.
>
Previous Topic:HELP: Eclipse with JSR14
Next Topic:Adding JRE container to classpath?
Goto Forum:
  


Current Time: Thu Dec 26 16:11:33 GMT 2024

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

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

Back to the top