Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 61345 - [launching] Shared launch configuration depends on the project name
Summary: [launching] Shared launch configuration depends on the project name
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 61487 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-06 21:41 EDT by Mark Drew CLA
Modified: 2009-08-30 02:23 EDT (History)
3 users (show)

See Also:


Attachments
Relevant excerpt from my log (13.08 KB, text/plain)
2004-05-14 12:30 EDT, Mark Drew CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Drew CLA 2004-05-06 21:41:07 EDT
Shared launch configuration depends on the project name.  This is inconvenient
because if I check out a project as something other than the module/dir name, my
shared launch configurations won't work without modification.  

The launch configuration needs to have some kind of project variable that can be
determined based on the project's actual name rather than "hard-coding" the
project name into the launch configuration.

I think this should be clear, but if it is not, please let me know and I'll add
more details.
Comment 1 Darin Wright CLA 2004-05-08 10:25:44 EDT
*** Bug 61488 has been marked as a duplicate of this bug. ***
Comment 2 Johan Compagner CLA 2004-05-08 11:38:28 EDT
*** Bug 61487 has been marked as a duplicate of this bug. ***
Comment 3 Darin Wright CLA 2004-05-11 14:49:08 EDT
There's really two issues here:

(1) The launch config itself stores the project name in the launch config 
handle. We could fix this relatively easily, to be dynamic based on its 
project (actually, not include the project)

(2) References to the launch config can become stale. For example, the lanuch 
history contains mementos to launch config handles (which point to the 
location of the config, containing the project name). If you change the 
project name, the handles now point to the wrong things. Fixing up incorrect 
references is not a simple task (i.e. we can't do it), and this is the real 
usability problem, I believe.

Can you expand on how the problem manifiests itself? I.e. what do you see 
broken first when you do this?
Comment 4 Mark Drew CLA 2004-05-11 15:49:56 EDT
There seems to be some confusion (maybe just with me) about what a shared launch
configuration is.  It seems to me that there needs to be better separation
between available persisted launch configurations (shared) and launch history
(local).  As a case in point, if I want to delete all my local historical
launches, I have to carefully examine each of them to ensure that I don't delete
a shared launch configuration.  This is very inconvenient--and probably needs to
be another, different, issue.

When I mark a launch configuration as shared, I want it to be available to
anyone who checks out the project (regardless of the name by which the project
is checked out).  So to answer your question, I believe the primary problem fits
your first description.  If I check out a project for the first time using a
non-default project name, the shared configurations show up in my favorites, but
they don't work because the configuration file itself references the default
project name.

As an aside (probably related to my previous tangent), note that I always tend
to mark shared configurations as favorites--it seems that I have to do this if I
want other to be able to easily run these shared configurations (i.e., without
having to sift through every previous launch I've ever done to find it).  Am I
missing something?  Is there an easy way to launch a non-favorite shared
configuration, if I've never launched it before (like right-clicking on the
configuration file and selecting "launch")?  This seems to be related to the
non-distinction between launch history and available launches.
Comment 5 Darin Wright CLA 2004-05-14 10:53:13 EDT
When a user imports a new "shared" launch config, it will appear in their 
launch dialog, but only appears in favorites if it is marked as a favorite. 
Currently, we do not support contenxt launching (i.e. context menu) for launch 
configs in the workspace.

Deferred for post 3.0 consideration.
Comment 6 Mark Drew CLA 2004-05-14 11:09:50 EDT
I realize that I've probably brought up a couple of related, but distinct
issues/enhancements.  However, I would ask you to reconsider including a fix for
the first issue you described in comment 3 (especially since you say it would be
relatively easy).  That is the problem that I'm actually reporting here (sorry
to have muddied the water a bit), and fixing it *would* make shared launch
configurations significantly more useful.  Please see the second paragraph in my
comment 4.  Thanks!
Comment 7 Darin Wright CLA 2004-05-14 11:55:22 EDT
Actually, when I import a shared launch config into a different project - it 
works for me. And looking at the code, it looks like it should. What error do 
you get? Is there a stack trace?
Comment 8 Mark Drew CLA 2004-05-14 12:30:44 EDT
Created attachment 10651 [details]
Relevant excerpt from my log
Comment 9 Mark Drew CLA 2004-05-14 12:32:07 EDT
Sorry, I should've included all of this information from the beginning.  FYI,
I'm running build 200403261517 (3.0M8).  I attached an excerpt of the relevant
portion of my log file.  Finally, here's a detailed description of what I'm
doing to create this:

1. Create a shared launch configuration called "launch" in project "project-x".
2. Mark it as a favorite.
3. Check the changes into CVS. (The CVS module/directory is "project-x".)
4. Delete project "project-x" (including the resources).  I think the shared 
   launch "launch" disappears from my favorites at this point (as I would 
   expect).
5. Check out the "project-x" module/directory from CVS as "project-y".  At this 
   point "launch" reappears in my favorites.
6. Select "launch" from my favorites, and this error occurs.

Hope this helps.  Thanks!
Comment 10 Darin Wright CLA 2004-05-14 12:40:37 EDT
I don't think the log is the correct portion - it is dispaying refactoring 
errors, and there is no mention of the debug "launch" action. There should 
likely be a "LaunchAction" in the stack trace if you invoke a favorite.
Comment 11 Mark Drew CLA 2004-05-14 12:52:55 EDT
Ok, you're right (sort of :).  I just deleted my log file and recreated the
error.  What follows is my entire log file:

  !ENTRY org.eclipse.jdt.launching 4 107 May 14, 2004 11:35:31.802
  !MESSAGE Launch configuration Realm Commons Tests references non-existing 
  project realmCommons.

In this log, "Realm Commons Tests" corresponds to my hypothetical shared
favorite launch configuration, "launch".  "realmCommons" corresponds to my
hypothetical project, "project-x".
Comment 12 Darin Wright CLA 2004-05-14 13:07:23 EDT
OK - do not intend to fix this for 3.0. The problem did not occurr for me, 
since I just exported the launch config from project A, that launched 
something in project B. I then imported the config into project C, and thus 
the launch works, since project B still existed. 

However, this is a different problem than I was anticiapting (I verified that 
the config itself could be read and was valid). This problem is that the 
project attribute is now invalid, and there is no limitation on what project a 
config references (i.e. class to run) vs what project it resides in. 
Comment 13 Johan Compagner CLA 2004-05-14 17:21:02 EDT
please look at it as soon as possible (then after 3.0 if really needed)
because shared configuration should really be project independend, It should 
look at the project it is currently in and use that one as its base project..

The basic example when the shared configuration is always going wrong is when 
you check out a branch of the project. Most of the time if you checkout a 
branch the project name will be somthing like: "project_20" instead of 
just "project". Branch projects have to have another name because the "project" 
project is also in the workspace because that contains my work on HEAD.
Comment 14 Darin Wright CLA 2004-08-03 14:21:43 EDT
Needs more investigation.
Comment 15 Darin Wright CLA 2005-02-23 12:00:16 EST
Deferred
Comment 16 Carsten Gosvig CLA 2006-04-06 06:47:14 EDT
I suggest the following solution to the problem (for release 3.2m6):

package org.eclipse.jdt.launching;
public abstract class AbstractJavaLaunchConfigurationDelegate {
    public IJavaProject getJavaProject(ILaunchConfiguration configuration) {
        String projectName = getJavaProjectName(configuration);
        if (projectName != null) {
            projectName = projectName.trim();
            if (projectName.length() == 0) {
                >>get the project name from the shared
                  location the launch configuration:
                   projectName = configuration.getSharedLocationRoot; <<
            }
            if (projectName.length() > 0) {
                IProject project = ResourcesPlugin.getWorkspace().getRoot()
                        .getProject(projectName);
                IJavaProject javaProject = JavaCore.create(project);
                if (javaProject != null && javaProject.exists()) {
                    return javaProject;
                }
            }
        }
        return null;
    }
}

This would leave the project name unaltered (empty string), but solve the places where the IProject reference is needed, without changing too much.
Comment 17 Denis Roy CLA 2009-08-30 02:23:34 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.