diff options
Diffstat (limited to 'ant/org.eclipse.ant.launching')
66 files changed, 3676 insertions, 0 deletions
diff --git a/ant/org.eclipse.ant.launching/.classpath b/ant/org.eclipse.ant.launching/.classpath new file mode 100644 index 000000000..a8eb00e30 --- /dev/null +++ b/ant/org.eclipse.ant.launching/.classpath @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" output="loggers_bin" path="loggers"/> + <classpathentry kind="src" output="common_bin" path="common"/> + <classpathentry kind="src" output="remote_bin" path="remote"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/ant/org.eclipse.ant.launching/.externalToolBuilders/build common debug [Builder].launch b/ant/org.eclipse.ant.launching/.externalToolBuilders/build common debug [Builder].launch new file mode 100644 index 000000000..2f1ec55b7 --- /dev/null +++ b/ant/org.eclipse.ant.launching/.externalToolBuilders/build common debug [Builder].launch @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> +<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> +<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <launchConfigurationWorkingSet editPageId="org.eclipse.ui.resourceWorkingSetPage" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1254539808328_112" label="working set" name="working set"> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.ant.launching/lib" type="2"/> </launchConfigurationWorkingSet>}"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.ant.launching/buildfiles/buildCommonDebug.xml"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="1"/> +</listAttribute> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.ant.launching"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <launchConfigurationWorkingSet editPageId="org.eclipse.ui.resourceWorkingSetPage" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1254539834953_113" label="workingSet" name="workingSet"> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.ant.launching/common" type="2"/> </launchConfigurationWorkingSet>}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.ant.launching/buildfiles/buildCommonDebug.xml}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> +<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> +</launchConfiguration> diff --git a/ant/org.eclipse.ant.launching/.externalToolBuilders/build loggers [Builder].launch b/ant/org.eclipse.ant.launching/.externalToolBuilders/build loggers [Builder].launch new file mode 100644 index 000000000..ec718d8f8 --- /dev/null +++ b/ant/org.eclipse.ant.launching/.externalToolBuilders/build loggers [Builder].launch @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> +<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> +<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> +<booleanAttribute key="org.eclipse.ant.uiSET_INPUTHANDLER" value="false"/> +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <launchConfigurationWorkingSet editPageId="org.eclipse.ui.resourceWorkingSetPage" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1254539604968_29" label="working set" name="working set"> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.ant.launching/lib" type="2"/> </launchConfigurationWorkingSet>}"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.ant.launching/buildfiles/buildLoggers.xml"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="1"/> +</listAttribute> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.ant.launching"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <launchConfigurationWorkingSet editPageId="org.eclipse.ui.resourceWorkingSetPage" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1254539671875_56" label="workingSet" name="workingSet"> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.ant.launching/loggers" type="2"/> </launchConfigurationWorkingSet>}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.ant.launching/buildfiles/buildLoggers.xml}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> +<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> +</launchConfiguration> diff --git a/ant/org.eclipse.ant.launching/.externalToolBuilders/build remote support [Builder].launch b/ant/org.eclipse.ant.launching/.externalToolBuilders/build remote support [Builder].launch new file mode 100644 index 000000000..c56eb96fa --- /dev/null +++ b/ant/org.eclipse.ant.launching/.externalToolBuilders/build remote support [Builder].launch @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> +<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> +<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <launchConfigurationWorkingSet factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1254617191468_44" label="working set" name="working set"> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.ant.launching/lib" type="2"/> </launchConfigurationWorkingSet>}"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.ant.launching/buildfiles/buildRemote.xml"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="1"/> +</listAttribute> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.ant.launching"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <launchConfigurationWorkingSet factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1254617206453_45" label="workingSet" name="workingSet"> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.ant.launching/remote" type="2"/> </launchConfigurationWorkingSet>}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.ant.launching/buildfiles/buildRemote.xml}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> +<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> +</launchConfiguration> diff --git a/ant/org.eclipse.ant.launching/.project b/ant/org.eclipse.ant.launching/.project new file mode 100644 index 000000000..5f704efb4 --- /dev/null +++ b/ant/org.eclipse.ant.launching/.project @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.ant.launching</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> + <triggers>auto,full,incremental,</triggers> + <arguments> + <dictionary> + <key>LaunchConfigHandle</key> + <value><project>/.externalToolBuilders/build loggers [Builder].launch</value> + </dictionary> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> + <triggers>auto,full,incremental,</triggers> + <arguments> + <dictionary> + <key>LaunchConfigHandle</key> + <value><project>/.externalToolBuilders/build common debug [Builder].launch</value> + </dictionary> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> + <triggers>auto,full,incremental,</triggers> + <arguments> + <dictionary> + <key>LaunchConfigHandle</key> + <value><project>/.externalToolBuilders/build remote support [Builder].launch</value> + </dictionary> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> + </natures> +</projectDescription> diff --git a/ant/org.eclipse.ant.launching/about.html b/ant/org.eclipse.ant.launching/about.html new file mode 100644 index 000000000..599392518 --- /dev/null +++ b/ant/org.eclipse.ant.launching/about.html @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>October 8, 2009</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +<h3>Third Party Content</h3> + +<p>The Content includes items that have been sourced from third parties as set out below. If you +did not receive this Content directly from the Eclipse Foundation, the following is provided +for informational purposes only, and you should look to the Redistributor’s license for +terms and conditions of use.</p> + +<h4>Ant 1.7.1</h4> + +<p>The following classes in the plug-in JAR are based on Ant code developed by The Apache Software Foundation and shall be defined as the "Ant-Derived Work":</p> + +<ul> + <li>org.eclipse.ant.internal.launching.remote.InternalAntRunner</li> +</ul> + +<p>The object code for InternalAntRunner is located in lib/remote.jar and the source code is located in lib/remotesrc.zip.</p> + +<p>Your use of the Ant-Derived Work is subject to the terms and conditions of the Apache Software License 2.0. A copy of the license is contained +in the file <a href="about_files/asl-v20.txt" target="_blank">about_files/asl-v20.txt</a> and is also available at +<a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>.</p> + +<p>The names "Ant" and "Apache Software Foundation" must not be used to endorse or promote products derived from this +software without prior written permission. For written permission, please contact <a href="mailto:apache@apache.org">apache@apache.org</a>.</p> + +<p>The Apache attribution <a href="about_files/NOTICE" target="_blank">NOTICE</a> file is included with the Content in accordance with 4d of the Apache License, Version 2.0.</p> +</body> +</html>
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/build.properties b/ant/org.eclipse.ant.launching/build.properties new file mode 100644 index 000000000..f7a9d05b8 --- /dev/null +++ b/ant/org.eclipse.ant.launching/build.properties @@ -0,0 +1,32 @@ +############################################################################### +# Copyright (c) 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties,\ + lib/antdebug.jar,\ + lib/loggers.jar,\ + lib/remote.jar,\ + about.html + +jars.compile.order = .,\ + lib/antdebug.jar,\ + lib/loggers.jar,\ + lib/remote.jar +source.lib/loggers.jar = loggers/ +output.lib/loggers.jar = loggers_bin/ +source.lib/antdebug.jar = common/ +output.lib/antdebug.jar = common_bin/ +source.lib/remote.jar = remote/ +output.lib/remote.jar = remote_bin/ +src.includes = about.html diff --git a/ant/org.eclipse.ant.launching/buildfiles/buildCommonDebug.xml b/ant/org.eclipse.ant.launching/buildfiles/buildCommonDebug.xml new file mode 100644 index 000000000..88b99eb55 --- /dev/null +++ b/ant/org.eclipse.ant.launching/buildfiles/buildCommonDebug.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2005, 2009 IBM Corporation and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + IBM Corporation - initial API and implementation + --> + +<project name="Build Ant common debug support JAR" default="build" basedir=".."> + + <target name="build" description="Cleans, builds and refreshes" depends="clean, lib/antdebuglib.jar"/> + + <target name="init"> + <property name="temp.folder" value="${basedir}/temp.folder"/> + <property name="build.result.folder" value="${basedir}"/> + </target> + + <target name="lib/antdebuglib.jar" description= "Creates the antdebug.jar" depends="init"> + <property name="destdir" value="${temp.folder}/lib/antdebug.jar.bin"/> + <delete dir="${destdir}"/> + <mkdir dir="${destdir}"/> + <!-- copy necessary class files resources --> + <copy todir="${destdir}"> + <fileset dir="${basedir}/common_bin"/> + </copy> + <mkdir dir="${build.result.folder}/lib"/> + <jar destfile="${build.result.folder}/lib/antdebug.jar" basedir="${destdir}"/> + <delete dir="${temp.folder}"/> + </target> + + <target name="clean" description="Deletes previous build remnants" depends="init"> + <delete file="${build.result.folder}/lib/antdebug.jar"/> + <delete dir="${temp.folder}"/> + </target> +</project> diff --git a/ant/org.eclipse.ant.launching/buildfiles/buildLoggers.xml b/ant/org.eclipse.ant.launching/buildfiles/buildLoggers.xml new file mode 100644 index 000000000..1dbb04c01 --- /dev/null +++ b/ant/org.eclipse.ant.launching/buildfiles/buildLoggers.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2005, 2009 IBM Corporation and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + IBM Corporation - initial API and implementation + --> + +<project name="Build Ant loggers support JAR" default="build" basedir=".."> + + <target name="build" description="Cleans, builds and refreshes" depends="clean, lib/loggerslib.jar"/> + + <target name="init"> + <property name="temp.folder" value="${basedir}/temp.folder"/> + <property name="build.result.folder" value="${basedir}"/> + </target> + + <target name="lib/loggerslib.jar" description= "Creates the loggers.jar" depends="init"> + <property name="destdir" value="${temp.folder}/lib/loggers.jar.bin"/> + <delete dir="${destdir}"/> + <mkdir dir="${destdir}"/> + <!-- copy necessary class files resources --> + <copy todir="${destdir}"> + <fileset dir="${basedir}/loggers_bin/"/> + </copy> + <mkdir dir="${build.result.folder}/lib"/> + <jar destfile="${build.result.folder}/lib/loggers.jar" basedir="${destdir}"/> + <delete dir="${temp.folder}"/> + </target> + + <target name="clean" description="Deletes previous build remnants" depends="init"> + <delete file="${build.result.folder}/lib/loggers.jar"/> + <delete dir="${temp.folder}"/> + </target> +</project> diff --git a/ant/org.eclipse.ant.launching/buildfiles/buildRemote.xml b/ant/org.eclipse.ant.launching/buildfiles/buildRemote.xml new file mode 100644 index 000000000..2122e5854 --- /dev/null +++ b/ant/org.eclipse.ant.launching/buildfiles/buildRemote.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2005, 2009 IBM Corporation and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + IBM Corporation - initial API and implementation + --> + +<project name="Build Ant remote support JAR" default="build" basedir=".."> + + <target name="build" description="Cleans, builds and refreshes" depends="clean, lib/remotelib.jar"/> + + <target name="init"> + <property name="temp.folder" value="${basedir}/temp.folder"/> + <property name="build.result.folder" value="${basedir}"/> + </target> + + <target name="lib/remotelib.jar" description= "Creates the remote.jar" depends="init"> + <property name="destdir" value="${temp.folder}/lib/remote.jar.bin"/> + <delete dir="${destdir}"/> + <mkdir dir="${destdir}"/> + <!-- copy necessary class files resources --> + <copy todir="${destdir}"> + <fileset dir="${basedir}/remote_bin"/> + </copy> + <mkdir dir="${build.result.folder}/lib"/> + <jar destfile="${build.result.folder}/lib/remote.jar" basedir="${destdir}"/> + <delete dir="${temp.folder}"/> + </target> + + <target name="clean" description="Deletes previous build remnants" depends="init"> + <delete file="${build.result.folder}/lib/remote.jar"/> + <delete dir="${temp.folder}"/> + </target> +</project> diff --git a/ant/org.eclipse.ant.launching/common/META-INF/eclipse.inf b/ant/org.eclipse.ant.launching/common/META-INF/eclipse.inf new file mode 100644 index 000000000..b4df3ab63 --- /dev/null +++ b/ant/org.eclipse.ant.launching/common/META-INF/eclipse.inf @@ -0,0 +1 @@ +jarprocessor.exclude.sign=true
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/common/org/eclipse/ant/internal/launching/debug/IDebugBuildLogger.java b/ant/org.eclipse.ant.launching/common/org/eclipse/ant/internal/launching/debug/IDebugBuildLogger.java new file mode 100644 index 000000000..9eb06c54b --- /dev/null +++ b/ant/org.eclipse.ant.launching/common/org/eclipse/ant/internal/launching/debug/IDebugBuildLogger.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug; + + +public interface IDebugBuildLogger { + + /** + * Requests to suspend the build if the current debug state + * indicates that suspension is required. + */ + public abstract void waitIfSuspended(); +}
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/loggers/META-INF/eclipse.inf b/ant/org.eclipse.ant.launching/loggers/META-INF/eclipse.inf new file mode 100644 index 000000000..b4df3ab63 --- /dev/null +++ b/ant/org.eclipse.ant.launching/loggers/META-INF/eclipse.inf @@ -0,0 +1 @@ +jarprocessor.exclude.sign=true
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/loggers/org/eclipse/ant/internal/launching/runtime/logger/NullBuildLogger.java b/ant/org.eclipse.ant.launching/loggers/org/eclipse/ant/internal/launching/runtime/logger/NullBuildLogger.java new file mode 100644 index 000000000..8d50250f3 --- /dev/null +++ b/ant/org.eclipse.ant.launching/loggers/org/eclipse/ant/internal/launching/runtime/logger/NullBuildLogger.java @@ -0,0 +1,179 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.runtime.logger; + + +import java.io.PrintStream; + +import org.apache.tools.ant.BuildEvent; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.BuildLogger; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.util.StringUtils; +import org.eclipse.ant.core.AntSecurityException; +import org.eclipse.ant.internal.core.AbstractEclipseBuildLogger; +import org.eclipse.core.runtime.OperationCanceledException; + +public class NullBuildLogger extends AbstractEclipseBuildLogger implements BuildLogger{ + + protected int fMessageOutputLevel = Project.MSG_INFO; + private PrintStream fErr= null; + private PrintStream fOut= null; + protected boolean fEmacsMode= false; + + /** + * An exception that has already been logged. + */ + protected Throwable fHandledException= null; + + /** + * @see org.apache.tools.ant.BuildLogger#setMessageOutputLevel(int) + */ + public void setMessageOutputLevel(int level) { + fMessageOutputLevel= level; + } + + protected int getMessageOutputLevel() { + return fMessageOutputLevel; + } + + /** + * @see org.apache.tools.ant.BuildLogger#setEmacsMode(boolean) + */ + public void setEmacsMode(boolean emacsMode) { + fEmacsMode= emacsMode; + } + + /** + * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) + */ + public void buildStarted(BuildEvent event) { + } + + /** + * @see org.apache.tools.ant.BuildListener#buildFinished(org.apache.tools.ant.BuildEvent) + */ + public void buildFinished(BuildEvent event) { + String message= handleException(event); + if (message != null) { + logMessage(message, getMessageOutputLevel()); + } + fHandledException= null; + } + + /** + * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) + */ + public void targetStarted(BuildEvent event) { + } + + /** + * @see org.apache.tools.ant.BuildListener#targetFinished(org.apache.tools.ant.BuildEvent) + */ + public void targetFinished(BuildEvent event) { + } + + /** + * @see org.apache.tools.ant.BuildListener#taskStarted(org.apache.tools.ant.BuildEvent) + */ + public void taskStarted(BuildEvent event) { + } + + /** + * @see org.apache.tools.ant.BuildListener#taskFinished(org.apache.tools.ant.BuildEvent) + */ + public void taskFinished(BuildEvent event) { + } + + /* (non-Javadoc) + * @see org.apache.tools.ant.BuildListener#messageLogged(org.apache.tools.ant.BuildEvent) + */ + public void messageLogged(BuildEvent event) { + logMessage(event.getMessage(), event.getPriority()); + } + + protected PrintStream getErrorPrintStream() { + return fErr; + } + + protected PrintStream getOutputPrintStream() { + return fOut; + } + + /** + * @see org.apache.tools.ant.BuildLogger#setErrorPrintStream(java.io.PrintStream) + */ + public void setErrorPrintStream(PrintStream err) { + //this build logger logs to "null" unless + //the user has explicitly set a logfile to use + if (err == System.err) { + fErr= null; + } else { + fErr= err; + } + } + + /** + * @see org.apache.tools.ant.BuildLogger#setOutputPrintStream(java.io.PrintStream) + */ + public void setOutputPrintStream(PrintStream output) { + //this build logger logs to "null" unless + //the user has explicitly set a logfile to use + if (output == System.out) { + fOut= null; + } else { + fOut= output; + } + } + + protected void logMessage(String message, int priority) { + if (priority > getMessageOutputLevel()) { + return; + } + + if (priority == Project.MSG_ERR) { + if (getErrorPrintStream() != null && getErrorPrintStream() != System.err) { + //user has designated to log to a logfile + getErrorPrintStream().println(message); + } + } else { + if (getOutputPrintStream() != null && getOutputPrintStream() != System.out) { + //user has designated to log to a logfile + getOutputPrintStream().println(message); + } + } + } + + protected String handleException(BuildEvent event) { + Throwable exception = event.getException(); + if (exception == null || exception == fHandledException + || exception instanceof OperationCanceledException + || exception instanceof AntSecurityException) { + return null; + } + fHandledException= exception; + StringBuffer message= new StringBuffer(); + message.append(StringUtils.LINE_SEP); + message.append(RuntimeMessages.NullBuildLogger_1); + message.append(StringUtils.LINE_SEP); + if (Project.MSG_VERBOSE <= fMessageOutputLevel || !(exception instanceof BuildException)) { + message.append(StringUtils.getStackTrace(exception)); + } else { + if (exception instanceof BuildException) { + message.append(exception.toString()).append(StringUtils.LINE_SEP); + } else { + message.append(exception.getMessage()).append(StringUtils.LINE_SEP); + } + } + + return message.toString(); + } +} diff --git a/ant/org.eclipse.ant.launching/loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.java b/ant/org.eclipse.ant.launching/loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.java new file mode 100644 index 000000000..a1db5586c --- /dev/null +++ b/ant/org.eclipse.ant.launching/loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.runtime.logger; + +import org.eclipse.osgi.util.NLS; + +public class RuntimeMessages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.ant.internal.launching.runtime.logger.RuntimeMessages";//$NON-NLS-1$ + + public static String NullBuildLogger_1; + public static String AntProcessBuildLogger_Total_time; + public static String AntProcessBuildLogger__minutes_2; + public static String AntProcessBuildLogger__minute_3; + public static String AntProcessBuildLogger__seconds_4; + public static String AntProcessBuildLogger__second_5; + public static String AntProcessBuildLogger__milliseconds_6; + + public static String AntProcessDebugBuildLogger_1; + + static { + // load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, RuntimeMessages.class); + } +}
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.properties b/ant/org.eclipse.ant.launching/loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.properties new file mode 100644 index 000000000..573188a0f --- /dev/null +++ b/ant/org.eclipse.ant.launching/loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.properties @@ -0,0 +1,20 @@ +############################################################################### +# Copyright (c) 2000, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### + +NullBuildLogger_1=BUILD FAILED +AntProcessBuildLogger_Total_time=Total time: +AntProcessBuildLogger__minutes_2=\ minutes +AntProcessBuildLogger__minute_3=\ minute +AntProcessBuildLogger__seconds_4=\ seconds +AntProcessBuildLogger__second_5=\ second +AntProcessBuildLogger__milliseconds_6=\ milliseconds + +AntProcessDebugBuildLogger_1=Build cancelled. diff --git a/ant/org.eclipse.ant.launching/plugin.properties b/ant/org.eclipse.ant.launching/plugin.properties new file mode 100644 index 000000000..650fb4ff5 --- /dev/null +++ b/ant/org.eclipse.ant.launching/plugin.properties @@ -0,0 +1,24 @@ +############################################################################### +# Copyright (c) 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### + +pluginName=Ant Launching Support +providerName=Eclipse.org + +AntBuild = Ant Build +AntLaunchDelegate.name=Eclipse Ant Launcher +AntLaunchDelegate.description=The Eclipse Ant Launcher supports running and debugging Ant build files. + +AntBuilder.name=Ant Builder +AntBuilderLaunchDelegate.name= Eclipse Ant Builder Launcher +AntBuilderLaunchDelegate.description=The Eclipse Ant Builder Launcher supports running Ant build files. + +antBreakpointGroupName= Ant Breakpoints +AntLineBreakpoint.name = Ant Line Breakpoint
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/remote/META-INF/eclipse.inf b/ant/org.eclipse.ant.launching/remote/META-INF/eclipse.inf new file mode 100644 index 000000000..b4df3ab63 --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/META-INF/eclipse.inf @@ -0,0 +1 @@ +jarprocessor.exclude.sign=true
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/AntSecurityException.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/AntSecurityException.java new file mode 100644 index 000000000..294b248a9 --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/AntSecurityException.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.remote; + +/** + * A security exception that is thrown by the AntSecurityManager if + * an Ant task in some way attempts to halt or exit the Java Virtual Machine. + * + * @since 2.1 + */ +public class AntSecurityException extends SecurityException { + + private static final long serialVersionUID = 1L; + +} diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/AntSecurityManager.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/AntSecurityManager.java new file mode 100644 index 000000000..30f7ebb0c --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/AntSecurityManager.java @@ -0,0 +1,371 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.remote; + + +import java.io.FileDescriptor; +import java.net.InetAddress; +import java.net.SocketPermission; +import java.security.Permission; +import java.util.PropertyPermission; + +/** + * A security manager that always throws an <code>AntSecurityException</code> + * if the calling thread attempts to cause the Java Virtual Machine to + * exit/halt or if the restricted thread attempts to set a System property. + * Otherwise this manager just delegates to the pre-existing manager + * passed in the constructor or mimics the default security manager behavior + */ +public class AntSecurityManager extends SecurityManager { + + private SecurityManager fSecurityManager= null; + private Thread fRestrictedThread= null; + //ensure that the PropertyPermission class is loaded before we + //start checking permissions: bug 85908 + private static final PropertyPermission fgPropertyPermission= new PropertyPermission("*", "write"); //$NON-NLS-1$ //$NON-NLS-2$ + + private boolean fAllowSettingSystemProperties= true; + + public AntSecurityManager(SecurityManager securityManager, Thread restrictedThread, boolean allowSettingProperties) { + fSecurityManager= securityManager; + fRestrictedThread= restrictedThread; + fAllowSettingSystemProperties= allowSettingProperties; + } + + public AntSecurityManager(SecurityManager securityManager, Thread restrictedThread) { + this(securityManager, restrictedThread, true); + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkExit(int) + */ + public void checkExit(int status) { + //no exit allowed from the restricted thread...System.exit is being called + //by some ant task...disallow the exit + if (Thread.currentThread() == fRestrictedThread) { + throw new AntSecurityException(); + } + if (fSecurityManager != null) { + fSecurityManager.checkExit(status); + } + } + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkAccept(java.lang.String, int) + */ + public void checkAccept(String host, int port) { + if (fSecurityManager != null) { + fSecurityManager.checkAccept(host, port); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkAccess(java.lang.Thread) + */ + public void checkAccess(Thread t) { + if (fSecurityManager != null) { + fSecurityManager.checkAccess(t); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkAccess(java.lang.ThreadGroup) + */ + public void checkAccess(ThreadGroup g) { + if (fSecurityManager != null) { + fSecurityManager.checkAccess(g); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkAwtEventQueueAccess() + */ + public void checkAwtEventQueueAccess() { + if (fSecurityManager != null) { + fSecurityManager.checkAwtEventQueueAccess(); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkConnect(java.lang.String, int, java.lang.Object) + */ + public void checkConnect(String host, int port, Object context) { + if (fSecurityManager != null) { + fSecurityManager.checkConnect(host, port, context); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkConnect(java.lang.String, int) + */ + public void checkConnect(String host, int port) { + if (fSecurityManager != null) { + fSecurityManager.checkConnect(host, port); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkCreateClassLoader() + */ + public void checkCreateClassLoader() { + if (fSecurityManager != null) { + fSecurityManager.checkCreateClassLoader(); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkDelete(java.lang.String) + */ + public void checkDelete(String file) { + if (fSecurityManager != null) { + fSecurityManager.checkDelete(file); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkExec(java.lang.String) + */ + public void checkExec(String cmd) { + if (fSecurityManager != null) { + fSecurityManager.checkExec(cmd); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkLink(java.lang.String) + */ + public void checkLink(String lib) { + if (fSecurityManager != null) { + fSecurityManager.checkLink(lib); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkListen(int) + */ + public void checkListen(int port) { + if (fSecurityManager != null) { + fSecurityManager.checkListen(port); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkMemberAccess(java.lang.Class, int) + */ + public void checkMemberAccess(Class clazz, int which) { + if (fSecurityManager != null) { + fSecurityManager.checkMemberAccess(clazz, which); + } + } + + /** + * @see java.lang.SecurityManager#checkMulticast(java.net.InetAddress, byte) + * @deprecated + */ + public void checkMulticast(InetAddress maddr, byte ttl) { + if (fSecurityManager != null) { + String host = maddr.getHostAddress(); + if (!host.startsWith("[") && host.indexOf(':') != -1) { //$NON-NLS-1$ + host = "[" + host + "]"; //$NON-NLS-1$ //$NON-NLS-2$ + } + checkPermission(new SocketPermission(host, "accept,connect")); //$NON-NLS-1$ + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkMulticast(java.net.InetAddress) + */ + public void checkMulticast(InetAddress maddr) { + if (fSecurityManager != null) { + fSecurityManager.checkMulticast(maddr); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkPackageAccess(java.lang.String) + */ + public void checkPackageAccess(String pkg) { + if (fSecurityManager != null) { + fSecurityManager.checkPackageAccess(pkg); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkPackageDefinition(java.lang.String) + */ + public void checkPackageDefinition(String pkg) { + if (fSecurityManager != null) { + fSecurityManager.checkPackageDefinition(pkg); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkPermission(java.security.Permission, java.lang.Object) + */ + public void checkPermission(Permission perm, Object context) { + if (fSecurityManager != null) { + fSecurityManager.checkPermission(perm, context); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkPermission(java.security.Permission) + */ + public void checkPermission(Permission perm) { + if (!fAllowSettingSystemProperties && fgPropertyPermission.implies(perm) && fRestrictedThread == Thread.currentThread()) { + //attempting to write a system property + throw new AntSecurityException(); + } + if (fSecurityManager != null) { + fSecurityManager.checkPermission(perm); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkPrintJobAccess() + */ + public void checkPrintJobAccess() { + if (fSecurityManager != null) { + fSecurityManager.checkPrintJobAccess(); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkPropertiesAccess() + */ + public void checkPropertiesAccess() { + if (fSecurityManager != null) { + fSecurityManager.checkPropertiesAccess(); + } + super.checkPropertiesAccess(); + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String) + */ + public void checkPropertyAccess(String key) { + if (fSecurityManager != null) { + fSecurityManager.checkPropertyAccess(key); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkRead(java.io.FileDescriptor) + */ + public void checkRead(FileDescriptor fd) { + if (fSecurityManager != null) { + fSecurityManager.checkRead(fd); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkRead(java.lang.String, java.lang.Object) + */ + public void checkRead(String file, Object context) { + if (fSecurityManager != null) { + fSecurityManager.checkRead(file, context); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkRead(java.lang.String) + */ + public void checkRead(String file) { + if (fSecurityManager != null) { + fSecurityManager.checkRead(file); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkSecurityAccess(java.lang.String) + */ + public void checkSecurityAccess(String target) { + if (fSecurityManager != null) { + fSecurityManager.checkSecurityAccess(target); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkSetFactory() + */ + public void checkSetFactory() { + if (fSecurityManager != null) { + fSecurityManager.checkSetFactory(); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkSystemClipboardAccess() + */ + public void checkSystemClipboardAccess() { + if (fSecurityManager != null) { + fSecurityManager.checkSystemClipboardAccess(); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkTopLevelWindow(java.lang.Object) + */ + public boolean checkTopLevelWindow(Object window) { + if (fSecurityManager != null) { + return fSecurityManager.checkTopLevelWindow(window); + } + return super.checkTopLevelWindow(window); + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkWrite(java.io.FileDescriptor) + */ + public void checkWrite(FileDescriptor fd) { + if (fSecurityManager != null) { + fSecurityManager.checkWrite(fd); + } + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#checkWrite(java.lang.String) + */ + public void checkWrite(String file) { + if (fSecurityManager != null) { + fSecurityManager.checkWrite(file); + } + } + + /** + * @see java.lang.SecurityManager#getInCheck() + * @deprecated + */ + public boolean getInCheck() { + if (fSecurityManager != null) { + return fSecurityManager.getInCheck(); + } + return super.getInCheck(); + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#getSecurityContext() + */ + public Object getSecurityContext() { + if (fSecurityManager != null) { + return fSecurityManager.getSecurityContext(); + } + return super.getSecurityContext(); + } + + /* (non-Javadoc) + * @see java.lang.SecurityManager#getThreadGroup() + */ + public ThreadGroup getThreadGroup() { + if (fSecurityManager != null) { + fSecurityManager.getThreadGroup(); + } + return super.getThreadGroup(); + } +} diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/DemuxInputStreamSetter.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/DemuxInputStreamSetter.java new file mode 100644 index 000000000..9111611c2 --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/DemuxInputStreamSetter.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.remote; + + +import org.apache.tools.ant.DemuxInputStream; +import org.apache.tools.ant.Project; + +/** + * This class exists so that the Ant integration has backwards compatibility + * with Ant releases previous to 1.6. DemuxInputStream is a new class to Ant 1.6. + */ +class DemuxInputStreamSetter { + + protected void remapSystemIn(Project project) { + System.setIn(new DemuxInputStream(project)); + } +} diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java new file mode 100644 index 000000000..6b86f5d62 --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2005, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.remote; + +import java.util.Arrays; +import java.util.Vector; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Executor; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.helper.DefaultExecutor; + +public class EclipseDefaultExecutor extends DefaultExecutor { + + private static final EclipseSingleCheckExecutor SUB_EXECUTOR = new EclipseSingleCheckExecutor(); + + /* (non-Javadoc) + * @see org.apache.tools.ant.Executor#executeTargets(org.apache.tools.ant.Project, java.lang.String[]) + */ + public void executeTargets(Project project, String[] targetNames) throws BuildException { + Vector v= new Vector(); + v.addAll(Arrays.asList(targetNames)); + project.addReference("eclipse.ant.targetVector", v); //$NON-NLS-1$ + super.executeTargets(project, targetNames); + } + + /* (non-Javadoc) + * @see org.apache.tools.ant.Executor#getSubProjectExecutor() + */ + public Executor getSubProjectExecutor() { + return SUB_EXECUTOR; + } +} diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java new file mode 100644 index 000000000..62ddd4fe0 --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2005, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.remote; + +import java.util.Arrays; +import java.util.Vector; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Executor; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.helper.SingleCheckExecutor; + +public class EclipseSingleCheckExecutor extends SingleCheckExecutor { + + /* (non-Javadoc) + * @see org.apache.tools.ant.Executor#executeTargets(org.apache.tools.ant.Project, java.lang.String[]) + */ + public void executeTargets(Project project, String[] targetNames) throws BuildException { + Vector v= new Vector(); + v.addAll(Arrays.asList(targetNames)); + project.addReference("eclipse.ant.targetVector", v); //$NON-NLS-1$ + super.executeTargets(project, targetNames); + } + + /* (non-Javadoc) + * @see org.apache.tools.ant.Executor#getSubProjectExecutor() + */ + public Executor getSubProjectExecutor() { + return this; + } +} diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/ExecutorSetter.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/ExecutorSetter.java new file mode 100644 index 000000000..ed9aba55f --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/ExecutorSetter.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2005, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.remote; + +import org.apache.tools.ant.Executor; +import org.apache.tools.ant.Project; + +/** + * This class exists so that the Ant integration has backwards compatibility + * with Ant releases previous to 1.6.3. Executors are a new feature of Ant 1.6.3. + */ +public class ExecutorSetter { + + protected void setExecutor(Project project) { + Executor executor= new EclipseDefaultExecutor(); + project.setExecutor(executor); + } +} diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InputHandlerSetter.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InputHandlerSetter.java new file mode 100644 index 000000000..21bdd1f30 --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InputHandlerSetter.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.remote; + + +import java.text.MessageFormat; // can't use ICU, used by ant + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.input.DefaultInputHandler; +import org.apache.tools.ant.input.InputHandler; + +/** + * This class exists so that the Ant integration has backwards compatibility + * with Ant releases previous to 1.5. InputHandlers are a new feature of Ant 1.5. + */ +class InputHandlerSetter { + + protected void setInputHandler(Project project, String inputHandlerClassname) { + InputHandler handler = null; + if (inputHandlerClassname == null) { + handler = new DefaultInputHandler(); + } else { + try { + handler = (InputHandler)(Class.forName(inputHandlerClassname).newInstance()); + } catch (ClassCastException e) { + String msg = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.The_specified_input_handler_class_{0}_does_not_implement_the_org.apache.tools.ant.input.InputHandler_interface_5"), new String[]{inputHandlerClassname}); //$NON-NLS-1$ + throw new BuildException(msg, e); + } catch (Exception e) { + String msg = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Unable_to_instantiate_specified_input_handler_class_{0}___{1}_6"), new String[]{inputHandlerClassname, e.getClass().getName()}); //$NON-NLS-1$ + throw new BuildException(msg, e); + } + } + project.setInputHandler(handler); + } +} diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.java new file mode 100644 index 000000000..5cb927eb4 --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.remote; + + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class RemoteAntMessages { + + private static final String BUNDLE_NAME = "org.eclipse.ant.internal.launching.remote.RemoteAntMessages"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + private RemoteAntMessages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.properties b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.properties new file mode 100644 index 000000000..a0c733232 --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.properties @@ -0,0 +1,76 @@ +############################################################################### +# Copyright (c) 2000, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### + +InternalAntRunner.Build_file__{0}_1=Buildfile: {0} +InternalAntRunner.Arguments__{0}_2=Arguments: {0} +InternalAntRunner.Default_target__3=Default target: +InternalAntRunner.Main_targets__4=Main targets: +InternalAntRunner.Subtargets__5=Subtargets: +InternalAntRunner.Unable_to_instantiate_logger__{0}_6=Unable to instantiate logger: {0} +InternalAntRunner.Could_not_load_the_version_information._{0}_9=Could not load the version information. {0} +InternalAntRunner.Could_not_load_the_version_information._10=Could not load the version information. +InternalAntRunner.options_13=options +InternalAntRunner.target_15=target +InternalAntRunner.Options___21=Options: +InternalAntRunner.print_this_message_23=print this message +InternalAntRunner.print_project_help_information_25=print project help information +InternalAntRunner.print_the_version_information_and_exit_27=print the version information and exit +InternalAntRunner.be_extra_quiet_29=be extra quiet +InternalAntRunner.be_extra_verbose_31=be extra verbose +InternalAntRunner.print_debugging_information_33=print debugging information +InternalAntRunner.produce_logging_information_without_adornments_35=produce logging information without adornments +InternalAntRunner.use_given_file_for_log_37=use given file for log +InternalAntRunner.the_class_which_is_to_perform_logging_39=the class which is to perform logging +InternalAntRunner.add_an_instance_of_class_as_a_project_listener_41=add an instance of class as a project listener +InternalAntRunner.use_given_buildfile_43=use given buildfile +InternalAntRunner.use_value_for_given_property_45=use value for given property +InternalAntRunner.Using_{0}_file_as_build_log._1=Using {0} file as build log. +InternalAntRunner.Could_not_write_to_the_specified_log_file__{0}._Make_sure_the_path_exists_and_you_have_write_permissions._2=Cannot write on the specified log file: {0}. Make sure the path exists and you have write permissions. +InternalAntRunner.BUILD_SUCCESSFUL_1=BUILD SUCCESSFUL +InternalAntRunner.Unknown_argument__{0}_2=Unknown argument: {0} +InternalAntRunner.Buildfile__{0}_does_not_exist_!_1=Buildfile: {0} does not exist +InternalAntRunner.{0}_which_was_specified_to_be_a_build_listener_is_not_an_instance_of_org.apache.tools.ant.BuildListener._1={0} which was specified to be a build listener is not an instance of org.apache.tools.ant.BuildListener. +InternalAntRunner.{0}_which_was_specified_to_perform_logging_is_not_an_instance_of_org.apache.tools.ant.BuildLogger._2={0} which was specified to perform logging is not an instance of org.apache.tools.ant.BuildLogger. +InternalAntRunner.You_must_specify_a_classname_when_using_the_-listener_argument_1=You must specify a classname when using the -listener argument +InternalAntRunner.You_must_specify_a_log_file_when_using_the_-log_argument_3=You must specify a log file when using the -log argument +InternalAntRunner.You_must_specify_a_buildfile_when_using_the_-buildfile_argument_4=You must specify a buildfile when using the -buildfile argument +InternalAntRunner.12=print information that might be helpful to +InternalAntRunner.13=\t\t\t\t\t\t\tdiagnose or report problems. +InternalAntRunner.19=load all properties from file with -D +InternalAntRunner.20=\t\t\t\t\t\t\tproperties taking precedence +InternalAntRunner.22=the class which will handle input requests +InternalAntRunner.1=\t\t\t\t\' +InternalAntRunner.Only_one_logger_class_may_be_specified_1=Only one logger class may be specified +InternalAntRunner.You_must_specify_a_classname_when_using_the_-inputhandler_argument_1=You must specify a classname when using the -inputhandler argument +InternalAntRunner.Only_one_input_handler_class_may_be_specified._2=Only one input handler class may be specified. +InternalAntRunner.You_must_specify_a_property_filename_when_using_the_-propertyfile_argument_3=You must specify a property filename when using the -propertyfile argument +InternalAntRunner.Could_not_load_property_file_{0}__{1}_4=Could not load property file {0}: {1} +InternalAntRunner.The_specified_input_handler_class_{0}_does_not_implement_the_org.apache.tools.ant.input.InputHandler_interface_5=The specified input handler class {0} does not implement the org.apache.tools.ant.input.InputHandler interface +InternalAntRunner.Unable_to_instantiate_specified_input_handler_class_{0}___{1}_6=Unable to instantiate specified input handler class {0} : {1} +InternalAntRunner.The_diagnositics_options_is_an_Ant_1.5.*_feature._Please_update_your_Ant_classpath_to_include_an_Ant_version_greater_than_this._4=The diagnostics options is an Ant 1.5.* feature. Please update your Ant classpath to include an Ant version greater than this. +InternalAntRunner.Specifying_property_files_is_a_Ant_1.5.*_feature._Please_update_your_Ant_classpath._6=Specifying property files is a Ant 1.5.* feature. Please update your Ant classpath to include an Ant version greater than this. +InternalAntRunner.ANT_HOME_must_be_set_to_use_Ant_diagnostics_2=ANT_HOME must be set to use Ant diagnostics +InternalAntRunner.Buildfile__{0}_is_not_a_file_1=Buildfile: {0} is not a file +InternalAntRunner.-find_not_supported=-find not supported.\nCan be emulated using Run As > Ant Build located\nin the Run > External Tools menu +InternalAntRunner.157=-lib not supported\nConfigure the Ant runtime classpath using either the\nglobal Ant runtime classpath or the Ant runtime classpath\n for this particular build +InternalAntRunner.158=\t\t\tdo not allow interactive input +InternalAntRunner.159=\t\texecute all targets that do not depend +InternalAntRunner.160=\t\t\t\t\t\ton failed target(s) +InternalAntRunner.161=Class {0} not found for task {1} +InternalAntRunner.162=Class {0} not found for type {1} + +RemoteAntBuildLogger.1=BUILD FAILED +RemoteAntBuildLogger.Total_time=Total time: +RemoteAntBuildLogger._minutes_2=\ minutes +RemoteAntBuildLogger._minute_3=\ minute +RemoteAntBuildLogger._seconds_4=\ seconds +RemoteAntBuildLogger._second_5=\ second +RemoteAntBuildLogger._milliseconds_6=\ milliseconds diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/inputhandler/FailInputHandler.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/inputhandler/FailInputHandler.java new file mode 100644 index 000000000..63341f448 --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/inputhandler/FailInputHandler.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2005, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ant.internal.launching.remote.inputhandler; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.tools.ant.input.DefaultInputHandler; + +public class FailInputHandler extends DefaultInputHandler { + + protected InputStream getInputStream() { + //ensure any attempts to read input fail + return new InputStream(){ + public int read() throws IOException { + throw new IOException(); + } + }; + } +} diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/logger/MessageIds.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/logger/MessageIds.java new file mode 100644 index 000000000..1c0741ab1 --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/logger/MessageIds.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2003, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.remote.logger; + + +public class MessageIds { + + public final static String PROCESS_ID= "processID"; //$NON-NLS-1$ + public final static String BUILD_CANCELLED= "cancelled"; //$NON-NLS-1$ + //constants need to start greater than the Project.MSG_* constants + public final static String TASK= "6"; //$NON-NLS-1$ + public final static String TARGET= "7"; //$NON-NLS-1$ +} diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBreakpoint.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBreakpoint.java new file mode 100644 index 000000000..f3715163c --- /dev/null +++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBreakpoint.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.remote.logger; + +import java.io.File; + +import org.eclipse.ant.internal.launching.debug.model.DebugMessageIds; + +public class RemoteAntBreakpoint { + + private File fFile; + private int fLineNumber; + private String fFileName; + + public RemoteAntBreakpoint(String breakpointRepresentation) { + String[] data= breakpointRepresentation.split(DebugMessageIds.MESSAGE_DELIMITER); + String fileName= data[1]; + String lineNumber= data[2]; + fFileName= fileName; + fFile= new File(fileName); + fLineNumber= Integer.parseInt(lineNumber); + } + + public boolean isAt(String fileName, int lineNumber) { + return fLineNumber == lineNumber && fileName != null && fFile.equals(new File(fileName)); + } + + public String toMarshallString() { + StringBuffer buffer= new StringBuffer(DebugMessageIds.BREAKPOINT); + buffer.append(DebugMessageIds.MESSAGE_DELIMITER); + buffer.append(fFileName); + buffer.append(DebugMessageIds.MESSAGE_DELIMITER); + buffer.append(fLineNumber); + return buffer.toString(); + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (!(obj instanceof RemoteAntBreakpoint)) { + return false; + } + RemoteAntBreakpoint other= (RemoteAntBreakpoint) obj; + return other.getLineNumber() == fLineNumber && other.getFile().equals(fFile); + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return fFileName.hashCode() + fLineNumber; + } + + public int getLineNumber() { + return fLineNumber; + } + + public String getFileName() { + return fFileName; + } + + public File getFile() { + return fFile; + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntCoreModelMessages.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntCoreModelMessages.java new file mode 100644 index 000000000..fa78e74ea --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntCoreModelMessages.java @@ -0,0 +1,25 @@ +/********************************************************************** + * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.ant.internal.launching; + +import org.eclipse.osgi.util.NLS; + +public class AntCoreModelMessages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.ant.internal.launching.launchConfigurations.AntCoreModelMessages";//$NON-NLS-1$ + + public static String AntUtil_6; + public static String AntUtil_7; + public static String AntUtil_2; + + static { + // load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, AntCoreModelMessages.class); + } +}
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntCoreModelMessages.properties b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntCoreModelMessages.properties new file mode 100644 index 000000000..6bad54fc4 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntCoreModelMessages.properties @@ -0,0 +1,14 @@ +############################################################################### +# Copyright (c) 2000, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### + +AntUtil_6=Invalid property file entry: {0} +AntUtil_7=Unable to generate Ant classpath +AntUtil_2=Error reading launch configuration diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntLaunch.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntLaunch.java new file mode 100644 index 000000000..81c4143df --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntLaunch.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.Launch; +import org.eclipse.debug.core.model.ISourceLocator; + +/** + * Stores link descriptors for Launch for further use of TaskLinkManager + */ +public class AntLaunch extends Launch { + List linkDescriptors; + + public AntLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) { + super(launchConfiguration, mode, locator); + linkDescriptors = new ArrayList(); + } + + public void addLinkDescriptor(String line, String fileName, int lineNumber, int offset, int length) { + if (fileName!= null && fileName.trim().length() > 0) { + synchronized (linkDescriptors) { + linkDescriptors.add(new LinkDescriptor(line, fileName, lineNumber, offset, length)); + } + } + } + + public void removeLinkDescriptor(LinkDescriptor ld) { + synchronized (linkDescriptors) { + linkDescriptors.remove(ld); + } + } + + public List getLinkDescriptors() { + synchronized (linkDescriptors) { + return new ArrayList(linkDescriptors); + } + } + + public void clearLinkDescriptors() { + synchronized (linkDescriptors) { + linkDescriptors.clear(); + } + } + +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntLaunchingPreferenceInitializer.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntLaunchingPreferenceInitializer.java new file mode 100644 index 000000000..54d596434 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntLaunchingPreferenceInitializer.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.core.runtime.preferences.DefaultScope; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; + +public class AntLaunchingPreferenceInitializer extends + AbstractPreferenceInitializer { + + public AntLaunchingPreferenceInitializer() { + super(); + } + + /* + * (non-Javadoc) + * + * @seeorg.eclipse.core.runtime.preferences.AbstractPreferenceInitializer# + * initializeDefaultPreferences() + */ + public void initializeDefaultPreferences() { + + IEclipsePreferences node = new DefaultScope() + .getNode(AntLaunching.getUniqueIdentifier()); + node.put(IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, + "20000"); //$NON-NLS-1$ + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/IAntLaunchingPreferenceConstants.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/IAntLaunchingPreferenceConstants.java new file mode 100644 index 000000000..9acd58136 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/IAntLaunchingPreferenceConstants.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching; + +/** + * Constants used to identify user preferences. + */ +public interface IAntLaunchingPreferenceConstants { + + /** + * int preference identifier constant which specifies the length of time to wait + * to connect with the socket that communicates with the separate JRE to capture the output + */ + public static final String ANT_COMMUNICATION_TIMEOUT= "timeout"; //$NON-NLS-1$ +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/LinkDescriptor.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/LinkDescriptor.java new file mode 100644 index 000000000..baba206cc --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/LinkDescriptor.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching; + +/** + * Stores detailed data of Link. Used to create linked messages. + */ +public class LinkDescriptor { + String line; + String fileName; + int lineNumber; + int offset; + int length; + + public LinkDescriptor(String line, String fileName, int lineNumber, + int offset, int length) { + super(); + this.line = line; + this.fileName = fileName; + this.lineNumber = lineNumber; + this.offset = offset; + this.length = length; + } + + public String getLine() { + return line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public int getLineNumber() { + return lineNumber; + } + + public void setLineNumber(int lineNumber) { + this.lineNumber = lineNumber; + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + public int getLength() { + return length; + } + + public void setLength(int length) { + this.length = length; + } + +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.java new file mode 100644 index 000000000..396c1c44a --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.java @@ -0,0 +1,23 @@ +/********************************************************************** + * Copyright (c) 2005, 2009 IBM Corporation and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.ant.internal.launching.debug; + +import org.eclipse.osgi.util.NLS; + +public class AntDebugMessages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.ant.internal.launching.debug.AntDebugMessages";//$NON-NLS-1$ + + public static String AntSourceContainer_0; + + static { + // load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, AntDebugMessages.class); + } +}
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.properties b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.properties new file mode 100644 index 000000000..78c11d981 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2005, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### + +AntSourceContainer_0=Ant Source Container
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourceContainer.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourceContainer.java new file mode 100644 index 000000000..579b66fc2 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourceContainer.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2005, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ant.internal.launching.debug; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.debug.core.sourcelookup.ISourceContainerType; +import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer; +import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage; + +public class AntSourceContainer extends AbstractSourceContainer { + + private IWorkspaceRoot fRoot; + + public AntSourceContainer() { + fRoot = ResourcesPlugin.getWorkspace().getRoot(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String) + */ + public Object[] findSourceElements(String path) throws CoreException { + ArrayList sources = new ArrayList(); + File osFile = new File(path); + if (osFile.exists()) { + try { + IPath canonicalPath = new Path(osFile.getCanonicalPath()); + IFile[] files = fRoot.findFilesForLocation(canonicalPath); + if (files.length > 0) { + for (int i = 0; i < files.length; i++) { + sources.add(files[i]); + } + } else { + sources.add(new LocalFileStorage(osFile)); + } + } catch (IOException e) { + } + } + return sources.toArray(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getName() + */ + public String getName() { + return AntDebugMessages.AntSourceContainer_0; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType() + * Not persisted via the launch configuration + */ + public ISourceContainerType getType() { + return null; + } +}
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourceLookupDirector.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourceLookupDirector.java new file mode 100644 index 000000000..e0de3dd7d --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourceLookupDirector.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; +import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant; + +/** + * Ant source lookup director. For Ant source lookup there is one source + * lookup participant. + */ +public class AntSourceLookupDirector extends AbstractSourceLookupDirector { + + /* (non-Javadoc) + * @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#initializeParticipants() + */ + public void initializeParticipants() { + addParticipants(new ISourceLookupParticipant[]{new AntSourceLookupParticipant()}); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IPersistableSourceLocator#getMemento() + */ + public String getMemento() throws CoreException { + return null; + } +}
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourceLookupParticipant.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourceLookupParticipant.java new file mode 100644 index 000000000..73e040977 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourceLookupParticipant.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug; + +import org.eclipse.ant.internal.launching.debug.model.AntStackFrame; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant; + +/** + * The Ant source lookup participant knows how to translate a + * Ant stack frame into a source file name + */ +public class AntSourceLookupParticipant extends AbstractSourceLookupParticipant { + + /* (non-Javadoc) + * @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#getSourceName(java.lang.Object) + */ + public String getSourceName(Object object) throws CoreException { + if (object instanceof AntStackFrame) { + return ((AntStackFrame)object).getFilePath(); + } + if (object instanceof String) { + // assume it's a file name + return (String)object; + } + return null; + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourcePathComputerDelegate.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourcePathComputerDelegate.java new file mode 100644 index 000000000..67e216f03 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/AntSourcePathComputerDelegate.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.sourcelookup.ISourceContainer; +import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate; + +/** + * Computes the default source lookup path for an Ant launch configuration. + * The default source lookup is a container that knows how to map the + * fully qualified file system paths to either the <code>IFile</code> within the workspace or + * a <code>LocalFileStorage</code> for buildfiles not in the workspace. + */ +public class AntSourcePathComputerDelegate implements ISourcePathComputerDelegate { + + /* (non-Javadoc) + * @see org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate#computeSourceContainers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.IProgressMonitor) + */ + public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { + return new ISourceContainer[] {new AntSourceContainer()}; + } +}
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/IAntDebugConstants.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/IAntDebugConstants.java new file mode 100644 index 000000000..c53e121a2 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/IAntDebugConstants.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ant.internal.launching.debug; + +public interface IAntDebugConstants { + + /** + * Unique identifier for the Ant debug model (value + * <code>org.eclipse.ant.ui.debug</code>). + */ + public static final String ID_ANT_DEBUG_MODEL = "org.eclipse.ant.ui.debug"; //$NON-NLS-1$ + + /** + * Unique identifier for the Ant line breakpoint markers + * (value <code>org.eclipse.ant.ui.antLineBreakpointMarker</code>). + */ + public static final String ID_ANT_LINE_BREAKPOINT_MARKER= "org.eclipse.ant.ui.antLineBreakpointMarker"; //$NON-NLS-1$ + + /** + * Unique identifier for the Ant run to line breakpoints + * (value <code>org.eclipse.ant.ui.runToLineBreakpoint</code>). + */ + public static final String ANT_RUN_TO_LINE= "org.eclipse.ant.ui.runToLineBreakpoint"; //$NON-NLS-1$ +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntDebugElement.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntDebugElement.java new file mode 100644 index 000000000..07a952802 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntDebugElement.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug.model; + + +import org.eclipse.ant.internal.launching.AntLaunching; +import org.eclipse.ant.internal.launching.debug.IAntDebugConstants; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.DebugElement; + +/** + * Common function of Ant debug model elements + */ +public abstract class AntDebugElement extends DebugElement { + + /** + * Constructs a new debug element contained in the given + * debug target. + * + * @param target debug target + */ + public AntDebugElement(AntDebugTarget target) { + super(target); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier() + */ + public String getModelIdentifier() { + return IAntDebugConstants.ID_ANT_DEBUG_MODEL; + } + + /** + * Throws a debug exception with the given message, error code, and underlying + * exception. + */ + protected void throwDebugException(String message) throws DebugException { + throw new DebugException(new Status(IStatus.ERROR, AntLaunching.getUniqueIdentifier(), + DebugException.TARGET_REQUEST_FAILED, message, null)); + } + + protected AntDebugTarget getAntDebugTarget() { + return (AntDebugTarget)super.getDebugTarget(); + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntLineBreakpoint.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntLineBreakpoint.java new file mode 100644 index 000000000..2a96b5bd9 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntLineBreakpoint.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug.model; + +import com.ibm.icu.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.ant.internal.launching.debug.IAntDebugConstants; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.debug.core.model.LineBreakpoint; + +/** + * Ant line breakpoint + */ +public class AntLineBreakpoint extends LineBreakpoint { + + /** + * Default constructor is required for the breakpoint manager + * to re-create persisted breakpoints. After instantiating a breakpoint, + * the <code>setMarker(...)</code> method is called to restore + * this breakpoint's attributes. + */ + public AntLineBreakpoint() { + } + + /** + * Constructs a line breakpoint on the given resource at the given + * line number. The line number is 1-based (i.e. the first line of a + * file is line number 1). + * + * @param resource file on which to set the breakpoint + * @param lineNumber 1-based line number of the breakpoint + * @throws CoreException if unable to create the breakpoint + */ + public AntLineBreakpoint(IResource resource, int lineNumber) throws CoreException { + this(resource, lineNumber, new HashMap(), true); + } + + /** + * Constructs a line breakpoint on the given resource at the given + * line number. The line number is 1-based (i.e. the first line of a + * file is line number 1). + * + * @param resource file on which to set the breakpoint + * @param lineNumber 1-based line number of the breakpoint + * @param attributes the marker attributes to set + * @param register whether to add this breakpoint to the breakpoint manager + * @throws CoreException if unable to create the breakpoint + */ + public AntLineBreakpoint(final IResource resource, final int lineNumber, final Map attributes, final boolean register) throws CoreException { + IWorkspaceRunnable wr= new IWorkspaceRunnable() { + public void run(IProgressMonitor monitor) throws CoreException { + IMarker marker = resource.createMarker(IAntDebugConstants.ID_ANT_LINE_BREAKPOINT_MARKER); + setMarker(marker); + attributes.put(IBreakpoint.ENABLED, Boolean.TRUE); + attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber)); + attributes.put(IBreakpoint.ID, IAntDebugConstants.ID_ANT_DEBUG_MODEL); + attributes.put(IMarker.MESSAGE, MessageFormat.format(DebugModelMessages.AntLineBreakpoint_0, new String[] {Integer.toString(lineNumber)})); + ensureMarker().setAttributes(attributes); + + register(register); + } + }; + run(getMarkerRule(resource), wr); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier() + */ + public String getModelIdentifier() { + return IAntDebugConstants.ID_ANT_DEBUG_MODEL; + } + + /** + * @return whether this breakpoint is a run to line breakpoint + */ + public boolean isRunToLine() { + try { + return ensureMarker().getAttribute(IAntDebugConstants.ANT_RUN_TO_LINE, false); + } catch (DebugException e) { + return false; + } + } + + /** + * Add this breakpoint to the breakpoint manager, + * or sets it as unregistered. + */ + private void register(boolean register) throws CoreException { + if (register) { + DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(this); + } else { + setRegistered(false); + } + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntProperties.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntProperties.java new file mode 100644 index 000000000..4f93fec49 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntProperties.java @@ -0,0 +1,109 @@ +/******************************************************************************* + * Copyright (c) 2005, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug.model; + +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.IValue; +import org.eclipse.debug.core.model.IVariable; + +public class AntProperties extends AntDebugElement implements IVariable { + + private IValue fValue; + private String fName; + private boolean fValid= true; + + public AntProperties(AntDebugTarget target, String name) { + super(target); + fName= name; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IVariable#getValue() + */ + public synchronized IValue getValue() throws DebugException { + int attempts= 0; + while (!fValid && !getDebugTarget().isTerminated()) { + try { + wait(50); + } catch (InterruptedException e) { + } + if (attempts == 20 && !fValid && !getDebugTarget().isTerminated()) { + throwDebugException(DebugModelMessages.AntProperties_1); + } + attempts++; + } + return fValue; + } + + public IValue getLastValue() { + return fValue; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IVariable#getName() + */ + public String getName() { + return fName; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName() + */ + public String getReferenceTypeName() { + return ""; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IVariable#hasValueChanged() + */ + public boolean hasValueChanged() { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String) + */ + public void setValue(String expression) { + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue) + */ + public void setValue(IValue value) { + fValue= value; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification() + */ + public boolean supportsValueModification() { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String) + */ + public boolean verifyValue(String expression) { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue) + */ + public boolean verifyValue(IValue value) { + return false; + } + + public synchronized void setValid(boolean valid) { + fValid= valid; + notifyAll(); + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntPropertiesValue.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntPropertiesValue.java new file mode 100644 index 000000000..2ec303ce0 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntPropertiesValue.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2005, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Brock Janiczak (brockj@tpg.com.au) - bug 154907 + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug.model; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.eclipse.debug.core.model.IValue; +import org.eclipse.debug.core.model.IVariable; + +public class AntPropertiesValue extends AntDebugElement implements IValue { + + private List fProperties= new ArrayList(); + + public AntPropertiesValue(AntDebugTarget target) { + super(target); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName() + */ + public String getReferenceTypeName() { + return ""; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValue#getValueString() + */ + public String getValueString() { + return ""; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValue#isAllocated() + */ + public boolean isAllocated() { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValue#getVariables() + */ + public IVariable[] getVariables() { + Collections.sort(fProperties); + return (IVariable[])fProperties.toArray(new IVariable[fProperties.size()]); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValue#hasVariables() + */ + public boolean hasVariables() { + return true; + } + + protected void addProperties(List properties) { + fProperties.addAll(properties); + } + + public List getProperties() { + return fProperties; + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntProperty.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntProperty.java new file mode 100644 index 000000000..9a699da01 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntProperty.java @@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Brock Janiczak (brockj@tpg.com.au) - bug 154907 + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug.model; + +import org.eclipse.debug.core.model.IValue; +import org.eclipse.debug.core.model.IVariable; + +/** + * A property in an Ant build. + */ +public class AntProperty extends AntDebugElement implements IVariable, Comparable { + + private String fName; + private AntValue fValue; + private String fLabel; + + /** + * Constructs a variable associated with the debug target + * with the given name and value. + * + * @param target the debug target + * @param name property name + * @param value property value + */ + public AntProperty(AntDebugTarget target, String name, String value) { + super(target); + fName = name; + fValue= new AntValue(target, value); + } + + /* + * @see org.eclipse.debug.core.model.IVariable#getValue() + */ + public IValue getValue() { + return fValue; + } + + /* + * @see org.eclipse.debug.core.model.IVariable#getName() + */ + public String getName() { + return fName; + } + + /* + * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName() + */ + public String getReferenceTypeName() { + return ""; //$NON-NLS-1$ + } + + /* + * @see org.eclipse.debug.core.model.IVariable#hasValueChanged() + */ + public boolean hasValueChanged() { + return false; + } + + /* + * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String) + */ + public void setValue(String expression) { + } + + /* + * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue) + */ + public void setValue(IValue value) { + } + + /* + * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification() + */ + public boolean supportsValueModification() { + return false; + } + + /* + * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String) + */ + public boolean verifyValue(String expression) { + return false; + } + + /* + * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue) + */ + public boolean verifyValue(IValue value) { + return false; + } + + /** + * @return the text used to render this property + */ + public String getText() { + if (fLabel == null) { + StringBuffer buffer= new StringBuffer(getName()); + buffer.append("= "); //$NON-NLS-1$ + buffer.append(fValue.getValueString()); + fLabel= buffer.toString(); + } + return fLabel; + } + + /* + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ + public int compareTo(Object other) { + AntProperty otherProperty = (AntProperty) other; + return fName.compareToIgnoreCase(otherProperty.getName()); + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntStackFrame.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntStackFrame.java new file mode 100644 index 000000000..a72a712c1 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntStackFrame.java @@ -0,0 +1,314 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug.model; + +import org.eclipse.ant.internal.launching.AntLaunchingUtil; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.Path; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.IRegisterGroup; +import org.eclipse.debug.core.model.IStackFrame; +import org.eclipse.debug.core.model.IThread; +import org.eclipse.debug.core.model.IVariable; + +/** + * Ant stack frame. + */ +public class AntStackFrame extends AntDebugElement implements IStackFrame { + + private AntThread fThread; + private String fName; + private int fLineNumber; + private String fFilePath; + private int fId; + private String fFullPath; + + /** + * Constructs a stack frame in the given thread with the given id. + * + * @param antThread + * @param id stack frame id (0 is the top of the stack) + */ + public AntStackFrame(AntThread antThread, int id, String name, String fullPath, int lineNumber) { + super((AntDebugTarget) antThread.getDebugTarget()); + fId = id; + fThread = antThread; + fLineNumber= lineNumber; + fName= name; + setFilePath(fullPath); + } + + public void setId(int id) { + fId= id; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getThread() + */ + public IThread getThread() { + return fThread; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getVariables() + */ + public IVariable[] getVariables() throws DebugException { + return fThread.getVariables(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#hasVariables() + */ + public boolean hasVariables() { + return isSuspended(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getLineNumber() + */ + public int getLineNumber() { + return fLineNumber; + } + + public void setLineNumber(int lineNumber) { + fLineNumber= lineNumber; + } + + public void setFilePath(String fullPath) { + fFullPath= fullPath; + IFile file= AntLaunchingUtil.getFileForLocation(fullPath, null); + if (file != null) { + fFilePath= file.getProjectRelativePath().toString(); + } else { + fFilePath= new Path(fullPath).lastSegment(); + } + } + + public String getFilePath() { + return fFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getCharStart() + */ + public int getCharStart() { + return -1; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getCharEnd() + */ + public int getCharEnd() { + return -1; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getName() + */ + public String getName() { + return fName; + } + + public void setName(String name) { + fName= name; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups() + */ + public IRegisterGroup[] getRegisterGroups() { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups() + */ + public boolean hasRegisterGroups() { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#canStepInto() + */ + public boolean canStepInto() { + return getThread().canStepInto(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#canStepOver() + */ + public boolean canStepOver() { + return getThread().canStepOver(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#canStepReturn() + */ + public boolean canStepReturn() { + return getThread().canStepReturn(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#isStepping() + */ + public boolean isStepping() { + return getThread().isStepping(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#stepInto() + */ + public void stepInto() throws DebugException { + getThread().stepInto(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#stepOver() + */ + public void stepOver() throws DebugException { + getThread().stepOver(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#stepReturn() + */ + public void stepReturn() throws DebugException { + getThread().stepReturn(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ISuspendResume#canResume() + */ + public boolean canResume() { + return getThread().canResume(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() + */ + public boolean canSuspend() { + return getThread().canSuspend(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() + */ + public boolean isSuspended() { + return getThread().isSuspended(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ISuspendResume#resume() + */ + public void resume() throws DebugException { + getThread().resume(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ISuspendResume#suspend() + */ + public void suspend() throws DebugException { + getThread().suspend(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ITerminate#canTerminate() + */ + public boolean canTerminate() { + return getThread().canTerminate(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ITerminate#isTerminated() + */ + public boolean isTerminated() { + return getThread().isTerminated(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ITerminate#terminate() + */ + public void terminate() throws DebugException { + getThread().terminate(); + } + + /** + * Returns the name of the buildfile this stack frame is associated + * with. + * + * @return the name of the buildfile this stack frame is associated + * with + */ + public String getSourceName() { + return fFilePath; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (obj instanceof AntStackFrame) { + AntStackFrame sf = (AntStackFrame)obj; + if (getSourceName() != null) { + return getSourceName().equals(sf.getSourceName()) && + sf.getLineNumber() == getLineNumber() && + sf.fId == fId; + } + return sf.fId == fId; + } + return false; + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + if (getSourceName() == null) { + return fId; + } + return getSourceName().hashCode() + fId; + } + + /** + * Returns this stack frame's unique identifier within its thread + * + * @return this stack frame's unique identifier within its thread + */ + protected int getIdentifier() { + return fId; + } + + /** + * Returns the system, user or runtime property + * name, or <code>null</code> if unable to resolve a property with the name. + * + * @param propertyName the name of the variable to search for + * @return a property, or <code>null</code> if none + */ + public AntProperty findProperty(String propertyName) { + try { + IVariable[] groups= getVariables(); + for (int i = 0; i < groups.length; i++) { + AntProperties propertiesGrouping = (AntProperties) groups[i]; + AntPropertiesValue value= (AntPropertiesValue) propertiesGrouping.getValue(); + IVariable[] properties= value.getVariables(); + for (int j = 0; j < properties.length; j++) { + AntProperty property = (AntProperty) properties[j]; + if (property.getName().equals(propertyName)) { + return property; + } + } + } + } catch (DebugException e) { + } + return null; + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntValue.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntValue.java new file mode 100644 index 000000000..2285279be --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/AntValue.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug.model; + +import org.eclipse.ant.internal.launching.debug.IAntDebugConstants; +import org.eclipse.debug.core.model.IValue; +import org.eclipse.debug.core.model.IVariable; + +public class AntValue extends AntDebugElement implements IValue { + + private String fValueString; + protected static final IVariable[] EMPTY = new IVariable[0]; + + /** + * @param target + */ + public AntValue(AntDebugTarget target, String value) { + super(target); + fValueString= value; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName() + */ + public String getReferenceTypeName() { + return ""; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValue#getValueString() + */ + public String getValueString() { + return fValueString; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValue#isAllocated() + */ + public boolean isAllocated() { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValue#getVariables() + */ + public IVariable[] getVariables() { + return EMPTY; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IValue#hasVariables() + */ + public boolean hasVariables() { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier() + */ + public String getModelIdentifier() { + return IAntDebugConstants.ID_ANT_DEBUG_MODEL; + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/DebugMessageIds.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/DebugMessageIds.java new file mode 100644 index 000000000..fcc8f3ed2 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/DebugMessageIds.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.debug.model; + + +public class DebugMessageIds { + + public final static String MESSAGE_DELIMITER= ","; //$NON-NLS-1$ + + public final static String BUILD_STARTED= "build_started"; //$NON-NLS-1$ + public final static String TARGET_STARTED= "target_started"; //$NON-NLS-1$ + public final static String TARGET_FINISHED= "target_finished"; //$NON-NLS-1$ + public final static String TASK_STARTED= "task_started"; //$NON-NLS-1$ + public final static String TASK_FINISHED= "task_finished"; //$NON-NLS-1$ + + public final static String STEP= "step"; //$NON-NLS-1$ + public final static String STEP_OVER= "step_over"; //$NON-NLS-1$ + public final static String STEP_INTO= "step_into"; //$NON-NLS-1$ + + public final static String TERMINATE= "terminate"; //$NON-NLS-1$ + public final static String TERMINATED= "terminated"; //$NON-NLS-1$ + public final static String SUSPEND= "suspend"; //$NON-NLS-1$ + public final static String SUSPENDED= "suspended"; //$NON-NLS-1$ + public final static String RESUME= "resume"; //$NON-NLS-1$ + + public final static String STACK= "stack"; //$NON-NLS-1$ + + public final static String ADD_BREAKPOINT= "add"; //$NON-NLS-1$ + public final static String REMOVE_BREAKPOINT= "remove"; //$NON-NLS-1$ + + public final static String CLIENT_REQUEST= "client"; //$NON-NLS-1$ + public final static String BREAKPOINT= "breakpoint"; //$NON-NLS-1$ + + public final static String PROPERTIES= "prop"; //$NON-NLS-1$ + public final static String PROPERTY_VALUE= "value"; //$NON-NLS-1$ + public final static int PROPERTY_USER= 0; + public final static int PROPERTY_SYSTEM= 1; + public final static int PROPERTY_RUNTIME= 2; +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.java new file mode 100644 index 000000000..acadad642 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.java @@ -0,0 +1,32 @@ +/********************************************************************** + * Copyright (c) 2004, 2009 IBM Corporation and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.ant.internal.launching.debug.model; + +import org.eclipse.osgi.util.NLS; + +public class DebugModelMessages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.ant.internal.launching.debug.model.DebugModelMessages";//$NON-NLS-1$ + + public static String AntDebugTarget_0; + + public static String AntLineBreakpoint_0; + public static String AntThread_0; + public static String AntThread_1; + public static String AntThread_2; + public static String AntThread_3; + public static String AntThread_4; + + public static String AntProperties_1; + + static { + // load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, DebugModelMessages.class); + } +}
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.properties b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.properties new file mode 100644 index 000000000..31cf84398 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.properties @@ -0,0 +1,21 @@ +############################################################################### +# Copyright (c) 2004, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### + +AntDebugTarget_0=Ant Build + +AntLineBreakpoint_0=Ant breakpoint [line: {0}] +AntThread_0=User Properties +AntThread_1=System Properties +AntThread_2=Runtime Properties +AntThread_3=Request to retrieve Ant stack frames failed +AntThread_4=Request to retrieve Ant properties failed + +AntProperties_1=Request to Ant properties value failed diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntClasspathProvider.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntClasspathProvider.java new file mode 100644 index 000000000..e4f8b36cf --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntClasspathProvider.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ant.internal.launching.launchConfigurations; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; +import org.eclipse.jdt.launching.IRuntimeClasspathEntry; +import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.jdt.launching.StandardClasspathProvider; + +public class AntClasspathProvider extends StandardClasspathProvider { + + /* (non-Javadoc) + * @see org.eclipse.jdt.launching.IRuntimeClasspathProvider#computeUnresolvedClasspath(org.eclipse.debug.core.ILaunchConfiguration) + */ + public IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration configuration) throws CoreException { + boolean useDefault = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true); + if (useDefault) { + List rtes = new ArrayList(10); + IRuntimeClasspathEntry jreEntry = null; + try { + jreEntry = JavaRuntime.computeJREEntry(configuration); + } catch (CoreException e) { + // not a java project + } + if (jreEntry == null) { + jreEntry = JavaRuntime.newRuntimeContainerClasspathEntry( + JavaRuntime.newDefaultJREContainerPath(), IRuntimeClasspathEntry.STANDARD_CLASSES); + } + rtes.add(jreEntry); + rtes.add(new AntHomeClasspathEntry()); + rtes.add(new ContributedClasspathEntriesEntry()); + return (IRuntimeClasspathEntry[]) rtes.toArray(new IRuntimeClasspathEntry[rtes.size()]); + } + return super.computeUnresolvedClasspath(configuration); + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntHomeClasspathEntry.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntHomeClasspathEntry.java new file mode 100644 index 000000000..1a8a9bf7c --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntHomeClasspathEntry.java @@ -0,0 +1,210 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.launchConfigurations; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.ant.core.AntCorePlugin; +import org.eclipse.ant.core.AntCorePreferences; +import org.eclipse.ant.core.IAntClasspathEntry; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.jdt.internal.launching.AbstractRuntimeClasspathEntry; +import org.eclipse.jdt.launching.IRuntimeClasspathEntry; +import org.eclipse.jdt.launching.JavaRuntime; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import com.ibm.icu.text.MessageFormat; + +/** + * A classpath entry that contains a set of archives for a particular + * ANT_HOME. + * + * @since 3.0 + */ +public class AntHomeClasspathEntry extends AbstractRuntimeClasspathEntry { + + public static final String TYPE_ID = "org.eclipse.ant.ui.classpathentry.antHome"; //$NON-NLS-1$ + + /** + * Local path on disk where Ant Home is located or <code>null</code> + * to indicate the use of the default Ant Home. + */ + private String antHomeLocation = null; + + /** + * Creates an AntHome entry for the default AntHome installation. + */ + public AntHomeClasspathEntry() { + antHomeLocation = null; + } + + /** + * Constructs an AntHome entry for the Ant installed at the specified + * root directory. + * + * @param antHome path in the local file system to an Ant installation + */ + public AntHomeClasspathEntry(String antHome) { + antHomeLocation = antHome; + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.internal.launching.AbstractRuntimeClasspathEntry#buildMemento(org.w3c.dom.Document, org.w3c.dom.Element) + */ + protected void buildMemento(Document document, Element memento) throws CoreException { + if (antHomeLocation == null) { + memento.setAttribute("default", "true"); //$NON-NLS-1$//$NON-NLS-2$ + } else { + memento.setAttribute("antHome", new Path(antHomeLocation).toString()); //$NON-NLS-1$ + } + } + /* (non-Javadoc) + * @see org.eclipse.jdt.internal.launching.IRuntimeClasspathEntry2#initializeFrom(org.w3c.dom.Element) + */ + public void initializeFrom(Element memento) throws CoreException { + String antHome = memento.getAttribute("antHome"); //$NON-NLS-1$ + if (antHome != null && (antHome.length() > 0)) { + IPath path = new Path(antHome); + antHomeLocation = path.toOSString(); + } else { + antHomeLocation = null; + } + } + /* (non-Javadoc) + * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getTypeId() + */ + public String getTypeId() { + return TYPE_ID; + } + /* (non-Javadoc) + * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getRuntimeClasspathEntries(org.eclipse.debug.core.ILaunchConfiguration) + */ + public IRuntimeClasspathEntry[] getRuntimeClasspathEntries(ILaunchConfiguration configuration) throws CoreException { + List libs = new ArrayList(40); + AntCorePreferences preferences = AntCorePlugin.getPlugin().getPreferences(); + if (antHomeLocation == null) { + IAntClasspathEntry[] entries = preferences.getAntHomeClasspathEntries(); + for (int i = 0; i < entries.length; i++) { + IAntClasspathEntry entry = entries[i]; + libs.add(JavaRuntime.newStringVariableClasspathEntry(entry.getLabel())); + } + } else { + File lib= resolveAntHome(); + IPath libDir = new Path(antHomeLocation).append("lib"); //$NON-NLS-1$ + String[] fileNames = lib.list(); + for (int i = 0; i < fileNames.length; i++) { + String name = fileNames[i]; + IPath path = new Path(name); + String fileExtension = path.getFileExtension(); + if ("jar".equalsIgnoreCase(fileExtension)) { //$NON-NLS-1$ + libs.add(JavaRuntime.newArchiveRuntimeClasspathEntry(libDir.append(path))); + } + } + } + return (IRuntimeClasspathEntry[]) libs.toArray(new IRuntimeClasspathEntry[libs.size()]); + } + + public File resolveAntHome() throws CoreException { + if (antHomeLocation == null) { //using the default ant home + return null; + } + IPath libDir= new Path(antHomeLocation).append("lib"); //$NON-NLS-1$ + File lib= libDir.toFile(); + File parentDir= lib.getParentFile(); + if (parentDir == null || !parentDir.exists()) { + abort(MessageFormat.format(AntLaunchConfigurationMessages.AntHomeClasspathEntry_10, new String[] {antHomeLocation}), null); + } + if (!lib.exists() || !lib.isDirectory()) { + abort(MessageFormat.format(AntLaunchConfigurationMessages.AntHomeClasspathEntry_11, new String[] {antHomeLocation}), null); + } + return lib; + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getName() + */ + public String getName() { + if (antHomeLocation == null) { + return AntLaunchConfigurationMessages.AntHomeClasspathEntry_8; + } + return MessageFormat.format(AntLaunchConfigurationMessages.AntHomeClasspathEntry_9, new String[]{antHomeLocation}); + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry#getType() + */ + public int getType() { + return IRuntimeClasspathEntry.OTHER; + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#isComposite() + */ + public boolean isComposite() { + return true; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + return obj instanceof AntHomeClasspathEntry && + equalsOrNull(antHomeLocation, ((AntHomeClasspathEntry)obj).antHomeLocation); + } + + /** + * Return whether s1 is equivalent to s2. + * + * @param s1 + * @param s2 + * @return whether s1 is equivalent to s2 + */ + private boolean equalsOrNull(String s1, String s2) { + if (s1 == null || s2 == null) { + return s1 == s2; + } + return s1.equalsIgnoreCase(s2); + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return getClass().hashCode(); + } + + /** + * Sets the ant home to use. + * + * @param path path to toor of an ant home installation + */ + public void setAntHome(String path) { + antHomeLocation = path; + } + + /** + * Returns the ant home location + * + * @return path to root ant installation directory + */ + public String getAntHome() { + if (antHomeLocation == null) { + return AntCorePlugin.getPlugin().getPreferences().getAntHome(); + } + return antHomeLocation; + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntJavaLaunchDelegate.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntJavaLaunchDelegate.java new file mode 100644 index 000000000..ac08c65cf --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntJavaLaunchDelegate.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.launchConfigurations; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; +import org.eclipse.jdt.launching.JavaLaunchDelegate; + +/** + * Used by the AntLaunchDelegate for Ant builds in a separate VM + * The subclassing is needed to be able to launch an Ant build from a non-Java project + */ +public class AntJavaLaunchDelegate extends JavaLaunchDelegate { + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate2#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) + */ + public boolean preLaunchCheck(ILaunchConfiguration configuration,String mode, IProgressMonitor monitor) throws CoreException { + try { + return super.preLaunchCheck(configuration, mode, monitor); + } catch (CoreException ce) { + //likely dealing with a non-Java project + } + //no need to check for breakpoints as always in run mode + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getProgramArguments(org.eclipse.debug.core.ILaunchConfiguration) + */ + public String getProgramArguments(ILaunchConfiguration configuration) throws CoreException { + try { + return super.getProgramArguments(configuration); + } catch (CoreException ce) { + } + return configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$ + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.java new file mode 100644 index 000000000..30c7df3b9 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.java @@ -0,0 +1,37 @@ +/********************************************************************** + * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + * dakshinamurthy.karra@gmail.com - bug 165371 + **********************************************************************/ +package org.eclipse.ant.internal.launching.launchConfigurations; + +import org.eclipse.osgi.util.NLS; + +public class AntLaunchConfigurationMessages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchConfigurationMessages";//$NON-NLS-1$ + + public static String AntLaunchDelegate_Launching__0__1; + public static String AntLaunchDelegate_Running__0__2; + public static String AntLaunchDelegate_Build_In_Progress; + public static String AntLaunchDelegate_Failure; + public static String AntLaunchDelegate_22; + public static String AntLaunchDelegate_23; + public static String AntLaunchDelegate_28; + + public static String AntHomeClasspathEntry_8; + public static String AntHomeClasspathEntry_9; + public static String AntHomeClasspathEntry_10; + public static String AntHomeClasspathEntry_11; + + public static String ContributedClasspathEntriesEntry_1; + + static { + // load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, AntLaunchConfigurationMessages.class); + } +}
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.properties b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.properties new file mode 100644 index 000000000..e66165576 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.properties @@ -0,0 +1,26 @@ +############################################################################### +# Copyright (c) 2000, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +# dakshinamurthy.karra@gmail.com - bug 165371 +############################################################################### + +AntLaunchDelegate_Launching__0__1=Launching {0} +AntLaunchDelegate_Running__0__2=Running {0} +AntLaunchDelegate_Build_In_Progress=Ant build {0} already in progress. Concurrent Ant builds are possible if you specify to build in a separate JRE. +AntLaunchDelegate_Failure=Failure of Background Ant Build +AntLaunchDelegate_22=&Do not show error dialog when Ant build fails +AntLaunchDelegate_23=Ant Build Failed +AntLaunchDelegate_28=Waiting for virtual machine to exit... + +AntHomeClasspathEntry_8=Ant Home (Default) +AntHomeClasspathEntry_9=Ant Home ({0}) +AntHomeClasspathEntry_10=Ant Home {0} does not exist +AntHomeClasspathEntry_11=Ant Home {0} does not contain a "lib" directory + +ContributedClasspathEntriesEntry_1=Additional Tasks & Support
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntMigrationDelegate.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntMigrationDelegate.java new file mode 100644 index 000000000..bd568321d --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntMigrationDelegate.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2006, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.launchConfigurations; + +import org.eclipse.ant.internal.launching.AntLaunchingUtil; +import org.eclipse.core.externaltools.internal.IExternalToolConstants; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.variables.IStringVariableManager; +import org.eclipse.core.variables.VariablesPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; + +/** + * Delegate for migrating Ant launch configurations. + * The migration process involves a resource mapping being created such that launch configurations + * can be filtered from the launch configuration dialog based on resource availability. + * + * @since 3.2 + */ +public class AntMigrationDelegate implements ILaunchConfigurationMigrationDelegate { + + /** + * Method to get the file for the specified launch configuration that should be mapped to the launch configuration + * + * @param candidate the launch configuration that the file will be mapped to. + * @return the buildfile or <code>null</code> if not in the workspace + */ + protected IFile getFileForCandidate(ILaunchConfiguration candidate) { + IFile file= null; + String expandedLocation= null; + String location= null; + IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); + try { + location= candidate.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String)null); + if (location != null) { + expandedLocation= manager.performStringSubstitution(location); + if (expandedLocation != null) { + file= AntLaunchingUtil.getFileForLocation(expandedLocation, null); + } + } + } catch (CoreException e) { + } + return file; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate#isCandidate() + */ + public boolean isCandidate(ILaunchConfiguration candidate) throws CoreException { + IResource[] mappedResources = candidate.getMappedResources(); + if (mappedResources != null && mappedResources.length > 0) { + return false; + } + return getFileForCandidate(candidate) != null; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate#migrate(org.eclipse.debug.core.ILaunchConfiguration) + */ + public void migrate(ILaunchConfiguration candidate) throws CoreException { + IFile file = getFileForCandidate(candidate); + ILaunchConfigurationWorkingCopy wc = candidate.getWorkingCopy(); + wc.setMappedResources(new IResource[] {file}); + wc.doSave(); + } +}
\ No newline at end of file diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java new file mode 100644 index 000000000..cf6199f60 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.launchConfigurations; + +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.debug.core.IStreamListener; +import org.eclipse.debug.core.model.IFlushableStreamMonitor; + +/** + * Stream monitor implementation for an Ant build process. + */ +public class AntStreamMonitor implements IFlushableStreamMonitor { + + private StringBuffer fContents = new StringBuffer(); + private ListenerList fListeners = new ListenerList(1); + private boolean fBuffered = true; + + /** + * @see org.eclipse.debug.core.model.IStreamMonitor#addListener(org.eclipse.debug.core.IStreamListener) + */ + public void addListener(IStreamListener listener) { + fListeners.add(listener); + } + + /** + * @see org.eclipse.debug.core.model.IStreamMonitor#getContents() + */ + public String getContents() { + return fContents.toString(); + } + + /** + * @see org.eclipse.debug.core.model.IStreamMonitor#removeListener(org.eclipse.debug.core.IStreamListener) + */ + public void removeListener(IStreamListener listener) { + fListeners.remove(listener); + } + + /** + * Appends the given message to this stream, and notifies listeners. + * + * @param message + */ + public void append(String message) { + if (isBuffered()) { + fContents.append(message); + } + Object[] listeners = fListeners.getListeners(); + for (int i = 0; i < listeners.length; i++) { + IStreamListener listener = (IStreamListener)listeners[i]; + listener.streamAppended(message, this); + } + } + /** + * @see org.eclipse.debug.core.model.IFlushableStreamMonitor#flushContents() + */ + public void flushContents() { + fContents.setLength(0); + } + + /** + * @see org.eclipse.debug.core.model.IFlushableStreamMonitor#isBuffered() + */ + public boolean isBuffered() { + return fBuffered; + } + + /** + * @see org.eclipse.debug.core.model.IFlushableStreamMonitor#setBuffered(boolean) + */ + public void setBuffered(boolean buffer) { + fBuffered = buffer; + } +} + diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamsProxy.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamsProxy.java new file mode 100644 index 000000000..66a5e0986 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamsProxy.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.internal.launching.launchConfigurations; + + +import org.eclipse.ant.internal.launching.AntLaunching; +import org.eclipse.debug.core.model.IStreamMonitor; +import org.eclipse.debug.core.model.IStreamsProxy; + +/** + * + */ +public class AntStreamsProxy implements IStreamsProxy { + + private AntStreamMonitor fErrorMonitor = new AntStreamMonitor(); + private AntStreamMonitor fOutputMonitor = new AntStreamMonitor(); + + public static final String ANT_DEBUG_STREAM = AntLaunching.PLUGIN_ID + ".ANT_DEBUG_STREAM"; //$NON-NLS-1$ + public static final String ANT_VERBOSE_STREAM = AntLaunching.PLUGIN_ID + ".ANT_VERBOSE_STREAM"; //$NON-NLS-1$ + public static final String ANT_WARNING_STREAM = AntLaunching.PLUGIN_ID + ".ANT_WARNING_STREAM"; //$NON-NLS-1$ + + private AntStreamMonitor fDebugMonitor = new AntStreamMonitor(); + private AntStreamMonitor fVerboseMonitor = new AntStreamMonitor(); + private AntStreamMonitor fWarningMonitor = new AntStreamMonitor(); + + /** + * @see org.eclipse.debug.core.model.IStreamsProxy#getErrorStreamMonitor() + */ + public IStreamMonitor getErrorStreamMonitor() { + return fErrorMonitor; + } + + /** + * @see org.eclipse.debug.core.model.IStreamsProxy#getOutputStreamMonitor() + */ + public IStreamMonitor getOutputStreamMonitor() { + return fOutputMonitor; + } + + /** + * @see org.eclipse.debug.core.model.IStreamsProxy#write(java.lang.String) + */ + public void write(String input) { + } + + public IStreamMonitor getWarningStreamMonitor() { + return fWarningMonitor; + } + + public IStreamMonitor getDebugStreamMonitor() { + return fDebugMonitor; + } + + public IStreamMonitor getVerboseStreamMonitor() { + return fVerboseMonitor; + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/MessageIds.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/MessageIds.java new file mode 100644 index 000000000..119e18af7 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/MessageIds.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2003, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ant.internal.launching.launchConfigurations; + +public class MessageIds { + + public final static String PROCESS_ID= "processID"; //$NON-NLS-1$ + public final static String BUILD_CANCELLED= "cancelled"; //$NON-NLS-1$ + //constants need to start greater than the Project.MSG_* constants + public final static String TASK= "6"; //$NON-NLS-1$ + public final static String TARGET= "7"; //$NON-NLS-1$ +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntProcessFactory.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntProcessFactory.java new file mode 100644 index 000000000..013c13e05 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntProcessFactory.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ant.internal.launching.launchConfigurations; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.ant.launching.IAntLaunchConstants; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.IProcessFactory; +import org.eclipse.debug.core.model.IProcess; + +public class RemoteAntProcessFactory implements IProcessFactory { + + /* (non-Javadoc) + * @see org.eclipse.debug.core.IProcessFactory#newProcess(org.eclipse.debug.core.ILaunch, java.lang.Process, java.lang.String, java.util.Map) + */ + public IProcess newProcess(ILaunch launch, Process process, String label, Map attributes) { + if (attributes == null) { + attributes= new HashMap(1); + } + attributes.put(IProcess.ATTR_PROCESS_TYPE, IAntLaunchConstants.ID_ANT_PROCESS_TYPE); + return new RemoteAntRuntimeProcess(launch, process, label, attributes); + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntRuntimeProcess.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntRuntimeProcess.java new file mode 100644 index 000000000..4a0bba2b1 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntRuntimeProcess.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ant.internal.launching.launchConfigurations; + +import java.util.Map; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.model.IStreamsProxy; +import org.eclipse.debug.core.model.RuntimeProcess; + +public class RemoteAntRuntimeProcess extends RuntimeProcess { + + /** + * Constructs a RuntimeProcess on the given system process + * with the given name, adding this process to the given + * launch. + * Sets the streams proxy to an AntStreamsProxy if output is captured. + */ + public RemoteAntRuntimeProcess(ILaunch launch, Process process, String name, Map attributes) { + super(launch, process, name, attributes); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.RuntimeProcess#createStreamsProxy() + */ + protected IStreamsProxy createStreamsProxy() { + return new AntStreamsProxy(); + } +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/launching/IAntLaunchConstants.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/launching/IAntLaunchConstants.java new file mode 100644 index 000000000..ec8ae33bd --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/launching/IAntLaunchConstants.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2008, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ant.launching; + +import org.eclipse.core.externaltools.internal.IExternalToolConstants; + +/** + * Constant definitions for Ant launch configurations. + * + * @since 1.0 + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IAntLaunchConstants { + + /** + * Ant launch configuration type identifier. + */ + public static final String ID_ANT_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ant.AntLaunchConfigurationType"; //$NON-NLS-1$ + + public static final String MAIN_TYPE_NAME= "org.eclipse.ant.internal.launching.remote.InternalAntRunner"; //$NON-NLS-1$ + + /** + * Ant builder launch configuration type identifier. Ant project builders + * are of this type. + */ + public static final String ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ant.AntBuilderLaunchConfigurationType"; //$NON-NLS-1$ + + /** + * String attribute indicating the Ant targets to execute. Default value is + * <code>null</code> which indicates that the default target is to be + * executed. Format is a comma separated listing of targets. + */ + public static final String ATTR_ANT_TARGETS = IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_ANT_TARGETS"; //$NON-NLS-1$ + + /** + * String attribute indicating the Ant targets to execute after a clean + * (full build) for an Ant builder. Default value is <code>null</code> which + * indicates that the default target is to be executed. Format is a comma + * separated listing of targets. + */ + public static final String ATTR_ANT_AFTER_CLEAN_TARGETS = "org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS"; //$NON-NLS-1$ + + /** + * String attribute indicating the Ant targets to execute during a manual + * build for an Ant builder. Default value is <code>null</code> which + * indicates that the default target is to be executed. Format is a comma + * separated listing of targets. + */ + public static final String ATTR_ANT_MANUAL_TARGETS = "org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS"; //$NON-NLS-1$ + + /** + * String attribute indicating the Ant targets to execute during an auto + * build for an Ant builder. Default value is <code>null</code> which + * indicates that the default target is to be executed. Format is a comma + * separated listing of targets. + */ + public static final String ATTR_ANT_AUTO_TARGETS = "org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS"; //$NON-NLS-1$ + + /** + * String attribute indicating the Ant targets to execute during a clean for + * an Ant builder. Default value is <code>null</code> which indicates that + * the default target is to be executed. Format is a comma separated listing + * of targets. + */ + public static final String ATTR_ANT_CLEAN_TARGETS = "org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS"; //$NON-NLS-1$ + + /** + * Boolean attribute indicating whether or not target specification for an + * Ant builder has been updated for 3.1 + */ + public static final String ATTR_TARGETS_UPDATED = "org.eclipse.ant.ui.ATTR_TARGETS_UPDATED"; //$NON-NLS-1$ + + /** + * Map attribute indicating the Ant properties to be defined during the + * build. Default value is <code>null</code> which indicates no additional + * properties will be defined. + */ + public static final String ATTR_ANT_PROPERTIES = IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_ANT_PROPERTIES"; //$NON-NLS-1$ + + /** + * String attribute indicating the Ant targets to execute. Default value is + * <code>null</code> which indicates that no additional property files will + * be defined. Format is a comma separated listing of property files. + */ + public static final String ATTR_ANT_PROPERTY_FILES = IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_ANT_PROPERTY_FILES"; //$NON-NLS-1$ + + /** + * Boolean attribute indicating whether or not internal targets (targets + * with no description) should be hidden from the user in the launch + * configuration dialog. Default value is <code>false</code> which indicates + * that all targets will be displayed. + */ + public static final String ATTR_HIDE_INTERNAL_TARGETS = IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_HIDE_INTERNAL_TARGETS"; //$NON-NLS-1$ + + /** + * Integer attribute indicating which column targets should be sorted on. A + * value of 0 indicates target name, 1 indicates target description, and -1 + * indicates no sort. Default value is -1. + */ + public static final String ATTR_SORT_TARGETS = IExternalToolConstants.UI_PLUGIN_ID + "ATTR_SORT_TARGETS"; //$NON-NLS-1$ + + /** + * Boolean attribute indicating if the default VM install should be used for + * the separate JRE build Default value is <code>false</code> for backwards + * compatibility + */ + public static final String ATTR_DEFAULT_VM_INSTALL = "org.eclipse.ant.ui.DEFAULT_VM_INSTALL"; //$NON-NLS-1$ + + /** + * Identifier for Ant processes (value + * <code>org.eclipse.ant.ui.antProcess</code>). This identifier is set as + * the value for the <code>IProcess.ATTR_PROCESS_TYPE</code> attribute in + * processes created by the Ant launch delegate. + */ + public static final String ID_ANT_PROCESS_TYPE = "org.eclipse.ant.ui.antProcess"; //$NON-NLS-1$ + +} diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/launching/package.html b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/launching/package.html new file mode 100644 index 000000000..55fd48456 --- /dev/null +++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/launching/package.html @@ -0,0 +1,13 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> + <title>Package-level Javadoc</title> +</head> +<body> +Provides support for Ant launching. +<h2> +Package Specification</h2> +This package defines constants for Ant launch configuration attributes. +</body> +</html> |