Bug 128258 - Project name of java elements from external file is _E_X_T_E_R_N_A_L_P_R_O_J_E_C_T_
Summary: Project name of java elements from external file is _E_X_T_E_R_N_A_L_P_R_O_J_...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-16 12:16 EST by Markus Keller CLA
Modified: 2006-03-28 04:12 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2006-02-16 12:16:07 EST
I20060216-0010

- open a java file from the CVS Repositories view
- select two members in the Outline
- choose Compare With > Each Other...

The element names are rendered with postfix _E_X_T_E_R_N_A_L_P_R_O_J_E_C_T_
Comment 1 Markus Keller CLA 2006-02-16 12:31:12 EST
It's even worse: the project name is also rendered in the status line when an element from the Outline is selected.
Comment 2 Dani Megert CLA 2006-02-16 12:53:07 EST
Could you set the project name to ""?
Comment 3 Jerome Lanneluc CLA 2006-02-16 13:00:56 EST
Unfortunately the project name has to contain at least 1 character as this is needed for the IPath manipulations.
Comment 4 Dani Megert CLA 2006-02-23 10:01:36 EST
Jerome,

the problem for resolving this on our/client side is that we do not know whether a project is external. There's no API to test this and exists() is not good enough since closed project also return false on exists().

Could be leave the current name internally to satisfy Platform Core requirements and use "" for getElementName()? This solution would also save us the pain to check every singel IJavaElement.getElementName() and do the painful testing.

If this doesn't work we need one of the following:
- API which tells whether a project is external
- API interface for the external project so that we can implement the test

Note: making the external project name itself API would work but I think it would be a dirty solution and a good idea to promote this to API status.
Comment 5 Jerome Lanneluc CLA 2006-02-27 10:16:21 EST
Even after changing getElementName() to return "", I still see _E_X_T_E_R_N_A_L_P_R_O_J_E_C_T_ in the Compare dialog. Are you using IProject#getName() for this ?
Comment 6 Dani Megert CLA 2006-02-27 10:51:25 EST
Besides IJavaProject.getElementName() we use IPackageFragmentRoot.getPath() if the full path is requested. And we (and most likely other clients) also have code like: IJavaElement.getResource().getProjectRelativePath().toString().

I think we can't expect that all J Core clients start to specially treat this external project. While additional API will help JDT UI to hide this from the UI others that e.g. listen for selection changes in the UI and then display the editor input CU will look bad.

So maybe using " " for the path, so that the UI doesn't look (too) bad and IProject.getName() and IJavaProject.getElementName() are in sync again?
Comment 7 Jerome Lanneluc CLA 2006-02-27 12:50:31 EST
Changed ExternalJavaProject#EXTERNAL_PROJECT_NAME to " ".
Comment 8 Maxime Daniel CLA 2006-03-28 03:12:00 EST
Verified for 3.2M6 using build I20060327-0010.
Anyway, we still get a trailing dash in the interface. There might be a need for a (future) API that would produce a consumable composite name. Jérôme, what do you think?
Comment 9 Markus Keller CLA 2006-03-28 04:12:24 EST
I think the current solution is good enough. The affected CUs come out of nowhere, so any real project name would be wrong.

The marginally better rendering that could be achieved would IMO not outweight the ripple that would be caused for all clients who would need to handle this case specially.