proper location for user-defined .launch files? [message #237385] |
Fri, 30 April 2004 13:51  |
Eclipse User |
|
|
|
Originally posted by: progers.classwide.com
Using Eclipse 2.1.1, build 200306271545
Where should my .launch file reside such that Eclipse will know about
it? For testing I cheated and copied my launch file down into
runtime-workspace\.metadata\.plugins\org.eclipse.debug.core\ .launches.
Should I specify something explicitly in my plugin.xml file?
|
|
|
|
|
|
|
|
|
|
|
Re: proper location for user-defined .launch files? [message #237520 is a reply to message #237507] |
Fri, 30 April 2004 17:42   |
Eclipse User |
|
|
|
Originally posted by: progers.classwide.com
> Please describe the lifecycle of your launch configuration more in
> details. (Or goto the irc://freenode/#eclipse :)
I've been discussing two scenarios, which has caused some confusion.
One scenario is within my own Eclipse installation when testing my
plug-in (using Run->Run As... Run-time workbench). The other scenario
is when some completely separate user wants to install my plug-in on
their machine, completely independent of me and my installation.
But I suspect they are really related, in that I don't know how to
tell Eclipse where my .launch file is located. The only approach that
has worked so far is to manually copy my .launch file to a predefined
directory that the run-time is aware of, but is not one of my own
directories. Because it is not one of my directories I think this is
just a temporary hack.
So, the details: my plug-in defines an action set which adds a toolbar
entry and menu entry, either of which invoke an external tool. I
manually created a launch file ("foo.launch"), without using the UI.
I just wrote it with an editor. The action class uses the API to
search for this launch configuration ("foo"):
try {
ILaunchManager manager =
DebugPlugin.getDefault().getLaunchManager();
ILaunchConfiguration[] configurations =
manager.getLaunchConfigurations();
for (int k = 0; k < configurations.length; k++) {
ILaunchConfiguration configuration = configurations[k];
if (configuration.getName().equals("foo")) {
config = configurations[k];
} // if
} // loop
} catch (CoreException e) {
System.out.println("Unexpected error getting configurations:"
+ e);
} // try
The launch configuration file "foo" is not found (config is null)
unless I copy the file to a pre-existing subdir not defined by me.
For example, I have another installation of Eclipse starting at
c:\wpidetar1, used in this case to test installation of my plug-in by
some third party. Unless I copy foo.launch to
C:\wpidetar1\workspace\.metadata\.plugins\org.eclipse.debug. core
the configuration "foo" is not found.
Presumably there is some way to tell the eclipse run-time where my
foo.launch file is located, but I don't know how.
Does that help?
|
|
|
|
|
|
|
Re: proper location for user-defined .launch files? [message #237630 is a reply to message #237611] |
Sat, 01 May 2004 17:29   |
Eclipse User |
|
|
|
Originally posted by: smesh.openrules.com
Below is modified code snippet from "Launching Java Applications
Programmatically", please read it carefully. :)
http://www.eclipse.org/articles/Article-Java-launch/launchin g-java.html
> import org.eclipse.debug.core.*;
> import org.eclipse.debug.ui.DebugUITools;
> import
org.eclipse.ui.externaltools.internal.model.IExternalToolCon stants;
>
> public class A {
>
> ILaunchConfiguration createLC(
> String program,
> String arguments,
> String launchConfigurationName)
> throws Exception {
>
> ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
> ILaunchConfigurationType type =
> manager.getLaunchConfigurationType(
> IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE) ;
> ILaunchConfigurationWorkingCopy workingCopy =
> type.newInstance(null, launchConfigurationName);
>
> workingCopy.setAttribute(IExternalToolConstants.ATTR_LOCATIO N,
program);
> workingCopy.setAttribute(
> IExternalToolConstants.ATTR_TOOL_ARGUMENTS,
> arguments);
>
> ILaunchConfiguration configuration = workingCopy.doSave();
> return configuration;
> }
>
> void run(String program, String arguments, String
launchConfigurationName)
> throws Exception {
> ILaunchConfiguration configuration =
> createLC(program, arguments, launchConfigurationName);
>
> DebugUITools.launch(configuration, ILaunchManager.RUN_MODE);
> }
> }
Andréa wrote:
> Other solution for that would be to get output to the Task View. So, I
> would use the Runtime.getRuntime().exec() to execute the process and get
> the result to show in Task View. Could you help me to find
information how
> to do this?
Will it be convenient to see the output as a Task?
PS, Do not hesitate to ask any questions and do not leave advises
without any reply?
--
Sam Mesh - http://openrules.com
|
|
|
|
Powered by
FUDForum. Page generated in 0.06884 seconds