Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 53736

Summary: Profile mode not handled by the launch shortcut
Product: [Eclipse Project] JDT Reporter: Stanley Shiah <shiah>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: chris, curtispd, who
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Stanley Shiah CLA 2004-03-04 09:02:30 EST
The current Java application launch shortcut context menu currently provides 
the user the ability to right click on a Java file and select Run -> Run Java 
Application to request that Eclipse run the Java application in question. The 
same class also provides the Run -> Debug Java Application functionality; thus 
handling the "run" and "debug" modes defined by eclipse.

Since the "profile" mode is also defined by the Eclipse platform, a shortcut 
for the profile mode should be provided and handled.

Please see bugzilla #53526 for more details.
Comment 1 Curtis d'Entremont CLA 2004-03-04 13:38:10 EST
*** Bug 53781 has been marked as a duplicate of this bug. ***
Comment 2 Darin Wright CLA 2004-03-05 10:33:59 EST
The SDK does not provide a profiler. Whoever provides the profiler provides 
the shortcut. Please move this to the correct component.
Comment 3 Curtis d'Entremont CLA 2004-03-05 11:04:43 EST
The platform provides the notion of a "profile" mode, though. Shouldn't it be 
the responsibility of the provider of the launch configuration type to _allow_ 
shortcutting for any of the 3 basic launch modes defined by the platform that 
make sense? After all, the implementation of launch shortcuts is the same for 
all modes.

If this isn't the case, the profilers' launch shortcuts would simply be copy & 
pasted from the original shortcuts, which seems slightly less than clean.
Comment 4 Darin Wright CLA 2004-03-05 11:08:08 EST
Perhaps there is room for an enhancement here. However, the existing launch 
shortcut extension allows a shortcut to define the modes it is applicable to. 
The Java short cut contributes for run/debug, since that is all we know about.

Adding Chris as CC for comment, since he owns the run context menu support.
Comment 5 Chris Tilt CLA 2004-03-05 17:28:39 EST
Darin is correct. The context launch menu supports *any* kind of shortcut,
including run, debug, profile, and any other "mode" that ever gets added to the
core debug platform. What appears in the Run-> context menu depends on what
shortcuts have been contributed. As Darin said, the JDT-Debug only contributes
"run" and "debug" modes. However, if third party plugins contribute shortcuts
with a "mode=profile", they  will appear in the context menu as well. Here is
the snippet from org.eclipse.jdt.debug.ui/plugin.xml to show you what we mean.

<extension
         point="org.eclipse.debug.ui.launchShortcuts">
      <shortcut
            label="%JavaApplicationShortcut.label"
            modes="run, debug"
       ...
...
</extension>
Comment 6 Darin Wright CLA 2004-03-08 09:03:17 EST
It is the launch shortcut's responsibility to create a launch config with 
appropriate default values/attributes, and launch it (or re-use an existing 
config). Since the Java Application launch shortcut has no knowledge 
of "profiling", it would have no idea what to set as default values/attributes 
on a profiling launch config.
Comment 7 Curtis d'Entremont CLA 2004-03-08 09:49:49 EST
Ok, I can accept that, since a profiler may decide not to use the 
IJavaLaunchConfigurationConstants keys for the launch configuration. 

The only option I see now is to duplicate all the code from the launch 
shortcuts I want to extend with the profile mode (because the launch shortcuts 
are internal). The major problem with this (aside from the duplication itself) 
is that launch shortcuts tend to use internal classes. For example, the 
JavaModelUtil class (internal) is used to determine whether a class has a main, 
which in turn uses other internal code. Obviously, I can't duplicate the entire 
dependency tree of internal code. So, the only feasible option for profilers is 
to use internal JDT code.

Do you see any solutions to this problem?
Comment 8 Darin Wright CLA 2004-03-08 09:53:51 EST
Options:

* Open a new feature request or re-open this feature request as enhancement 
aksing for new API (likely will not happen in 3.0).
* Subclass the internal stuff knowning that you will be broken, but hope for 
API in a future release.
* Contribute a fix