Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 149050 Details for
Bug 264338
External tool builder fails in headless mode because of dependencies to UI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Further updates (X)
headless-builders.patch (text/plain), 1.11 MB, created by
Darin Wright
on 2009-10-07 16:11:09 EDT
(
hide
)
Description:
Further updates (X)
Filename:
MIME Type:
Creator:
Darin Wright
Created:
2009-10-07 16:11:09 EDT
Size:
1.11 MB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ant.core >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.core/META-INF/MANIFEST.MF,v >retrieving revision 1.19 >diff -u -r1.19 MANIFEST.MF >--- META-INF/MANIFEST.MF 26 Jun 2008 19:01:12 -0000 1.19 >+++ META-INF/MANIFEST.MF 7 Oct 2009 20:08:11 -0000 >@@ -7,7 +7,7 @@ > Bundle-Vendor: %providerName > Bundle-Localization: plugin > Export-Package: org.eclipse.ant.core, >- org.eclipse.ant.internal.core;x-friends:="org.eclipse.ant.ui", >+ org.eclipse.ant.internal.core;x-friends:="org.eclipse.ant.ui,org.eclipse.ant.launching", > org.eclipse.ant.internal.core.contentDescriber;x-internal:=true > Require-Bundle: org.eclipse.core.variables;bundle-version="[3.1.0,4.0.0)", > org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)" >#P org.eclipse.ant.launching >Index: .classpath >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.launching/.classpath,v >retrieving revision 1.1 >diff -u -r1.1 .classpath >--- .classpath 16 Sep 2009 14:34:09 -0000 1.1 >+++ .classpath 7 Oct 2009 20:08:12 -0000 >@@ -3,5 +3,8 @@ > <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> >Index: .cvsignore >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.launching/.cvsignore,v >retrieving revision 1.1 >diff -u -r1.1 .cvsignore >--- .cvsignore 16 Sep 2009 14:34:09 -0000 1.1 >+++ .cvsignore 7 Oct 2009 20:08:12 -0000 >@@ -1 +1,6 @@ >-bin >\ No newline at end of file >+bin >+lib >+temp.folder >+loggers_bin >+common_bin >+remote_bin >\ No newline at end of file >Index: .externalToolBuilders/build common debug [Builder].launch >=================================================================== >RCS file: .externalToolBuilders/build common debug [Builder].launch >diff -N .externalToolBuilders/build common debug [Builder].launch >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .externalToolBuilders/build common debug [Builder].launch 1 Jan 1970 00:00:00 -0000 >@@ -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> >Index: .externalToolBuilders/build loggers [Builder].launch >=================================================================== >RCS file: .externalToolBuilders/build loggers [Builder].launch >diff -N .externalToolBuilders/build loggers [Builder].launch >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .externalToolBuilders/build loggers [Builder].launch 1 Jan 1970 00:00:00 -0000 >@@ -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> >Index: .externalToolBuilders/build remote support [Builder].launch >=================================================================== >RCS file: .externalToolBuilders/build remote support [Builder].launch >diff -N .externalToolBuilders/build remote support [Builder].launch >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .externalToolBuilders/build remote support [Builder].launch 1 Jan 1970 00:00:00 -0000 >@@ -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> >Index: .project >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.launching/.project,v >retrieving revision 1.1 >diff -u -r1.1 .project >--- .project 16 Sep 2009 14:34:09 -0000 1.1 >+++ .project 7 Oct 2009 20:08:13 -0000 >@@ -25,6 +25,36 @@ > <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> >Index: .settings/org.eclipse.jdt.core.prefs >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.launching/.settings/org.eclipse.jdt.core.prefs,v >retrieving revision 1.2 >diff -u -r1.2 org.eclipse.jdt.core.prefs >--- .settings/org.eclipse.jdt.core.prefs 16 Sep 2009 14:44:24 -0000 1.2 >+++ .settings/org.eclipse.jdt.core.prefs 7 Oct 2009 20:08:13 -0000 >@@ -1,6 +1,6 @@ >-#Wed Sep 16 09:44:05 CDT 2009 >+#Sun Sep 20 13:08:07 CEST 2009 > eclipse.preferences.version=1 >-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled >+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled > org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 > org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve > org.eclipse.jdt.core.compiler.compliance=1.4 >Index: .settings/org.eclipse.pde.prefs >=================================================================== >RCS file: .settings/org.eclipse.pde.prefs >diff -N .settings/org.eclipse.pde.prefs >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .settings/org.eclipse.pde.prefs 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+#Wed Oct 07 12:57:43 CDT 2009 >+compilers.f.unresolved-features=1 >+compilers.f.unresolved-plugins=1 >+compilers.incompatible-environment=1 >+compilers.p.build=1 >+compilers.p.deprecated=1 >+compilers.p.discouraged-class=1 >+compilers.p.internal=1 >+compilers.p.missing-packages=1 >+compilers.p.missing-version-export-package=2 >+compilers.p.missing-version-import-package=2 >+compilers.p.missing-version-require-bundle=1 >+compilers.p.no-required-att=0 >+compilers.p.not-externalized-att=1 >+compilers.p.unknown-attribute=1 >+compilers.p.unknown-class=1 >+compilers.p.unknown-element=1 >+compilers.p.unknown-identifier=1 >+compilers.p.unknown-resource=1 >+compilers.p.unresolved-ex-points=0 >+compilers.p.unresolved-import=0 >+compilers.s.create-docs=false >+compilers.s.doc-folder=doc >+compilers.s.open-tags=1 >+eclipse.preferences.version=1 >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.launching/META-INF/MANIFEST.MF,v >retrieving revision 1.2 >diff -u -r1.2 MANIFEST.MF >--- META-INF/MANIFEST.MF 16 Sep 2009 14:48:25 -0000 1.2 >+++ META-INF/MANIFEST.MF 7 Oct 2009 20:08:14 -0000 >@@ -1,16 +1,29 @@ > Manifest-Version: 1.0 > Bundle-ManifestVersion: 2 >+Bundle-Localization: plugin > Bundle-Name: %pluginName >-Bundle-SymbolicName: org.eclipse.ant.launching >+Bundle-SymbolicName: org.eclipse.ant.launching;singleton:=true > Bundle-Version: 1.0.0.qualifier > Bundle-Activator: org.eclipse.ant.internal.launching.AntLaunching > Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", >- org.eclipse.debug.core;bundle-version="[3.6.0,4.0.0)", >+ org.eclipse.debug.core;bundle-version="[3.5.0,4.0.0)", > org.eclipse.jdt.launching;bundle-version="[3.5.0,4.0.0)", > org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)", > org.eclipse.ant.core;bundle-version="[3.2.0,4.0.0)", >- org.apache.ant;bundle-version="1.7.1" >+ org.apache.ant;bundle-version="1.7.1", >+ org.eclipse.jdt.core;bundle-version="3.5.0", >+ org.eclipse.core.commands;bundle-version="3.5.0", >+ org.eclipse.core.externaltools;bundle-version="1.0.0" > Bundle-RequiredExecutionEnvironment: J2SE-1.4 > Bundle-ActivationPolicy: lazy > Bundle-Vendor: %providerName >-Export-Package: org.eclipse.ant.internal.launching;x-internal:=true >+Export-Package: org.eclipse.ant.internal.launching;x-friends:="org.eclipse.ant.ui", >+ org.eclipse.ant.internal.launching.debug;x-friends:="org.eclipse.ant.ui", >+ org.eclipse.ant.internal.launching.debug.model;x-friends:="org.eclipse.ant.ui", >+ org.eclipse.ant.internal.launching.launchConfigurations;x-friends:="org.eclipse.ant.ui", >+ org.eclipse.ant.launching >+Import-Package: com.ibm.icu.text, >+ org.eclipse.ant.internal.launching.launchConfigurations, >+ org.eclipse.core.filebuffers, >+ org.eclipse.jface.preference, >+ org.eclipse.jface.text >Index: build.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.launching/build.properties,v >retrieving revision 1.1 >diff -u -r1.1 build.properties >--- build.properties 16 Sep 2009 14:34:09 -0000 1.1 >+++ build.properties 7 Oct 2009 20:08:14 -0000 >@@ -1,4 +1,31 @@ >-source.. = src/ >+############################################################################### >+# 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 >+ >+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 >Index: buildfiles/buildCommonDebug.xml >=================================================================== >RCS file: buildfiles/buildCommonDebug.xml >diff -N buildfiles/buildCommonDebug.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ buildfiles/buildCommonDebug.xml 1 Jan 1970 00:00:00 -0000 >@@ -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> >Index: buildfiles/buildLoggers.xml >=================================================================== >RCS file: buildfiles/buildLoggers.xml >diff -N buildfiles/buildLoggers.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ buildfiles/buildLoggers.xml 1 Jan 1970 00:00:00 -0000 >@@ -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> >Index: buildfiles/buildRemote.xml >=================================================================== >RCS file: buildfiles/buildRemote.xml >diff -N buildfiles/buildRemote.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ buildfiles/buildRemote.xml 1 Jan 1970 00:00:00 -0000 >@@ -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> >Index: common/META-INF/eclipse.inf >=================================================================== >RCS file: common/META-INF/eclipse.inf >diff -N common/META-INF/eclipse.inf >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ common/META-INF/eclipse.inf 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1 @@ >+jarprocessor.exclude.sign=true >\ No newline at end of file >Index: common/org/eclipse/ant/internal/launching/debug/AntDebugState.java >=================================================================== >RCS file: common/org/eclipse/ant/internal/launching/debug/AntDebugState.java >diff -N common/org/eclipse/ant/internal/launching/debug/AntDebugState.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ common/org/eclipse/ant/internal/launching/debug/AntDebugState.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,530 @@ >+/******************************************************************************* >+ * 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.util.HashMap; >+import java.util.Hashtable; >+import java.util.Iterator; >+import java.util.Map; >+import java.util.Stack; >+import java.util.Vector; >+ >+import org.apache.tools.ant.BuildEvent; >+import org.apache.tools.ant.Location; >+import org.apache.tools.ant.Project; >+import org.apache.tools.ant.Target; >+import org.apache.tools.ant.Task; >+import org.apache.tools.ant.taskdefs.MacroInstance; >+import org.eclipse.ant.internal.launching.debug.model.DebugMessageIds; >+ >+public class AntDebugState { >+ >+ private static final String fgAntTaskName= "ant"; //$NON-NLS-1$ >+ private static final String fgAntCallTaskName= "antcall"; //$NON-NLS-1$ >+ >+ private IDebugBuildLogger fLogger; >+ private Stack fTasks= new Stack(); >+ private Map fTaskToProxies= new HashMap(); >+ private Task fCurrentTask; >+ private Task fStepOverTask; >+ private Task fStepIntoTask; >+ private Task fLastTaskFinished; >+ >+ //properties set before execution >+ private Map fInitialProperties= null; >+ private Map fProperties= null; >+ >+ private Map fProjectToTargetNames= null; >+ private Map fProjectToMapOfTargetToBuildSequence= null; >+ private Stack fTargetsToExecute= new Stack(); >+ private Stack fTargetsExecuting= new Stack(); >+ >+ private boolean fConsiderTargetBreakpoints= false; >+ private boolean fShouldSuspend; >+ private boolean fClientSuspend= false; >+ private boolean fStepIntoSuspend= false; >+ private boolean fIsAfterTaskEvent= false; >+ >+ >+ public AntDebugState(IDebugBuildLogger logger) { >+ fLogger= logger; >+ } >+ >+ public void waitIfSuspended() { >+ fLogger.waitIfSuspended(); >+ } >+ >+ public Task getLastTaskFinished() { >+ return fLastTaskFinished; >+ } >+ >+ private void setLastTaskFinished(Task lastTaskFinished) { >+ fLastTaskFinished= lastTaskFinished; >+ >+ } >+ >+ public Task getCurrentTask() { >+ return fCurrentTask; >+ } >+ >+ public void setCurrentTask(Task currentTask) { >+ fCurrentTask= currentTask; >+ >+ } >+ >+ private Map getInitialProperties() { >+ return fInitialProperties; >+ } >+ >+ public Task getStepOverTask() { >+ return fStepOverTask; >+ } >+ >+ public void setStepOverTask(Task stepOverTask) { >+ fStepOverTask= stepOverTask; >+ >+ } >+ >+ private boolean considerTargetBreakpoints() { >+ return fConsiderTargetBreakpoints; >+ } >+ >+ private void setConsiderTargetBreakpoints(boolean considerTargetBreakpoints) { >+ fConsiderTargetBreakpoints= considerTargetBreakpoints; >+ } >+ >+ private Stack getTasks() { >+ return fTasks; >+ } >+ >+ public void setShouldSuspend(boolean shouldSuspend) { >+ fShouldSuspend= shouldSuspend; >+ } >+ >+ public boolean shouldSuspend() { >+ return fShouldSuspend; >+ } >+ >+ private Map getTargetToBuildSequence(Project project) { >+ return (Map) fProjectToMapOfTargetToBuildSequence.get(project); >+ } >+ >+ public void setTargetToExecute(Target target) { >+ if (target == null) { >+ fTargetsToExecute.pop(); >+ } else { >+ fTargetsToExecute.push(target); >+ } >+ } >+ >+ public void setTargetExecuting(Target target) { >+ if (target == null) { >+ fTargetsExecuting.pop(); >+ } else { >+ fTargetsExecuting.push(target); >+ } >+ } >+ >+ private Target getTargetToExecute() { >+ if (fTargetsToExecute.isEmpty()) { >+ return null; >+ } >+ return (Target) fTargetsToExecute.peek(); >+ } >+ >+ private Target getTargetExecuting() { >+ if (fTargetsExecuting.isEmpty()) { >+ return null; >+ } >+ return (Target) fTargetsExecuting.peek(); >+ } >+ >+ public boolean isStepIntoSuspend() { >+ return isAfterTaskEvent() && fStepIntoSuspend; >+ } >+ >+ public void setStepIntoSuspend(boolean stepIntoSuspend) { >+ fStepIntoSuspend = stepIntoSuspend; >+ } >+ >+ public boolean isClientSuspend() { >+ return fClientSuspend; >+ } >+ >+ public void setClientSuspend(boolean clientSuspend) { >+ fClientSuspend = clientSuspend; >+ } >+ >+ public Task getStepIntoTask() { >+ return fStepIntoTask; >+ } >+ >+ public void setStepIntoTask(Task stepIntoTask) { >+ fStepIntoTask = stepIntoTask; >+ } >+ >+ public void resume() { >+ fLogger.notifyAll(); >+ } >+ >+ public Map getProperties() { >+ return fProperties; >+ } >+ >+ public Location getBreakpointLocation() { >+ if (isAfterTaskEvent() && getCurrentTask() != null) { >+ return getCurrentTask().getLocation(); >+ } >+ if (considerTargetBreakpoints()) { >+ Target targetExecuting= getTargetExecuting(); >+ if (targetExecuting != null) { >+ return getLocation(targetExecuting); >+ } >+ } >+ return null; >+ } >+ >+ private boolean isAfterTaskEvent() { >+ return fIsAfterTaskEvent; >+ } >+ >+ private void setAfterTaskEvent(boolean isAfterTaskEvent) { >+ fIsAfterTaskEvent = isAfterTaskEvent; >+ } >+ >+ public void taskStarted(BuildEvent event) { >+ setAfterTaskEvent(true); >+ if (getInitialProperties() == null) {//implicit or top level target does not fire targetStarted() >+ fInitialProperties= event.getProject().getProperties(); >+ } >+ >+ setCurrentTask(event.getTask()); >+ setConsiderTargetBreakpoints(false); >+ if (!getTasks().isEmpty()) { >+ //cache the parent task proxy as when that task is started or finished the >+ //proxy is not yet available or is nulled out >+ Task parentTask = (Task) getTasks().peek(); >+ Object proxy = parentTask.getRuntimeConfigurableWrapper().getProxy(); >+ if (proxy != null) { >+ fTaskToProxies.put(parentTask, proxy); >+ } >+ } >+ getTasks().push(getCurrentTask()); >+ waitIfSuspended(); >+ } >+ >+ >+ public void taskFinished() { >+ Task lastTask= (Task)getTasks().pop(); >+ setLastTaskFinished(lastTask); >+ setCurrentTask(null); >+ String taskName= lastTask.getTaskName(); >+ >+ if (getStepOverTask() != null) { >+ if ((fgAntCallTaskName.equals(taskName) || fgAntTaskName.equals(taskName)) && (!fgAntCallTaskName.equals(getStepOverTask().getTaskName()) && !fgAntTaskName.equals(getStepOverTask().getTaskName()))) { >+ setShouldSuspend(true); >+ } else if (fTaskToProxies.remove(lastTask) instanceof MacroInstance) { >+ setShouldSuspend(true); >+ } >+ } >+ waitIfSuspended(); >+ } >+ >+ public void stepOver() { >+ setStepOverTask(getCurrentTask()); >+ if (getCurrentTask() == null) { >+ //stepping over target breakpoint >+ setShouldSuspend(true); >+ } >+ resume(); >+ } >+ >+ public void targetStarted(BuildEvent event) { >+ setAfterTaskEvent(false); >+ Project eventProject = event.getProject(); >+ if (getInitialProperties() == null) { >+ fInitialProperties= eventProject.getProperties(); >+ } >+ if (fProjectToTargetNames.get(eventProject) == null) { >+ Object ref= eventProject.getReference("eclipse.ant.targetVector"); //$NON-NLS-1$ >+ if (ref != null) { >+ fProjectToTargetNames.put(eventProject, ref); >+ Map targetToBuildSequence= new HashMap(); >+ setTargetToExecute(initializeBuildSequenceInformation(event, targetToBuildSequence)); >+ fProjectToMapOfTargetToBuildSequence.put(eventProject, targetToBuildSequence); >+ } >+ } >+ >+ setTargetExecuting(event.getTarget()); >+ if (event.getTarget().equals(getTargetToExecute())) { >+ //the dependencies of the target to execute have been met >+ //prepare for the next target >+ Vector targets= (Vector) fProjectToTargetNames.get(eventProject); >+ if (!targets.isEmpty()) { >+ setTargetToExecute((Target) eventProject.getTargets().get(targets.remove(0))); >+ } else { >+ setTargetToExecute(null); >+ } >+ } >+ setConsiderTargetBreakpoints(true); >+ } >+ >+ public int getLineNumber(Location location) { >+ try { //succeeds with Ant newer than 1.6 >+ return location.getLineNumber(); >+ } catch (NoSuchMethodError e) { >+ //Ant before 1.6 >+ String locationString= location.toString(); >+ if (locationString.length() == 0) { >+ return 0; >+ } >+ //filename: lineNumber: ("c:\buildfile.xml: 12: ") >+ int lastIndex= locationString.lastIndexOf(':'); >+ int index =locationString.lastIndexOf(':', lastIndex - 1); >+ if (index != -1) { >+ try { >+ return Integer.parseInt(locationString.substring(index+1, lastIndex)); >+ } catch (NumberFormatException nfe) { >+ return 0; >+ } >+ } >+ return 0; >+ } >+ } >+ >+ public static Location getLocation(Target target) { >+ try {//succeeds with Ant newer than 1.6.2 >+ return target.getLocation(); >+ } catch (NoSuchMethodError e) { >+ return Location.UNKNOWN_LOCATION; >+ } >+ } >+ >+ public String getFileName(Location location) { >+ try {//succeeds with Ant newer than 1.6 >+ return location.getFileName(); >+ } catch (NoSuchMethodError e) { >+ //Ant before 1.6 >+ String locationString= location.toString(); >+ if (locationString.length() == 0) { >+ return null; >+ } >+ //filename: lineNumber: ("c:\buildfile.xml: 12: ") >+ int lastIndex= locationString.lastIndexOf(':'); >+ int index =locationString.lastIndexOf(':', lastIndex-1); >+ if (index == -1) { >+ index= lastIndex; //only the filename is known >+ } >+ if (index != -1) { >+ //bug 84403 >+ //if (locationString.startsWith("file:")) { >+ // return FileUtils.newFileUtils().fromURI(locationString); >+ //} >+ //remove file: >+ return locationString.substring(5, index); >+ } >+ return null; >+ } >+ } >+ >+ private void appendToStack(StringBuffer stackRepresentation, String targetName, String taskName, Location location) { >+ stackRepresentation.append(targetName); >+ stackRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ stackRepresentation.append(taskName); >+ stackRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ >+ stackRepresentation.append(getFileName(location)); >+ stackRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ stackRepresentation.append(getLineNumber(location)); >+ stackRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ } >+ >+ public void marshalStack(StringBuffer stackRepresentation) { >+ Stack tasks= getTasks(); >+ >+ stackRepresentation.append(DebugMessageIds.STACK); >+ stackRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ >+ Target targetToExecute= getTargetToExecute(); >+ Target targetExecuting= getTargetExecuting(); >+ >+ Project projectExecuting= null; >+ if (targetExecuting != null) { >+ projectExecuting= targetExecuting.getProject(); >+ } else { //no target...must be a task >+ Task task= (Task) tasks.peek(); >+ projectExecuting= task.getProject(); >+ } >+ >+ if (!isAfterTaskEvent()) { >+ appendToStack(stackRepresentation, targetExecuting.getName(), "", getLocation(targetExecuting)); //$NON-NLS-1$ >+ } >+ for (int i = tasks.size() - 1; i >= 0 ; i--) { >+ Task task= (Task) tasks.get(i); >+ if (task.getProject() == projectExecuting) { >+ appendToStack(stackRepresentation, task.getOwningTarget().getName(), task.getTaskName(), task.getLocation()); >+ } else { >+ //sub build target dependencies >+ String targetName= task.getOwningTarget().getName(); >+ if (targetName != null && targetName.length() != 0) { //skip for implicit target >+ Iterator itr= fTargetsToExecute.iterator(); >+ while (itr.hasNext()) { >+ Target target= (Target) itr.next(); >+ if (target.getProject() != projectExecuting) { >+ targetToExecute= target; >+ continue; >+ } >+ marshalTargetDependancyStack(stackRepresentation, target, targetExecuting); >+ } >+ } >+ projectExecuting= task.getProject(); >+ targetExecuting= task.getOwningTarget(); >+ appendToStack(stackRepresentation, targetExecuting.getName(), task.getTaskName(), task.getLocation()); >+ } >+ } >+ >+ //target dependency stack >+ marshalTargetDependancyStack(stackRepresentation, targetToExecute, targetExecuting); >+ } >+ >+ private void marshalTargetDependancyStack(StringBuffer stackRepresentation, Target targetToExecute, Target targetExecuting) { >+ if (targetToExecute != null) { >+ Vector buildSequence= (Vector) getTargetToBuildSequence(targetToExecute.getProject()).get(targetToExecute); >+ int startIndex= buildSequence.indexOf(targetExecuting) + 1; >+ int dependancyStackDepth= buildSequence.indexOf(targetToExecute); >+ >+ Target stackTarget; >+ for (int i = startIndex; i <= dependancyStackDepth; i++) { >+ stackTarget= (Target) buildSequence.get(i); >+ if (stackTarget.dependsOn(targetExecuting.getName())) { >+ appendToStack(stackRepresentation, stackTarget.getName(), "", getLocation(stackTarget)); //$NON-NLS-1$ >+ } >+ } >+ } >+ } >+ >+ public void marshallProperties(StringBuffer propertiesRepresentation, boolean escapeLineSep) { >+ if (getTasks().isEmpty()) { >+ return; >+ } >+ propertiesRepresentation.append(DebugMessageIds.PROPERTIES); >+ propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ >+ Project project= ((Task)getTasks().peek()).getProject(); >+ Map lastProperties= getProperties(); >+ >+ Map currentProperties= project.getProperties(); >+ if (lastProperties != null && currentProperties.size() == lastProperties.size()) { >+ //no new properties >+ return; >+ } >+ >+ Map initialProperties= getInitialProperties(); >+ Map currentUserProperties= project.getUserProperties(); >+ Iterator iter= currentProperties.keySet().iterator(); >+ String propertyName; >+ String originalPropertyName; >+ String propertyValue; >+ while (iter.hasNext()) { >+ propertyName = (String) iter.next(); >+ originalPropertyName= propertyName; >+ if (lastProperties == null || lastProperties.get(propertyName) == null) { //new property >+ if (escapeLineSep) { >+ propertyName= escapeLineSeparator(propertyName); >+ } >+ propertiesRepresentation.append(propertyName.length()); >+ propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ propertiesRepresentation.append(propertyName); >+ propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ propertyValue= (String) currentProperties.get(originalPropertyName); >+ if (escapeLineSep) { >+ propertyValue= escapeLineSeparator(propertyValue); >+ } >+ propertiesRepresentation.append(propertyValue.length()); >+ propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ propertiesRepresentation.append(propertyValue); >+ propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ propertiesRepresentation.append(getPropertyType(initialProperties, currentUserProperties, originalPropertyName)); >+ propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >+ } >+ } >+ >+ propertiesRepresentation.deleteCharAt(propertiesRepresentation.length() - 1); >+ fProperties= currentProperties; >+ } >+ >+ private int getPropertyType(Map initialProperties, Map currentUserProperties, String propertyName) { >+ if (initialProperties.get(propertyName) != null) { //properties set before the start of the build >+ if (currentUserProperties.get(propertyName) == null) { >+ return DebugMessageIds.PROPERTY_SYSTEM; >+ } >+ return DebugMessageIds.PROPERTY_USER; >+ } else if (currentUserProperties.get(propertyName) == null){ >+ return DebugMessageIds.PROPERTY_RUNTIME; >+ } else { >+ return DebugMessageIds.PROPERTY_USER; >+ } >+ } >+ >+ private String escapeLineSeparator(String stringToEscape) { >+ if (!(stringToEscape.indexOf('\r') != -1 || stringToEscape.indexOf('\n') != -1 || stringToEscape.indexOf("\\r") != -1 || stringToEscape.indexOf("\\n") != -1)) { //$NON-NLS-1$ //$NON-NLS-2$ >+ return stringToEscape; >+ } >+ StringBuffer escapedValue= new StringBuffer(stringToEscape); >+ for (int i= 0; i < escapedValue.length(); i++) { >+ switch (escapedValue.charAt(i)) { >+ case '\r': >+ escapedValue.replace(i, i+1, "\\r"); //$NON-NLS-1$ >+ i++; >+ break; >+ case '\n': >+ escapedValue.replace(i, i+1, "\\n"); //$NON-NLS-1$ >+ i++; >+ break; >+ case '\\': >+ if (escapedValue.charAt(i + 1) == 'r' || escapedValue.charAt(i + 1) == 'n') { >+ escapedValue.replace(i, i+1, "\\\\"); //$NON-NLS-1$ >+ i++; >+ } >+ break; >+ default: >+ break; >+ } >+ } >+ >+ return escapedValue.toString(); >+ } >+ >+ private Target initializeBuildSequenceInformation(BuildEvent event, Map targetToBuildSequence) { >+ Project antProject= event.getProject(); >+ Vector targets= (Vector) antProject.getReference("eclipse.ant.targetVector"); //$NON-NLS-1$ >+ if (targets == null) { >+ return null; >+ } >+ Iterator itr= targets.iterator(); >+ Hashtable allTargets= antProject.getTargets(); >+ String targetName; >+ Vector sortedTargets; >+ while (itr.hasNext()) { >+ targetName= (String) itr.next(); >+ sortedTargets= antProject.topoSort(targetName, allTargets); >+ targetToBuildSequence.put(allTargets.get(targetName), sortedTargets); >+ } >+ //the target to execute >+ return (Target) allTargets.get(targets.remove(0)); >+ } >+ >+ public void buildStarted() { >+ fProjectToTargetNames= new HashMap(); >+ fProjectToMapOfTargetToBuildSequence= new HashMap(); >+ } >+} >Index: common/org/eclipse/ant/internal/launching/debug/IDebugBuildLogger.java >=================================================================== >RCS file: common/org/eclipse/ant/internal/launching/debug/IDebugBuildLogger.java >diff -N common/org/eclipse/ant/internal/launching/debug/IDebugBuildLogger.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ common/org/eclipse/ant/internal/launching/debug/IDebugBuildLogger.java 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: loggers/META-INF/eclipse.inf >=================================================================== >RCS file: loggers/META-INF/eclipse.inf >diff -N loggers/META-INF/eclipse.inf >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ loggers/META-INF/eclipse.inf 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1 @@ >+jarprocessor.exclude.sign=true >\ No newline at end of file >Index: loggers/org/eclipse/ant/internal/launching/runtime/logger/AntProcessBuildLogger.java >=================================================================== >RCS file: loggers/org/eclipse/ant/internal/launching/runtime/logger/AntProcessBuildLogger.java >diff -N loggers/org/eclipse/ant/internal/launching/runtime/logger/AntProcessBuildLogger.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ loggers/org/eclipse/ant/internal/launching/runtime/logger/AntProcessBuildLogger.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,306 @@ >+/******************************************************************************* >+ * 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 >+ * Matt Conway - Patch for Bug 28052 >+ *******************************************************************************/ >+ >+package org.eclipse.ant.internal.launching.runtime.logger; >+ >+import java.io.BufferedReader; >+import java.io.IOException; >+import java.io.StringReader; >+ >+import org.apache.tools.ant.BuildEvent; >+import org.apache.tools.ant.Location; >+import org.apache.tools.ant.Project; >+import org.apache.tools.ant.Target; >+import org.eclipse.ant.internal.core.AbstractEclipseBuildLogger; >+import org.eclipse.ant.internal.launching.AntLaunch; >+import org.eclipse.ant.internal.launching.AntLaunching; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.ant.internal.launching.debug.AntDebugState; >+import org.eclipse.ant.internal.launching.launchConfigurations.AntProcess; >+import org.eclipse.ant.internal.launching.launchConfigurations.AntStreamMonitor; >+import org.eclipse.ant.internal.launching.launchConfigurations.AntStreamsProxy; >+import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.model.IProcess; >+import org.eclipse.jface.text.IRegion; >+import org.eclipse.jface.text.Region; >+ >+public class AntProcessBuildLogger extends NullBuildLogger { >+ >+ private long fStartTime; >+ >+ /** >+ * Associated process - discovered as needed to log messages >+ */ >+ private AntProcess fProcess = null; >+ >+ protected void logMessage(String message, BuildEvent event, int overridePriority) { >+ int priority= overridePriority; >+ if (priority == -1) { >+ priority= event.getPriority(); >+ } >+ >+ if (priority > getMessageOutputLevel()) { >+ return; >+ } >+ AntProcess antProcess = getAntProcess(fProcessId); >+ if (antProcess == null) { >+ return; >+ } >+ >+ StringBuffer fullMessage= new StringBuffer(); >+ if (!loggingToLogFile()) { >+ fullMessage.append(System.getProperty("line.separator")); //$NON-NLS-1$ >+ } >+ if (event.getException() == null && event.getTask() != null && !fEmacsMode) { >+ adornMessage(event, fullMessage); >+ } else { >+ fullMessage.append(message); >+ } >+ message= fullMessage.toString(); >+ >+ if (loggingToLogFile()) { >+ logMessageToLogFile(message, priority); >+ } else { >+ AntStreamMonitor monitor = getMonitor(priority); >+ monitor.append(message); >+ } >+ } >+ >+ /** >+ * Builds a right justified task prefix for the given build event, placing it >+ * in the given string buffer. Creates the hyperlinks for the task prefix. >+ * >+ * @param event build event >+ * @param fullMessage buffer to place task prefix in >+ */ >+ private void adornMessage(BuildEvent event, StringBuffer fullMessage) { >+ String name = event.getTask().getTaskName(); >+ if (name == null) { >+ name = "null"; //$NON-NLS-1$ >+ } >+ Location location = event.getTask().getLocation(); >+ StringBuffer column= new StringBuffer(); >+ int size = AntLaunching.LEFT_COLUMN_SIZE - (name.length() + 3); >+ for (int i = 0; i < size; i++) { >+ column.append(' '); >+ } >+ StringBuffer labelBuff= new StringBuffer(); >+ labelBuff.append('['); >+ labelBuff.append(name); >+ labelBuff.append("] "); //$NON-NLS-1$ >+ >+ int offset = Math.max(size, 0) + 1; >+ String label= labelBuff.toString(); >+ if (event.getMessage() == null) { >+ return; >+ } >+ try { >+ BufferedReader r = new BufferedReader(new StringReader(event.getMessage())); >+ String line = r.readLine(); >+ fullMessage.append(column); >+ appendAndLink(fullMessage, location, label, offset, line); >+ line = r.readLine(); >+ while (line != null) { >+ fullMessage.append(System.getProperty("line.separator")); //$NON-NLS-1$ >+ fullMessage.append(column); >+ appendAndLink(fullMessage, location, label, offset, line); >+ line = r.readLine(); >+ } >+ } catch (IOException e) { >+ if (event.getMessage() != null) { >+ fullMessage.append(label).append(event.getMessage()); >+ } >+ } >+ } >+ >+ private void appendAndLink(StringBuffer fullMessage, Location location, String label, int offset, String line) { >+ fullMessage.append(label); >+ fullMessage.append(line); >+ if (location != null) { >+ String newLine= (label + line).trim(); >+ IRegion region= new Region(offset, label.length() - 3); // only >+ // want >+ // the >+ // name >+ // length >+ // "[name] " >+ AntProcess antProcess = getAntProcess(fProcessId); >+ AntLaunch antLaunch = (AntLaunch)antProcess.getLaunch(); >+ antLaunch.addLinkDescriptor(newLine, location.getFileName(), location.getLineNumber(), region.getOffset(), region.getLength()); >+ } >+ } >+ >+ private AntStreamMonitor getMonitor(int priority) { >+ AntStreamsProxy proxy = (AntStreamsProxy)fProcess.getStreamsProxy(); >+ AntStreamMonitor monitor = null; >+ switch (priority) { >+ case Project.MSG_INFO: >+ monitor = (AntStreamMonitor)proxy.getOutputStreamMonitor(); >+ break; >+ case Project.MSG_ERR: >+ monitor = (AntStreamMonitor)proxy.getErrorStreamMonitor(); >+ break; >+ case Project.MSG_DEBUG: >+ monitor = (AntStreamMonitor)proxy.getDebugStreamMonitor(); >+ break; >+ case Project.MSG_WARN: >+ monitor = (AntStreamMonitor)proxy.getWarningStreamMonitor(); >+ break; >+ case Project.MSG_VERBOSE: >+ monitor = (AntStreamMonitor)proxy.getVerboseStreamMonitor(); >+ break; >+ } >+ return monitor; >+ } >+ >+ private void logMessageToLogFile(String message, int priority) { >+ if (priority == Project.MSG_ERR) { >+ getErrorPrintStream().println(message); >+ } else { >+ getOutputPrintStream().println(message); >+ } >+ } >+ >+ /** >+ * Returns the associated Ant process, finding it if necessary, if not >+ * already found. >+ */ >+ protected AntProcess getAntProcess(String processId) { >+ if (fProcess == null && processId != null) { >+ IProcess[] all = DebugPlugin.getDefault().getLaunchManager().getProcesses(); >+ for (int i = 0; i < all.length; i++) { >+ IProcess process = all[i]; >+ if (process instanceof AntProcess && processId.equals(process.getAttribute(AbstractEclipseBuildLogger.ANT_PROCESS_ID))) { >+ fProcess = (AntProcess)process; >+ break; >+ } >+ } >+ } >+ return fProcess; >+ } >+ >+ /* (non-Javadoc) >+ * Set the start time. >+ * >+ * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) >+ */ >+ public void buildStarted(BuildEvent event) { >+ fStartTime= System.currentTimeMillis(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#buildFinished(org.apache.tools.ant.BuildEvent) >+ */ >+ public void buildFinished(BuildEvent event) { >+ String message= handleException(event); >+ if (message != null) { >+ try { >+ BufferedReader r = new BufferedReader(new StringReader(message)); >+ String line = r.readLine(); >+ logMessage(line, event, Project.MSG_ERR); >+ line = r.readLine(); >+ AntProcess antProcess = getAntProcess(fProcessId); >+ while (line != null) { >+ logMessage(line, event, Project.MSG_ERR); >+ if (!message.startsWith("Total time:")) { //$NON-NLS-1$ >+ AntLaunchingUtil.linkBuildFailedMessage(line, antProcess); >+ } >+ line = r.readLine(); >+ } >+ logMessage("", event, Project.MSG_ERR); //$NON-NLS-1$ >+ } catch (IOException e) { >+ } >+ } >+ fHandledException= null; >+ if (!(event.getException() instanceof OperationCanceledException)) { >+ logMessage(getTimeString(System.currentTimeMillis() - fStartTime), event, fMessageOutputLevel); >+ } >+ fProcess= null; >+ event.getProject().removeBuildListener(this); >+ } >+ >+ private String getTimeString(long milliseconds) { >+ long seconds = milliseconds / 1000; >+ long minutes = seconds / 60; >+ seconds= seconds % 60; >+ >+ StringBuffer result= new StringBuffer(RuntimeMessages.AntProcessBuildLogger_Total_time); >+ if (minutes > 0) { >+ result.append(minutes); >+ if (minutes > 1) { >+ result.append(RuntimeMessages.AntProcessBuildLogger__minutes_2); >+ } else { >+ result.append(RuntimeMessages.AntProcessBuildLogger__minute_3); >+ } >+ } >+ if (seconds > 0) { >+ if (minutes > 0) { >+ result.append(' '); >+ } >+ result.append(seconds); >+ >+ if (seconds > 1) { >+ result.append(RuntimeMessages.AntProcessBuildLogger__seconds_4); >+ } else { >+ result.append(RuntimeMessages.AntProcessBuildLogger__second_5); >+ } >+ } >+ if (seconds == 0 && minutes == 0) { >+ result.append(milliseconds); >+ result.append(RuntimeMessages.AntProcessBuildLogger__milliseconds_6); >+ } >+ >+ result.append(System.getProperty("line.separator")); //$NON-NLS-1$ >+ return result.toString(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#messageLogged(org.apache.tools.ant.BuildEvent) >+ */ >+ public void messageLogged(BuildEvent event) { >+ if (event.getPriority() > getMessageOutputLevel()) { >+ return; >+ } >+ if (event.getMessage() != null && event.getMessage().length() > 0) { >+ logMessage(event.getMessage(), event, -1); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) >+ */ >+ public void targetStarted(BuildEvent event) { >+ if (Project.MSG_INFO > getMessageOutputLevel()) { >+ return; >+ } >+ Target target= event.getTarget(); >+ StringBuffer msg= new StringBuffer(System.getProperty("line.separator")); //$NON-NLS-1$ >+ String targetName= target.getName(); >+ msg.append(targetName); >+ msg.append(':'); >+ String message= msg.toString(); >+ Location location= AntDebugState.getLocation(target); >+ if (location != null && location != Location.UNKNOWN_LOCATION) { >+ IRegion region = new Region(0, targetName.length()); >+ AntProcess antProcess = getAntProcess(fProcessId); >+ AntLaunch antLaunch = (AntLaunch)antProcess.getLaunch(); >+ antLaunch.addLinkDescriptor(message, location.getFileName(), location.getLineNumber(), region.getOffset(), region.getLength()); >+ } >+ logMessage(message, event, Project.MSG_INFO); >+ } >+ >+ private boolean loggingToLogFile() { >+ //check if user has designated to log to a log file >+ return getErrorPrintStream() != null && getErrorPrintStream() != System.err; >+ } >+} >Index: loggers/org/eclipse/ant/internal/launching/runtime/logger/AntProcessDebugBuildLogger.java >=================================================================== >RCS file: loggers/org/eclipse/ant/internal/launching/runtime/logger/AntProcessDebugBuildLogger.java >diff -N loggers/org/eclipse/ant/internal/launching/runtime/logger/AntProcessDebugBuildLogger.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ loggers/org/eclipse/ant/internal/launching/runtime/logger/AntProcessDebugBuildLogger.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,246 @@ >+/******************************************************************************* >+ * 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.runtime.logger; >+ >+import java.io.File; >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.apache.tools.ant.BuildEvent; >+import org.apache.tools.ant.Location; >+import org.eclipse.ant.internal.launching.debug.AntDebugState; >+import org.eclipse.ant.internal.launching.debug.IAntDebugController; >+import org.eclipse.ant.internal.launching.debug.IDebugBuildLogger; >+import org.eclipse.ant.internal.launching.debug.model.AntDebugTarget; >+import org.eclipse.ant.internal.launching.debug.model.AntThread; >+import org.eclipse.ant.internal.launching.launchConfigurations.AntProcess; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.debug.core.DebugEvent; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.model.IBreakpoint; >+import org.eclipse.debug.core.model.ILineBreakpoint; >+import org.eclipse.debug.core.model.IProcess; >+ >+public class AntProcessDebugBuildLogger extends AntProcessBuildLogger implements IAntDebugController, IDebugBuildLogger { >+ >+ private AntDebugState fDebugState= null; >+ >+ private List fBreakpoints= null; >+ >+ private AntDebugTarget fAntDebugTarget; >+ private boolean fResumed= false; >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) >+ */ >+ public void buildStarted(BuildEvent event) { >+ fDebugState= new AntDebugState(this); >+ super.buildStarted(event); >+ IProcess process= getAntProcess(fProcessId); >+ ILaunch launch= process.getLaunch(); >+ fAntDebugTarget= new AntDebugTarget(launch, process, this); >+ launch.addDebugTarget(fAntDebugTarget); >+ >+ fAntDebugTarget.buildStarted(); >+ fDebugState.buildStarted(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#taskFinished(org.apache.tools.ant.BuildEvent) >+ */ >+ public void taskFinished(BuildEvent event) { >+ super.taskFinished(event); >+ fDebugState.taskFinished(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#taskStarted(org.apache.tools.ant.BuildEvent) >+ */ >+ public void taskStarted(BuildEvent event) { >+ super.taskStarted(event); >+ fDebugState.taskStarted(event); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.antsupport.logger.util.IDebugBuildLogger#waitIfSuspended() >+ */ >+ public synchronized void waitIfSuspended() { >+ fResumed= false; >+ IBreakpoint breakpoint= breakpointAtLineNumber(fDebugState.getBreakpointLocation()); >+ if (breakpoint != null) { >+ fAntDebugTarget.breakpointHit(breakpoint); >+ try { >+ while (!fResumed) { >+ wait(500); >+ checkCancelled(); >+ } >+ } catch (InterruptedException e) { >+ } >+ } else if (fDebugState.getCurrentTask() != null) { >+ int detail= -1; >+ boolean shouldSuspend= true; >+ if (fDebugState.isStepIntoSuspend()) { >+ detail= DebugEvent.STEP_END; >+ fDebugState.setStepIntoSuspend(false); >+ } else if ((fDebugState.getLastTaskFinished() != null && fDebugState.getLastTaskFinished() == fDebugState.getStepOverTask()) || fDebugState.shouldSuspend()) { >+ detail= DebugEvent.STEP_END; >+ fDebugState.setShouldSuspend(false); >+ fDebugState.setStepOverTask(null); >+ } else if (fDebugState.isClientSuspend()) { >+ detail= DebugEvent.CLIENT_REQUEST; >+ fDebugState.setClientSuspend(false); >+ } else { >+ shouldSuspend= false; >+ } >+ if (shouldSuspend) { >+ fAntDebugTarget.suspended(detail); >+ try { >+ while (!fResumed) { >+ wait(500); >+ checkCancelled(); >+ } >+ } catch (InterruptedException e) { >+ } >+ } >+ } >+ } >+ >+ private void checkCancelled() { >+ AntProcess process= getAntProcess(fProcessId); >+ if (process != null && process.isCanceled()) { >+ throw new OperationCanceledException(RuntimeMessages.AntProcessDebugBuildLogger_1); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#resume() >+ */ >+ public synchronized void resume() { >+ fResumed= true; >+ notifyAll(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#suspend() >+ */ >+ public synchronized void suspend() { >+ fDebugState.setClientSuspend(true); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#stepInto() >+ */ >+ public synchronized void stepInto() { >+ fDebugState.setStepIntoSuspend(true); >+ fResumed= true; >+ notifyAll(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#stepOver() >+ */ >+ public synchronized void stepOver() { >+ fResumed= true; >+ fDebugState.stepOver(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#handleBreakpoint(org.eclipse.debug.core.model.IBreakpoint, boolean) >+ */ >+ public void handleBreakpoint(IBreakpoint breakpoint, boolean added) { >+ if (added) { >+ if (fBreakpoints == null) { >+ fBreakpoints= new ArrayList(); >+ } >+ if (!fBreakpoints.contains(breakpoint)) { >+ fBreakpoints.add(breakpoint); >+ } >+ } else { >+ if (fBreakpoints != null) { >+ fBreakpoints.remove(breakpoint); >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#getProperties() >+ */ >+ public void getProperties() { >+ if (!fAntDebugTarget.isSuspended()) { >+ return; >+ } >+ StringBuffer propertiesRepresentation= new StringBuffer(); >+ fDebugState.marshallProperties(propertiesRepresentation, false); >+ if (fAntDebugTarget.getThreads().length > 0) { >+ ((AntThread) fAntDebugTarget.getThreads()[0]).newProperties(propertiesRepresentation.toString()); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#getStackFrames() >+ */ >+ public void getStackFrames() { >+ StringBuffer stackRepresentation= new StringBuffer(); >+ fDebugState.marshalStack(stackRepresentation); >+ ((AntThread) fAntDebugTarget.getThreads()[0]).buildStack(stackRepresentation.toString()); >+ } >+ >+ private IBreakpoint breakpointAtLineNumber(Location location) { >+ if (fBreakpoints == null || location == null || location == Location.UNKNOWN_LOCATION) { >+ return null; >+ } >+ int lineNumber= fDebugState.getLineNumber(location); >+ File locationFile= new File(fDebugState.getFileName(location)); >+ for (int i = 0; i < fBreakpoints.size(); i++) { >+ ILineBreakpoint breakpoint = (ILineBreakpoint) fBreakpoints.get(i); >+ int breakpointLineNumber; >+ try { >+ if (!breakpoint.isEnabled()) { >+ continue; >+ } >+ breakpointLineNumber = breakpoint.getLineNumber(); >+ } catch (CoreException e) { >+ return null; >+ } >+ IFile resource= (IFile) breakpoint.getMarker().getResource(); >+ if (breakpointLineNumber == lineNumber && resource.getLocation().toFile().equals(locationFile)) { >+ return breakpoint; >+ } >+ } >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) >+ */ >+ public void targetStarted(BuildEvent event) { >+ fDebugState.targetStarted(event); >+ waitIfSuspended(); >+ super.targetStarted(event); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#targetFinished(org.apache.tools.ant.BuildEvent) >+ */ >+ public void targetFinished(BuildEvent event) { >+ super.targetFinished(event); >+ fDebugState.setTargetExecuting(null); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#unescapeString(java.lang.StringBuffer) >+ */ >+ public StringBuffer unescapeString(StringBuffer propertyValue) { >+ return propertyValue; >+ } >+} >Index: loggers/org/eclipse/ant/internal/launching/runtime/logger/NullBuildLogger.java >=================================================================== >RCS file: loggers/org/eclipse/ant/internal/launching/runtime/logger/NullBuildLogger.java >diff -N loggers/org/eclipse/ant/internal/launching/runtime/logger/NullBuildLogger.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ loggers/org/eclipse/ant/internal/launching/runtime/logger/NullBuildLogger.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,179 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 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(); >+ } >+} >Index: loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.java >=================================================================== >RCS file: loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.java >diff -N loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,31 @@ >+/********************************************************************** >+ * Copyright (c) 2000, 2005 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 >Index: loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.properties >=================================================================== >RCS file: loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.properties >diff -N loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ loggers/org/eclipse/ant/internal/launching/runtime/logger/RuntimeMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -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. >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.launching/plugin.properties,v >retrieving revision 1.1 >diff -u -r1.1 plugin.properties >--- plugin.properties 16 Sep 2009 14:34:09 -0000 1.1 >+++ plugin.properties 7 Oct 2009 20:08:14 -0000 >@@ -10,4 +10,15 @@ > ############################################################################### > > pluginName=Ant Launching Support >-providerName=Eclipse.org >\ No newline at end of file >+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 >Index: plugin.xml >=================================================================== >RCS file: plugin.xml >diff -N plugin.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ plugin.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,92 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<?eclipse version="3.4"?> >+<plugin> >+ <extension >+ point="org.eclipse.debug.core.launchConfigurationTypes"> >+ <launchConfigurationType >+ category="org.eclipse.ui.externaltools" >+ delegate="org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate" >+ delegateDescription="%AntLaunchDelegate.description" >+ delegateName="%AntLaunchDelegate.name" >+ id="org.eclipse.ant.AntLaunchConfigurationType" >+ migrationDelegate="org.eclipse.ant.internal.launching.launchConfigurations.AntMigrationDelegate" >+ modes="run, debug" >+ name="%AntBuild" >+ sourceLocatorId="org.eclipse.ant.ui.debug.sourceLookupDirector" >+ sourcePathComputerId="org.eclipse.ant.ui.debug.sourcePathComputer"> >+ </launchConfigurationType> >+ <launchConfigurationType >+ category="org.eclipse.ui.externaltools.builder" >+ delegate="org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate" >+ delegateDescription="%AntBuilderLaunchDelegate.description" >+ delegateName="%AntBuilderLaunchDelegate.name" >+ id="org.eclipse.ant.AntBuilderLaunchConfigurationType" >+ modes="run" >+ name="%AntBuilder.name"> >+ </launchConfigurationType> >+ </extension> >+ <extension point="org.eclipse.core.runtime.preferences"> >+ <initializer class="org.eclipse.ant.internal.launching.AntLaunchingPreferenceInitializer"/> >+ </extension> >+ <extension >+ point="org.eclipse.jdt.launching.runtimeClasspathEntries"> >+ <runtimeClasspathEntry >+ class="org.eclipse.ant.internal.launching.launchConfigurations.AntHomeClasspathEntry" >+ id="org.eclipse.antui.classpathentry.antHome"> >+ </runtimeClasspathEntry> >+ <runtimeClasspathEntry >+ class="org.eclipse.ant.internal.launching.launchConfigurations.ContributedClasspathEntriesEntry" >+ id="org.eclipse.ant.ui.classpathentry.extraClasspathEntries"> >+ </runtimeClasspathEntry> >+ </extension> >+ <extension >+ point="org.eclipse.jdt.launching.classpathProviders"> >+ <classpathProvider >+ class="org.eclipse.ant.internal.launching.launchConfigurations.AntClasspathProvider" >+ id="org.eclipse.ant.ui.AntClasspathProvider"> >+ </classpathProvider> >+ </extension> >+ <extension >+ point="org.eclipse.debug.core.processFactories"> >+ <processFactory >+ class="org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntProcessFactory" >+ id="org.eclipse.ant.ui.remoteAntProcessFactory"> >+ </processFactory> >+ </extension> >+ <extension point="org.eclipse.core.runtime.preferences"> >+ <initializer class="org.eclipse.ant.internal.launching.AntLaunchingPreferenceInitializer"/> >+ </extension> >+ <extension >+ point="org.eclipse.ant.core.extraClasspathEntries"> >+ <extraClasspathEntry >+ headless="true" >+ library="lib/loggers.jar"> >+ </extraClasspathEntry> >+ <extraClasspathEntry >+ eclipseRuntime="false" >+ headless="true" >+ library="lib/antdebug.jar"> >+ </extraClasspathEntry> >+ <extraClasspathEntry >+ eclipseRuntime="false" >+ headless="true" >+ library="lib/remote.jar"> >+ </extraClasspathEntry> >+ </extension> >+ <extension >+ point="org.eclipse.debug.core.breakpoints"> >+ <breakpoint >+ markerType="org.eclipse.ant.ui.antLineBreakpointMarker" >+ class="org.eclipse.ant.internal.launching.debug.model.AntLineBreakpoint" >+ id="org.eclipse.ant.ui.lineBreakpoint" >+ name="%antBreakpointGroupName"> >+ </breakpoint> >+ </extension> >+ <extension >+ id="org.eclipse.ant.ui.antLineBreakpointMarker" >+ name="%AntLineBreakpoint.name" >+ point="org.eclipse.core.resources.markers"> >+ <super type="org.eclipse.debug.core.lineBreakpointMarker"/> >+ <persistent value="true"/> >+ </extension> >+</plugin> >Index: remote/META-INF/eclipse.inf >=================================================================== >RCS file: remote/META-INF/eclipse.inf >diff -N remote/META-INF/eclipse.inf >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/META-INF/eclipse.inf 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1 @@ >+jarprocessor.exclude.sign=true >\ No newline at end of file >Index: remote/org/eclipse/ant/internal/launching/remote/AntSecurityException.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/AntSecurityException.java >diff -N remote/org/eclipse/ant/internal/launching/remote/AntSecurityException.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/AntSecurityException.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,23 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 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; >+ >+} >Index: remote/org/eclipse/ant/internal/launching/remote/AntSecurityManager.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/AntSecurityManager.java >diff -N remote/org/eclipse/ant/internal/launching/remote/AntSecurityManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/AntSecurityManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,371 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 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(); >+ } >+} >Index: remote/org/eclipse/ant/internal/launching/remote/DemuxInputStreamSetter.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/DemuxInputStreamSetter.java >diff -N remote/org/eclipse/ant/internal/launching/remote/DemuxInputStreamSetter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/DemuxInputStreamSetter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2005 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)); >+ } >+} >Index: remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java >diff -N remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,41 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 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; >+ } >+} >Index: remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java >diff -N remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,39 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 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; >+ } >+} >Index: remote/org/eclipse/ant/internal/launching/remote/ExecutorSetter.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/ExecutorSetter.java >diff -N remote/org/eclipse/ant/internal/launching/remote/ExecutorSetter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/ExecutorSetter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 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); >+ } >+} >Index: remote/org/eclipse/ant/internal/launching/remote/InputHandlerSetter.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/InputHandlerSetter.java >diff -N remote/org/eclipse/ant/internal/launching/remote/InputHandlerSetter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/InputHandlerSetter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,44 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2006 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); >+ } >+} >Index: remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java >diff -N remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1231 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Portions Copyright 2000-2005 The Apache Software Foundation >+ * All rights reserved. This program and the accompanying materials are made >+ * available under the terms of the Apache Software License v2.0 which >+ * accompanies this distribution and is available at >+ * http://www.apache.org/licenses/LICENSE-2.0. >+ * >+ * Contributors: >+ * IBM Corporation - derived implementation >+ *******************************************************************************/ >+ >+package org.eclipse.ant.internal.launching.remote; >+ >+import java.io.File; >+import java.io.FileInputStream; >+import java.io.FileNotFoundException; >+import java.io.FileOutputStream; >+import java.io.IOException; >+import java.io.InputStream; >+import java.io.PrintStream; >+import java.text.MessageFormat; >+import java.util.ArrayList; >+import java.util.Collections; >+import java.util.Enumeration; >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Map; >+import java.util.Properties; >+import java.util.Vector; >+ >+import org.apache.tools.ant.AntTypeDefinition; >+import org.apache.tools.ant.BuildEvent; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.BuildListener; >+import org.apache.tools.ant.BuildLogger; >+import org.apache.tools.ant.ComponentHelper; >+import org.apache.tools.ant.DefaultLogger; >+import org.apache.tools.ant.DemuxOutputStream; >+import org.apache.tools.ant.Diagnostics; >+import org.apache.tools.ant.Main; >+import org.apache.tools.ant.Project; >+import org.apache.tools.ant.ProjectHelper; >+import org.apache.tools.ant.Target; >+import org.apache.tools.ant.Task; >+import org.apache.tools.ant.TaskAdapter; >+import org.apache.tools.ant.util.FileUtils; >+import org.eclipse.ant.internal.launching.remote.logger.RemoteAntBuildLogger; >+ >+/** >+ * Eclipse application entry point into Ant in a separate VM. Derived from the original Ant Main class >+ * to ensure that the functionality is equivalent when running in the platform. >+ */ >+public class InternalAntRunner { >+ >+ /** >+ * Message priority for project help messages. >+ */ >+ public static final int MSG_PROJECT_HELP= Project.MSG_DEBUG + 1; >+ >+ private List buildListeners; >+ >+ private String buildFileLocation; >+ >+ /** >+ * Targets we want to run. >+ */ >+ private Vector targets; >+ >+ private Map userProperties; >+ >+ private Project currentProject; >+ >+ private BuildLogger buildLogger= null; >+ >+ private Map eclipseSpecifiedTasks; >+ private Map eclipseSpecifiedTypes; >+ >+ /** >+ * Cache of the Ant version number when it has been loaded >+ */ >+ private String antVersionNumber= null; >+ >+ /** Our current message output status. Follows Project.MSG_XXX */ >+ private int messageOutputLevel = Project.MSG_INFO; >+ >+ /** Indicates whether output to the log is to be unadorned. */ >+ private boolean emacsMode = false; >+ >+ /** Indicates we should only parse and display the project help information */ >+ private boolean projectHelp = false; >+ >+ /** Stream that we are using for logging */ >+ private PrintStream out = System.out; >+ >+ /** Stream that we are using for logging error messages */ >+ private PrintStream err = System.err; >+ >+ /** >+ * The Ant logger class. There may be only one logger. It will have the >+ * right to use the 'out' PrintStream. The class must implement the BuildLogger >+ * interface. An empty String indicates that no logger is to be used. A <code>null</code> >+ * name indicates that the <code>org.apache.tools.ant.DefaultLogger</code> will be used. >+ */ >+ private String loggerClassname = null; >+ >+ /** Extra arguments to be parsed as command line arguments. */ >+ private String[] extraArguments = null; >+ >+ private boolean scriptExecuted= false; >+ >+ private List propertyFiles= new ArrayList(); >+ >+ /** >+ * The Ant InputHandler class. There may be only one input handler. >+ */ >+ private String inputHandlerClassname = null; >+ >+ /** >+ * Indicates whether to execute all targets that >+ * do not depend on failed targets >+ * @since Ant 1.6.0 >+ */ >+ private boolean keepGoing= false; >+ >+ /** >+ * Indicates whether this build is to support interactive input >+ * @since Ant 1.6.0 >+ */ >+ private boolean allowInput = true; >+ >+ private String fEarlyErrorMessage= null; >+ >+ public static void main(String[] args) { >+ try { >+ new InternalAntRunner().run(getArrayList(args)); >+ } catch (Throwable t) { >+ t.printStackTrace(); >+ System.exit(1); >+ } >+ System.exit(0); >+ } >+ >+ private void addBuildListeners(Project project) { >+ String className= null; >+ try { >+ BuildLogger logger= createLogger(); >+ if (logger != null) { >+ project.addBuildListener(logger); >+ } >+ if (buildListeners != null) { >+ for (Iterator iterator = buildListeners.iterator(); iterator.hasNext();) { >+ className = (String) iterator.next(); >+ Class listener = Class.forName(className); >+ project.addBuildListener((BuildListener) listener.newInstance()); >+ } >+ } >+ } catch (ClassCastException e) { >+ String message = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.{0}_which_was_specified_to_be_a_build_listener_is_not_an_instance_of_org.apache.tools.ant.BuildListener._1"), new String[]{className}); //$NON-NLS-1$ >+ logMessage(null, message, Project.MSG_ERR); >+ throw new BuildException(message, e); >+ } catch (BuildException e) { >+ throw e; >+ } catch (Exception e) { >+ throw new BuildException(e); >+ } >+ } >+ >+ /** >+ * Parses the build file and adds necessary information into >+ * the given project. >+ * @param project The project to configure >+ */ >+ private void parseBuildFile(Project project) { >+ File buildFile = new File(getBuildFileLocation()); >+ if (!buildFile.exists()) { >+ throw new BuildException(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Buildfile__{0}_does_not_exist_!_1"), //$NON-NLS-1$ >+ new String[]{buildFile.getAbsolutePath()})); >+ } >+ if (!buildFile.isFile()) { >+ throw new BuildException(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Buildfile__{0}_is_not_a_file_1"), //$NON-NLS-1$ >+ new String[]{buildFile.getAbsolutePath()})); >+ } >+ >+ if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >+ parseBuildFile(project, buildFile); >+ } else { >+ ProjectHelper helper = ProjectHelper.getProjectHelper(); >+ project.addReference("ant.projectHelper", helper); //$NON-NLS-1$ >+ helper.parse(project, buildFile); >+ } >+ } >+ >+ /** >+ * @deprecated support for Ant older than 1.5 >+ */ >+ private void parseBuildFile(Project project, File buildFile) { >+ ProjectHelper.configureProject(project, buildFile); >+ } >+ >+ private void printArguments(Project project) { >+ if ((messageOutputLevel != Project.MSG_DEBUG) && (messageOutputLevel != Project.MSG_VERBOSE)) { >+ return; >+ } >+ StringBuffer sb = new StringBuffer(); >+ for (int i = 0; i < extraArguments.length; i++) { >+ sb.append(extraArguments[i]); >+ sb.append(' '); >+ } >+ project.log(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Arguments__{0}_2"), new String[]{sb.toString().trim()})); //$NON-NLS-1$ >+ } >+ >+ >+ /** >+ * Logs a message with the client that lists the targets >+ * in a project >+ * >+ * @param project the project to list targets from >+ */ >+ private void printTargets(Project project) { >+ //notify the logger that project help message are coming >+ //since there is no buildstarted or targetstarted to >+ //to be used to establish the connection >+ logMessage(project, "", MSG_PROJECT_HELP); //$NON-NLS-1$ >+ // find the target with the longest name >+ int maxLength = 0; >+ Enumeration ptargets = project.getTargets().elements(); >+ String targetName; >+ String targetDescription; >+ Target currentTarget; >+ // split the targets in top-level and sub-targets depending >+ // on the presence of a description >+ List topNames = new ArrayList(); >+ List topDescriptions = new ArrayList(); >+ List subNames = new ArrayList(); >+ >+ while (ptargets.hasMoreElements()) { >+ currentTarget = (Target) ptargets.nextElement(); >+ targetName = currentTarget.getName(); >+ targetDescription = currentTarget.getDescription(); >+ if (targetDescription == null) { >+ subNames.add(targetName); >+ } else { >+ topNames.add(targetName); >+ topDescriptions.add(targetDescription); >+ if (targetName.length() > maxLength) { >+ maxLength = targetName.length(); >+ } >+ } >+ } >+ >+ Collections.sort(subNames); >+ Collections.sort(topNames); >+ Collections.sort(topDescriptions); >+ >+ String defaultTargetName = project.getDefaultTarget(); >+ if (defaultTargetName != null && !"".equals(defaultTargetName)) { // shouldn't need to check but... //$NON-NLS-1$ >+ List defaultName = new ArrayList(1); >+ List defaultDesc = null; >+ defaultName.add(defaultTargetName); >+ >+ int indexOfDefDesc = topNames.indexOf(defaultTargetName); >+ if (indexOfDefDesc >= 0) { >+ defaultDesc = new ArrayList(1); >+ defaultDesc.add(topDescriptions.get(indexOfDefDesc)); >+ } >+ printTargets(project, defaultName, defaultDesc, RemoteAntMessages.getString("InternalAntRunner.Default_target__3"), maxLength); //$NON-NLS-1$ >+ >+ } >+ >+ printTargets(project, topNames, topDescriptions, RemoteAntMessages.getString("InternalAntRunner.Main_targets__4"), maxLength); //$NON-NLS-1$ >+ printTargets(project, subNames, null, RemoteAntMessages.getString("InternalAntRunner.Subtargets__5"), 0); //$NON-NLS-1$ >+ } >+ >+ /** >+ * Logs a message with the client that lists the target names and optional descriptions >+ * >+ * @param project the enclosing target >+ * @param names the targets names >+ * @param descriptions the corresponding descriptions >+ * @param heading the message heading >+ * @param maxlen maximum length that can be allocated for a name >+ */ >+ private void printTargets(Project project, List names, List descriptions, String heading, int maxlen) { >+ // now, start printing the targets and their descriptions >+ String lSep = System.getProperty("line.separator"); //$NON-NLS-1$ >+ >+ String spaces = " "; //$NON-NLS-1$ >+ while (spaces.length() < maxlen) { >+ spaces += spaces; >+ } >+ StringBuffer msg = new StringBuffer(); >+ msg.append(heading + lSep + lSep); >+ for (int i = 0; i < names.size(); i++) { >+ msg.append(' '); >+ msg.append(names.get(i)); >+ if (descriptions != null) { >+ msg.append(spaces.substring(0, maxlen - ((String) names.get(i)).length() + 2)); >+ msg.append(descriptions.get(i)); >+ } >+ msg.append(lSep); >+ } >+ logMessage(project, msg.toString(), Project.MSG_INFO); >+ } >+ >+ /* >+ * Note that the list passed to this method must support >+ * List#remove(Object) >+ */ >+ private void run(List argList) { >+ setCurrentProject(new Project()); >+ if (isVersionCompatible("1.6.3")) { //$NON-NLS-1$ >+ new ExecutorSetter().setExecutor(getCurrentProject()); >+ } >+ Throwable error = null; >+ PrintStream originalErr = System.err; >+ PrintStream originalOut = System.out; >+ InputStream originalIn= System.in; >+ >+ SecurityManager originalSM= System.getSecurityManager(); >+ scriptExecuted= true; >+ try { >+ if (argList != null && (argList.remove("-projecthelp") || argList.remove("-p"))) { //$NON-NLS-1$ //$NON-NLS-2$ >+ projectHelp = true; >+ } >+ getCurrentProject().init(); >+ if (argList != null) { >+ scriptExecuted= preprocessCommandLine(argList); >+ >+ if (!scriptExecuted) { >+ return; >+ } >+ } >+ >+ boolean exceptionState= processProperties(argList); >+ >+ addBuildListeners(getCurrentProject()); >+ >+ addInputHandler(getCurrentProject()); >+ >+ remapSystemIn(); >+ System.setOut(new PrintStream(new DemuxOutputStream(getCurrentProject(), false))); >+ System.setErr(new PrintStream(new DemuxOutputStream(getCurrentProject(), true))); >+ >+ if (!projectHelp) { >+ fireBuildStarted(getCurrentProject()); >+ } >+ >+ if (fEarlyErrorMessage != null) { >+ //an error occurred processing the properties >+ //build started has fired and we have >+ //listeners/loggers to report the error >+ logMessage(getCurrentProject(), fEarlyErrorMessage, Project.MSG_ERR); >+ if (exceptionState) { >+ throw new BuildException(fEarlyErrorMessage); >+ } >+ } >+ >+ //properties can only be set after buildStarted as some listeners/loggers >+ //depend on this (e.g. XMLLogger) >+ setProperties(getCurrentProject()); >+ >+ if (argList != null && !argList.isEmpty()) { >+ try { >+ scriptExecuted= processCommandLine(argList); >+ } catch (BuildException e) { >+ scriptExecuted= false; >+ throw e; >+ } >+ } >+ if (!scriptExecuted) { >+ return; >+ } >+ >+ //needs to occur after processCommandLine(List) >+ if (allowInput && (inputHandlerClassname != null && inputHandlerClassname.length() > 0)) { >+ if (isVersionCompatible("1.6")) { //$NON-NLS-1$ >+ getCurrentProject().setDefaultInputStream(originalIn); >+ } >+ } else { >+ //set the system property that any input handler >+ //can check to see if handling input is allowed >+ System.setProperty("eclipse.ant.noInput", "true"); //$NON-NLS-1$//$NON-NLS-2$ >+ if (isVersionCompatible("1.5") && (inputHandlerClassname == null || inputHandlerClassname.length() == 0)) { //$NON-NLS-1$ >+ InputHandlerSetter setter= new InputHandlerSetter(); >+ setter.setInputHandler(getCurrentProject(), "org.eclipse.ant.internal.ui.antsupport.inputhandler.FailInputHandler"); //$NON-NLS-1$ >+ } >+ } >+ >+ getCurrentProject().log(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Build_file__{0}_1"), new String[]{getBuildFileLocation()})); //$NON-NLS-1$ >+ >+ setTasks(); >+ setTypes(); >+ >+ if (isVersionCompatible("1.6")) { //$NON-NLS-1$ >+ getCurrentProject().setKeepGoingMode(keepGoing); >+ } >+ >+ parseBuildFile(getCurrentProject()); >+ >+ if (projectHelp) { >+ printHelp(getCurrentProject()); >+ scriptExecuted= false; >+ return; >+ } >+ >+ if (extraArguments != null) { >+ printArguments(getCurrentProject()); >+ } >+ >+ System.setSecurityManager(new AntSecurityManager(originalSM, Thread.currentThread())); >+ >+ if (targets == null) { >+ targets= new Vector(1); >+ } >+ if (targets.isEmpty() && getCurrentProject().getDefaultTarget() != null) { >+ targets.add(getCurrentProject().getDefaultTarget()); >+ } >+ if (!isVersionCompatible("1.6.3")) { //$NON-NLS-1$ >+ getCurrentProject().addReference("eclipse.ant.targetVector", targets); //$NON-NLS-1$ >+ } >+ getCurrentProject().executeTargets(targets); >+ } catch (AntSecurityException e) { >+ //expected >+ } catch (Throwable e) { >+ error = e; >+ } finally { >+ System.setErr(originalErr); >+ System.setOut(originalOut); >+ System.setIn(originalIn); >+ if (System.getSecurityManager() instanceof AntSecurityManager) { >+ System.setSecurityManager(originalSM); >+ } >+ >+ if (!projectHelp) { >+ fireBuildFinished(getCurrentProject(), error); >+ } >+ >+ //close any user specified build log >+ if (err != originalErr) { >+ err.close(); >+ } >+ if (out != originalOut) { >+ out.close(); >+ } >+ } >+ } >+ >+ private void setTasks() { >+ if (eclipseSpecifiedTasks != null) { >+ Iterator itr= eclipseSpecifiedTasks.keySet().iterator(); >+ String taskName; >+ String taskClassName; >+ while (itr.hasNext()) { >+ taskName= (String) itr.next(); >+ taskClassName= (String) eclipseSpecifiedTasks.get(taskName); >+ >+ if (isVersionCompatible("1.6")) { //$NON-NLS-1$ >+ AntTypeDefinition def= new AntTypeDefinition(); >+ def.setName(taskName); >+ def.setClassName(taskClassName); >+ def.setClassLoader(this.getClass().getClassLoader()); >+ def.setAdaptToClass(Task.class); >+ def.setAdapterClass(TaskAdapter.class); >+ ComponentHelper.getComponentHelper(getCurrentProject()).addDataTypeDefinition(def); >+ } else { >+ try { >+ Class taskClass = Class.forName(taskClassName); >+ getCurrentProject().addTaskDefinition(taskName, taskClass); >+ } catch (ClassNotFoundException e) { >+ String message= MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.161"), new String[]{taskClassName, taskName}); //$NON-NLS-1$ >+ getCurrentProject().log(message, Project.MSG_WARN); >+ } >+ } >+ } >+ } >+ } >+ >+ private void setTypes() { >+ if (eclipseSpecifiedTypes != null) { >+ Iterator itr= eclipseSpecifiedTypes.keySet().iterator(); >+ String typeName; >+ String typeClassName; >+ while (itr.hasNext()) { >+ typeName = (String) itr.next(); >+ typeClassName= (String) eclipseSpecifiedTypes.get(typeName); >+ if (isVersionCompatible("1.6")) { //$NON-NLS-1$ >+ AntTypeDefinition def = new AntTypeDefinition(); >+ def.setName(typeName); >+ def.setClassName(typeClassName); >+ def.setClassLoader(this.getClass().getClassLoader()); >+ ComponentHelper.getComponentHelper(getCurrentProject()).addDataTypeDefinition(def); >+ } else { >+ try { >+ Class typeClass = Class.forName(typeClassName); >+ getCurrentProject().addDataTypeDefinition(typeName, typeClass); >+ } catch (ClassNotFoundException e) { >+ String message= MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.162"), new String[]{typeClassName, typeName}); //$NON-NLS-1$ >+ getCurrentProject().log(message, Project.MSG_WARN); >+ } >+ } >+ } >+ } >+ } >+ >+ private void remapSystemIn() { >+ if (!isVersionCompatible("1.6")) { //$NON-NLS-1$ >+ return; >+ } >+ DemuxInputStreamSetter setter= new DemuxInputStreamSetter(); >+ setter.remapSystemIn(getCurrentProject()); >+ } >+ >+ /** >+ * Creates and returns the default build logger for logging build events to the ant log. >+ * >+ * @return the default build logger for logging build events to the ant log >+ * can return <code>null</code> if no logging is to occur >+ */ >+ private BuildLogger createLogger() { >+ if (loggerClassname == null) { >+ buildLogger= new DefaultLogger(); >+ } else if (!"".equals(loggerClassname)) { //$NON-NLS-1$ >+ try { >+ buildLogger = (BuildLogger) (Class.forName(loggerClassname).newInstance()); >+ } catch (ClassCastException e) { >+ String message = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.{0}_which_was_specified_to_perform_logging_is_not_an_instance_of_org.apache.tools.ant.BuildLogger._2"), new String[]{loggerClassname}); //$NON-NLS-1$ >+ logMessage(null, message, Project.MSG_ERR); >+ throw new BuildException(message, e); >+ } catch (Exception e) { >+ String message = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Unable_to_instantiate_logger__{0}_6"), new String[]{loggerClassname}); //$NON-NLS-1$ >+ logMessage(null, message, Project.MSG_ERR); >+ throw new BuildException(message, e); >+ } >+ } >+ >+ if (buildLogger != null) { >+ buildLogger.setMessageOutputLevel(messageOutputLevel); >+ buildLogger.setOutputPrintStream(out); >+ buildLogger.setErrorPrintStream(err); >+ buildLogger.setEmacsMode(emacsMode); >+ if (buildLogger instanceof RemoteAntBuildLogger) { >+ ((RemoteAntBuildLogger) buildLogger).configure(userProperties); >+ } >+ } >+ >+ return buildLogger; >+ } >+ >+ /** >+ * Project.fireBuildStarted is protected in Ant earlier than 1.5.*. >+ * Provides backwards compatibility with old Ant installs. >+ */ >+ private void fireBuildStarted(Project project) { >+ if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >+ BuildEvent event = new BuildEvent(project); >+ for (Iterator iterator = project.getBuildListeners().iterator(); iterator.hasNext();) { >+ BuildListener listener = (BuildListener) iterator.next(); >+ listener.buildStarted(event); >+ } >+ } else { >+ project.fireBuildStarted(); >+ } >+ } >+ >+ private void fireBuildFinished(Project project, Throwable error) { >+ if (error == null && scriptExecuted) { >+ logMessage(project, RemoteAntMessages.getString("InternalAntRunner.BUILD_SUCCESSFUL_1"), messageOutputLevel); //$NON-NLS-1$ >+ } >+ if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >+ BuildEvent event = new BuildEvent(project); >+ event.setException(error); >+ Iterator iter = project.getBuildListeners().iterator(); >+ while (iter.hasNext()) { >+ BuildListener listener = (BuildListener) iter.next(); >+ listener.buildFinished(event); >+ } >+ } else { >+ project.fireBuildFinished(error); >+ } >+ } >+ >+ private void logMessage(Project project, String message, int priority) { >+ if (project != null) { >+ project.log(message, priority); >+ } else { >+ if (buildListeners != null) { >+ project = new Project(); >+ BuildEvent event = new BuildEvent(project); >+ event.setMessage(message, priority); >+ //notify the build listeners that are not registered as >+ //no project existed >+ for (Iterator iterator = buildListeners.iterator(); iterator.hasNext();) { >+ try { >+ BuildListener listener = (BuildListener) iterator.next(); >+ listener.messageLogged(event); >+ } catch (ClassCastException e) { >+ //ignore we could be trying to log that a build listener is the >+ //wrong type of class >+ } >+ } >+ } >+ } >+ } >+ >+ /** >+ * Sets the buildFileLocation. >+ * >+ * @param buildFileLocation the file system location of the build file >+ */ >+ private void setBuildFileLocation(String buildFileLocation) { >+ this.buildFileLocation = buildFileLocation; >+ if (getCurrentProject() != null) { >+ getCurrentProject().setUserProperty("ant.file", buildFileLocation); //$NON-NLS-1$ >+ } >+ } >+ >+ private String getBuildFileLocation() { >+ if (buildFileLocation == null) { >+ buildFileLocation = new File("build.xml").getAbsolutePath(); //$NON-NLS-1$ >+ } >+ return buildFileLocation; >+ } >+ >+ /** >+ * Sets the message output level. Use -1 for none. >+ * @param level The message output level >+ */ >+ private void setMessageOutputLevel(int level) { >+ messageOutputLevel = level; >+ if (buildLogger != null) { >+ buildLogger.setMessageOutputLevel(level); >+ } >+ } >+ >+ /* >+ * Returns a String representation of the Ant version number as specified >+ * in the version.txt file. >+ */ >+ private String getAntVersionNumber() throws BuildException { >+ if (antVersionNumber == null) { >+ try { >+ Properties props = new Properties(); >+ InputStream in = Main.class.getResourceAsStream("/org/apache/tools/ant/version.txt"); //$NON-NLS-1$ >+ props.load(in); >+ in.close(); >+ String versionNumber= props.getProperty("VERSION"); //$NON-NLS-1$ >+ antVersionNumber= versionNumber; >+ } catch (IOException ioe) { >+ throw new BuildException(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Could_not_load_the_version_information._{0}_9"), new String[]{ioe.getMessage()})); //$NON-NLS-1$ >+ } catch (NullPointerException npe) { >+ throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.Could_not_load_the_version_information._10")); //$NON-NLS-1$ >+ } >+ } >+ return antVersionNumber; >+ } >+ >+ /* >+ * Returns whether the given version is compatible with the >+ * current Ant version. A version is compatible if it is less >+ * than or equal to the current version. >+ */ >+ private boolean isVersionCompatible(String comparison) { >+ String version= getAntVersionNumber(); >+ return version.compareTo(comparison) >= 0; >+ } >+ >+ private boolean preprocessCommandLine(List commands) { >+ >+ String arg = getArgument(commands, "-listener"); //$NON-NLS-1$ >+ while (arg != null) { >+ if (arg.length() == 0) { >+ throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_classname_when_using_the_-listener_argument_1")); //$NON-NLS-1$ >+ } >+ if (buildListeners == null) { >+ buildListeners= new ArrayList(1); >+ } >+ buildListeners.add(arg); >+ arg = getArgument(commands, "-listener"); //$NON-NLS-1$ >+ } >+ >+ arg = getArgument(commands, "-logger"); //$NON-NLS-1$ >+ if (arg != null) { >+ //allow empty string to mean no logger >+ loggerClassname = arg; >+ } >+ arg = getArgument(commands, "-logger"); //$NON-NLS-1$ >+ if (arg != null) { >+ throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.Only_one_logger_class_may_be_specified_1")); //$NON-NLS-1$ >+ } >+ >+ arg = getArgument(commands, "-inputhandler"); //$NON-NLS-1$ >+ if (arg != null) { >+ if (arg.length() == 0) { >+ throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_classname_when_using_the_-inputhandler_argument_1")); //$NON-NLS-1$ >+ } >+ inputHandlerClassname = arg; >+ } >+ arg = getArgument(commands, "-inputhandler"); //$NON-NLS-1$ >+ if (arg != null) { >+ throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.Only_one_input_handler_class_may_be_specified._2")); //$NON-NLS-1$ >+ } >+ return true; >+ } >+ >+ /* >+ * Looks for interesting command line arguments. >+ * Returns whether it is OK to run the script. >+ */ >+ private boolean processCommandLine(List commands) { >+ >+ if (commands.remove("-help") || commands.remove("-h")) { //$NON-NLS-1$ //$NON-NLS-2$ >+ printUsage(); >+ return false; >+ } >+ >+ if (commands.remove("-version")) { //$NON-NLS-1$ >+ printVersion(); >+ return false; >+ } >+ >+ if (commands.remove("-verbose") || commands.remove("-v")) { //$NON-NLS-1$ //$NON-NLS-2$ >+ printVersion(); >+ setMessageOutputLevel(Project.MSG_VERBOSE); >+ } >+ >+ if (commands.remove("-debug") || commands.remove("-d")) { //$NON-NLS-1$ //$NON-NLS-2$ >+ printVersion(); >+ setMessageOutputLevel(Project.MSG_DEBUG); >+ } >+ >+ if (commands.remove("-quiet") || commands.remove("-q")) { //$NON-NLS-1$ //$NON-NLS-2$ >+ setMessageOutputLevel(Project.MSG_WARN); >+ } >+ >+ if (commands.remove("-emacs") || commands.remove("-e")) { //$NON-NLS-1$ //$NON-NLS-2$ >+ emacsMode = true; >+ if (buildLogger != null) { >+ buildLogger.setEmacsMode(true); >+ } >+ } >+ >+ if (commands.remove("-diagnostics")) { //$NON-NLS-1$ >+ if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >+ throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.The_diagnositics_options_is_an_Ant_1.5.*_feature._Please_update_your_Ant_classpath_to_include_an_Ant_version_greater_than_this._4")); //$NON-NLS-1$ >+ } >+ try { >+ Diagnostics.doReport(System.out); >+ } catch (NullPointerException e) { >+ logMessage(getCurrentProject(), RemoteAntMessages.getString("InternalAntRunner.ANT_HOME_must_be_set_to_use_Ant_diagnostics_2"), Project.MSG_ERR); //$NON-NLS-1$ >+ } >+ return false; >+ } >+ >+ String arg = getArgument(commands, "-logfile"); //$NON-NLS-1$ >+ if (arg == null) { >+ arg = getArgument(commands, "-l"); //$NON-NLS-1$ >+ } >+ if (arg != null) { >+ if (arg.length() == 0) { >+ String message= RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_log_file_when_using_the_-log_argument_3"); //$NON-NLS-1$ >+ logMessage(currentProject, message, Project.MSG_ERR); >+ throw new BuildException(message); >+ } >+ try { >+ createLogFile(arg); >+ } catch (IOException e) { >+ // just log message and ignore exception >+ logMessage(getCurrentProject(), MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Could_not_write_to_the_specified_log_file__{0}._Make_sure_the_path_exists_and_you_have_write_permissions._2"), new String[]{arg}), Project.MSG_ERR); //$NON-NLS-1$ >+ return false; >+ } >+ >+ } >+ >+ arg = getArgument(commands, "-buildfile"); //$NON-NLS-1$ >+ if (arg == null) { >+ arg = getArgument(commands, "-file"); //$NON-NLS-1$ >+ if (arg == null) { >+ arg = getArgument(commands, "-f"); //$NON-NLS-1$ >+ } >+ } >+ >+ if (arg != null) { >+ if (arg.length() == 0) { >+ String message= RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_buildfile_when_using_the_-buildfile_argument_4"); //$NON-NLS-1$ >+ logMessage(currentProject, message, Project.MSG_ERR); >+ throw new BuildException(message); >+ } >+ setBuildFileLocation(arg); >+ } >+ >+ if (isVersionCompatible("1.6")) { //$NON-NLS-1$ >+ if (commands.remove("-k") || commands.remove("-keep-going")) { //$NON-NLS-1$ //$NON-NLS-2$ >+ keepGoing= true; >+ } >+ if (commands.remove("-noinput")) { //$NON-NLS-1$ >+ allowInput= false; >+ } >+ arg= getArgument(commands, "-lib"); //$NON-NLS-1$ >+ if (arg != null) { >+ logMessage(currentProject, RemoteAntMessages.getString("InternalAntRunner.157"), Project.MSG_ERR); //$NON-NLS-1$ >+ return false; >+ } >+ } >+ >+ arg= getArgument(commands, "-find"); //$NON-NLS-1$ >+ if (arg == null) { >+ arg= getArgument(commands, "-s"); //$NON-NLS-1$ >+ } >+ if (arg != null) { >+ logMessage(currentProject, RemoteAntMessages.getString("InternalAntRunner.-find_not_supported"), Project.MSG_ERR); //$NON-NLS-1$ >+ return false; >+ } >+ >+ processTasksAndTypes(commands); >+ >+ if (!commands.isEmpty()) { >+ processUnrecognizedCommands(commands); >+ } >+ >+ if (!commands.isEmpty()) { >+ processTargets(commands); >+ } >+ >+ return true; >+ } >+ >+ private void processTasksAndTypes(List commands) { >+ String arg = getArgument(commands, "-eclipseTask"); //$NON-NLS-1$ >+ while (arg != null) { >+ if (eclipseSpecifiedTasks == null) { >+ eclipseSpecifiedTasks= new HashMap(); >+ } >+ int index= arg.indexOf(','); >+ if (index != -1) { >+ String name= arg.substring(0, index); >+ String className= arg.substring(index + 1); >+ eclipseSpecifiedTasks.put(name, className); >+ } >+ arg = getArgument(commands, "-eclipseTask"); //$NON-NLS-1$ >+ } >+ >+ arg = getArgument(commands, "-eclipseType"); //$NON-NLS-1$ >+ while (arg != null) { >+ if (eclipseSpecifiedTypes == null) { >+ eclipseSpecifiedTypes= new HashMap(); >+ } >+ int index= arg.indexOf(','); >+ if (index != -1) { >+ String name= arg.substring(0, index); >+ String className= arg.substring(index + 1); >+ eclipseSpecifiedTypes.put(name, className); >+ } >+ arg = getArgument(commands, "-eclipseType"); //$NON-NLS-1$ >+ } >+ } >+ >+ /* >+ * Checks for unrecognized arguments on the command line. >+ * Since there is no syntactic way to distingush between >+ * ant -foo target1 target2 >+ * ant -foo fooarg target >+ * we remove everything up to the last argument that >+ * begins with a '-'. In the latter case, above, that >+ * means that there will be an extra target, 'fooarg', >+ * left lying around. >+ */ >+ private void processUnrecognizedCommands(List commands) { >+ int p = -1; >+ >+ // find the last arg that begins with '-' >+ for (int i = commands.size() - 1; i >= 0; i--) { >+ if (((String) commands.get(0)).startsWith("-")) { //$NON-NLS-1$ >+ p = i; >+ break; >+ } >+ } >+ if (p < 0) { return; } >+ >+ // remove everything preceding that last '-arg' >+ String s = ""; //$NON-NLS-1$ >+ for (int i = 0; i <= p; i++) { >+ s += " " + ((String) commands.get(0)); //$NON-NLS-1$ >+ commands.remove(0); >+ } >+ >+ // warn of ignored commands >+ String message = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Unknown_argument__{0}_2"), new Object[]{ s.substring(1) }); //$NON-NLS-1$ >+ logMessage(currentProject, message, Project.MSG_WARN); >+ } >+ >+ >+ /* >+ * Checks for targets specified at the command line. >+ */ >+ private void processTargets(List commands) { >+ if (targets == null) { >+ targets = new Vector(commands.size()); >+ } >+ for (Iterator iter = commands.iterator(); iter.hasNext();) { >+ targets.add(iter.next()); >+ } >+ } >+ >+ /* >+ * Creates the log file with the name specified by the user. >+ * If the fileName is not absolute, the file will be created in the >+ * working directory if specified or in the same directory as the location >+ * of the build file. >+ */ >+ private void createLogFile(String fileName) throws FileNotFoundException, IOException { >+ File logFile = getFileRelativeToBaseDir(fileName); >+ >+ //this stream is closed in the finally block of run(list) >+ out = new PrintStream(new FileOutputStream(logFile)); >+ err = out; >+ logMessage(getCurrentProject(), MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Using_{0}_file_as_build_log._1"), new String[]{logFile.getCanonicalPath()}), Project.MSG_INFO); //$NON-NLS-1$ >+ if (buildLogger != null) { >+ buildLogger.setErrorPrintStream(err); >+ buildLogger.setOutputPrintStream(out); >+ } >+ } >+ >+ private File getFileRelativeToBaseDir(String fileName) { >+ File parentFile= null; >+ >+ String base= getCurrentProject().getUserProperty("basedir"); //$NON-NLS-1$ >+ if (base != null) { >+ parentFile= new File(base); >+ } else { >+ //relative to the build file location >+ parentFile= new File(getBuildFileLocation()).getParentFile(); >+ } >+ >+ //remain backwards compatible for older Ant usage >+ return FileUtils.newFileUtils().resolveFile(parentFile, fileName); >+ } >+ >+ /* >+ * Processes cmd line properties and adds the user properties >+ * Any user properties that have been explicitly set are set as well. >+ * Ensures that -D properties take precedence. >+ */ >+ private boolean processProperties(List commands) { >+ boolean exceptionToBeThrown= false; >+ //MULTIPLE property files are allowed >+ String arg= getArgument(commands, "-propertyfile"); //$NON-NLS-1$ >+ while (arg != null) { >+ if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >+ fEarlyErrorMessage= RemoteAntMessages.getString("InternalAntRunner.Specifying_property_files_is_a_Ant_1.5.*_feature._Please_update_your_Ant_classpath._6"); //$NON-NLS-1$ >+ break; >+ } >+ if (arg.length() == 0) { >+ fEarlyErrorMessage= RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_property_filename_when_using_the_-propertyfile_argument_3"); //$NON-NLS-1$ >+ exceptionToBeThrown= true; >+ break; >+ } >+ >+ propertyFiles.add(arg); >+ arg= getArgument(commands, "-propertyfile"); //$NON-NLS-1$ >+ } >+ >+ if (propertyFiles != null && !propertyFiles.isEmpty()) { >+ loadPropertyFiles(); >+ } >+ >+ if (commands != null) { >+ processMinusDProperties(commands); >+ } >+ return exceptionToBeThrown; >+ } >+ >+ private void processMinusDProperties(List commands) { >+ String[] args = (String[]) commands.toArray(new String[commands.size()]); >+ for (int i = 0; i < args.length; i++) { >+ String arg = args[i]; >+ if (arg.startsWith("-D")) { //$NON-NLS-1$ >+ String name = arg.substring(2, arg.length()); >+ String value = null; >+ int posEq = name.indexOf("="); //$NON-NLS-1$ >+ if (posEq == 0) { >+ value= name.substring(1); >+ name= ""; //$NON-NLS-1$ >+ } else if (posEq > 0 && posEq != name.length() - 1) { >+ value = name.substring(posEq + 1).trim(); >+ name = name.substring(0, posEq); >+ } >+ >+ if (value == null) { >+ //the user has specified something like "-Debug" >+ continue; >+ } >+ if (userProperties == null) { >+ userProperties= new HashMap(); >+ } >+ userProperties.put(name, value); >+ commands.remove(args[i]); >+ } >+ } >+ } >+ >+ private void setProperties(Project project) { >+ setBuiltInProperties(project); >+ if (userProperties != null) { >+ for (Iterator iterator = userProperties.entrySet().iterator(); iterator.hasNext();) { >+ Map.Entry entry = (Map.Entry) iterator.next(); >+ project.setUserProperty((String) entry.getKey(), (String) entry.getValue()); >+ } >+ } >+ } >+ >+ private void setBuiltInProperties(Project project) { >+ project.setUserProperty("ant.file", getBuildFileLocation()); //$NON-NLS-1$ >+ project.setUserProperty("ant.version", Main.getAntVersion()); //$NON-NLS-1$ >+ } >+ >+ /* >+ * Print the project description, if any >+ */ >+ private void printHelp(Project project) { >+ if (project.getDescription() != null) { >+ logMessage(project, project.getDescription(), Project.MSG_INFO); >+ } >+ printTargets(project); >+ } >+ >+ /* >+ * Logs a message with the client indicating the version of <b>Ant</b> that this class >+ * fronts. >+ */ >+ private void printVersion() { >+ logMessage(getCurrentProject(), Main.getAntVersion(), Project.MSG_INFO); >+ } >+ >+ /* >+ * Logs a message with the client outlining the usage of <b>Ant</b>. >+ */ >+ private void printUsage() { >+ String lSep = System.getProperty("line.separator"); //$NON-NLS-1$ >+ StringBuffer msg = new StringBuffer(); >+ msg.append("ant ["); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.options_13")); //$NON-NLS-1$ >+ msg.append("] ["); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.target_15")); //$NON-NLS-1$ >+ msg.append(" ["); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.target_15")); //$NON-NLS-1$ >+ msg.append("2 ["); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.target_15")); //$NON-NLS-1$ >+ msg.append("3] ...]]"); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.Options___21")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-help, -h\t\t\t\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.print_this_message_23")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-projecthelp, -p\t\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.print_project_help_information_25")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-version\t\t\t\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.print_the_version_information_and_exit_27")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-diagnostics\t\t\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.12")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.13")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-quiet, -q\t\t\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.be_extra_quiet_29")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-verbose, -v\t\t\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.be_extra_verbose_31")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-debug, -d\t\t\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.print_debugging_information_33")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-emacs, -e\t\t\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.produce_logging_information_without_adornments_35")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-logfile\t<file>\t\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.use_given_file_for_log_37")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t\t-l\t<file>"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.1")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-logger <classname>\t\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.the_class_which_is_to_perform_logging_39")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-listener <classname>\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.add_an_instance_of_class_as_a_project_listener_41")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-noinput\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.158")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-buildfile\t<file>\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.use_given_buildfile_43")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t\t-file\t<file>"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.1")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t\t-f\t\t<file>"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.1")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-D<property>=<value>\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.use_value_for_given_property_45")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-keep-going, -k"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.159")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.160")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-propertyfile <name>\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.19")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.20")); //$NON-NLS-1$ >+ msg.append(lSep); >+ msg.append("\t-inputhandler <class>\t"); //$NON-NLS-1$ >+ msg.append(RemoteAntMessages.getString("InternalAntRunner.22")); //$NON-NLS-1$ >+ msg.append(lSep); >+ >+ logMessage(getCurrentProject(), msg.toString(), Project.MSG_INFO); >+ } >+ >+ /* >+ * From a command line list, return the argument for the given parameter. >+ * The parameter and its argument are removed from the list. >+ * >+ * @return <code>null</code> if the parameter is not found >+ * or an empty String if no arguments are found >+ */ >+ private String getArgument(List commands, String param) { >+ if (commands == null) { >+ return null; >+ } >+ int index = commands.indexOf(param); >+ if (index == -1) { >+ return null; >+ } >+ commands.remove(index); >+ if (index == commands.size()) {// if this is the last command >+ return ""; //$NON-NLS-1$ >+ } >+ >+ String command = (String) commands.get(index); >+ if (command.startsWith("-")) { //new parameter //$NON-NLS-1$ >+ return ""; //$NON-NLS-1$ >+ } >+ >+ commands.remove(index); >+ return command; >+ } >+ >+ /* >+ * Helper method to ensure an array is converted into an ArrayList. >+ */ >+ private static ArrayList getArrayList(String[] args) { >+ if (args == null) { >+ return null; >+ } >+ // We could be using Arrays.asList() here, but it does not specify >+ // what kind of list it will return. We need a list that >+ // implements the method List.remove(Object) and ArrayList does. >+ ArrayList result = new ArrayList(args.length); >+ for (int i = 0; i < args.length; i++) { >+ result.add(args[i]); >+ } >+ return result; >+ } >+ >+ private Project getCurrentProject() { >+ return currentProject; >+ } >+ >+ private void setCurrentProject(Project currentProject) { >+ this.currentProject = currentProject; >+ } >+ >+ /** >+ * Load all properties from the files >+ * specified by -propertyfile. >+ */ >+ private void loadPropertyFiles() { >+ Iterator itr= propertyFiles.iterator(); >+ while (itr.hasNext()) { >+ String filename= (String) itr.next(); >+ File file= getFileRelativeToBaseDir(filename); >+ Properties props = new Properties(); >+ FileInputStream fis = null; >+ try { >+ fis = new FileInputStream(file); >+ props.load(fis); >+ } catch (IOException e) { >+ fEarlyErrorMessage= MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Could_not_load_property_file_{0}__{1}_4"), new String[]{filename, e.getMessage()}); //$NON-NLS-1$ >+ } finally { >+ if (fis != null) { >+ try { >+ fis.close(); >+ } catch (IOException e){ >+ } >+ } >+ } >+ >+ if (userProperties == null) { >+ userProperties= new HashMap(); >+ } >+ Enumeration propertyNames = props.propertyNames(); >+ while (propertyNames.hasMoreElements()) { >+ String name = (String) propertyNames.nextElement(); >+ //most specific to global >+ //do not overwrite specific with a global property >+ if (userProperties.get(name) == null) { >+ userProperties.put(name, props.getProperty(name)); >+ } >+ } >+ } >+ } >+ >+ /* >+ * Creates the InputHandler and adds it to the project. >+ * >+ * @exception BuildException if a specified InputHandler >+ * implementation could not be loaded. >+ */ >+ private void addInputHandler(Project project) { >+ if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >+ return; >+ } >+ InputHandlerSetter setter= new InputHandlerSetter(); >+ setter.setInputHandler(project, inputHandlerClassname); >+ } >+} >\ No newline at end of file >Index: remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.java >diff -N remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,33 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 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 + '!'; >+ } >+ } >+} >Index: remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.properties >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.properties >diff -N remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/RemoteAntMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: remote/org/eclipse/ant/internal/launching/remote/inputhandler/FailInputHandler.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/inputhandler/FailInputHandler.java >diff -N remote/org/eclipse/ant/internal/launching/remote/inputhandler/FailInputHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/inputhandler/FailInputHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 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(); >+ } >+ }; >+ } >+} >Index: remote/org/eclipse/ant/internal/launching/remote/logger/MessageIds.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/logger/MessageIds.java >diff -N remote/org/eclipse/ant/internal/launching/remote/logger/MessageIds.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/logger/MessageIds.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+/******************************************************************************* >+ * Copyright (c) 2003, 2005 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$ >+} >Index: remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBreakpoint.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBreakpoint.java >diff -N remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBreakpoint.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBreakpoint.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,74 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2005 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; >+ } >+} >Index: remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBuildLogger.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBuildLogger.java >diff -N remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBuildLogger.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntBuildLogger.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,396 @@ >+/******************************************************************************* >+ * Copyright (c) 2003, 2007 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.BufferedReader; >+import java.io.IOException; >+import java.io.PrintStream; >+import java.io.PrintWriter; >+import java.io.StringReader; >+import java.net.Socket; >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Map; >+ >+import org.apache.tools.ant.BuildEvent; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.DefaultLogger; >+import org.apache.tools.ant.Location; >+import org.apache.tools.ant.Project; >+import org.apache.tools.ant.Target; >+import org.apache.tools.ant.util.StringUtils; >+import org.eclipse.ant.internal.launching.debug.AntDebugState; >+import org.eclipse.ant.internal.launching.remote.AntSecurityException; >+import org.eclipse.ant.internal.launching.remote.InternalAntRunner; >+import org.eclipse.ant.internal.launching.remote.RemoteAntMessages; >+ >+/** >+ * Parts adapted from org.eclipse.jdt.internal.junit.runner.RemoteTestRunner >+ * A build logger that reports via a socket connection. >+ * See MessageIds for more information about the protocol. >+ */ >+public class RemoteAntBuildLogger extends DefaultLogger { >+ >+ /** Time of the start of the build */ >+ private long fStartTime = System.currentTimeMillis(); >+ >+ /** >+ * The client socket. >+ */ >+ private Socket fEventSocket; >+ /** >+ * Print writer for sending messages >+ */ >+ private PrintWriter fWriter; >+ /** >+ * Host to connect to, default is the localhost >+ */ >+ protected String fHost= ""; //$NON-NLS-1$ >+ /** >+ * Port to connect to. >+ */ >+ private int fEventPort= -1; >+ >+ private String fProcessId= null; >+ >+ /** >+ * Is the debug mode enabled? >+ */ >+ protected boolean fDebugMode= false; >+ >+ protected boolean fSentProcessId= false; >+ >+ private List fEventQueue; >+ >+ private String fLastFileName= null; >+ private String fLastTaskName= null; >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.DefaultLogger#printMessage(java.lang.String, java.io.PrintStream, int) >+ */ >+ protected void printMessage(String message, PrintStream stream, int priority) { >+ marshalMessage(priority, message); >+ } >+ >+ /** >+ * Connect to the remote Ant build listener. >+ */ >+ protected void connect() { >+ if (fDebugMode) { >+ System.out.println("RemoteAntBuildLogger: trying to connect" + fHost + ":" + fEventPort); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ for (int i= 1; i < 5; i++) { >+ try{ >+ fEventSocket= new Socket(fHost, fEventPort); >+ fWriter= new PrintWriter(fEventSocket.getOutputStream(), true); >+ return; >+ } catch(IOException e){ >+ } >+ try { >+ Thread.sleep(500); >+ } catch(InterruptedException e) { >+ } >+ } >+ shutDown(); >+ } >+ >+ /** >+ * Shutdown the connection to the remote build listener. >+ */ >+ protected void shutDown() { >+ if (fEventQueue != null) { >+ fEventQueue.clear(); >+ } >+ if (fWriter != null) { >+ fWriter.close(); >+ fWriter= null; >+ } >+ >+ try { >+ if (fEventSocket != null) { >+ fEventSocket.close(); >+ fEventSocket= null; >+ } >+ } catch(IOException e) { >+ } >+ } >+ >+ private void sendMessage(String msg) { >+ if (fWriter == null) { >+ return; >+ } >+ >+ fWriter.println(msg); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#buildFinished(org.apache.tools.ant.BuildEvent) >+ */ >+ public void buildFinished(BuildEvent event) { >+ if (!fSentProcessId) { >+ establishConnection(); >+ } >+ handleException(event); >+ printMessage( getTimeString(System.currentTimeMillis() - fStartTime), out, Project.MSG_INFO); >+ shutDown(); >+ } >+ >+ protected void handleException(BuildEvent event) { >+ Throwable exception = event.getException(); >+ if (exception == null || exception instanceof AntSecurityException) { >+ return; >+ } >+ >+ StringBuffer message= new StringBuffer(); >+ message.append(StringUtils.LINE_SEP); >+ message.append(RemoteAntMessages.getString("RemoteAntBuildLogger.1")); //$NON-NLS-1$ >+ message.append(StringUtils.LINE_SEP); >+ if (Project.MSG_VERBOSE <= this.msgOutputLevel || !(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); >+ } >+ } >+ message.append(StringUtils.LINE_SEP); >+ printMessage(message.toString(), out, Project.MSG_ERR); >+ } >+ >+ private String getTimeString(long milliseconds) { >+ long seconds = milliseconds / 1000; >+ long minutes = seconds / 60; >+ seconds= seconds % 60; >+ >+ StringBuffer result= new StringBuffer(RemoteAntMessages.getString("RemoteAntBuildLogger.Total_time")); //$NON-NLS-1$ >+ if (minutes > 0) { >+ result.append(minutes); >+ if (minutes > 1) { >+ result.append(RemoteAntMessages.getString("RemoteAntBuildLogger._minutes_2")); //$NON-NLS-1$ >+ } else { >+ result.append(RemoteAntMessages.getString("RemoteAntBuildLogger._minute_3")); //$NON-NLS-1$ >+ } >+ } >+ if (seconds > 0) { >+ if (minutes > 0) { >+ result.append(' '); >+ } >+ result.append(seconds); >+ >+ if (seconds > 1) { >+ result.append(RemoteAntMessages.getString("RemoteAntBuildLogger._seconds_4")); //$NON-NLS-1$ >+ } else { >+ result.append(RemoteAntMessages.getString("RemoteAntBuildLogger._second_5")); //$NON-NLS-1$ >+ } >+ } >+ if (seconds == 0 && minutes == 0) { >+ result.append(milliseconds); >+ result.append(RemoteAntMessages.getString("RemoteAntBuildLogger._milliseconds_6")); //$NON-NLS-1$ >+ } >+ return result.toString(); >+ } >+ >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) >+ */ >+ public void targetStarted(BuildEvent event) { >+ if (!fSentProcessId) { >+ establishConnection(); >+ } >+ >+ if (Project.MSG_INFO <= msgOutputLevel) { >+ marshalTargetMessage(event); >+ } >+ } >+ >+ protected void establishConnection() { >+ if (fEventPort != -1) { >+ connect(); >+ } else { >+ shutDown(); >+ return; >+ } >+ >+ fSentProcessId= true; >+ StringBuffer message= new StringBuffer(MessageIds.PROCESS_ID); >+ message.append(fProcessId); >+ sendMessage(message.toString()); >+ if (fEventQueue != null) { >+ for (Iterator iter = fEventQueue.iterator(); iter.hasNext();) { >+ processEvent((BuildEvent)iter.next()); >+ } >+ fEventQueue= null; >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#messageLogged(org.apache.tools.ant.BuildEvent) >+ */ >+ public void messageLogged(BuildEvent event) { >+ if (event.getPriority() > msgOutputLevel && event.getPriority() != InternalAntRunner.MSG_PROJECT_HELP) { >+ return; >+ } >+ >+ if (!fSentProcessId) { >+ if (event.getPriority() == InternalAntRunner.MSG_PROJECT_HELP) { >+ if (Project.MSG_INFO > msgOutputLevel) { >+ return; >+ } >+ //no buildstarted or project started for project help option >+ establishConnection(); >+ return; >+ } >+ if (fEventQueue == null){ >+ fEventQueue= new ArrayList(10); >+ } >+ fEventQueue.add(event); >+ return; >+ } >+ >+ processEvent(event); >+ } >+ >+ private void processEvent(BuildEvent event) { >+ if (event.getTask() != null & !emacsMode) { >+ try { >+ marshalTaskMessage(event); >+ } catch (IOException e) { >+ } >+ } else { >+ marshalMessage(event); >+ } >+ } >+ >+ private void marshalMessage(BuildEvent event) { >+ String eventMessage= event.getMessage(); >+ if (eventMessage.length() == 0) { >+ return; >+ } >+ marshalMessage(event.getPriority(), eventMessage); >+ } >+ >+ protected void marshalMessage(int priority, String message) { >+ try { >+ BufferedReader r = new BufferedReader(new StringReader(message)); >+ String line = r.readLine(); >+ StringBuffer messageLine; >+ while (line != null) { >+ messageLine= new StringBuffer(); >+ if (priority != -1) { >+ messageLine.append(priority); >+ messageLine.append(','); >+ } >+ messageLine.append(line); >+ sendMessage(messageLine.toString()); >+ line = r.readLine(); >+ } >+ } catch (IOException e) { >+ } >+ } >+ >+ private void marshalTaskMessage(BuildEvent event) throws IOException { >+ String eventMessage= event.getMessage(); >+ if (eventMessage.length() == 0) { >+ return; >+ } >+ BufferedReader r = new BufferedReader(new StringReader(eventMessage)); >+ String line = r.readLine(); >+ StringBuffer message; >+ String taskName= event.getTask().getTaskName(); >+ if (taskName != null && taskName.equals(fLastTaskName)) { >+ taskName= ""; //$NON-NLS-1$ >+ } else { >+ fLastTaskName= taskName; >+ } >+ Location location= event.getTask().getLocation(); >+ String fileName= null; >+ int lineNumber= -1; >+ try { >+ fileName= location.getFileName(); >+ lineNumber= location.getLineNumber(); >+ } catch (NoSuchMethodError e) { >+ //older Ant >+ fileName= location.toString(); >+ } >+ if (location.equals(Location.UNKNOWN_LOCATION)) { >+ fileName= location.toString(); >+ lineNumber= -1; >+ } >+ int priority= event.getPriority(); >+ while (line != null) { >+ message= new StringBuffer(MessageIds.TASK); >+ message.append(priority); >+ message.append(','); >+ message.append(taskName); >+ message.append(','); >+ message.append(line.length()); >+ message.append(','); >+ message.append(line); >+ message.append(','); >+ if (!fileName.equals(fLastFileName)) { >+ message.append(fileName.length()); >+ message.append(','); >+ message.append(fileName); >+ } >+ message.append(','); >+ message.append(lineNumber); >+ sendMessage(message.toString()); >+ fLastFileName= fileName; >+ line= r.readLine(); >+ } >+ } >+ >+ private void marshalTargetMessage(BuildEvent event) { >+ Target target= event.getTarget(); >+ Location location= AntDebugState.getLocation(target); >+ >+ StringBuffer message= new StringBuffer(); >+ message.append(MessageIds.TARGET); >+ message.append(','); >+ message.append(target.getName()); >+ message.append(':'); >+ message.append(','); >+ if (location != null && location != Location.UNKNOWN_LOCATION) { >+ //if a target has a valid location then we are on an Ant that is >+ //new enough to have the accessor methods on Location >+ String fileName= location.getFileName(); >+ message.append(fileName.length()); >+ message.append(','); >+ message.append(fileName); >+ message.append(','); >+ message.append(location.getLineNumber()); >+ } >+ sendMessage(message.toString()); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) >+ */ >+ public void buildStarted(BuildEvent event) { >+ establishConnection(); >+ super.buildStarted(event); >+ } >+ >+ public void configure(Map userProperties) { >+ String portProperty= (String) userProperties.remove("eclipse.connect.port"); //$NON-NLS-1$ >+ >+ if (portProperty != null) { >+ fEventPort= Integer.parseInt(portProperty); >+ } >+ >+ fProcessId= (String) userProperties.remove("org.eclipse.ant.core.ANT_PROCESS_ID"); //$NON-NLS-1$ >+ } >+} >\ No newline at end of file >Index: remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntDebugBuildLogger.java >=================================================================== >RCS file: remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntDebugBuildLogger.java >diff -N remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntDebugBuildLogger.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntDebugBuildLogger.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,353 @@ >+/******************************************************************************* >+ * Copyright (c) 2003, 2005 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.BufferedReader; >+import java.io.IOException; >+import java.io.InputStreamReader; >+import java.io.PrintWriter; >+import java.net.ServerSocket; >+import java.net.Socket; >+import java.net.SocketTimeoutException; >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Map; >+ >+import org.apache.tools.ant.BuildEvent; >+import org.apache.tools.ant.Location; >+import org.apache.tools.ant.Task; >+import org.eclipse.ant.internal.launching.debug.AntDebugState; >+import org.eclipse.ant.internal.launching.debug.IDebugBuildLogger; >+import org.eclipse.ant.internal.launching.debug.model.DebugMessageIds; >+ >+/** >+ * Parts adapted from org.eclipse.jdt.internal.junit.runner.RemoteTestRunner >+ * A build logger that reports via a socket connection. >+ * See DebugMessageIds and MessageIds for more information about the protocol. >+ */ >+public class RemoteAntDebugBuildLogger extends RemoteAntBuildLogger implements IDebugBuildLogger { >+ >+ private ServerSocket fServerSocket; >+ private static final int fgServerSocketTimeout= 5000; >+ private Socket fRequestSocket; >+ >+ private PrintWriter fRequestWriter; >+ >+ private BufferedReader fRequestReader; >+ >+ private boolean fBuildStartedSuspend= true; >+ >+ private Task fStepOverTaskInterrupted; >+ >+ private List fBreakpoints= null; >+ >+ /** >+ * Request port to connect to. >+ * Used for debug connections >+ */ >+ private int fRequestPort= -1; >+ private AntDebugState fDebugState; >+ >+ /** >+ * Reader thread that processes requests from the debug client. >+ */ >+ private class ReaderThread extends Thread { >+ public ReaderThread() { >+ super("ReaderThread"); //$NON-NLS-1$ >+ setDaemon(true); >+ } >+ >+ public void run(){ >+ try { >+ String message= null; >+ while (fRequestReader != null) { >+ if ((message= fRequestReader.readLine()) != null) { >+ >+ if (message.startsWith(DebugMessageIds.STEP_INTO)){ >+ synchronized(RemoteAntDebugBuildLogger.this) { >+ fDebugState.setStepIntoSuspend(true); >+ fDebugState.setStepIntoTask(fDebugState.getCurrentTask()); >+ RemoteAntDebugBuildLogger.this.notifyAll(); >+ } >+ } if (message.startsWith(DebugMessageIds.STEP_OVER)){ >+ synchronized(RemoteAntDebugBuildLogger.this) { >+ fDebugState.stepOver(); >+ } >+ } else if (message.startsWith(DebugMessageIds.SUSPEND)) { >+ synchronized(RemoteAntDebugBuildLogger.this) { >+ fDebugState.setStepIntoTask(null); >+ fDebugState.setStepOverTask(null); >+ fStepOverTaskInterrupted= null; >+ fDebugState.setClientSuspend(true); >+ } >+ } else if (message.startsWith(DebugMessageIds.RESUME)) { >+ synchronized(RemoteAntDebugBuildLogger.this) { >+ fDebugState.setStepIntoTask(null); >+ fDebugState.setStepOverTask(null); >+ fStepOverTaskInterrupted= null; >+ RemoteAntDebugBuildLogger.this.notifyAll(); >+ } >+ } else if (message.startsWith(DebugMessageIds.TERMINATE)) { >+ sendRequestResponse(DebugMessageIds.TERMINATED); >+ shutDown(); >+ } else if (message.startsWith(DebugMessageIds.STACK)) { >+ marshallStack(); >+ } else if (message.startsWith(DebugMessageIds.ADD_BREAKPOINT)) { >+ addBreakpoint(message); >+ } else if (message.startsWith(DebugMessageIds.REMOVE_BREAKPOINT)) { >+ removeBreakpoint(message); >+ } else if (message.startsWith(DebugMessageIds.PROPERTIES)) { >+ marshallProperties(); >+ } >+ } >+ } >+ } catch (Exception e) { >+ RemoteAntDebugBuildLogger.this.shutDown(); >+ } >+ } >+ } >+ >+ private void requestConnect() { >+ if (fDebugMode) { >+ System.out.println("RemoteAntDebugBuildLogger: trying to connect" + fHost + ":" + fRequestPort); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ try{ >+ fServerSocket.setSoTimeout(fgServerSocketTimeout); >+ fRequestSocket= fServerSocket.accept(); >+ fRequestWriter= new PrintWriter(fRequestSocket.getOutputStream(), true); >+ fRequestReader = new BufferedReader(new InputStreamReader(fRequestSocket.getInputStream())); >+ >+ ReaderThread readerThread= new ReaderThread(); >+ readerThread.setDaemon(true); >+ readerThread.start(); >+ return; >+ } catch(SocketTimeoutException e){ >+ } catch(IOException e) { >+ } >+ shutDown(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.antsupport.logger.RemoteAntBuildLogger#shutDown() >+ */ >+ protected void shutDown() { >+ if (fRequestWriter != null) { >+ fRequestWriter.close(); >+ fRequestWriter= null; >+ } >+ >+ if (fRequestReader != null) { >+ try { >+ fRequestReader.close(); >+ } catch (IOException e) { >+ } >+ fRequestReader= null; >+ } >+ >+ if (fRequestSocket != null) { >+ try { >+ fRequestSocket.close(); >+ } catch(IOException e) { >+ } >+ } >+ fRequestSocket= null; >+ >+ super.shutDown(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) >+ */ >+ public synchronized void buildStarted(BuildEvent event) { >+ fDebugState= new AntDebugState(this); >+ super.buildStarted(event); >+ marshalMessage(-1, DebugMessageIds.BUILD_STARTED); >+ if (fRequestPort != -1) { >+ try { >+ fServerSocket= new ServerSocket(fRequestPort); >+ } catch (IOException ioe) { >+ shutDown(); >+ } >+ requestConnect(); >+ } else { >+ shutDown(); >+ } >+ fDebugState.buildStarted(); >+ fDebugState.setShouldSuspend(true); >+ waitIfSuspended(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#taskStarted(org.apache.tools.ant.BuildEvent) >+ */ >+ public void taskStarted(BuildEvent event) { >+ super.taskStarted(event); >+ fDebugState.taskStarted(event); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#taskFinished(org.apache.tools.ant.BuildEvent) >+ */ >+ public synchronized void taskFinished(BuildEvent event) { >+ super.taskFinished(event); >+ fDebugState.taskFinished(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.antsupport.logger.util.IDebugBuildLogger#waitIfSuspended() >+ */ >+ public synchronized void waitIfSuspended() { >+ String detail= null; >+ boolean shouldSuspend= true; >+ RemoteAntBreakpoint breakpoint= breakpointAtLineNumber(fDebugState.getBreakpointLocation()); >+ if (breakpoint != null) { >+ detail= breakpoint.toMarshallString(); >+ fDebugState.setShouldSuspend(false); >+ if (fDebugState.getStepOverTask() != null) { >+ fStepOverTaskInterrupted= fDebugState.getStepOverTask(); >+ fDebugState.setStepOverTask(null); >+ } >+ } else if (fDebugState.getCurrentTask() != null) { >+ if (fDebugState.isStepIntoSuspend()) { >+ detail= DebugMessageIds.STEP; >+ fDebugState.setStepIntoSuspend(false); >+ } else if ((fDebugState.getLastTaskFinished() != null && fDebugState.getLastTaskFinished() == fDebugState.getStepOverTask()) || fDebugState.shouldSuspend()) { >+ //suspend as a step over has finished >+ detail= DebugMessageIds.STEP; >+ fDebugState.setStepOverTask(null); >+ fDebugState.setShouldSuspend(false); >+ } else if (fDebugState.getLastTaskFinished() != null && fDebugState.getLastTaskFinished() == fDebugState.getStepIntoTask()) { >+ //suspend as a task that was stepped into has finally completed >+ detail= DebugMessageIds.STEP; >+ fDebugState.setStepIntoTask(null); >+ } else if (fDebugState.getLastTaskFinished() != null && fDebugState.getLastTaskFinished() == fStepOverTaskInterrupted) { >+ //suspend as a task that was stepped over but hit a breakpoint has finally completed >+ detail= DebugMessageIds.STEP; >+ fStepOverTaskInterrupted= null; >+ } else if (fDebugState.isClientSuspend()) { >+ detail= DebugMessageIds.CLIENT_REQUEST; >+ fDebugState.setClientSuspend(false); >+ } else { >+ shouldSuspend= false; >+ } >+ } else if (fDebugState.shouldSuspend() && fBuildStartedSuspend) { >+ fBuildStartedSuspend= false; >+ fDebugState.setShouldSuspend(false); >+ } else { >+ shouldSuspend= false; >+ } >+ >+ if (shouldSuspend) { >+ if (detail != null) { >+ StringBuffer message= new StringBuffer(DebugMessageIds.SUSPENDED); >+ message.append(detail); >+ sendRequestResponse(message.toString()); >+ } >+ try { >+ wait(); >+ shouldSuspend= false; >+ } catch (InterruptedException e) { >+ } >+ } >+ } >+ >+ private RemoteAntBreakpoint breakpointAtLineNumber(Location location) { >+ if (fBreakpoints == null || location == null || location == Location.UNKNOWN_LOCATION) { >+ return null; >+ } >+ String fileName= fDebugState.getFileName(location); >+ int lineNumber= fDebugState.getLineNumber(location); >+ for (int i = 0; i < fBreakpoints.size(); i++) { >+ RemoteAntBreakpoint breakpoint = (RemoteAntBreakpoint) fBreakpoints.get(i); >+ if (breakpoint.isAt(fileName, lineNumber)) { >+ return breakpoint; >+ } >+ } >+ return null; >+ } >+ >+ private void sendRequestResponse(String message) { >+ if (fRequestWriter == null) { >+ return; >+ } >+ >+ fRequestWriter.println(message); >+ } >+ >+ protected void marshallStack() { >+ StringBuffer stackRepresentation= new StringBuffer(); >+ fDebugState.marshalStack(stackRepresentation); >+ sendRequestResponse(stackRepresentation.toString()); >+ } >+ >+ protected void marshallProperties() { >+ StringBuffer propertiesRepresentation= new StringBuffer(); >+ fDebugState.marshallProperties(propertiesRepresentation, true); >+ sendRequestResponse(propertiesRepresentation.toString()); >+ } >+ >+ protected void addBreakpoint(String breakpointRepresentation) { >+ if (fBreakpoints == null) { >+ fBreakpoints= new ArrayList(); >+ } >+ RemoteAntBreakpoint newBreakpoint= new RemoteAntBreakpoint(breakpointRepresentation); >+ if (!fBreakpoints.contains(newBreakpoint)) { >+ fBreakpoints.add(newBreakpoint); >+ } >+ } >+ >+ protected void removeBreakpoint(String breakpointRepresentation) { >+ if (fBreakpoints == null) { >+ return; >+ } >+ RemoteAntBreakpoint equivalentBreakpoint= new RemoteAntBreakpoint(breakpointRepresentation); >+ for (Iterator iter = fBreakpoints.iterator(); iter.hasNext(); ) { >+ RemoteAntBreakpoint breakpoint = (RemoteAntBreakpoint) iter.next(); >+ if (breakpoint.equals(equivalentBreakpoint)) { >+ iter.remove(); >+ return; >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) >+ */ >+ public void targetStarted(BuildEvent event) { >+ fDebugState.targetStarted(event); >+ if (!fSentProcessId) { >+ establishConnection(); >+ } >+ waitIfSuspended(); >+ super.targetStarted(event); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.BuildListener#targetFinished(org.apache.tools.ant.BuildEvent) >+ */ >+ public void targetFinished(BuildEvent event) { >+ super.targetFinished(event); >+ fDebugState.setTargetExecuting(null); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.antsupport.logger.RemoteAntBuildLogger#configure(java.util.Map) >+ */ >+ public void configure(Map userProperties) { >+ super.configure(userProperties); >+ String requestPortProperty= (String) userProperties.remove("eclipse.connect.request_port"); //$NON-NLS-1$ >+ if (requestPortProperty != null) { >+ fRequestPort= Integer.parseInt(requestPortProperty); >+ } >+ } >+} >Index: src/org/eclipse/ant/internal/launching/AntCoreModelMessages.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/AntCoreModelMessages.java >diff -N src/org/eclipse/ant/internal/launching/AntCoreModelMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/AntCoreModelMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/AntCoreModelMessages.properties >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/AntCoreModelMessages.properties >diff -N src/org/eclipse/ant/internal/launching/AntCoreModelMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/AntCoreModelMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/AntLaunch.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/AntLaunch.java >diff -N src/org/eclipse/ant/internal/launching/AntLaunch.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/AntLaunch.java 1 Jan 1970 00:00:00 -0000 >@@ -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(); >+ } >+ } >+ >+} >Index: src/org/eclipse/ant/internal/launching/AntLaunching.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/AntLaunching.java,v >retrieving revision 1.2 >diff -u -r1.2 AntLaunching.java >--- src/org/eclipse/ant/internal/launching/AntLaunching.java 16 Sep 2009 14:39:43 -0000 1.2 >+++ src/org/eclipse/ant/internal/launching/AntLaunching.java 7 Oct 2009 20:08:15 -0000 >@@ -10,7 +10,11 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.launching; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Plugin; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; > import org.osgi.framework.BundleContext; > > /** >@@ -20,6 +24,61 @@ > > // The plug-in ID > public static final String PLUGIN_ID = "org.eclipse.ant.launching"; //$NON-NLS-1$ >+ >+ private static final String EMPTY_STRING= ""; //$NON-NLS-1$ >+ >+ /** >+ * Boolean attribute indicating if an input handler should be supplied for >+ * the build Default value is <code>true</code>. >+ */ >+ public static final String SET_INPUTHANDLER = "org.eclipse.ant.ui.SET_INPUTHANDLER"; //$NON-NLS-1$ >+ >+ /** >+ * 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$ >+ >+ /** >+ * Size of left-hand column for right-justified task name. Used for Ant >+ * Build logging. >+ * >+ * @see org.eclipse.ant.internal.ui.antsupport.logger.AntProcessBuildLogger >+ * @see org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntBuildListener >+ */ >+ public static final int LEFT_COLUMN_SIZE = 15; >+ >+ /** >+ * String attribute indicating the custom runtime classpath to use for an >+ * Ant build. Default value is <code>null</code> which indicates that the >+ * global classpath is to be used. Format is a comma separated listing of >+ * URLs. >+ * >+ * @deprecated no longer supported: use >+ * {@link IJavaLaunchConfigurationConstants#ATTR_CLASSPATH_PROVIDER} >+ * @see IJavaLaunchConfigurationConstants#ATTR_DEFAULT_CLASSPATH >+ */ >+ public static final String ATTR_ANT_CUSTOM_CLASSPATH = IExternalToolConstants.UI_PLUGIN_ID >+ + ".ATTR_ANT_CUSTOM_CLASSPATH"; //$NON-NLS-1$ >+ /** >+ * String attribute indicating the custom Ant home to use for an Ant build. >+ * Default value is <code>null</code> which indicates that no Ant home is to >+ * be set >+ * >+ * @deprecated no longer supported: use >+ * {@link IJavaLaunchConfigurationConstants#ATTR_CLASSPATH_PROVIDER} >+ * @see IJavaLaunchConfigurationConstants#ATTR_DEFAULT_CLASSPATH >+ */ >+ public static final String ATTR_ANT_HOME = IExternalToolConstants.UI_PLUGIN_ID >+ + ".ATTR_ANT_HOME"; //$NON-NLS-1$ >+ >+ >+ /** >+ * Status code indicating an unexpected internal error. >+ * @since 2.1 >+ */ >+ public static final int INTERNAL_ERROR = 120; > > // The shared instance > private static AntLaunching plugin; >@@ -56,5 +115,52 @@ > public static AntLaunching getDefault() { > return plugin; > } >+ >+ public static String getUniqueIdentifier() { >+ return PLUGIN_ID; >+ } >+ >+ /** >+ * Logs the specified throwable with this plug-in's log. >+ * >+ * @param t throwable to log >+ */ >+ public static void log(Throwable t) { >+ IStatus status= new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR, "Error logged from Ant UI: ", t); //$NON-NLS-1$ >+ log(status); >+ } >+ >+ /** >+ * Logs the specified status with this plug-in's log. >+ * >+ * @param status status >+ */ >+ public static void log(IStatus status) { >+ getDefault().getLog().log(status); >+ } >+ >+ /** >+ * Writes the message to the plug-in's log >+ * >+ * @param message the text to write to the log >+ */ >+ public static void log(String message, Throwable exception) { >+ IStatus status = newErrorStatus(message, exception); >+ log(status); >+ } >+ >+ /** >+ * Returns a new <code>IStatus</code> for this plug-in >+ */ >+ public static IStatus newErrorStatus(String message, Throwable exception) { >+ if (message == null) { >+ message= EMPTY_STRING; >+ } >+ return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, exception); >+ } >+ >+ public static AntLaunching getPlugin() { >+ return plugin; >+ } > > } >Index: src/org/eclipse/ant/internal/launching/AntLaunchingPreferenceInitializer.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/AntLaunchingPreferenceInitializer.java >diff -N src/org/eclipse/ant/internal/launching/AntLaunchingPreferenceInitializer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/AntLaunchingPreferenceInitializer.java 1 Jan 1970 00:00:00 -0000 >@@ -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("org.eclipse.ant.launching"); //$NON-NLS-1$ >+ node.put(IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, >+ "20000"); //$NON-NLS-1$ >+ } >+} >Index: src/org/eclipse/ant/internal/launching/AntLaunchingUtil.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/AntLaunchingUtil.java >diff -N src/org/eclipse/ant/internal/launching/AntLaunchingUtil.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/AntLaunchingUtil.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,524 @@ >+/******************************************************************************* >+ * 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; >+ >+import java.io.File; >+import java.io.IOException; >+import java.net.MalformedURLException; >+import java.net.URL; >+import java.util.ArrayList; >+import java.util.List; >+import java.util.Map; >+import java.util.StringTokenizer; >+ >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.util.FileUtils; >+import org.eclipse.ant.internal.launching.launchConfigurations.AntHomeClasspathEntry; >+import org.eclipse.ant.internal.launching.launchConfigurations.AntProcess; >+import org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntRuntimeProcess; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.model.ExternalToolBuilder; >+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.IStatus; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.variables.VariablesPlugin; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.debug.core.model.IProcess; >+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; >+import org.eclipse.jdt.launching.IRuntimeClasspathEntry; >+import org.eclipse.jdt.launching.IRuntimeClasspathEntry2; >+import org.eclipse.jdt.launching.JavaRuntime; >+ >+import com.ibm.icu.text.MessageFormat; >+ >+/** >+ * General utility class dealing with Ant build files >+ */ >+public final class AntLaunchingUtil { >+ public static final String ATTRIBUTE_SEPARATOR = ","; //$NON-NLS-1$; >+ public static final char ANT_CLASSPATH_DELIMITER = '*'; >+ public static final String ANT_HOME_CLASSPATH_PLACEHOLDER = "G"; //$NON-NLS-1$ >+ public static final String ANT_GLOBAL_USER_CLASSPATH_PLACEHOLDER = "UG"; //$NON-NLS-1$ >+ >+ /** >+ * No instances allowed >+ */ >+ private AntLaunchingUtil() { >+ super(); >+ } >+ >+ /** >+ * Returns a single-string of the strings for storage. >+ * >+ * @param strings >+ * the array of strings >+ * @return a single-string representation of the strings or >+ * <code>null</code> if the array is empty. >+ */ >+ public static String combineStrings(String[] strings) { >+ if (strings.length == 0) >+ return null; >+ >+ if (strings.length == 1) >+ return strings[0]; >+ >+ StringBuffer buf = new StringBuffer(); >+ for (int i = 0; i < strings.length - 1; i++) { >+ buf.append(strings[i]); >+ buf.append(ATTRIBUTE_SEPARATOR); >+ } >+ buf.append(strings[strings.length - 1]); >+ return buf.toString(); >+ } >+ >+ /** >+ * Returns an array of targets to be run, or <code>null</code> if none are >+ * specified (indicating the default target or implicit target should be >+ * run). >+ * >+ * @param configuration >+ * launch configuration >+ * @return array of target names, or <code>null</code> >+ * @throws CoreException >+ * if unable to access the associated attribute >+ */ >+ public static String[] getTargetNames(ILaunchConfiguration configuration) >+ throws CoreException { >+ String attribute = null; >+ if (IAntLaunchConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE >+ .equals(configuration.getType().getIdentifier())) { >+ attribute = getTargetNamesForAntBuilder(configuration); >+ } >+ if (attribute == null) { >+ attribute = configuration.getAttribute( >+ IAntLaunchConstants.ATTR_ANT_TARGETS, >+ (String) null); >+ if (attribute == null) { >+ return null; >+ } >+ } >+ >+ return AntLaunchingUtil.parseRunTargets(attribute); >+ } >+ >+ private static String getTargetNamesForAntBuilder( >+ ILaunchConfiguration configuration) throws CoreException { >+ String buildType = ExternalToolBuilder.getBuildType(); >+ String targets = null; >+ if (IExternalToolConstants.BUILD_TYPE_AUTO.equals(buildType)) { >+ targets = configuration.getAttribute( >+ IAntLaunchConstants.ATTR_ANT_AUTO_TARGETS, >+ (String) null); >+ } else if (IExternalToolConstants.BUILD_TYPE_CLEAN.equals(buildType)) { >+ targets = configuration.getAttribute( >+ IAntLaunchConstants.ATTR_ANT_CLEAN_TARGETS, >+ (String) null); >+ } else if (IExternalToolConstants.BUILD_TYPE_FULL.equals(buildType)) { >+ targets = configuration >+ .getAttribute( >+ IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, >+ (String) null); >+ } else if (IExternalToolConstants.BUILD_TYPE_INCREMENTAL >+ .equals(buildType)) { >+ targets = configuration.getAttribute( >+ IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS, >+ (String) null); >+ } >+ >+ return targets; >+ } >+ >+ /** >+ * Returns a map of properties to be defined for the build, or >+ * <code>null</code> if none are specified (indicating no additional >+ * properties specified for the build). >+ * >+ * @param configuration >+ * launch configuration >+ * @return map of properties (name --> value), or <code>null</code> >+ * @throws CoreException >+ * if unable to access the associated attribute >+ */ >+ public static Map getProperties(ILaunchConfiguration configuration) >+ throws CoreException { >+ Map map = configuration.getAttribute( >+ IAntLaunchConstants.ATTR_ANT_PROPERTIES, >+ (Map) null); >+ return map; >+ } >+ >+ /** >+ * Returns a String specifying the Ant home to use for the build. >+ * >+ * @param configuration >+ * launch configuration >+ * @return String specifying Ant home to use or <code>null</code> >+ * @throws CoreException >+ * if unable to access the associated attribute >+ */ >+ public static String getAntHome(ILaunchConfiguration configuration) >+ throws CoreException { >+ IRuntimeClasspathEntry[] entries = JavaRuntime >+ .computeUnresolvedRuntimeClasspath(configuration); >+ for (int i = 0; i < entries.length; i++) { >+ IRuntimeClasspathEntry entry = entries[i]; >+ if (entry.getType() == IRuntimeClasspathEntry.OTHER) { >+ IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2) entry; >+ if (entry2.getTypeId().equals(AntHomeClasspathEntry.TYPE_ID)) { >+ return ((AntHomeClasspathEntry) entry2).getAntHome(); >+ } >+ } >+ } >+ return null; >+ } >+ >+ /** >+ * Returns an array of property files to be used for the build, or >+ * <code>null</code> if none are specified (indicating no additional >+ * property files specified for the build). >+ * >+ * @param configuration >+ * launch configuration >+ * @return array of property file names, or <code>null</code> >+ * @throws CoreException >+ * if unable to access the associated attribute >+ */ >+ public static String[] getPropertyFiles(ILaunchConfiguration configuration) >+ throws CoreException { >+ String attribute = configuration.getAttribute( >+ IAntLaunchConstants.ATTR_ANT_PROPERTY_FILES, >+ (String) null); >+ if (attribute == null) { >+ return null; >+ } >+ String[] propertyFiles = AntLaunchingUtil.parseString(attribute, ","); //$NON-NLS-1$ >+ for (int i = 0; i < propertyFiles.length; i++) { >+ String propertyFile = propertyFiles[i]; >+ propertyFile = expandVariableString(propertyFile, >+ AntCoreModelMessages.AntUtil_6); >+ propertyFiles[i] = propertyFile; >+ } >+ return propertyFiles; >+ } >+ >+ /** >+ * Returns the list of URLs that define the custom classpath for the Ant >+ * build, or <code>null</code> if the global classpath is to be used. >+ * >+ * @param config >+ * launch configuration >+ * @return a list of <code>URL</code> >+ * >+ * @throws CoreException >+ * if file does not exist, IO problems, or invalid format. >+ */ >+ public static URL[] getCustomClasspath(ILaunchConfiguration config) >+ throws CoreException { >+ boolean useDefault = config.getAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true); >+ if (useDefault) { >+ return null; >+ } >+ IRuntimeClasspathEntry[] unresolved = JavaRuntime >+ .computeUnresolvedRuntimeClasspath(config); >+ // don't consider bootpath entries >+ List userEntries = new ArrayList(unresolved.length); >+ for (int i = 0; i < unresolved.length; i++) { >+ IRuntimeClasspathEntry entry = unresolved[i]; >+ if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { >+ userEntries.add(entry); >+ } >+ } >+ IRuntimeClasspathEntry[] entries = JavaRuntime >+ .resolveRuntimeClasspath( >+ (IRuntimeClasspathEntry[]) userEntries >+ .toArray(new IRuntimeClasspathEntry[userEntries >+ .size()]), config); >+ URL[] urls = new URL[entries.length]; >+ for (int i = 0; i < entries.length; i++) { >+ IRuntimeClasspathEntry entry = entries[i]; >+ try { >+ urls[i] = new URL("file:" + entry.getLocation()); //$NON-NLS-1$ >+ } catch (MalformedURLException e) { >+ throw new CoreException(new Status(IStatus.ERROR, AntLaunching >+ .getUniqueIdentifier(), AntLaunching.INTERNAL_ERROR, >+ AntCoreModelMessages.AntUtil_7, e)); >+ } >+ } >+ return urls; >+ } >+ >+ private static String expandVariableString(String variableString, >+ String invalidMessage) throws CoreException { >+ String expandedString = VariablesPlugin.getDefault() >+ .getStringVariableManager().performStringSubstitution( >+ variableString); >+ if (expandedString == null || expandedString.length() == 0) { >+ String msg = MessageFormat.format(invalidMessage, >+ new String[] { variableString }); >+ throw new CoreException(new Status(IStatus.ERROR, >+ AntLaunching.PLUGIN_ID, 0, msg, null)); >+ } >+ >+ return expandedString; >+ } >+ >+ /** >+ * Returns the list of target names to run >+ * >+ * @param extraAttibuteValue >+ * the external tool's extra attribute value for the run targets >+ * key. >+ * @return a list of target names >+ */ >+ public static String[] parseRunTargets(String extraAttibuteValue) { >+ return parseString(extraAttibuteValue, ATTRIBUTE_SEPARATOR); >+ } >+ >+ /** >+ * Returns the list of Strings that were delimiter separated. >+ * >+ * @param delimString >+ * the String to be tokenized based on the delimiter >+ * @return a list of Strings >+ */ >+ public static String[] parseString(String delimString, String delim) { >+ if (delimString == null) { >+ return new String[0]; >+ } >+ >+ // Need to handle case where separator character is >+ // actually part of the target name! >+ StringTokenizer tokenizer = new StringTokenizer(delimString, delim); >+ String[] results = new String[tokenizer.countTokens()]; >+ for (int i = 0; i < results.length; i++) { >+ results[i] = tokenizer.nextToken(); >+ } >+ >+ return results; >+ } >+ >+ /** >+ * Returns an IFile with the given fully qualified path (relative to the >+ * workspace root). The returned IFile may or may not exist. >+ */ >+ public static IFile getFile(String fullPath) { >+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); >+ return root.getFile(new Path(fullPath)); >+ } >+ >+ /** >+ * Returns the workspace file associated with the given path in the local >+ * file system, or <code>null</code> if none. If the path happens to be a >+ * relative path, then the path is interpreted as relative to the specified >+ * parent file. >+ * >+ * Attempts to handle linked files; the first found linked file with the >+ * correct path is returned. >+ * >+ * @param path >+ * @param buildFileParent >+ * @return file or <code>null</code> >+ * @see org.eclipse.core.resources.IWorkspaceRoot#findFilesForLocation(IPath) >+ */ >+ public static IFile getFileForLocation(String path, File buildFileParent) { >+ if (path == null) { >+ return null; >+ } >+ IPath filePath = new Path(path); >+ IFile file = null; >+ IFile[] files = ResourcesPlugin.getWorkspace().getRoot() >+ .findFilesForLocation(filePath); >+ if (files.length > 0) { >+ file = files[0]; >+ } >+ if (file == null) { >+ // relative path >+ File relativeFile = null; >+ try { >+ // this call is ok if buildFileParent is null >+ relativeFile = FileUtils.getFileUtils().resolveFile( >+ buildFileParent, path); >+ filePath = new Path(relativeFile.getAbsolutePath()); >+ files = ResourcesPlugin.getWorkspace().getRoot() >+ .findFilesForLocation(filePath); >+ if (files.length > 0) { >+ file = files[0]; >+ } else { >+ return null; >+ } >+ } catch (BuildException be) { >+ return null; >+ } >+ } >+ >+ if (file.exists()) { >+ return file; >+ } >+ File ioFile = file.getLocation().toFile(); >+ if (ioFile.exists()) {// needs to handle case insensitivity on WINOS >+ try { >+ files = ResourcesPlugin.getWorkspace().getRoot() >+ .findFilesForLocation( >+ new Path(ioFile.getCanonicalPath())); >+ if (files.length > 0) { >+ return files[0]; >+ } >+ } catch (IOException e) { >+ } >+ } >+ >+ return null; >+ } >+ >+ /** >+ * Migrates the classpath in the given configuration from the old format to >+ * the new format. The old format is not preserved. Instead, the default >+ * classpath will be used. However, ANT_HOME settings are preserved. >+ * >+ * @param configuration >+ * a configuration to migrate >+ * @throws CoreException >+ * if unable to migrate >+ * @since 3.0 >+ */ >+ public static void migrateToNewClasspathFormat( >+ ILaunchConfiguration configuration) throws CoreException { >+ String oldClasspath = configuration.getAttribute( >+ AntLaunching.ATTR_ANT_CUSTOM_CLASSPATH, >+ (String) null); >+ String oldAntHome = configuration.getAttribute( >+ AntLaunching.ATTR_ANT_HOME, (String) null); >+ String provider = configuration.getAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, >+ (String) null); >+ if (oldClasspath != null || oldAntHome != null || provider == null) { >+ ILaunchConfigurationWorkingCopy workingCopy = null; >+ if (configuration.isWorkingCopy()) { >+ workingCopy = (ILaunchConfigurationWorkingCopy) configuration; >+ } else { >+ workingCopy = configuration.getWorkingCopy(); >+ } >+ workingCopy >+ .setAttribute( >+ AntLaunching.ATTR_ANT_CUSTOM_CLASSPATH, >+ (String) null); >+ workingCopy >+ .setAttribute( >+ AntLaunching.ATTR_ANT_HOME, >+ (String) null); >+ workingCopy.setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, >+ "org.eclipse.ant.ui.AntClasspathProvider"); //$NON-NLS-1$ >+ workingCopy.setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, >+ true); >+ if (oldAntHome != null) { >+ IRuntimeClasspathEntry[] entries = JavaRuntime >+ .computeUnresolvedRuntimeClasspath(workingCopy); >+ List mementos = new ArrayList(entries.length); >+ for (int i = 0; i < entries.length; i++) { >+ IRuntimeClasspathEntry entry = entries[i]; >+ if (entry.getType() == IRuntimeClasspathEntry.OTHER) { >+ IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2) entry; >+ if (entry2.getTypeId().equals( >+ AntHomeClasspathEntry.TYPE_ID)) { >+ AntHomeClasspathEntry homeEntry = new AntHomeClasspathEntry( >+ oldAntHome); >+ mementos.add(homeEntry.getMemento()); >+ continue; >+ } >+ } >+ mementos.add(entry.getMemento()); >+ } >+ workingCopy >+ .setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, >+ false); >+ workingCopy.setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, >+ mementos); >+ } >+ workingCopy.doSave(); >+ } >+ } >+ >+ public static boolean isSeparateJREAntBuild( >+ ILaunchConfiguration configuration) { >+ boolean separateJRE = true; >+ try { >+ // always null for same JRE >+ separateJRE = configuration.getAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, >+ (String) null) != null; >+ } catch (CoreException e) { >+ AntLaunching.log(AntCoreModelMessages.AntUtil_2, e); >+ } >+ >+ return separateJRE; >+ } >+ >+ public static void linkBuildFailedMessage(String message, IProcess process) { >+ String fileName = null; >+ String lineNumber = ""; //$NON-NLS-1$ >+ int fileStart = 0; >+ int index = message.indexOf("xml"); //$NON-NLS-1$ >+ if (index > 0) { >+ int numberStart = index + 4; >+ int numberEnd = message.indexOf(':', numberStart); >+ int fileEnd = index + 3; >+ if (numberStart > 0 && fileEnd > 0) { >+ fileName = message.substring(fileStart, fileEnd).trim(); >+ if (numberEnd > 0) { >+ lineNumber = message.substring(numberStart, numberEnd) >+ .trim(); >+ } >+ } >+ } >+ >+ if (fileName != null) { >+ int num = -1; >+ try { >+ num = Integer.parseInt(lineNumber); >+ } catch (NumberFormatException e) { >+ } >+ IFile[] files = ResourcesPlugin.getWorkspace().getRoot() >+ .findFilesForLocation(new Path(fileName)); >+ IFile file = null; >+ if (files.length > 0) { >+ file = files[0]; >+ } >+ if (file != null && file.exists()) { >+ if (process != null) { >+ ILaunch launch = null; >+ if (process instanceof RemoteAntRuntimeProcess) { >+ launch = ((RemoteAntRuntimeProcess) process) >+ .getLaunch(); >+ } else if (process instanceof AntProcess) { >+ launch = ((AntProcess) process).getLaunch(); >+ } >+ if (launch != null) { >+ ((AntLaunch) launch).addLinkDescriptor(message, >+ fileName, num, 0, message.length()); >+ } >+ } >+ } >+ } >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/ant/internal/launching/IAntLaunchingPreferenceConstants.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/IAntLaunchingPreferenceConstants.java >diff -N src/org/eclipse/ant/internal/launching/IAntLaunchingPreferenceConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/IAntLaunchingPreferenceConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -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$ >+} >Index: src/org/eclipse/ant/internal/launching/LinkDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/LinkDescriptor.java >diff -N src/org/eclipse/ant/internal/launching/LinkDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/LinkDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -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; >+ } >+ >+} >Index: src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.java >diff -N src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.properties >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.properties >diff -N src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/AntDebugMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/debug/AntSourceContainer.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/AntSourceContainer.java >diff -N src/org/eclipse/ant/internal/launching/debug/AntSourceContainer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/AntSourceContainer.java 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/debug/AntSourceLookupDirector.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/AntSourceLookupDirector.java >diff -N src/org/eclipse/ant/internal/launching/debug/AntSourceLookupDirector.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/AntSourceLookupDirector.java 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/debug/AntSourceLookupParticipant.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/AntSourceLookupParticipant.java >diff -N src/org/eclipse/ant/internal/launching/debug/AntSourceLookupParticipant.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/AntSourceLookupParticipant.java 1 Jan 1970 00:00:00 -0000 >@@ -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; >+ } >+} >Index: src/org/eclipse/ant/internal/launching/debug/AntSourcePathComputerDelegate.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/AntSourcePathComputerDelegate.java >diff -N src/org/eclipse/ant/internal/launching/debug/AntSourcePathComputerDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/AntSourcePathComputerDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/debug/IAntDebugConstants.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/IAntDebugConstants.java >diff -N src/org/eclipse/ant/internal/launching/debug/IAntDebugConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/IAntDebugConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -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$ >+} >Index: src/org/eclipse/ant/internal/launching/debug/IAntDebugController.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/IAntDebugController.java >diff -N src/org/eclipse/ant/internal/launching/debug/IAntDebugController.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/IAntDebugController.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,66 @@ >+/******************************************************************************* >+ * 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.debug.core.model.IBreakpoint; >+ >+public interface IAntDebugController { >+ >+ /** >+ * Resume the Ant build >+ */ >+ public void resume(); >+ >+ /** >+ * Suspend the Ant build >+ */ >+ public void suspend(); >+ >+ /** >+ * Step into the current Ant task >+ */ >+ public void stepInto(); >+ >+ /** >+ * Step over the current Ant task >+ */ >+ public void stepOver(); >+ >+ /** >+ * The provided breakpoint has been added or removed depending on the <code>added</code> parameter. >+ * Updates the controller for this change. >+ * >+ * @param breakpoint the breakpoint that has been added or removed >+ * @param added whether or not the breakpoint has been added >+ */ >+ public void handleBreakpoint(IBreakpoint breakpoint, boolean added); >+ >+ /** >+ * Retrieve the properties of the Ant build. >+ * May occur asynchronously depending on implementation. >+ */ >+ public void getProperties(); >+ >+ /** >+ * Retrieve the stack frames of the Ant build. >+ * May occur asynchronously depending on implementation. >+ */ >+ public void getStackFrames(); >+ >+ /** >+ * Some strings are escaped when marshalled for socket communication. >+ * The Ant debug controller will properly unescape these Strings if required. >+ * >+ * @param value The buffer of the string to unescape >+ * @return The unescaped string >+ */ >+ public StringBuffer unescapeString(StringBuffer value); >+} >Index: src/org/eclipse/ant/internal/launching/debug/model/AntDebugElement.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/AntDebugElement.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/AntDebugElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/AntDebugElement.java 1 Jan 1970 00:00:00 -0000 >@@ -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(); >+ } >+} >Index: src/org/eclipse/ant/internal/launching/debug/model/AntDebugTarget.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/AntDebugTarget.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/AntDebugTarget.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/AntDebugTarget.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,463 @@ >+/******************************************************************************* >+ * 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 java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+ >+import org.eclipse.ant.internal.launching.debug.IAntDebugConstants; >+import org.eclipse.ant.internal.launching.debug.IAntDebugController; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.resources.IMarkerDelta; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.variables.VariablesPlugin; >+import org.eclipse.debug.core.DebugEvent; >+import org.eclipse.debug.core.DebugException; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.IBreakpointManager; >+import org.eclipse.debug.core.IBreakpointManagerListener; >+import org.eclipse.debug.core.IDebugEventSetListener; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.model.IBreakpoint; >+import org.eclipse.debug.core.model.IDebugTarget; >+import org.eclipse.debug.core.model.ILineBreakpoint; >+import org.eclipse.debug.core.model.IMemoryBlock; >+import org.eclipse.debug.core.model.IProcess; >+import org.eclipse.debug.core.model.IThread; >+ >+/** >+ * Ant Debug Target >+ */ >+public class AntDebugTarget extends AntDebugElement implements IDebugTarget, IDebugEventSetListener, IBreakpointManagerListener { >+ >+ // associated system process (Ant Build) >+ private IProcess fProcess; >+ >+ // containing launch object >+ private ILaunch fLaunch; >+ >+ // Build file name >+ private String fName; >+ >+ // suspend state >+ private boolean fSuspended= false; >+ >+ // terminated state >+ private boolean fTerminated= false; >+ >+ // threads >+ private AntThread fThread; >+ private IThread[] fThreads; >+ >+ private IAntDebugController fController; >+ >+ private List fRunToLineBreakpoints; >+ >+ /** >+ * Constructs a new debug target in the given launch for the >+ * associated Ant build process. >+ * >+ * @param launch containing launch >+ * @param process Ant build process >+ * @param controller the controller to communicate to the Ant build >+ */ >+ public AntDebugTarget(ILaunch launch, IProcess process, IAntDebugController controller) { >+ super(null); >+ fLaunch = launch; >+ fProcess = process; >+ >+ fController= controller; >+ >+ fThread = new AntThread(this); >+ fThreads = new IThread[] {fThread}; >+ >+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointManagerListener(this); >+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this); >+ DebugPlugin.getDefault().addDebugEventListener(this); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IDebugTarget#getProcess() >+ */ >+ public IProcess getProcess() { >+ return fProcess; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IDebugTarget#getThreads() >+ */ >+ public IThread[] getThreads() { >+ return fThreads; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IDebugTarget#hasThreads() >+ */ >+ public boolean hasThreads() throws DebugException { >+ return !fTerminated && fThreads.length > 0; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IDebugTarget#getName() >+ */ >+ public String getName() throws DebugException { >+ if (fName == null) { >+ try { >+ fName= getLaunch().getLaunchConfiguration().getAttribute(IExternalToolConstants.ATTR_LOCATION, DebugModelMessages.AntDebugTarget_0); >+ fName= VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(fName); >+ } catch (CoreException e) { >+ fName = DebugModelMessages.AntDebugTarget_0; >+ } >+ } >+ return fName; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint) >+ */ >+ public boolean supportsBreakpoint(IBreakpoint breakpoint) { >+ if (breakpoint.getModelIdentifier().equals(IAntDebugConstants.ID_ANT_DEBUG_MODEL)) { >+ //need to consider all breakpoints as no way to tell which set >+ //of buildfiles will be executed (ant task) >+ return true; >+ } >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget() >+ */ >+ public IDebugTarget getDebugTarget() { >+ return this; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IDebugElement#getLaunch() >+ */ >+ public ILaunch getLaunch() { >+ return fLaunch; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ITerminate#canTerminate() >+ */ >+ public boolean canTerminate() { >+ return !fTerminated; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ITerminate#isTerminated() >+ */ >+ public boolean isTerminated() { >+ return fTerminated; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ITerminate#terminate() >+ */ >+ public void terminate() throws DebugException { >+ terminated(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ISuspendResume#canResume() >+ */ >+ public boolean canResume() { >+ return !isTerminated() && isSuspended(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() >+ */ >+ public boolean canSuspend() { >+ return !isTerminated() && !isSuspended(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() >+ */ >+ public boolean isSuspended() { >+ return fSuspended; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ISuspendResume#resume() >+ */ >+ public void resume() throws DebugException { >+ fSuspended= false; >+ fController.resume(); >+ } >+ >+ /** >+ * Notification the target has suspended for the given reason >+ * >+ * @param detail reason for the suspend >+ */ >+ public void suspended(int detail) { >+ fSuspended = true; >+ fThread.setStepping(false); >+ fThread.fireSuspendEvent(detail); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ISuspendResume#suspend() >+ */ >+ public void suspend() throws DebugException { >+ fController.suspend(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint) >+ */ >+ public void breakpointAdded(IBreakpoint breakpoint) { >+ fController.handleBreakpoint(breakpoint, true); >+ if (breakpoint instanceof AntLineBreakpoint) { >+ if (((AntLineBreakpoint) breakpoint).isRunToLine()) { >+ if (fRunToLineBreakpoints == null) { >+ fRunToLineBreakpoints= new ArrayList(); >+ } >+ fRunToLineBreakpoints.add(breakpoint); >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta) >+ */ >+ public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { >+ fController.handleBreakpoint(breakpoint, false); >+ if (fRunToLineBreakpoints != null) { >+ if (fRunToLineBreakpoints.remove(breakpoint) && fRunToLineBreakpoints.isEmpty()) { >+ fRunToLineBreakpoints= null; >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta) >+ */ >+ public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { >+ if (supportsBreakpoint(breakpoint)) { >+ try { >+ if (breakpoint.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled()) { >+ breakpointAdded(breakpoint); >+ } else { >+ breakpointRemoved(breakpoint, null); >+ } >+ } catch (CoreException e) { >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IDisconnect#canDisconnect() >+ */ >+ public boolean canDisconnect() { >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IDisconnect#disconnect() >+ */ >+ public void disconnect() throws DebugException { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IDisconnect#isDisconnected() >+ */ >+ public boolean isDisconnected() { >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval() >+ */ >+ public boolean supportsStorageRetrieval() { >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long) >+ */ >+ public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException { >+ return null; >+ } >+ >+ /** >+ * Notification we have connected to the Ant build logger and it has started. >+ * Resume the build. >+ */ >+ public void buildStarted() { >+ fireCreationEvent(); >+ installDeferredBreakpoints(); >+ try { >+ resume(); >+ } catch (DebugException e) { >+ } >+ } >+ >+ /** >+ * Install breakpoints that are already registered with the breakpoint >+ * manager if the breakpoint manager is enabled and the breakpoint is enabled. >+ */ >+ private void installDeferredBreakpoints() { >+ IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager(); >+ if (!manager.isEnabled()) { >+ return; >+ } >+ IBreakpoint[] breakpoints = manager.getBreakpoints(IAntDebugConstants.ID_ANT_DEBUG_MODEL); >+ for (int i = 0; i < breakpoints.length; i++) { >+ IBreakpoint breakpoint= breakpoints[i]; >+ try { >+ if (breakpoint.isEnabled()) { >+ breakpointAdded(breakpoints[i]); >+ } >+ } catch (CoreException e) { >+ } >+ } >+ } >+ >+ /** >+ * Called when this debug target terminates. >+ */ >+ public void terminated() { >+ fThreads= new IThread[0]; >+ fTerminated = true; >+ fSuspended = false; >+ if (DebugPlugin.getDefault() != null) { >+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this); >+ DebugPlugin.getDefault().removeDebugEventListener(this); >+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpointManagerListener(this); >+ } >+ if (!getProcess().isTerminated()) { >+ try { >+ fProcess.terminate(); >+ resume(); >+ } catch (DebugException e) { >+ } >+ } >+ if (DebugPlugin.getDefault() != null) { >+ fireTerminateEvent(); >+ } >+ } >+ >+ /** >+ * Single step the Ant build. >+ * >+ * @throws DebugException if the request fails >+ */ >+ public void stepOver() { >+ fSuspended= false; >+ fController.stepOver(); >+ } >+ >+ /** >+ * Step-into the Ant build. >+ * >+ * @throws DebugException if the request fails >+ */ >+ public void stepInto() { >+ fSuspended= false; >+ fController.stepInto(); >+ } >+ >+ /** >+ * Notification a breakpoint was encountered. Determine >+ * which breakpoint was hit and fire a suspend event. >+ * >+ * @param event debug event >+ */ >+ public void breakpointHit(String event) { >+ // determine which breakpoint was hit, and set the thread's breakpoint >+ String[] datum= event.split(DebugMessageIds.MESSAGE_DELIMITER); >+ String fileName= datum[1]; >+ int lineNumber = Integer.parseInt(datum[2]); >+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IAntDebugConstants.ID_ANT_DEBUG_MODEL); >+ boolean found= false; >+ for (int i = 0; i < breakpoints.length; i++) { >+ ILineBreakpoint lineBreakpoint = (ILineBreakpoint)breakpoints[i]; >+ if (setThreadBreakpoint(lineBreakpoint, lineNumber, fileName)) { >+ found= true; >+ break; >+ } >+ } >+ if (!found && fRunToLineBreakpoints != null) { >+ Iterator iter= fRunToLineBreakpoints.iterator(); >+ while (iter.hasNext()) { >+ ILineBreakpoint lineBreakpoint = (ILineBreakpoint) iter.next(); >+ if (setThreadBreakpoint(lineBreakpoint, lineNumber, fileName)) { >+ break; >+ } >+ } >+ } >+ suspended(DebugEvent.BREAKPOINT); >+ } >+ >+ private boolean setThreadBreakpoint(ILineBreakpoint lineBreakpoint, int lineNumber, String fileName) { >+ try { >+ if (lineBreakpoint.getLineNumber() == lineNumber && >+ fileName.equals(lineBreakpoint.getMarker().getResource().getLocation().toOSString())) { >+ fThread.setBreakpoints(new IBreakpoint[]{lineBreakpoint}); >+ return true; >+ } >+ } catch (CoreException e) { >+ } >+ return false; >+ } >+ >+ public void breakpointHit (IBreakpoint breakpoint) { >+ fThread.setBreakpoints(new IBreakpoint[]{breakpoint}); >+ suspended(DebugEvent.BREAKPOINT); >+ } >+ >+ public void getStackFrames() { >+ fController.getStackFrames(); >+ } >+ >+ public void getProperties() { >+ fController.getProperties(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) >+ */ >+ public void handleDebugEvents(DebugEvent[] events) { >+ for (int i = 0; i < events.length; i++) { >+ DebugEvent event = events[i]; >+ if (event.getKind() == DebugEvent.TERMINATE && event.getSource().equals(fProcess)) { >+ terminated(); >+ } >+ } >+ } >+ >+ /** >+ * When the breakpoint manager disables, remove all registered breakpoints >+ * requests from the VM. When it enables, reinstall them. >+ * >+ * @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean) >+ */ >+ public void breakpointManagerEnablementChanged(boolean enabled) { >+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IAntDebugConstants.ID_ANT_DEBUG_MODEL); >+ for (int i = 0; i < breakpoints.length; i++) { >+ IBreakpoint breakpoint = breakpoints[i]; >+ if (enabled) { >+ breakpointAdded(breakpoint); >+ } else { >+ breakpointRemoved(breakpoint, null); >+ } >+ } >+ } >+ >+ public IAntDebugController getAntDebugController() { >+ return fController; >+ } >+} >Index: src/org/eclipse/ant/internal/launching/debug/model/AntLineBreakpoint.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/AntLineBreakpoint.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/AntLineBreakpoint.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/AntLineBreakpoint.java 1 Jan 1970 00:00:00 -0000 >@@ -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); >+ } >+ } >+} >Index: src/org/eclipse/ant/internal/launching/debug/model/AntProperties.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/AntProperties.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/AntProperties.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/AntProperties.java 1 Jan 1970 00:00:00 -0000 >@@ -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(); >+ } >+} >Index: src/org/eclipse/ant/internal/launching/debug/model/AntPropertiesValue.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/AntPropertiesValue.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/AntPropertiesValue.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/AntPropertiesValue.java 1 Jan 1970 00:00:00 -0000 >@@ -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; >+ } >+} >Index: src/org/eclipse/ant/internal/launching/debug/model/AntProperty.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/AntProperty.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/AntProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/AntProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -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()); >+ } >+} >Index: src/org/eclipse/ant/internal/launching/debug/model/AntStackFrame.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/AntStackFrame.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/AntStackFrame.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/AntStackFrame.java 1 Jan 1970 00:00:00 -0000 >@@ -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; >+ } >+} >Index: src/org/eclipse/ant/internal/launching/debug/model/AntThread.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/AntThread.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/AntThread.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/AntThread.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,479 @@ >+/******************************************************************************* >+ * 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 java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.debug.core.DebugEvent; >+import org.eclipse.debug.core.DebugException; >+import org.eclipse.debug.core.model.IBreakpoint; >+import org.eclipse.debug.core.model.IStackFrame; >+import org.eclipse.debug.core.model.IThread; >+import org.eclipse.debug.core.model.IVariable; >+ >+/** >+ * An Ant build thread. >+ */ >+public class AntThread extends AntDebugElement implements IThread { >+ >+ /** >+ * Breakpoints this thread is suspended at or <code>null</code> >+ * if none. >+ */ >+ private IBreakpoint[] fBreakpoints; >+ >+ /** >+ * The stackframes associated with this thread >+ */ >+ private List fFrames= new ArrayList(1); >+ >+ /** >+ * The stackframes to be reused on suspension >+ */ >+ private List fOldFrames; >+ >+ /** >+ * Whether this thread is stepping >+ */ >+ private boolean fStepping = false; >+ >+ private boolean fRefreshProperties= true; >+ >+ /** >+ * The user properties associated with this thread >+ */ >+ private AntProperties fUserProperties; >+ >+ /** >+ * The system properties associated with this thread >+ */ >+ private AntProperties fSystemProperties; >+ >+ /** >+ * The properties set during the build associated with this thread >+ */ >+ private AntProperties fRuntimeProperties; >+ >+ private Object fPropertiesLock= new Object(); >+ >+ /** >+ * Constructs a new thread for the given target >+ * >+ * @param target the Ant Build >+ */ >+ public AntThread(AntDebugTarget target) { >+ super(target); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IThread#getStackFrames() >+ */ >+ public synchronized IStackFrame[] getStackFrames() throws DebugException { >+ if (isSuspended()) { >+ if (fFrames.size() == 0) { >+ getStackFrames0(); >+ } >+ } >+ >+ return (IStackFrame[]) fFrames.toArray(new IStackFrame[fFrames.size()]); >+ } >+ >+ /** >+ * Retrieves the current stack frames in the thread >+ * possibly waiting until the frames are populated >+ * >+ */ >+ private void getStackFrames0() throws DebugException { >+ synchronized (fFrames) { >+ getAntDebugTarget().getStackFrames(); >+ if (fFrames.size() > 0) { >+ //frames set..no need to wait >+ return; >+ } >+ int attempts= 0; >+ try { >+ while (fFrames.size() == 0 && !isTerminated()) { >+ fFrames.wait(50); >+ if (attempts == 20 && fFrames.size() == 0 && !isTerminated()) { >+ throwDebugException(DebugModelMessages.AntThread_3); >+ } >+ attempts++; >+ } >+ } catch (InterruptedException e) { >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IThread#hasStackFrames() >+ */ >+ public boolean hasStackFrames() throws DebugException { >+ return isSuspended(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IThread#getPriority() >+ */ >+ public int getPriority() throws DebugException { >+ return 0; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IThread#getTopStackFrame() >+ */ >+ public synchronized IStackFrame getTopStackFrame() throws DebugException { >+ if (isSuspended()) { >+ if (fFrames.size() == 0) { >+ getStackFrames0(); >+ } >+ if (fFrames.size() > 0) { >+ return (IStackFrame)fFrames.get(0); >+ } >+ } >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IThread#getName() >+ */ >+ public String getName() { >+ return "Thread [Ant Build]"; //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IThread#getBreakpoints() >+ */ >+ public IBreakpoint[] getBreakpoints() { >+ if (fBreakpoints == null) { >+ return new IBreakpoint[0]; >+ } >+ return fBreakpoints; >+ } >+ >+ /** >+ * Sets the breakpoints this thread is suspended at, or <code>null</code> >+ * if none. >+ * >+ * @param breakpoints the breakpoints this thread is suspended at, or <code>null</code> >+ * if none >+ */ >+ protected void setBreakpoints(IBreakpoint[] breakpoints) { >+ fBreakpoints = breakpoints; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ISuspendResume#canResume() >+ */ >+ public boolean canResume() { >+ return isSuspended(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() >+ */ >+ public boolean canSuspend() { >+ return !isSuspended(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() >+ */ >+ public boolean isSuspended() { >+ return getDebugTarget().isSuspended(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ISuspendResume#resume() >+ */ >+ public synchronized void resume() throws DebugException { >+ aboutToResume(DebugEvent.CLIENT_REQUEST, false); >+ getDebugTarget().resume(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ISuspendResume#suspend() >+ */ >+ public synchronized void suspend() throws DebugException { >+ getDebugTarget().suspend(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IStep#canStepInto() >+ */ >+ public boolean canStepInto() { >+ return isSuspended(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IStep#canStepOver() >+ */ >+ public boolean canStepOver() { >+ return isSuspended(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IStep#canStepReturn() >+ */ >+ public boolean canStepReturn() { >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IStep#isStepping() >+ */ >+ public boolean isStepping() { >+ return fStepping; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IStep#stepInto() >+ */ >+ public synchronized void stepInto() throws DebugException { >+ aboutToResume(DebugEvent.STEP_INTO, true); >+ ((AntDebugTarget)getDebugTarget()).stepInto(); >+ } >+ >+ private void aboutToResume(int detail, boolean stepping) { >+ fRefreshProperties= true; >+ fOldFrames= new ArrayList(fFrames); >+ fFrames.clear(); >+ setPropertiesValid(false); >+ setStepping(stepping); >+ setBreakpoints(null); >+ fireResumeEvent(detail); >+ } >+ >+ private void setPropertiesValid(boolean valid) { >+ if (fUserProperties != null) { >+ fUserProperties.setValid(valid); >+ fSystemProperties.setValid(valid); >+ fRuntimeProperties.setValid(valid); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IStep#stepOver() >+ */ >+ public synchronized void stepOver() throws DebugException { >+ aboutToResume(DebugEvent.STEP_OVER, true); >+ ((AntDebugTarget)getDebugTarget()).stepOver(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.IStep#stepReturn() >+ */ >+ public synchronized void stepReturn() throws DebugException { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ITerminate#canTerminate() >+ */ >+ public boolean canTerminate() { >+ return !isTerminated(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ITerminate#isTerminated() >+ */ >+ public boolean isTerminated() { >+ return getDebugTarget().isTerminated(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ITerminate#terminate() >+ */ >+ public void terminate() throws DebugException { >+ fFrames.clear(); >+ getDebugTarget().terminate(); >+ } >+ >+ /** >+ * Sets whether this thread is stepping >+ * >+ * @param stepping whether stepping >+ */ >+ protected void setStepping(boolean stepping) { >+ fStepping = stepping; >+ } >+ >+ public void buildStack(String data) { >+ synchronized (fFrames) { >+ String[] strings= data.split(DebugMessageIds.MESSAGE_DELIMITER); >+ //0 STACK message >+ //1 targetName >+ //2 taskName >+ //3 filePath >+ //4 lineNumber >+ //5 ... >+ if (fOldFrames != null && (strings.length - 1)/ 4 != fOldFrames.size()) { >+ fOldFrames= null; //stack size changed..do not preserve >+ } >+ StringBuffer name; >+ String filePath; >+ int lineNumber; >+ int stackFrameId= 0; >+ String taskName; >+ for (int i = 1; i < strings.length; i++) { >+ if (strings[i].length() > 0) { >+ name= new StringBuffer(strings[i]); >+ taskName= strings[++i]; >+ if (taskName.length() > 0) { >+ name.append(": "); //$NON-NLS-1$ >+ name.append(taskName); >+ } >+ } else { >+ name= new StringBuffer(strings[++i]); >+ } >+ filePath= strings[++i]; >+ lineNumber= Integer.parseInt(strings[++i]); >+ addFrame(stackFrameId++, name.toString(), filePath, lineNumber); >+ } >+ //wake up the call from getStackFrames >+ fFrames.notifyAll(); >+ } >+ } >+ >+ private void addFrame(int stackFrameId, String name, String filePath, int lineNumber) { >+ AntStackFrame frame= getOldFrame(); >+ >+ if (frame == null || !frame.getFilePath().equals(filePath)) { >+ frame= new AntStackFrame(this, stackFrameId, name, filePath, lineNumber); >+ } else { >+ frame.setFilePath(filePath); >+ frame.setId(stackFrameId); >+ frame.setLineNumber(lineNumber); >+ frame.setName(name); >+ } >+ fFrames.add(frame); >+ } >+ >+ private AntStackFrame getOldFrame() { >+ if (fOldFrames == null) { >+ return null; >+ } >+ AntStackFrame frame= (AntStackFrame) fOldFrames.remove(0); >+ if (fOldFrames.isEmpty()) { >+ fOldFrames= null; >+ } >+ return frame; >+ } >+ >+ public void newProperties(String data) { >+ synchronized (fPropertiesLock) { >+ try { >+ String[] datum= data.split(DebugMessageIds.MESSAGE_DELIMITER); >+ if (fUserProperties == null) { >+ initializePropertyGroups(); >+ } >+ >+ List userProperties= ((AntPropertiesValue)fUserProperties.getLastValue()).getProperties(); >+ List systemProperties= ((AntPropertiesValue)fSystemProperties.getLastValue()).getProperties(); >+ List runtimeProperties= ((AntPropertiesValue)fRuntimeProperties.getLastValue()).getProperties(); >+ //0 PROPERTIES message >+ //1 propertyName length >+ //2 propertyName >+ //3 propertyValue length >+ //3 propertyValue >+ //4 propertyType >+ //5 ... >+ if (datum.length > 1) { //new properties >+ StringBuffer propertyName; >+ StringBuffer propertyValue; >+ int propertyNameLength; >+ int propertyValueLength; >+ for (int i = 1; i < datum.length; i++) { >+ propertyNameLength= Integer.parseInt(datum[i]); >+ propertyName= new StringBuffer(datum[++i]); >+ while (propertyName.length() != propertyNameLength) { >+ propertyName.append(DebugMessageIds.MESSAGE_DELIMITER); >+ propertyName.append(datum[++i]); >+ } >+ >+ propertyName= getAntDebugTarget().getAntDebugController().unescapeString(propertyName); >+ >+ propertyValueLength= Integer.parseInt(datum[++i]); >+ if (propertyValueLength == 0 && i + 1 == datum.length) { //bug 81299 >+ propertyValue= new StringBuffer(""); //$NON-NLS-1$ >+ } else { >+ propertyValue= new StringBuffer(datum[++i]); >+ } >+ while (propertyValue.length() != propertyValueLength) { >+ propertyValue.append(DebugMessageIds.MESSAGE_DELIMITER); >+ propertyValue.append(datum[++i]); >+ } >+ >+ propertyValue= getAntDebugTarget().getAntDebugController().unescapeString(propertyValue); >+ >+ int propertyType= Integer.parseInt(datum[++i]); >+ addProperty(userProperties, systemProperties, runtimeProperties, propertyName.toString(), propertyValue.toString(), propertyType); >+ } >+ } >+ } finally { >+ fRefreshProperties= false; >+ setPropertiesValid(true); >+ //wake up the call from getVariables >+ fPropertiesLock.notifyAll(); >+ } >+ } >+ } >+ >+ private void addProperty(List userProperties, List systemProperties, List runtimeProperties, String propertyName, String propertyValue, int propertyType) { >+ AntProperty property= new AntProperty((AntDebugTarget) getDebugTarget(), propertyName, propertyValue); >+ switch (propertyType) { >+ case DebugMessageIds.PROPERTY_SYSTEM: >+ systemProperties.add(property); >+ break; >+ case DebugMessageIds.PROPERTY_USER: >+ userProperties.add(property); >+ break; >+ case DebugMessageIds.PROPERTY_RUNTIME: >+ runtimeProperties.add(property); >+ break; >+ } >+ } >+ >+ private void initializePropertyGroups() { >+ AntDebugTarget target= getAntDebugTarget(); >+ fUserProperties= new AntProperties(target, DebugModelMessages.AntThread_0); >+ fUserProperties.setValue(new AntPropertiesValue(target)); >+ fSystemProperties= new AntProperties(target, DebugModelMessages.AntThread_1); >+ fSystemProperties.setValue(new AntPropertiesValue(target)); >+ fRuntimeProperties= new AntProperties(target, DebugModelMessages.AntThread_2); >+ fRuntimeProperties.setValue(new AntPropertiesValue(target)); >+ } >+ >+ protected IVariable[] getVariables() throws DebugException { >+ synchronized (fPropertiesLock) { >+ if (fRefreshProperties) { >+ getAntDebugTarget().getProperties(); >+ if (fRefreshProperties) { >+ //properties have not been set; need to wait >+ try { >+ int attempts= 0; >+ while (fRefreshProperties && !isTerminated()) { >+ fPropertiesLock.wait(50); >+ if (attempts == 20 && fRefreshProperties && !isTerminated()) { >+ throwDebugException(DebugModelMessages.AntThread_4); >+ } >+ attempts++; >+ } >+ } catch (InterruptedException ie) { >+ } >+ } >+ } >+ if (fSystemProperties == null) { >+ return new IVariable[0]; >+ } >+ return new IVariable[]{fSystemProperties, fUserProperties, fRuntimeProperties}; >+ } >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/ant/internal/launching/debug/model/AntValue.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/AntValue.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/AntValue.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/AntValue.java 1 Jan 1970 00:00:00 -0000 >@@ -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; >+ } >+} >Index: src/org/eclipse/ant/internal/launching/debug/model/DebugMessageIds.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/DebugMessageIds.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/DebugMessageIds.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/DebugMessageIds.java 1 Jan 1970 00:00:00 -0000 >@@ -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; >+} >Index: src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.properties >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.properties >diff -N src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/DebugModelMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/debug/model/RemoteAntDebugBuildListener.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/debug/model/RemoteAntDebugBuildListener.java >diff -N src/org/eclipse/ant/internal/launching/debug/model/RemoteAntDebugBuildListener.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/debug/model/RemoteAntDebugBuildListener.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,321 @@ >+/******************************************************************************* >+ * 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.debug.model; >+ >+import java.io.BufferedReader; >+import java.io.IOException; >+import java.io.InputStreamReader; >+import java.io.PrintWriter; >+import java.net.Socket; >+import java.net.UnknownHostException; >+ >+import org.eclipse.ant.internal.launching.AntLaunching; >+import org.eclipse.ant.internal.launching.debug.IAntDebugController; >+import org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntBuildListener; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.DebugEvent; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.model.IBreakpoint; >+import org.eclipse.debug.core.model.ILineBreakpoint; >+import org.eclipse.debug.core.model.IProcess; >+ >+public class RemoteAntDebugBuildListener extends RemoteAntBuildListener implements IAntDebugController { >+ >+ // sockets to communicate with the remote Ant debug build logger >+ private Socket fRequestSocket; >+ private PrintWriter fRequestWriter; >+ private BufferedReader fResponseReader; >+ >+ private int fRequestPort= -1; >+ private Thread fReaderThread; >+ >+ private AntDebugTarget fTarget; >+ >+ /** >+ * Reader thread that processes request responses from the remote Ant debug build logger >+ */ >+ private class ReaderThread extends Thread { >+ public ReaderThread() { >+ super("Ant Request Response Reader Thread"); //$NON-NLS-1$ >+ setDaemon(true); >+ } >+ >+ public void run(){ >+ try { >+ String message= null; >+ while (fResponseReader != null) { >+ synchronized (RemoteAntDebugBuildListener.this) { >+ if (fResponseReader != null && (message= fResponseReader.readLine()) != null) { >+ receiveMessage(message); >+ } >+ } >+ } >+ } catch (IOException ie) { //the other end has shutdown >+ RemoteAntDebugBuildListener.this.shutDown(); >+ } catch (Exception e) { >+ AntLaunching.log("Internal error processing remote response", e); //$NON-NLS-1$ >+ RemoteAntDebugBuildListener.this.shutDown(); >+ } >+ } >+ } >+ >+ public RemoteAntDebugBuildListener(ILaunch launch) { >+ super(launch); >+ //fDebug= true; >+ } >+ >+ protected void receiveMessage(String message) { >+ if (message.startsWith(DebugMessageIds.BUILD_STARTED)) { >+ buildStarted(); >+ } else if (message.startsWith(DebugMessageIds.SUSPENDED)){ >+ handleSuspendMessage(message); >+ } else if (message.startsWith(DebugMessageIds.TERMINATED)){ >+ fTarget.terminated(); >+ } else if (message.startsWith(DebugMessageIds.STACK)){ >+ AntThread thread= (AntThread) fTarget.getThreads()[0]; >+ thread.buildStack(message); >+ } else if (message.startsWith(DebugMessageIds.PROPERTIES)){ >+ AntThread thread= (AntThread) fTarget.getThreads()[0]; >+ thread.newProperties(message); >+ } else { >+ super.receiveMessage(message); >+ } >+ } >+ >+ private void handleSuspendMessage(String message) { >+ if (message.endsWith(DebugMessageIds.CLIENT_REQUEST)) { >+ fTarget.suspended(DebugEvent.CLIENT_REQUEST); >+ } else if (message.endsWith(DebugMessageIds.STEP)) { >+ fTarget.suspended(DebugEvent.STEP_END); >+ } else if (message.indexOf(DebugMessageIds.BREAKPOINT) >= 0) { >+ fTarget.breakpointHit(message); >+ } >+ } >+ >+ private void buildStarted() { >+ IProcess process= getProcess(); >+ while(process == null) { >+ try { >+ synchronized (this) { >+ wait(400); >+ } >+ process= getProcess(); >+ } catch (InterruptedException ie) { >+ } >+ } >+ fTarget= new AntDebugTarget(fLaunch, process, this); >+ fLaunch.addDebugTarget(fTarget); >+ >+ if (!connectRequest()) { >+ RemoteAntDebugBuildListener.this.shutDown(); >+ return; >+ } >+ >+ fTarget.buildStarted(); >+ } >+ >+ private boolean connectRequest() { >+ Exception exception= null; >+ for (int i= 1; i < 20; i++) { >+ try { >+ fRequestSocket = new Socket("localhost", fRequestPort); //$NON-NLS-1$ >+ fRequestWriter = new PrintWriter(fRequestSocket.getOutputStream(), true); >+ fResponseReader = new BufferedReader(new InputStreamReader(fRequestSocket.getInputStream())); >+ >+ fReaderThread= new ReaderThread(); >+ fReaderThread.start(); >+ return true; >+ } catch (UnknownHostException e) { >+ exception= e; >+ break; >+ } catch (IOException e) { >+ exception= e; >+ } >+ try { >+ Thread.sleep(500); >+ } catch(InterruptedException e) { >+ } >+ } >+ AntLaunching.log("Internal error attempting to connect to debug target", exception); //$NON-NLS-1$ >+ return false; >+ } >+ >+ /** >+ * Start listening to an Ant build. Start a server connection that >+ * the RemoteAntDebugBuildLogger can connect to. >+ * >+ * @param eventPort The port number to create the server connection on >+ * @param requestPort The port number to use for sending requests to the remote logger >+ */ >+ public synchronized void startListening(int eventPort, int requestPort) { >+ super.startListening(eventPort); >+ fRequestPort= requestPort; >+ } >+ >+ /** >+ * Sends a request to the Ant build >+ * >+ * @param request debug command >+ */ >+ protected void sendRequest(String request) { >+ if (fRequestSocket == null) { >+ return; >+ } >+ synchronized (fRequestSocket) { >+ fRequestWriter.println(request); >+ } >+ } >+ >+ protected synchronized void shutDown() { >+ if (fTarget != null) { >+ fTarget.terminated(); >+ fTarget= null; >+ } >+ fLaunch= null; >+ if (DebugPlugin.getDefault() != null) { >+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this); >+ } >+ try { >+ if (fReaderThread != null) { >+ // interrupt reader thread so that we don't block on close >+ // on a lock held by the BufferedReader >+ // see bug: 38955 >+ fReaderThread.interrupt(); >+ } >+ if (fResponseReader != null) { >+ fResponseReader.close(); >+ fResponseReader= null; >+ } >+ } catch(IOException e) { >+ } >+ if (fRequestWriter != null) { >+ fRequestWriter.close(); >+ fRequestWriter= null; >+ } >+ try{ >+ if(fRequestSocket != null) { >+ fRequestSocket.close(); >+ fRequestSocket= null; >+ } >+ } catch(IOException e) { >+ } >+ super.shutDown(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#resume() >+ */ >+ public void resume() { >+ sendRequest(DebugMessageIds.RESUME); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#suspend() >+ */ >+ public void suspend() { >+ sendRequest(DebugMessageIds.SUSPEND); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#stepInto() >+ */ >+ public void stepInto() { >+ sendRequest(DebugMessageIds.STEP_INTO); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#stepOver() >+ */ >+ public void stepOver() { >+ sendRequest(DebugMessageIds.STEP_OVER); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#handleBreakpoint(IBreakpoint, boolean) >+ */ >+ public void handleBreakpoint(IBreakpoint breakpoint, boolean add) { >+ if (fTarget == null || !fTarget.supportsBreakpoint(breakpoint)) { >+ return; >+ } >+ StringBuffer message= new StringBuffer(); >+ if (add) { >+ try { >+ if (!breakpoint.isEnabled()) { >+ return; >+ } >+ } catch (CoreException e) { >+ AntLaunching.log(e); >+ return; >+ } >+ message.append(DebugMessageIds.ADD_BREAKPOINT); >+ } else { >+ message.append(DebugMessageIds.REMOVE_BREAKPOINT); >+ } >+ message.append(DebugMessageIds.MESSAGE_DELIMITER); >+ message.append(breakpoint.getMarker().getResource().getLocation().toOSString()); >+ message.append(DebugMessageIds.MESSAGE_DELIMITER); >+ try { >+ message.append(((ILineBreakpoint)breakpoint).getLineNumber()); >+ sendRequest(message.toString()); >+ } catch (CoreException ce) { >+ AntLaunching.log(ce); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#getProperties() >+ */ >+ public void getProperties() { >+ sendRequest(DebugMessageIds.PROPERTIES); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#getStackFrames() >+ */ >+ public void getStackFrames() { >+ sendRequest(DebugMessageIds.STACK); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#unescapeString(java.lang.StringBuffer) >+ */ >+ public StringBuffer unescapeString(StringBuffer property) { >+ if (property.indexOf("\\r") == -1 && property.indexOf("\\n") == -1) { //$NON-NLS-1$ //$NON-NLS-2$ >+ return property; >+ } >+ for (int i= 0; i < property.length(); i++) { >+ if ('\\' == property.charAt(i)) { >+ String newString= ""; //$NON-NLS-1$ >+ if ('r' == property.charAt(i + 1)) { >+ if (i-1 > - 1 && '\\' == property.charAt(i-1)) { >+ newString= "r"; //$NON-NLS-1$ >+ } else { >+ newString+= '\r'; >+ } >+ } else if ('n' == property.charAt(i + 1)) { >+ if (i-1 > - 1 && '\\' == property.charAt(i-1)) { >+ newString= "n"; //$NON-NLS-1$ >+ } else { >+ newString+= '\n'; >+ } >+ >+ } >+ if (newString.length() > 0) { >+ property.replace(i, i + 2, newString); >+ } >+ } >+ } >+ >+ return property; >+ } >+} >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/AntClasspathProvider.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntClasspathProvider.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntClasspathProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/AntClasspathProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -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); >+ } >+} >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/AntHomeClasspathEntry.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntHomeClasspathEntry.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntHomeClasspathEntry.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/AntHomeClasspathEntry.java 1 Jan 1970 00:00:00 -0000 >@@ -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; >+ } >+} >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/AntJavaLaunchDelegate.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntJavaLaunchDelegate.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntJavaLaunchDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/AntJavaLaunchDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -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$ >+ } >+} >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.properties >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.properties >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchConfigurationMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchDelegate.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchDelegate.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,888 @@ >+/******************************************************************************* >+ * 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 >+ * Juan A. Hernandez - bug 89926 >+ * dakshinamurthy.karra@gmail.com - bug 165371 >+ *******************************************************************************/ >+package org.eclipse.ant.internal.launching.launchConfigurations; >+ >+import java.io.File; >+import java.io.IOException; >+import java.net.URL; >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Map; >+ >+import org.apache.tools.ant.ProjectHelper; >+import org.eclipse.ant.core.AntCorePlugin; >+import org.eclipse.ant.core.AntCorePreferences; >+import org.eclipse.ant.core.AntRunner; >+import org.eclipse.ant.core.Property; >+import org.eclipse.ant.core.Task; >+import org.eclipse.ant.core.Type; >+import org.eclipse.ant.internal.core.AbstractEclipseBuildLogger; >+import org.eclipse.ant.internal.launching.AntLaunch; >+import org.eclipse.ant.internal.launching.AntLaunching; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.ant.internal.launching.debug.IAntDebugConstants; >+import org.eclipse.ant.internal.launching.debug.model.RemoteAntDebugBuildListener; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.launchConfigurations.BackgroundResourceRefresher; >+import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.FileLocator; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.SubProgressMonitor; >+import org.eclipse.core.variables.VariablesPlugin; >+import org.eclipse.debug.core.DebugEvent; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.IBreakpointManager; >+import org.eclipse.debug.core.IDebugEventSetListener; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.debug.core.ILaunchManager; >+import org.eclipse.debug.core.RefreshUtil; >+import org.eclipse.debug.core.model.IBreakpoint; >+import org.eclipse.debug.core.model.IProcess; >+import org.eclipse.debug.core.model.LaunchConfigurationDelegate; >+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; >+import org.eclipse.jdt.launching.IVMInstall; >+import org.eclipse.jdt.launching.JavaRuntime; >+import org.eclipse.jdt.launching.SocketUtil; >+import org.eclipse.osgi.service.resolver.BundleDescription; >+import org.osgi.framework.Bundle; >+ >+import com.ibm.icu.text.MessageFormat; >+ >+/** >+ * Launch delegate for Ant builds >+ */ >+public class AntLaunchDelegate extends LaunchConfigurationDelegate { >+ >+ private static final String ANT_LOGGER_CLASS = "org.eclipse.ant.internal.launching.runtime.logger.AntProcessBuildLogger"; //$NON-NLS-1$ >+ private static final String ANT_DEBUG_LOGGER_CLASS = "org.eclipse.ant.internal.launching.runtime.logger.AntProcessDebugBuildLogger"; //$NON-NLS-1$ >+ private static final String NULL_LOGGER_CLASS = "org.eclipse.ant.internal.launching.runtime.logger.NullBuildLogger"; //$NON-NLS-1$ >+ private static final String REMOTE_ANT_LOGGER_CLASS = "org.eclipse.ant.internal.launching.remote.logger.RemoteAntBuildLogger"; //$NON-NLS-1$ >+ private static final String REMOTE_ANT_DEBUG_LOGGER_CLASS = "org.eclipse.ant.internal.launching.remote.logger.RemoteAntDebugBuildLogger"; //$NON-NLS-1$ >+ private static final String BASE_DIR_PREFIX = "-Dbasedir="; //$NON-NLS-1$ >+ private static final String INPUT_HANDLER_CLASS = "org.eclipse.ant.internal.ui.antsupport.inputhandler.AntInputHandler"; //$NON-NLS-1$ >+ private static final String REMOTE_INPUT_HANDLER_CLASS = "org.eclipse.ant.internal.ui.antsupport.inputhandler.ProxyInputHandler"; //$NON-NLS-1$ >+ >+ private static final IProject[] NO_PROJECTS = new IProject[0]; >+ >+ /** >+ * String attribute identifying the build scope for a launch configuration. >+ * <code>null</code> indicates the default workspace build. >+ */ >+ private static final String ATTR_BUILD_SCOPE = AntLaunching >+ .getUniqueIdentifier() >+ + ".ATTR_BUILD_SCOPE"; //$NON-NLS-1$ >+ >+ /** >+ * Attribute identifier specifying whether referenced projects should be >+ * considered when computing the projects to build. Default value is >+ * <code>true</code>. >+ */ >+ private static final String ATTR_INCLUDE_REFERENCED_PROJECTS = AntLaunching >+ .getUniqueIdentifier() >+ + ".ATTR_INCLUDE_REFERENCED_PROJECTS"; //$NON-NLS-1$ >+ >+ private static String fgSWTLibraryLocation; >+ >+ private String fMode; >+ ILaunchManager launchManager; >+ >+ private boolean fUserSpecifiedLogger = false; >+ >+ private String getProgramArguments(ILaunchConfiguration configuration) >+ throws CoreException { >+ String arguments = configuration.getAttribute( >+ IExternalToolConstants.ATTR_TOOL_ARGUMENTS, ""); //$NON-NLS-1$ >+ return VariablesPlugin.getDefault().getStringVariableManager() >+ .performStringSubstitution(arguments); >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, >+ * java.lang.String, org.eclipse.debug.core.ILaunch, >+ * org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public void launch(ILaunchConfiguration configuration, String mode, >+ ILaunch launch, IProgressMonitor monitor) throws CoreException { >+ if (monitor.isCanceled()) { >+ return; >+ } >+ fUserSpecifiedLogger = false; >+ fMode = mode; >+ launchManager = DebugPlugin.getDefault().getLaunchManager(); >+ >+ // migrate the config to the new classpath format if required >+ AntLaunchingUtil.migrateToNewClasspathFormat(configuration); >+ >+ boolean isSeparateJRE = AntLaunchingUtil >+ .isSeparateJREAntBuild(configuration); >+ >+ if (ExternalToolsCoreUtil.isAsynchronousBuild(configuration)) { >+ monitor.beginTask(MessageFormat.format( >+ AntLaunchConfigurationMessages.AntLaunchDelegate_Launching__0__1, >+ new String[] { configuration.getName() }), 10); >+ } else { >+ monitor.beginTask(MessageFormat.format( >+ AntLaunchConfigurationMessages.AntLaunchDelegate_Running__0__2, >+ new String[] { configuration.getName() }), 100); >+ } >+ >+ // resolve location >+ IPath location = ExternalToolsCoreUtil.getLocation(configuration); >+ monitor.worked(1); >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ if (!isSeparateJRE && AntRunner.isBuildRunning()) { >+ IStatus status = new Status( >+ IStatus.ERROR, >+ AntLaunching.PLUGIN_ID, >+ 1, >+ MessageFormat >+ .format( >+ AntLaunchConfigurationMessages.AntLaunchDelegate_Build_In_Progress, >+ new String[] { location.toOSString() }), >+ null); >+ throw new CoreException(status); >+ } >+ >+ // resolve working directory >+ IPath workingDirectory = ExternalToolsCoreUtil >+ .getWorkingDirectory(configuration); >+ String basedir = null; >+ if (workingDirectory != null) { >+ basedir = workingDirectory.toOSString(); >+ } >+ monitor.worked(1); >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ // link the process to its build logger via a timestamp >+ long timeStamp = System.currentTimeMillis(); >+ String idStamp = Long.toString(timeStamp); >+ StringBuffer idProperty = new StringBuffer("-D"); //$NON-NLS-1$ >+ idProperty.append(AbstractEclipseBuildLogger.ANT_PROCESS_ID); >+ idProperty.append('='); >+ idProperty.append(idStamp); >+ >+ // resolve arguments >+ String[] arguments = null; >+ if (isSeparateJRE) { >+ arguments = new String[] { getProgramArguments(configuration) }; >+ } else { >+ arguments = ExternalToolsCoreUtil.getArguments(configuration); >+ } >+ >+ Map userProperties = AntLaunchingUtil.getProperties(configuration); >+ if (userProperties != null) {// create a copy so as to not affect the >+ // configuration with transient >+ // properties >+ userProperties = new HashMap(userProperties); >+ } >+ String[] propertyFiles = AntLaunchingUtil >+ .getPropertyFiles(configuration); >+ String[] targets = AntLaunchingUtil.getTargetNames(configuration); >+ URL[] customClasspath = AntLaunchingUtil >+ .getCustomClasspath(configuration); >+ String antHome = AntLaunchingUtil.getAntHome(configuration); >+ >+ boolean setInputHandler = true; >+ try { >+ // check if set specify inputhandler >+ setInputHandler = configuration.getAttribute( >+ AntLaunching.SET_INPUTHANDLER, true); >+ } catch (CoreException ce) { >+ AntLaunching.log(ce); >+ } >+ >+ AntRunner runner = null; >+ if (!isSeparateJRE) { >+ runner = configureAntRunner(configuration, location, basedir, >+ idProperty, arguments, userProperties, propertyFiles, >+ targets, customClasspath, antHome, setInputHandler); >+ } >+ >+ monitor.worked(1); >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ boolean captureOutput = ExternalToolsCoreUtil >+ .getCaptureOutput(configuration); >+ int port = -1; >+ int requestPort = -1; >+ if (isSeparateJRE && captureOutput) { >+ if (userProperties == null) { >+ userProperties = new HashMap(); >+ } >+ port = SocketUtil.findFreePort(); >+ userProperties.put(AbstractEclipseBuildLogger.ANT_PROCESS_ID, >+ idStamp); >+ userProperties.put("eclipse.connect.port", Integer.toString(port)); //$NON-NLS-1$ >+ if (fMode.equals(ILaunchManager.DEBUG_MODE)) { >+ requestPort = SocketUtil.findFreePort(); >+ userProperties >+ .put( >+ "eclipse.connect.request_port", Integer.toString(requestPort)); //$NON-NLS-1$ >+ } >+ } >+ >+ StringBuffer commandLine = generateCommandLine(location, arguments, >+ userProperties, propertyFiles, targets, antHome, basedir, >+ isSeparateJRE, captureOutput, setInputHandler); >+ >+ if (isSeparateJRE) { >+ monitor >+ .beginTask( >+ MessageFormat >+ .format( >+ AntLaunchConfigurationMessages.AntLaunchDelegate_Launching__0__1, >+ new String[] { configuration >+ .getName() }), 10); >+ runInSeparateVM(configuration, launch, monitor, idStamp, antHome, >+ port, requestPort, commandLine, captureOutput, >+ setInputHandler); >+ } else { >+ runInSameVM(configuration, launch, monitor, location, idStamp, >+ runner, commandLine); >+ } >+ >+ monitor.done(); >+ } >+ >+ private void runInSameVM(ILaunchConfiguration configuration, >+ ILaunch launch, IProgressMonitor monitor, IPath location, >+ String idStamp, AntRunner runner, StringBuffer commandLine) throws CoreException { >+ Map attributes = new HashMap(2); >+ attributes.put(IProcess.ATTR_PROCESS_TYPE, >+ IAntLaunchConstants.ID_ANT_PROCESS_TYPE); >+ attributes.put(AbstractEclipseBuildLogger.ANT_PROCESS_ID, idStamp); >+ >+ final AntProcess process = new AntProcess(location.toOSString(), >+ launch, attributes); >+ setProcessAttributes(process, idStamp, commandLine); >+ boolean debug = fMode.equals(ILaunchManager.DEBUG_MODE); >+ if (debug || ExternalToolsCoreUtil.isAsynchronousBuild(configuration)) { >+ final AntRunner finalRunner = runner; >+ Runnable r = new Runnable() { >+ public void run() { >+ try { >+ finalRunner.run(process); >+ } catch (CoreException e) { >+ handleException( >+ e, >+ AntLaunchConfigurationMessages.AntLaunchDelegate_Failure); >+ } >+ process.terminated(); >+ } >+ }; >+ Thread background = new Thread(r); >+ background.setDaemon(true); >+ background.start(); >+ monitor.worked(1); >+ // refresh resources after process finishes >+ if (configuration.getAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, (String)null) != null) { >+ BackgroundResourceRefresher refresher = new BackgroundResourceRefresher( >+ configuration, process); >+ refresher.startBackgroundRefresh(); >+ } >+ } else { >+ // execute the build >+ try { >+ runner.run(monitor); >+ } catch (CoreException e) { >+ process.terminated(); >+ monitor.done(); >+ handleException(e, >+ AntLaunchConfigurationMessages.AntLaunchDelegate_23); >+ return; >+ } >+ process.terminated(); >+ >+ // refresh resources >+ RefreshUtil.refreshResources(configuration, monitor); >+ } >+ } >+ >+ private AntRunner configureAntRunner(ILaunchConfiguration configuration, >+ IPath location, String baseDir, StringBuffer idProperty, >+ String[] arguments, Map userProperties, String[] propertyFiles, >+ String[] targets, URL[] customClasspath, String antHome, >+ boolean setInputHandler) throws CoreException { >+ int argLength = 1; // at least one user property - timestamp >+ if (arguments != null) { >+ argLength += arguments.length; >+ } >+ if (baseDir != null && baseDir.length() > 0) { >+ argLength++; >+ } >+ String[] runnerArgs = new String[argLength]; >+ if (arguments != null) { >+ System.arraycopy(arguments, 0, runnerArgs, 0, arguments.length); >+ } >+ if (baseDir != null && baseDir.length() > 0) { >+ runnerArgs[runnerArgs.length - 2] = BASE_DIR_PREFIX + baseDir; >+ } >+ runnerArgs[runnerArgs.length - 1] = idProperty.toString(); >+ >+ AntRunner runner = new AntRunner(); >+ runner.setBuildFileLocation(location.toOSString()); >+ boolean captureOutput = ExternalToolsCoreUtil >+ .getCaptureOutput(configuration); >+ if (captureOutput) { >+ if (fMode.equals(ILaunchManager.DEBUG_MODE)) { >+ runner.addBuildLogger(ANT_DEBUG_LOGGER_CLASS); >+ } else { >+ runner.addBuildLogger(ANT_LOGGER_CLASS); >+ } >+ } else { >+ runner.addBuildLogger(NULL_LOGGER_CLASS); >+ } >+ if (setInputHandler) { >+ runner.setInputHandler(INPUT_HANDLER_CLASS); >+ } else { >+ runner.setInputHandler(""); //$NON-NLS-1$ >+ } >+ runner.setArguments(runnerArgs); >+ if (userProperties != null) { >+ runner.addUserProperties(userProperties); >+ } >+ >+ if (propertyFiles != null) { >+ runner.setPropertyFiles(propertyFiles); >+ } >+ >+ if (targets != null) { >+ runner.setExecutionTargets(targets); >+ } >+ >+ if (customClasspath != null) { >+ runner.setCustomClasspath(customClasspath); >+ } >+ >+ if (antHome != null) { >+ runner.setAntHome(antHome); >+ } >+ return runner; >+ } >+ >+ private void handleException(final CoreException e, final String title) { >+ AntLaunching.log(title, e); >+ } >+ >+ private void setProcessAttributes(IProcess process, String idStamp, >+ StringBuffer commandLine) { >+ // link the process to the Eclipse build logger via a timestamp >+ if (!fUserSpecifiedLogger) { >+ process.setAttribute(AbstractEclipseBuildLogger.ANT_PROCESS_ID, >+ idStamp); >+ } >+ >+ // create "fake" command line for the process >+ if (commandLine != null) { >+ process.setAttribute(IProcess.ATTR_CMDLINE, commandLine.toString()); >+ } >+ } >+ >+ private StringBuffer generateCommandLine(IPath location, >+ String[] arguments, Map userProperties, String[] propertyFiles, >+ String[] targets, String antHome, String basedir, >+ boolean separateVM, boolean captureOutput, boolean setInputHandler) { >+ StringBuffer commandLine = new StringBuffer(); >+ >+ if (!separateVM) { >+ commandLine.append("ant"); //$NON-NLS-1$ >+ } >+ >+ if (arguments != null) { >+ for (int i = 0; i < arguments.length; i++) { >+ commandLine.append(' '); >+ commandLine.append(arguments[i]); >+ } >+ } >+ >+ AntCorePreferences prefs = AntCorePlugin.getPlugin().getPreferences(); >+ if (propertyFiles == null) { // global >+ String[] files = prefs.getCustomPropertyFiles(); >+ for (int i = 0; i < files.length; i++) { >+ String path = files[i]; >+ commandLine.append(" -propertyfile \""); //$NON-NLS-1$ >+ commandLine.append(path); >+ commandLine.append('\"'); >+ } >+ } else {// "local" configuration >+ for (int i = 0; i < propertyFiles.length; i++) { >+ String path = propertyFiles[i]; >+ commandLine.append(" -propertyfile \""); //$NON-NLS-1$ >+ commandLine.append(path); >+ commandLine.append('\"'); >+ } >+ } >+ // "local" configuration >+ if (userProperties != null) { >+ Iterator keys = userProperties.keySet().iterator(); >+ String key; >+ while (keys.hasNext()) { >+ key = (String) keys.next(); >+ appendProperty(commandLine, key, (String) userProperties >+ .get(key)); >+ } >+ } >+ >+ // global >+ List properties = null; >+ if (!separateVM) { >+ properties = prefs.getProperties(); >+ } else { >+ properties = prefs.getRemoteAntProperties(); >+ } >+ >+ // if we have user properties this means that the user has chosen to >+ // override the global properties >+ // if in a separate VM and have only two (or three if debug) user >+ // properties these are really only Eclipse generated properties >+ // and the user is still using the global properties >+ int numberOfEclipseProperties = 2; >+ if (userProperties != null >+ && userProperties.get("eclipse.connect.request_port") != null) { //$NON-NLS-1$ >+ numberOfEclipseProperties = 3; // debug mode >+ } >+ boolean useGlobalProperties = userProperties == null >+ || (separateVM && userProperties.size() == numberOfEclipseProperties); >+ if (useGlobalProperties) { >+ for (Iterator iter = properties.iterator(); iter.hasNext();) { >+ Property property = (Property) iter.next(); >+ String key = property.getName(); >+ String value = property.getValue(false); >+ if (value != null) { >+ appendProperty(commandLine, key, value); >+ } >+ } >+ } >+ >+ if (basedir != null && basedir.length() > 0) { >+ appendProperty(commandLine, "basedir", basedir); //$NON-NLS-1$ >+ } >+ >+ if (antHome != null) { >+ commandLine.append(" \"-Dant.home="); //$NON-NLS-1$ >+ commandLine.append(antHome); >+ commandLine.append('\"'); >+ } >+ >+ if (separateVM) { >+ if (commandLine.indexOf("-logger") == -1) { //$NON-NLS-1$ >+ if (captureOutput) { >+ commandLine.append(" -logger "); //$NON-NLS-1$ >+ if (fMode.equals(ILaunchManager.DEBUG_MODE)) { >+ commandLine.append(REMOTE_ANT_DEBUG_LOGGER_CLASS); >+ } else { >+ commandLine.append(REMOTE_ANT_LOGGER_CLASS); >+ } >+ } >+ } else { >+ fUserSpecifiedLogger = true; >+ } >+ if (commandLine.indexOf("-inputhandler") == -1 && setInputHandler) { //$NON-NLS-1$ >+ commandLine.append(" -inputhandler "); //$NON-NLS-1$ >+ commandLine.append(REMOTE_INPUT_HANDLER_CLASS); >+ } >+ } else { >+ if (commandLine.indexOf("-inputhandler") == -1 && setInputHandler) { //$NON-NLS-1$ >+ commandLine.append(" -inputhandler "); //$NON-NLS-1$ >+ commandLine.append(INPUT_HANDLER_CLASS); >+ } >+ if (commandLine.indexOf("-logger") == -1) { //$NON-NLS-1$ >+ commandLine.append(" -logger "); //$NON-NLS-1$ >+ if (fMode.equals(ILaunchManager.DEBUG_MODE)) { >+ commandLine.append(ANT_DEBUG_LOGGER_CLASS); >+ } else if (captureOutput) { >+ commandLine.append(ANT_LOGGER_CLASS); >+ } else { >+ commandLine.append(NULL_LOGGER_CLASS); >+ } >+ } >+ } >+ >+ if (separateVM) { >+ appendTaskAndTypes(prefs, commandLine); >+ } >+ commandLine.append(" -buildfile \""); //$NON-NLS-1$ >+ commandLine.append(location.toOSString()); >+ commandLine.append('\"'); >+ >+ if (targets != null) { >+ for (int i = 0; i < targets.length; i++) { >+ commandLine.append(" \""); //$NON-NLS-1$ >+ commandLine.append(targets[i]); >+ commandLine.append('\"'); >+ } >+ } >+ return commandLine; >+ } >+ >+ private void appendTaskAndTypes(AntCorePreferences prefs, >+ StringBuffer commandLine) { >+ List tasks = prefs.getRemoteTasks(); >+ Iterator itr = tasks.iterator(); >+ while (itr.hasNext()) { >+ Task task = (Task) itr.next(); >+ commandLine.append(" -eclipseTask "); //$NON-NLS-1$ >+ String name = ProjectHelper.genComponentName(task.getURI(), task >+ .getTaskName()); >+ commandLine.append(name); >+ commandLine.append(','); >+ commandLine.append(task.getClassName()); >+ } >+ >+ List types = prefs.getRemoteTypes(); >+ itr = types.iterator(); >+ while (itr.hasNext()) { >+ Type type = (Type) itr.next(); >+ commandLine.append(" -eclipseType "); //$NON-NLS-1$ >+ String name = ProjectHelper.genComponentName(type.getURI(), type >+ .getTypeName()); >+ commandLine.append(name); >+ commandLine.append(','); >+ commandLine.append(type.getClassName()); >+ } >+ } >+ >+ private void appendProperty(StringBuffer commandLine, String name, >+ String value) { >+ commandLine.append(" \"-D"); //$NON-NLS-1$ >+ commandLine.append(name); >+ commandLine.append('='); >+ commandLine.append(value); >+ if (value.length() > 0 >+ && value.charAt(value.length() - 1) == File.separatorChar) { >+ commandLine.append(File.separatorChar); >+ } >+ commandLine.append("\""); //$NON-NLS-1$ >+ } >+ >+ private void runInSeparateVM(ILaunchConfiguration configuration, >+ ILaunch launch, IProgressMonitor monitor, String idStamp, >+ String antHome, int port, int requestPort, >+ StringBuffer commandLine, boolean captureOutput, >+ boolean setInputHandler) throws CoreException { >+ boolean debug = fMode.equals(ILaunchManager.DEBUG_MODE); >+ if (captureOutput) { >+ if (debug) { >+ RemoteAntDebugBuildListener listener = new RemoteAntDebugBuildListener( >+ launch); >+ if (requestPort != -1) { >+ listener.startListening(port, requestPort); >+ } >+ } else if (!fUserSpecifiedLogger) { >+ RemoteAntBuildListener client = new RemoteAntBuildListener( >+ launch); >+ if (port != -1) { >+ client.startListening(port); >+ } >+ } >+ } >+ >+ ILaunchConfigurationWorkingCopy copy = configuration.getWorkingCopy(); >+ setDefaultWorkingDirectory(copy); >+ copy.setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, >+ commandLine.toString()); >+ copy.setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, >+ IAntLaunchConstants.MAIN_TYPE_NAME); >+ StringBuffer vmArgs = generateVMArguments(copy, setInputHandler, >+ antHome); >+ copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, >+ vmArgs.toString()); >+ copy.setAttribute(ILaunchManager.ATTR_PRIVATE, true); >+ if (copy >+ .getAttribute( >+ IAntLaunchConstants.ATTR_DEFAULT_VM_INSTALL, >+ false)) { >+ setDefaultVM(configuration, copy); >+ } >+ >+ if (debug) { // do not allow launch in foreground bug 83254 >+ copy.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, true); >+ } >+ >+ // set the ANT_HOME environment variable >+ if (antHome != null) { >+ Map vars = copy.getAttribute( >+ ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new HashMap(1)); >+ vars.put("ANT_HOME", antHome); //$NON-NLS-1$ >+ copy.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, vars); >+ } >+ >+ // copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, >+ // "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"); >+ IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 10); >+ AntJavaLaunchDelegate delegate = new AntJavaLaunchDelegate(); >+ delegate.preLaunchCheck(copy, ILaunchManager.RUN_MODE, subMonitor); >+ delegate.launch(copy, ILaunchManager.RUN_MODE, launch, subMonitor); >+ final IProcess[] processes = launch.getProcesses(); >+ for (int i = 0; i < processes.length; i++) { >+ setProcessAttributes(processes[i], idStamp, null); >+ } >+ >+ if (ExternalToolsCoreUtil.isAsynchronousBuild(copy)) { >+ // refresh resources after process finishes >+ if (configuration.getAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, (String)null) != null) { >+ BackgroundResourceRefresher refresher = new BackgroundResourceRefresher( >+ configuration, processes[0]); >+ refresher.startBackgroundRefresh(); >+ } >+ } else { >+ final boolean[] terminated = new boolean[1]; >+ terminated[0] = launch.isTerminated(); >+ IDebugEventSetListener listener = new IDebugEventSetListener() { >+ public void handleDebugEvents(DebugEvent[] events) { >+ for (int i = 0; i < events.length; i++) { >+ DebugEvent event = events[i]; >+ for (int j = 0, numProcesses = processes.length; j < numProcesses; j++) { >+ if (event.getSource() == processes[j] >+ && event.getKind() == DebugEvent.TERMINATE) { >+ terminated[0] = true; >+ break; >+ } >+ } >+ } >+ } >+ }; >+ DebugPlugin.getDefault().addDebugEventListener(listener); >+ monitor >+ .subTask(AntLaunchConfigurationMessages.AntLaunchDelegate_28); >+ while (!monitor.isCanceled() && !terminated[0]) { >+ try { >+ Thread.sleep(50); >+ } catch (InterruptedException e) { >+ } >+ } >+ DebugPlugin.getDefault().removeDebugEventListener(listener); >+ if (!monitor.isCanceled()) { >+ // refresh resources >+ RefreshUtil.refreshResources(configuration, monitor); >+ } >+ } >+ } >+ >+ private void setDefaultVM(ILaunchConfiguration configuration, >+ ILaunchConfigurationWorkingCopy copy) { >+ try { >+ JavaRuntime.getJavaProject(configuration); >+ // remove the vm name, install type and jre container path for the >+ // Java launching concept of default VM >+ copy.setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, >+ (String) null); >+ copy.setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, >+ (String) null); >+ copy.setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, >+ (String) null); >+ } catch (CoreException ce) { >+ // not in a Java project >+ IVMInstall defaultVMInstall = JavaRuntime.getDefaultVMInstall(); >+ copy.setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, >+ defaultVMInstall.getName()); >+ copy.setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, >+ defaultVMInstall.getVMInstallType().getId()); >+ } >+ } >+ >+ private StringBuffer generateVMArguments(ILaunchConfiguration config, >+ boolean setInputHandler, String antHome) { >+ StringBuffer vmArgs = new StringBuffer(); >+ try { >+ String configArgs = config.getAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, >+ (String) null); >+ if (configArgs != null) { >+ vmArgs.append(configArgs); >+ vmArgs.append(' '); >+ } >+ } catch (CoreException e) { >+ } >+ >+ if (antHome != null) { >+ vmArgs.append("-Dant.home=\""); //$NON-NLS-1$ >+ vmArgs.append(antHome); >+ vmArgs.append("\" "); //$NON-NLS-1$ >+ >+ File antLibDir = new File(antHome, "lib"); //$NON-NLS-1$ >+ vmArgs.append("-Dant.library.dir=\""); //$NON-NLS-1$ >+ vmArgs.append(antLibDir.getAbsolutePath()); >+ vmArgs.append('\"'); >+ } >+ if (setInputHandler) { >+ String swtLocation = getSWTLibraryLocation(); >+ if (swtLocation != null) { >+ vmArgs.append(" -Djava.library.path=\""); //$NON-NLS-1$ >+ String javaLibPath = System.getProperty("java.library.path"); //$NON-NLS-1$ >+ javaLibPath = stripUnescapedQuotes(javaLibPath); >+ if (javaLibPath != null) { >+ vmArgs.append(javaLibPath); >+ if (vmArgs.charAt(vmArgs.length() - 1) != File.pathSeparatorChar) { >+ vmArgs.append(File.pathSeparatorChar); >+ } >+ } >+ vmArgs.append(swtLocation); >+ vmArgs.append('"'); >+ } >+ } >+ return vmArgs; >+ } >+ >+ private String stripUnescapedQuotes(String javaLibPath) { >+ StringBuffer buf = new StringBuffer(javaLibPath.length()); >+ for (int i = 0; i < javaLibPath.length(); i++) { >+ char c = javaLibPath.charAt(i); >+ switch (c) { >+ case '"': >+ if (i != 0 && javaLibPath.charAt(i - 1) == '\\') { >+ buf.append(c); >+ } >+ break; >+ default: >+ buf.append(c); >+ break; >+ } >+ } >+ return buf.toString(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder >+ * (org.eclipse.debug.core.ILaunchConfiguration, java.lang.String) >+ */ >+ protected IProject[] getBuildOrder(ILaunchConfiguration configuration, >+ String mode) throws CoreException { >+ IProject[] projects = ExternalToolsCoreUtil.getBuildProjects( >+ configuration, ATTR_BUILD_SCOPE); >+ if (projects == null) { >+ return NO_PROJECTS; >+ } >+ boolean isRef = ExternalToolsCoreUtil.isIncludeReferencedProjects( >+ configuration, ATTR_INCLUDE_REFERENCED_PROJECTS); >+ if (isRef) { >+ return computeReferencedBuildOrder(projects); >+ } >+ return computeBuildOrder(projects); >+ } >+ >+ private String getSWTLibraryLocation() { >+ if (fgSWTLibraryLocation == null) { >+ Bundle bundle = Platform.getBundle("org.eclipse.swt"); //$NON-NLS-1$ >+ BundleDescription description = Platform.getPlatformAdmin() >+ .getState(false).getBundle(bundle.getBundleId()); >+ BundleDescription[] fragments = description.getFragments(); >+ if (fragments == null || fragments.length == 0) { >+ return null; >+ } >+ Bundle fragBundle = Platform.getBundle(fragments[0] >+ .getSymbolicName()); >+ try { >+ URL url = FileLocator.toFileURL(fragBundle.getEntry("/")); //$NON-NLS-1$ >+ IPath path = new Path(url.getPath()); >+ path = path.removeTrailingSeparator(); >+ fgSWTLibraryLocation = path.toOSString(); >+ } catch (IOException e) { >+ } >+ } >+ return fgSWTLibraryLocation; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBreakpoints >+ * (org.eclipse.debug.core.ILaunchConfiguration) >+ */ >+ protected IBreakpoint[] getBreakpoints(ILaunchConfiguration configuration) { >+ IBreakpointManager breakpointManager = DebugPlugin.getDefault() >+ .getBreakpointManager(); >+ if (!breakpointManager.isEnabled()) { >+ // no need to check breakpoints individually. >+ return null; >+ } >+ return breakpointManager >+ .getBreakpoints(IAntDebugConstants.ID_ANT_DEBUG_MODEL); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.model.LaunchConfigurationDelegate#saveBeforeLaunch >+ * (org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, >+ * org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ protected boolean saveBeforeLaunch(ILaunchConfiguration configuration, >+ String mode, IProgressMonitor monitor) throws CoreException { >+ if (IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY >+ .equals(configuration.getType().getCategory())) { >+ // don't prompt for builders >+ return true; >+ } >+ return super.saveBeforeLaunch(configuration, mode, monitor); >+ } >+ >+ /** >+ * Sets the default working directory to be the parent folder of the >+ * buildfile if the user has not explicitly set the working directory. >+ */ >+ private void setDefaultWorkingDirectory(ILaunchConfigurationWorkingCopy copy) { >+ try { >+ String wd = copy.getAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, >+ (String) null); >+ if (wd == null) { >+ wd = ExternalToolsCoreUtil.getLocation(copy) >+ .removeLastSegments(1).toOSString(); >+ copy >+ .setAttribute( >+ IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, >+ wd); >+ } >+ } catch (CoreException e) { >+ AntLaunching.log(e.getStatus()); >+ } >+ } >+ >+ public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) >+ throws CoreException { >+ return new AntLaunch(configuration, mode, null); >+ } >+} >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/AntMigrationDelegate.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntMigrationDelegate.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntMigrationDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/AntMigrationDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -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 >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/AntProcess.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntProcess.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntProcess.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/AntProcess.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,172 @@ >+/******************************************************************************* >+ * 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.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.PlatformObject; >+import org.eclipse.debug.core.DebugEvent; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.model.IProcess; >+import org.eclipse.debug.core.model.IStreamsProxy; >+ >+public class AntProcess extends PlatformObject implements IProcess, IProgressMonitor { >+ >+ private AntStreamsProxy fProxy; >+ private String fLabel = null; >+ private ILaunch fLaunch = null; >+ private Map fAttributes = null; >+ private boolean fTerminated = false; >+ private boolean fCancelled = false; >+ >+ public AntProcess(String label, ILaunch launch, Map attributes) { >+ fLabel = label; >+ fLaunch = launch; >+ if (attributes == null) { >+ fAttributes = new HashMap(); >+ } else { >+ fAttributes = attributes; >+ } >+ String captureOutput= launch.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT); >+ if(!("false".equals(captureOutput))) { //$NON-NLS-1$ >+ fProxy= new AntStreamsProxy(); >+ } >+ launch.addProcess(this); >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.model.IProcess#getLabel() >+ */ >+ public String getLabel() { >+ return fLabel; >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.model.IProcess#getLaunch() >+ */ >+ public ILaunch getLaunch() { >+ return fLaunch; >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.model.IProcess#getStreamsProxy() >+ */ >+ public IStreamsProxy getStreamsProxy() { >+ return fProxy; >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.model.IProcess#setAttribute(java.lang.String, java.lang.String) >+ */ >+ public void setAttribute(String key, String value) { >+ fAttributes.put(key, value); >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.model.IProcess#getAttribute(java.lang.String) >+ */ >+ public String getAttribute(String key) { >+ return (String)fAttributes.get(key); >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.model.IProcess#getExitValue() >+ */ >+ public int getExitValue() { >+ return 0; >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.model.ITerminate#canTerminate() >+ */ >+ public boolean canTerminate() { >+ return !isCanceled() && !isTerminated(); >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.model.ITerminate#isTerminated() >+ */ >+ public boolean isTerminated() { >+ return fTerminated; >+ } >+ >+ protected void terminated() { >+ if (!fTerminated) { >+ fTerminated = true; >+ if (DebugPlugin.getDefault() != null) { >+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {new DebugEvent(this, DebugEvent.TERMINATE)}); >+ } >+ } >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.model.ITerminate#terminate() >+ */ >+ public void terminate() { >+ setCanceled(true); >+ } >+ >+ // IProgressMonitor implemented to support termination. >+ >+ /** >+ * @see org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String, int) >+ */ >+ public void beginTask(String name, int totalWork) { >+ } >+ >+ /** >+ * @see org.eclipse.core.runtime.IProgressMonitor#done() >+ */ >+ public void done() { >+ } >+ >+ /** >+ * @see org.eclipse.core.runtime.IProgressMonitor#internalWorked(double) >+ */ >+ public void internalWorked(double work) { >+ } >+ >+ /** >+ * @see org.eclipse.core.runtime.IProgressMonitor#isCanceled() >+ */ >+ public boolean isCanceled() { >+ return fCancelled; >+ } >+ >+ /** >+ * @see org.eclipse.core.runtime.IProgressMonitor#setCanceled(boolean) >+ */ >+ public void setCanceled(boolean value) { >+ fCancelled = value; >+ } >+ >+ /** >+ * @see org.eclipse.core.runtime.IProgressMonitor#setTaskName(java.lang.String) >+ */ >+ public void setTaskName(String name) { >+ } >+ >+ /** >+ * @see org.eclipse.core.runtime.IProgressMonitor#subTask(java.lang.String) >+ */ >+ public void subTask(String name) { >+ } >+ >+ /** >+ * @see org.eclipse.core.runtime.IProgressMonitor#worked(int) >+ */ >+ public void worked(int work) { >+ } >+} >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java 1 Jan 1970 00:00:00 -0000 >@@ -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; >+ } >+} >+ >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamsProxy.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamsProxy.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamsProxy.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamsProxy.java 1 Jan 1970 00:00:00 -0000 >@@ -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; >+ } >+} >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/ContributedClasspathEntriesEntry.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/ContributedClasspathEntriesEntry.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/ContributedClasspathEntriesEntry.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/ContributedClasspathEntriesEntry.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,245 @@ >+/******************************************************************************* >+ * 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.io.FilenameFilter; >+import java.io.IOException; >+import java.net.MalformedURLException; >+import java.net.URL; >+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.ant.internal.launching.AntLaunching; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.FileLocator; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.jdt.internal.launching.AbstractRuntimeClasspathEntry; >+import org.eclipse.jdt.launching.IRuntimeClasspathEntry; >+import org.eclipse.jdt.launching.IVMInstall; >+import org.eclipse.jdt.launching.JavaRuntime; >+import org.eclipse.osgi.service.resolver.BundleDescription; >+import org.osgi.framework.Bundle; >+import org.w3c.dom.Document; >+import org.w3c.dom.Element; >+ >+/** >+ * A classpath entry that contains a contributed classpath entries >+ * via the <code>extraClasspathEntries</code> extension point. >+ * >+ * @since 3.0 >+ */ >+public class ContributedClasspathEntriesEntry extends AbstractRuntimeClasspathEntry { >+ >+ public static final String TYPE_ID = "org.eclipse.ant.ui.classpathentry.extraClasspathEntries"; //$NON-NLS-1$ >+ >+ public static List fgSWTEntries= null; >+ >+ /** >+ * Default contructor required to instantiate persisted extensions. >+ */ >+ public ContributedClasspathEntriesEntry() { >+ } >+ >+ /* (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 { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.internal.launching.IRuntimeClasspathEntry2#initializeFrom(org.w3c.dom.Element) >+ */ >+ public void initializeFrom(Element memento) throws CoreException { >+ } >+ >+ /* (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 { >+ boolean separateVM= AntLaunchingUtil.isSeparateJREAntBuild(configuration); >+ boolean setInputHandler= configuration.getAttribute(AntLaunching.SET_INPUTHANDLER, true); >+ AntCorePreferences prefs= AntCorePlugin.getPlugin().getPreferences(); >+ IAntClasspathEntry[] antClasspathEntries = prefs.getContributedClasspathEntries(); >+ IAntClasspathEntry[] userEntries = prefs.getAdditionalClasspathEntries(); >+ List rtes = new ArrayList(antClasspathEntries.length + userEntries.length); >+ IAntClasspathEntry entry; >+ for (int i = 0; i < antClasspathEntries.length; i++) { >+ entry= antClasspathEntries[i]; >+ if (!separateVM || (separateVM && !entry.isEclipseRuntimeRequired())) { >+ rtes.add(JavaRuntime.newStringVariableClasspathEntry(entry.getLabel())); >+ } >+ } >+ boolean haveToolsEntry= false; >+ String path; >+ for (int i = 0; i < userEntries.length; i++) { >+ entry = userEntries[i]; >+ path= entry.getLabel(); >+ IPath toolsPath= new Path(path); >+ if (toolsPath.lastSegment().equals("tools.jar")) { //$NON-NLS-1$ >+ haveToolsEntry= true; >+ // replace with dynamically resolved tools.jar based on >+ // the JRE being used >+ addToolsJar(configuration, rtes, path); >+ } else { >+ rtes.add(JavaRuntime.newStringVariableClasspathEntry(path)); >+ } >+ } >+ if (!haveToolsEntry) { >+ addToolsJar(configuration, rtes, null); >+ } >+ >+ if (setInputHandler && separateVM) { >+ addSWTJars(rtes); >+ } >+ >+ return (IRuntimeClasspathEntry[]) rtes.toArray(new IRuntimeClasspathEntry[rtes.size()]); >+ } >+ >+ private void addToolsJar(ILaunchConfiguration configuration, List rtes, String path) { >+ IRuntimeClasspathEntry tools = getToolsJar(configuration); >+ if (tools == null) { >+ if (path != null) { >+ //use the global entry >+ rtes.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(path))); >+ } else { >+ //use the default vm install to try to find a tools.jar >+ IVMInstall install= JavaRuntime.getDefaultVMInstall(); >+ if (install != null) { >+ IAntClasspathEntry entry = AntCorePlugin.getPlugin().getPreferences().getToolsJarEntry(new Path(install.getInstallLocation().getAbsolutePath())); >+ if (entry != null) { >+ rtes.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(entry.getEntryURL().getPath()))); >+ } >+ } >+ } >+ } else { >+ rtes.add(tools); >+ } >+ } >+ >+ private void addSWTJars(List rtes) { >+ if (fgSWTEntries == null) { >+ fgSWTEntries= new ArrayList(); >+ Bundle bundle= Platform.getBundle("org.eclipse.swt"); //$NON-NLS-1$ >+ BundleDescription description= Platform.getPlatformAdmin().getState(false).getBundle(bundle.getBundleId()); >+ BundleDescription[] fragments= description.getFragments(); >+ for (int i = 0; i < fragments.length; i++) { >+ Bundle fragmentBundle= Platform.getBundle(fragments[i].getName()); >+ URL bundleURL; >+ try { >+ bundleURL = FileLocator.resolve(fragmentBundle.getEntry("/")); //$NON-NLS-1$ >+ } catch (IOException e) { >+ AntLaunching.log(e); >+ continue; >+ } >+ String urlFileName= bundleURL.getFile(); >+ if (urlFileName.startsWith("file:")) { //$NON-NLS-1$ >+ try { >+ urlFileName= new URL(urlFileName).getFile(); >+ if (urlFileName.endsWith("!/")) { //$NON-NLS-1$ >+ urlFileName= urlFileName.substring(0, urlFileName.length() - 2); >+ } >+ } catch (MalformedURLException e) { >+ AntLaunching.log(e); >+ continue; >+ } >+ } >+ IPath fragmentPath= new Path(urlFileName); >+ if (fragmentPath.getFileExtension() != null) { //JAR file >+ fgSWTEntries.add(JavaRuntime.newArchiveRuntimeClasspathEntry(fragmentPath)); >+ } else { // folder >+ File bundleFolder= fragmentPath.toFile(); >+ if (!bundleFolder.isDirectory()) { >+ continue; >+ } >+ String[] names= bundleFolder.list(new FilenameFilter() { >+ public boolean accept(File dir, String name) { >+ return name.endsWith(".jar"); //$NON-NLS-1$ >+ } >+ }); >+ for (int j = 0; j < names.length; j++) { >+ String jarName = names[j]; >+ fgSWTEntries.add(JavaRuntime.newArchiveRuntimeClasspathEntry(fragmentPath.append(jarName))); >+ } >+ } >+ } >+ } >+ rtes.addAll(fgSWTEntries); >+ } >+ >+ /** >+ * Returns the tools.jar to use for this launch configuration, or <code>null</code> >+ * if none. >+ * >+ * @param configuration configuration to resolve a tools.jar for >+ * @return associated tools.jar archive, or <code>null</code> >+ */ >+ private IRuntimeClasspathEntry getToolsJar(ILaunchConfiguration configuration) { >+ try { >+ IVMInstall install = JavaRuntime.computeVMInstall(configuration); >+ if (install != null) { >+ IAntClasspathEntry entry = AntCorePlugin.getPlugin().getPreferences().getToolsJarEntry(new Path(install.getInstallLocation().getAbsolutePath())); >+ if (entry != null) { >+ return JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(entry.getEntryURL().getPath())); >+ } >+ } >+ } catch (CoreException ce) { >+ //likely dealing with a non-Java project >+ } >+ >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getName() >+ */ >+ public String getName() { >+ return AntLaunchConfigurationMessages.ContributedClasspathEntriesEntry_1; >+ } >+ /* (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 ContributedClasspathEntriesEntry; >+ } >+ /* (non-Javadoc) >+ * @see java.lang.Object#hashCode() >+ */ >+ public int hashCode() { >+ return getClass().hashCode(); >+ } >+} >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/MessageIds.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/MessageIds.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/MessageIds.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/MessageIds.java 1 Jan 1970 00:00:00 -0000 >@@ -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$ >+} >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntBuildListener.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntBuildListener.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntBuildListener.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntBuildListener.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,401 @@ >+/******************************************************************************* >+ * 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; >+ >+import java.io.BufferedReader; >+import java.io.IOException; >+import java.io.InputStreamReader; >+import java.net.ServerSocket; >+import java.net.Socket; >+import java.net.SocketException; >+import java.net.SocketTimeoutException; >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+import java.util.StringTokenizer; >+ >+import org.apache.tools.ant.Project; >+import org.eclipse.ant.internal.core.AbstractEclipseBuildLogger; >+import org.eclipse.ant.internal.launching.AntLaunch; >+import org.eclipse.ant.internal.launching.AntLaunching; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.ant.internal.launching.IAntLaunchingPreferenceConstants; >+import org.eclipse.core.runtime.ISafeRunnable; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.ILaunchesListener; >+import org.eclipse.debug.core.model.IProcess; >+ >+/** >+ * Parts adapted from org.eclipse.jdt.internal.junit.ui.RemoteTestRunnerClient >+ * The client side of the RemoteAntBuildLogger. Handles the marshalling of the >+ * different messages. >+ */ >+public class RemoteAntBuildListener implements ILaunchesListener { >+ public abstract class ListenerSafeRunnable implements ISafeRunnable { >+ public void handleException(Throwable exception) { >+ AntLaunching.log(exception); >+ } >+ } >+ >+ /** >+ * The server socket >+ */ >+ private ServerSocket fServerSocket; >+ private Socket fSocket; >+ private BufferedReader fBufferedReader; >+ private IProcess fProcess; >+ private String fProcessId; >+ private List fMessageQueue; >+ protected ILaunch fLaunch; >+ private String fLastFileName = null; >+ private String fLastTaskName = null; >+ private boolean fBuildFailed = false; >+ >+ /** >+ * Reads the message stream from the RemoteAntBuildLogger >+ */ >+ private class ServerConnection extends Thread { >+ private int fServerPort; >+ >+ public ServerConnection(int port) { >+ super("Ant Build Server Connection"); //$NON-NLS-1$ >+ setDaemon(true); >+ fServerPort = port; >+ } >+ >+ public void run() { >+ Exception exception = null; >+ try { >+ fServerSocket = new ServerSocket(fServerPort); >+ >+ int socketTimeout = Platform >+ .getPreferencesService() >+ .getInt( >+ AntLaunching.getUniqueIdentifier(), >+ IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, >+ 20000, null); >+ fServerSocket.setSoTimeout(socketTimeout); >+ fSocket = fServerSocket.accept(); >+ fBufferedReader = new BufferedReader(new InputStreamReader( >+ fSocket.getInputStream(), "UTF-8")); //$NON-NLS-1$ >+ String message; >+ while (fBufferedReader != null >+ && (message = fBufferedReader.readLine()) != null) { >+ receiveMessage(message); >+ } >+ } catch (SocketException e) { >+ } catch (SocketTimeoutException e) { >+ exception = e; >+ } catch (IOException e) { >+ // fall through >+ exception = e; >+ } >+ if (exception != null) { >+ AntLaunching.log(exception); >+ } >+ shutDown(); >+ } >+ } >+ >+ public RemoteAntBuildListener(ILaunch launch) { >+ super(); >+ fLaunch = launch; >+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); >+ } >+ >+ /** >+ * Start listening to an Ant build. Start a server connection that the >+ * RemoteAntBuildLogger can connect to. >+ * >+ * @param eventPort >+ * The port number to create the server connection on >+ */ >+ public synchronized void startListening(int eventPort) { >+ ServerConnection connection = new ServerConnection(eventPort); >+ connection.start(); >+ } >+ >+ protected synchronized void shutDown() { >+ fLaunch = null; >+ if (DebugPlugin.getDefault() != null) { >+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener( >+ this); >+ } >+ try { >+ if (fBufferedReader != null) { >+ fBufferedReader.close(); >+ fBufferedReader = null; >+ } >+ } catch (IOException e) { >+ } >+ try { >+ if (fSocket != null) { >+ fSocket.close(); >+ fSocket = null; >+ } >+ } catch (IOException e) { >+ } >+ try { >+ if (fServerSocket != null) { >+ fServerSocket.close(); >+ fServerSocket = null; >+ } >+ } catch (IOException e) { >+ } >+ } >+ >+ protected void receiveMessage(String message) { >+ if (message.startsWith(MessageIds.TASK)) { >+ receiveTaskMessage(message); >+ } else if (message.startsWith(MessageIds.TARGET)) { >+ receiveTargetMessage(message); >+ } else if (message.startsWith(MessageIds.PROCESS_ID)) { >+ message = message.substring(MessageIds.PROCESS_ID.length()); >+ fProcessId = message; >+ } else { >+ int index = message.indexOf(','); >+ if (index > 0) { >+ int priority = Integer.parseInt(message.substring(0, index)); >+ message = message.substring(index + 1); >+ writeMessage( >+ message + System.getProperty("line.separator"), priority); //$NON-NLS-1$ >+ if (message.startsWith("BUILD FAILED")) { //$NON-NLS-1$ >+ fBuildFailed = true; >+ } else if (fBuildFailed) { >+ if (message.startsWith("Total time:")) { //$NON-NLS-1$ >+ fBuildFailed = false; >+ } else { >+ AntLaunchingUtil.linkBuildFailedMessage(message, >+ getProcess()); >+ } >+ } >+ >+ } >+ } >+ } >+ >+ private void receiveTargetMessage(String message) { >+ message = message.substring(MessageIds.TARGET.length()); >+ StringTokenizer tokenizer = new StringTokenizer(message, ","); //$NON-NLS-1$ >+ message = tokenizer.nextToken(); >+ if (tokenizer.hasMoreTokens()) { >+ int locationLength = Integer.parseInt(tokenizer.nextToken()); >+ String location = tokenizer.nextToken(); >+ while (location.length() < locationLength) { // path with a comma in >+ // it >+ location += ","; //$NON-NLS-1$ >+ location += tokenizer.nextToken(); >+ } >+ int lineNumber = Integer.parseInt(tokenizer.nextToken()); >+ generateLink(message, location, lineNumber, 0, message.length() - 1); >+ } >+ writeMessage( >+ message + System.getProperty("line.separator"), Project.MSG_INFO); //$NON-NLS-1$ >+ } >+ >+ private void receiveTaskMessage(String message) { >+ message = message.substring(MessageIds.TASK.length()); >+ >+ int index = message.indexOf(','); >+ int priority = Integer.parseInt(message.substring(0, index)); >+ int index2 = message.indexOf(',', index + 1); >+ String taskName = message.substring(index + 1, index2); >+ if (taskName.length() == 0) { >+ taskName = fLastTaskName; >+ } >+ int index3 = message.indexOf(',', index2 + 1); >+ int lineLength = Integer >+ .parseInt(message.substring(index2 + 1, index3)); >+ int index4 = index3 + 1 + lineLength; >+ >+ String line = message.substring(index3 + 1, index4); >+ StringBuffer labelBuff = new StringBuffer(); >+ labelBuff.append('['); >+ labelBuff.append(taskName); >+ labelBuff.append("] "); //$NON-NLS-1$ >+ labelBuff.append(line); >+ line = labelBuff.toString(); >+ >+ fLastTaskName = taskName; >+ >+ int locationIndex = message.indexOf(',', index4 + 1); >+ int finalIndex = locationIndex + 1; >+ String fileName = message.substring(index4 + 1, locationIndex); >+ int locationLength = 0; >+ if (fileName.length() == 0) { >+ fileName = fLastFileName; >+ } else { >+ finalIndex = message.indexOf(',', locationIndex) + 1; >+ locationLength = Integer.parseInt(fileName); >+ fileName = message.substring(finalIndex, finalIndex >+ + locationLength); >+ locationLength += 1; // set past delimiter >+ } >+ fLastFileName = fileName; >+ int lineNumber = Integer.parseInt(message.substring(finalIndex >+ + locationLength)); >+ >+ int size = AntLaunching.LEFT_COLUMN_SIZE >+ - (taskName.length() + 3); >+ int offset = Math.max(size - 2, 1); >+ int length = AntLaunching.LEFT_COLUMN_SIZE - size - 3; >+ if (fileName != null) { >+ generateLink(line, fileName, lineNumber, offset, length); >+ } >+ >+ StringBuffer fullMessage = new StringBuffer(); >+ adornMessage(taskName, line, fullMessage); >+ writeMessage( >+ fullMessage >+ .append(System.getProperty("line.separator")).toString(), priority); //$NON-NLS-1$ >+ } >+ >+ private void generateLink(String line, String fileName, int lineNumber, >+ int offset, int length) { >+ ((AntLaunch) fLaunch).addLinkDescriptor(line, fileName, lineNumber, >+ offset, length); >+ } >+ >+ /** >+ * Returns the associated process, finding it if necessary. >+ */ >+ protected IProcess getProcess() { >+ if (fProcess == null) { >+ if (fProcessId != null) { >+ IProcess[] all = DebugPlugin.getDefault().getLaunchManager() >+ .getProcesses(); >+ for (int i = 0; i < all.length; i++) { >+ IProcess process = all[i]; >+ if (fProcessId >+ .equals(process >+ .getAttribute(AbstractEclipseBuildLogger.ANT_PROCESS_ID))) { >+ fProcess = process; >+ break; >+ } >+ } >+ } >+ } >+ return fProcess; >+ } >+ >+ private AntStreamMonitor getMonitor(int priority) { >+ IProcess process = getProcess(); >+ if (process == null) { >+ return null; >+ } >+ AntStreamsProxy proxy = (AntStreamsProxy) process.getStreamsProxy(); >+ if (proxy == null) { >+ return null; >+ } >+ AntStreamMonitor monitor = null; >+ switch (priority) { >+ case Project.MSG_INFO: >+ monitor = (AntStreamMonitor) proxy.getOutputStreamMonitor(); >+ break; >+ case Project.MSG_ERR: >+ monitor = (AntStreamMonitor) proxy.getErrorStreamMonitor(); >+ break; >+ case Project.MSG_DEBUG: >+ monitor = (AntStreamMonitor) proxy.getDebugStreamMonitor(); >+ break; >+ case Project.MSG_WARN: >+ monitor = (AntStreamMonitor) proxy.getWarningStreamMonitor(); >+ break; >+ case Project.MSG_VERBOSE: >+ monitor = (AntStreamMonitor) proxy.getVerboseStreamMonitor(); >+ break; >+ } >+ return monitor; >+ } >+ >+ /** >+ * Builds a right justified task prefix for the given build event, placing >+ * it in the given string buffer. >+ * >+ * @param event >+ * build event >+ * @param fullMessage >+ * buffer to place task prefix in >+ */ >+ private void adornMessage(String taskName, String line, >+ StringBuffer fullMessage) { >+ if (taskName == null) { >+ taskName = "null"; //$NON-NLS-1$ >+ } >+ >+ int size = AntLaunching.LEFT_COLUMN_SIZE >+ - (taskName.length() + 6); >+ for (int i = 0; i < size; i++) { >+ fullMessage.append(' '); >+ } >+ >+ fullMessage.append(line); >+ } >+ >+ protected void writeMessage(String message, int priority) { >+ AntStreamMonitor monitor = getMonitor(priority); >+ if (monitor == null) { >+ if (fMessageQueue == null) { >+ fMessageQueue = new ArrayList(); >+ } >+ fMessageQueue.add(message); >+ return; >+ } >+ if (fMessageQueue != null) { >+ for (Iterator iter = fMessageQueue.iterator(); iter.hasNext();) { >+ String oldMessage = (String) iter.next(); >+ monitor.append(oldMessage); >+ } >+ fMessageQueue = null; >+ } >+ monitor.append(message); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.ILaunchesListener#launchesAdded(org.eclipse.debug >+ * .core.ILaunch[]) >+ */ >+ public void launchesAdded(ILaunch[] launches) { >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.ILaunchesListener#launchesChanged(org.eclipse. >+ * debug.core.ILaunch[]) >+ */ >+ public void launchesChanged(ILaunch[] launches) { >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.ILaunchesListener#launchesRemoved(org.eclipse. >+ * debug.core.ILaunch[]) >+ */ >+ public void launchesRemoved(ILaunch[] launches) { >+ for (int i = 0; i < launches.length; i++) { >+ ILaunch launch = launches[i]; >+ if (launch.equals(fLaunch)) { >+ shutDown(); >+ return; >+ } >+ } >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntProcessFactory.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntProcessFactory.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntProcessFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntProcessFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -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); >+ } >+} >Index: src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntRuntimeProcess.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntRuntimeProcess.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntRuntimeProcess.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/RemoteAntRuntimeProcess.java 1 Jan 1970 00:00:00 -0000 >@@ -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(); >+ } >+} >Index: src/org/eclipse/ant/launching/IAntLaunchConstants.java >=================================================================== >RCS file: src/org/eclipse/ant/launching/IAntLaunchConstants.java >diff -N src/org/eclipse/ant/launching/IAntLaunchConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/launching/IAntLaunchConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -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$ >+ >+} >Index: src/org/eclipse/ant/launching/package.html >=================================================================== >RCS file: src/org/eclipse/ant/launching/package.html >diff -N src/org/eclipse/ant/launching/package.html >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/launching/package.html 1 Jan 1970 00:00:00 -0000 >@@ -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> >#P org.eclipse.ant.tests.ui >Index: Ant Debug Tests/org/eclipse/ant/tests/ui/debug/AbstractAntDebugTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/AbstractAntDebugTest.java,v >retrieving revision 1.12 >diff -u -r1.12 AbstractAntDebugTest.java >--- Ant Debug Tests/org/eclipse/ant/tests/ui/debug/AbstractAntDebugTest.java 6 Jul 2009 16:44:59 -0000 1.12 >+++ Ant Debug Tests/org/eclipse/ant/tests/ui/debug/AbstractAntDebugTest.java 7 Oct 2009 20:08:16 -0000 >@@ -10,10 +10,10 @@ > *******************************************************************************/ > package org.eclipse.ant.tests.ui.debug; > >-import org.eclipse.ant.internal.ui.debug.model.AntDebugTarget; >-import org.eclipse.ant.internal.ui.debug.model.AntLineBreakpoint; >-import org.eclipse.ant.internal.ui.debug.model.AntStackFrame; >-import org.eclipse.ant.internal.ui.debug.model.AntThread; >+import org.eclipse.ant.internal.launching.debug.model.AntDebugTarget; >+import org.eclipse.ant.internal.launching.debug.model.AntLineBreakpoint; >+import org.eclipse.ant.internal.launching.debug.model.AntStackFrame; >+import org.eclipse.ant.internal.launching.debug.model.AntThread; > import org.eclipse.ant.tests.ui.AbstractAntUIBuildTest; > import org.eclipse.ant.tests.ui.testplugin.DebugElementKindEventWaiter; > import org.eclipse.ant.tests.ui.testplugin.DebugEventWaiter; >@@ -307,7 +307,7 @@ > */ > protected AntDebugTarget debugLaunchAndTerminate(ILaunchConfiguration config, int timeout) throws Exception { > DebugEventWaiter waiter= new DebugElementKindEventWaiter(DebugEvent.TERMINATE, AntDebugTarget.class); >- waiter.setTimeout(timeout); >+ waiter.setTimeout(2000000000); > > Object terminatee = launchAndWait(config, waiter); > assertNotNull("Program did not terminate.", terminatee); >Index: Ant Debug Tests/org/eclipse/ant/tests/ui/debug/BreakpointTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/BreakpointTests.java,v >retrieving revision 1.11 >diff -u -r1.11 BreakpointTests.java >--- Ant Debug Tests/org/eclipse/ant/tests/ui/debug/BreakpointTests.java 13 Aug 2008 15:32:16 -0000 1.11 >+++ Ant Debug Tests/org/eclipse/ant/tests/ui/debug/BreakpointTests.java 7 Oct 2009 20:08:16 -0000 >@@ -13,9 +13,9 @@ > import java.util.ArrayList; > import java.util.List; > >-import org.eclipse.ant.internal.ui.debug.model.AntDebugTarget; >-import org.eclipse.ant.internal.ui.debug.model.AntThread; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.internal.launching.debug.model.AntDebugTarget; >+import org.eclipse.ant.internal.launching.debug.model.AntThread; >+import org.eclipse.ant.launching.IAntLaunchConstants; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugException; >@@ -116,7 +116,7 @@ > } > ILaunchConfiguration config= getLaunchConfiguration(fileName); > ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, "entry1,entry2"); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, "entry1,entry2"); > thread= launchToLineBreakpoint(copy, bp); > bp.setEnabled(false); > if (sepVM) { >@@ -200,7 +200,7 @@ > } > ILaunchConfiguration config= getLaunchConfiguration(fileName); > ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, defaultTargetName); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, defaultTargetName); > if (!sepVM) { > Thread.sleep(3000); //TODO bug 121207: wait for previous launch to fully terminate > } >Index: Ant Debug Tests/org/eclipse/ant/tests/ui/debug/PropertyTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/PropertyTests.java,v >retrieving revision 1.12 >diff -u -r1.12 PropertyTests.java >--- Ant Debug Tests/org/eclipse/ant/tests/ui/debug/PropertyTests.java 13 Aug 2008 15:32:16 -0000 1.12 >+++ Ant Debug Tests/org/eclipse/ant/tests/ui/debug/PropertyTests.java 7 Oct 2009 20:08:16 -0000 >@@ -10,11 +10,11 @@ > *******************************************************************************/ > package org.eclipse.ant.tests.ui.debug; > >-import org.eclipse.ant.internal.ui.debug.model.AntProperty; >-import org.eclipse.ant.internal.ui.debug.model.AntStackFrame; >-import org.eclipse.ant.internal.ui.debug.model.AntThread; >-import org.eclipse.ant.internal.ui.debug.model.AntValue; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.internal.launching.debug.model.AntProperty; >+import org.eclipse.ant.internal.launching.debug.model.AntStackFrame; >+import org.eclipse.ant.internal.launching.debug.model.AntThread; >+import org.eclipse.ant.internal.launching.debug.model.AntValue; >+import org.eclipse.ant.launching.IAntLaunchConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugException; > import org.eclipse.debug.core.ILaunchConfiguration; >@@ -48,7 +48,7 @@ > } > ILaunchConfiguration config= getLaunchConfiguration(fileName); > ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, "properties"); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, "properties"); > thread= launchToLineBreakpoint(copy, bp); > > AntStackFrame frame = (AntStackFrame)thread.getTopStackFrame(); >@@ -82,7 +82,7 @@ > } > ILaunchConfiguration config= getLaunchConfiguration(fileName); > ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, "properties"); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, "properties"); > thread= launchToLineBreakpoint(copy, bp); > > AntStackFrame frame = (AntStackFrame)thread.getTopStackFrame(); >@@ -118,7 +118,7 @@ > } > ILaunchConfiguration config= getLaunchConfiguration(fileName); > ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, "properties"); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, "properties"); > thread= launchToLineBreakpoint(copy, bp); > > AntStackFrame frame = (AntStackFrame)thread.getTopStackFrame(); >Index: Ant Debug Tests/org/eclipse/ant/tests/ui/debug/RunToLineTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/RunToLineTests.java,v >retrieving revision 1.9 >diff -u -r1.9 RunToLineTests.java >--- Ant Debug Tests/org/eclipse/ant/tests/ui/debug/RunToLineTests.java 4 May 2009 16:11:03 -0000 1.9 >+++ Ant Debug Tests/org/eclipse/ant/tests/ui/debug/RunToLineTests.java 7 Oct 2009 20:08:16 -0000 >@@ -10,8 +10,8 @@ > *******************************************************************************/ > package org.eclipse.ant.tests.ui.debug; > >-import org.eclipse.ant.internal.ui.debug.model.AntLineBreakpoint; >-import org.eclipse.ant.internal.ui.debug.model.AntThread; >+import org.eclipse.ant.internal.launching.debug.model.AntLineBreakpoint; >+import org.eclipse.ant.internal.launching.debug.model.AntThread; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugEvent; > import org.eclipse.debug.core.model.IStackFrame; >Index: Ant Debug Tests/org/eclipse/ant/tests/ui/debug/StackTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/StackTests.java,v >retrieving revision 1.4 >diff -u -r1.4 StackTests.java >--- Ant Debug Tests/org/eclipse/ant/tests/ui/debug/StackTests.java 10 Feb 2006 18:11:13 -0000 1.4 >+++ Ant Debug Tests/org/eclipse/ant/tests/ui/debug/StackTests.java 7 Oct 2009 20:08:16 -0000 >@@ -10,7 +10,7 @@ > *******************************************************************************/ > package org.eclipse.ant.tests.ui.debug; > >-import org.eclipse.ant.internal.ui.debug.model.AntThread; >+import org.eclipse.ant.internal.launching.debug.model.AntThread; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.model.ILineBreakpoint; >Index: Ant Debug Tests/org/eclipse/ant/tests/ui/debug/SteppingTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/SteppingTests.java,v >retrieving revision 1.11 >diff -u -r1.11 SteppingTests.java >--- Ant Debug Tests/org/eclipse/ant/tests/ui/debug/SteppingTests.java 28 Mar 2006 16:01:17 -0000 1.11 >+++ Ant Debug Tests/org/eclipse/ant/tests/ui/debug/SteppingTests.java 7 Oct 2009 20:08:16 -0000 >@@ -10,8 +10,8 @@ > *******************************************************************************/ > package org.eclipse.ant.tests.ui.debug; > >-import org.eclipse.ant.internal.ui.debug.model.AntStackFrame; >-import org.eclipse.ant.internal.ui.debug.model.AntThread; >+import org.eclipse.ant.internal.launching.debug.model.AntStackFrame; >+import org.eclipse.ant.internal.launching.debug.model.AntThread; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugEvent; > import org.eclipse.debug.core.DebugException; >Index: Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildTest.java,v >retrieving revision 1.9 >diff -u -r1.9 AbstractAntUIBuildTest.java >--- Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildTest.java 23 Feb 2005 16:29:14 -0000 1.9 >+++ Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildTest.java 7 Oct 2009 20:08:16 -0000 >@@ -81,7 +81,7 @@ > * @return thread in which the first suspend event occurred > */ > protected void launch(ILaunchConfiguration config) throws CoreException { >- launchAndTerminate(config, 20000); >+ launchAndTerminate(config, 200000); > } > > protected void activateLink(final IHyperlink link) { >Index: Ant Tests/org/eclipse/ant/tests/ui/AntUtilTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AntUtilTests.java,v >retrieving revision 1.4 >diff -u -r1.4 AntUtilTests.java >--- Ant Tests/org/eclipse/ant/tests/ui/AntUtilTests.java 13 Aug 2008 15:32:16 -0000 1.4 >+++ Ant Tests/org/eclipse/ant/tests/ui/AntUtilTests.java 7 Oct 2009 20:08:17 -0000 >@@ -16,12 +16,12 @@ > > import org.eclipse.ant.internal.ui.AntUtil; > import org.eclipse.ant.internal.ui.model.AntTargetNode; >+import org.eclipse.ant.launching.IAntLaunchConstants; > import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > public class AntUtilTests extends AbstractAntUITest { > >@@ -101,10 +101,10 @@ > copy.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments); > } > if (properties != null) { >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES, properties); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTIES, properties); > } > if (propertyFiles != null) { >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTY_FILES, propertyFiles); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTY_FILES, propertyFiles); > } > return copy; > } >Index: Ant Tests/org/eclipse/ant/tests/ui/BuildTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/BuildTests.java,v >retrieving revision 1.24 >diff -u -r1.24 BuildTests.java >--- Ant Tests/org/eclipse/ant/tests/ui/BuildTests.java 13 Aug 2008 15:32:16 -0000 1.24 >+++ Ant Tests/org/eclipse/ant/tests/ui/BuildTests.java 7 Oct 2009 20:08:17 -0000 >@@ -18,8 +18,8 @@ > > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; > import org.eclipse.ant.tests.ui.testplugin.ConsoleLineTracker; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchConfiguration; >@@ -41,7 +41,7 @@ > */ > public void testOutput() throws CoreException { > launch("echoing"); >- assertTrue("Incorrect number of messages logged for build. Should be 8. Was " + ConsoleLineTracker.getNumberOfMessages(), ConsoleLineTracker.getNumberOfMessages() == 8); >+ assertTrue("Incorrect number of messages logged for build. Should be 8. Was " + ConsoleLineTracker.getNumberOfMessages(), ConsoleLineTracker.getNumberOfMessages() == 8); > String message= ConsoleLineTracker.getMessage(6); > assertTrue("Incorrect last message. Should start with Total time:. Message: " + message, message.startsWith("Total time:")); > } >@@ -143,8 +143,8 @@ > ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); > Map properties= new HashMap(1); > properties.put("platform.location", "${workspace_loc}"); >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES, properties); >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES, properties); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTIES, properties); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTIES, properties); > launchAndTerminate(copy, 20000); > ConsoleLineTracker.waitForConsole(); > assertTrue("Incorrect number of messages logged for build. Should be 8. Was " + ConsoleLineTracker.getNumberOfMessages(), ConsoleLineTracker.getNumberOfMessages() == 8); >Index: Ant Tests/org/eclipse/ant/tests/ui/performance/OpenLaunchConfigurationDialogTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/performance/OpenLaunchConfigurationDialogTests.java,v >retrieving revision 1.12 >diff -u -r1.12 OpenLaunchConfigurationDialogTests.java >--- Ant Tests/org/eclipse/ant/tests/ui/performance/OpenLaunchConfigurationDialogTests.java 8 Mar 2006 16:46:42 -0000 1.12 >+++ Ant Tests/org/eclipse/ant/tests/ui/performance/OpenLaunchConfigurationDialogTests.java 7 Oct 2009 20:08:17 -0000 >@@ -14,6 +14,7 @@ > import org.eclipse.ant.internal.ui.IAntUIConstants; > import org.eclipse.ant.tests.ui.editor.performance.EditorTestHelper; > import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; >@@ -26,7 +27,6 @@ > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.test.performance.Dimension; > import org.eclipse.test.performance.PerformanceTestCase; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > public class OpenLaunchConfigurationDialogTests extends PerformanceTestCase { > >Index: Ant Tests/org/eclipse/ant/tests/ui/performance/SeparateVMTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/performance/SeparateVMTests.java,v >retrieving revision 1.11 >diff -u -r1.11 SeparateVMTests.java >--- Ant Tests/org/eclipse/ant/tests/ui/performance/SeparateVMTests.java 28 Apr 2009 16:58:34 -0000 1.11 >+++ Ant Tests/org/eclipse/ant/tests/ui/performance/SeparateVMTests.java 7 Oct 2009 20:08:17 -0000 >@@ -15,12 +15,12 @@ > import junit.framework.TestSuite; > > import org.eclipse.ant.tests.ui.AbstractAntUIBuildPerformanceTest; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.debug.ui.IDebugUIConstants; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > public class SeparateVMTests extends AbstractAntUIBuildPerformanceTest { > >Index: Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java,v >retrieving revision 1.44 >diff -u -r1.44 SeparateVMTests.java >--- Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java 4 May 2009 16:11:03 -0000 1.44 >+++ Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java 7 Oct 2009 20:08:17 -0000 >@@ -21,10 +21,10 @@ > > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; > import org.eclipse.ant.tests.ui.AbstractAntUIBuildTest; > import org.eclipse.ant.tests.ui.testplugin.ConsoleLineTracker; > import org.eclipse.ant.tests.ui.testplugin.ProjectHelper; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >@@ -158,7 +158,7 @@ > assertNotNull("Could not locate launch configuration for " + "echoingSepVM", config); > ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); > copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, getJavaProject().getProject().getLocation().toOSString()); >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, "Bug42984"); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, "Bug42984"); > launchAndTerminate(copy, 20000); > ConsoleLineTracker.waitForConsole(); > assertTrue("Incorrect number of messages logged for build. Should be 6. Was " + ConsoleLineTracker.getNumberOfMessages(), ConsoleLineTracker.getNumberOfMessages() == 6); >@@ -175,7 +175,7 @@ > ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); > Map properties= new HashMap(1); > properties.put("platform.location", "${workspace_loc}"); >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES, properties); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTIES, properties); > launchAndTerminate(copy, 20000); > ConsoleLineTracker.waitForConsole(); > assertTrue("Incorrect number of messages logged for build. Should be 6. Was " + ConsoleLineTracker.getNumberOfMessages(), ConsoleLineTracker.getNumberOfMessages() == 6); >Index: External Tools/org/eclipse/ant/tests/ui/externaltools/MigrationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/External Tools/org/eclipse/ant/tests/ui/externaltools/MigrationTests.java,v >retrieving revision 1.8 >diff -u -r1.8 MigrationTests.java >--- External Tools/org/eclipse/ant/tests/ui/externaltools/MigrationTests.java 13 Aug 2008 15:32:16 -0000 1.8 >+++ External Tools/org/eclipse/ant/tests/ui/externaltools/MigrationTests.java 7 Oct 2009 20:08:17 -0000 >@@ -15,15 +15,15 @@ > > import junit.framework.TestCase; > >-import org.eclipse.ant.internal.ui.AntUtil; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.registry.ExternalToolMigration; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.debug.ui.IDebugUIConstants; > import org.eclipse.debug.ui.RefreshTab; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >-import org.eclipse.ui.externaltools.internal.registry.ExternalToolMigration; > > /** > * Tests migration of Ant and External Tool configurations from old >@@ -42,11 +42,11 @@ > ILaunchConfigurationWorkingCopy config = ExternalToolMigration.configFromArgumentMap(argumentMap); > assertNotNull("Migration failed", config); > >- assertEquals("Wrong configuration type", IAntLaunchConfigurationConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE, config.getType().getIdentifier()); >+ assertEquals("Wrong configuration type", IAntLaunchConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE, config.getType().getIdentifier()); > assertEquals("ant tool", config.getName()); > assertEquals("location", config.getAttribute(IExternalToolConstants.ATTR_LOCATION, "")); > assertEquals("refresh scope", config.getAttribute(RefreshTab.ATTR_REFRESH_SCOPE, "")); >- String[] targets= AntUtil.getTargetNames(config); >+ String[] targets= AntLaunchingUtil.getTargetNames(config); > assertNotNull("No targets found", targets); > assertEquals("Wrong number of targets", 2, targets.length); > assertEquals("target1", targets[0]); >@@ -131,7 +131,7 @@ > ILaunchConfigurationWorkingCopy config = ExternalToolMigration.configFromArgumentMap(argumentMap); > assertNotNull("Migration failed", config); > >- assertEquals("Wrong config type", IAntLaunchConfigurationConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE, config.getType().getIdentifier()); >+ assertEquals("Wrong config type", IAntLaunchConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE, config.getType().getIdentifier()); > assertEquals("ant config", config.getName()); > assertEquals("location", config.getAttribute(IExternalToolConstants.ATTR_LOCATION, "")); > assertEquals("working directory", config.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, "")); >@@ -143,7 +143,7 @@ > assertEquals(true, config.getAttribute(RefreshTab.ATTR_REFRESH_RECURSIVE, false)); > assertEquals("build kinds", config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, "")); > assertEquals("arg1 arg2", config.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, "")); >- String[] targets= AntUtil.getTargetNames(config); >+ String[] targets= AntLaunchingUtil.getTargetNames(config); > assertEquals("Wrong number of targets", 2, targets.length); > assertEquals("target1", targets[0]); > assertEquals("target2", targets[1]); >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.1 >diff -u -r1.1 MANIFEST.MF >--- META-INF/MANIFEST.MF 17 Mar 2008 20:22:01 -0000 1.1 >+++ META-INF/MANIFEST.MF 7 Oct 2009 20:08:17 -0000 >@@ -35,5 +35,7 @@ > org.eclipse.ant.ui, > org.eclipse.core.runtime, > org.eclipse.test.performance, >- org.eclipse.ui.console >+ org.eclipse.ui.console, >+ org.eclipse.ant.launching;bundle-version="1.0.0", >+ org.eclipse.core.externaltools;bundle-version="1.0.0" > Bundle-ActivationPolicy: lazy >Index: test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java,v >retrieving revision 1.32 >diff -u -r1.32 AbstractAntUITest.java >--- test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java 4 May 2009 16:11:03 -0000 1.32 >+++ test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java 7 Oct 2009 20:08:17 -0000 >@@ -30,6 +30,7 @@ > import org.eclipse.ant.internal.ui.model.AntModel; > import org.eclipse.ant.tests.ui.editor.support.TestLocationProvider; > import org.eclipse.ant.tests.ui.editor.support.TestProblemRequestor; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IFolder; > import org.eclipse.core.resources.IProject; >@@ -53,7 +54,6 @@ > import org.eclipse.jface.text.Position; > import org.eclipse.swt.graphics.Color; > import org.eclipse.ui.console.IHyperlink; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition; > import org.eclipse.ui.internal.console.IOConsolePartition; > import org.xml.sax.InputSource; >@@ -274,7 +274,7 @@ > protected void launch(String buildFileName) throws CoreException { > ILaunchConfiguration config = getLaunchConfiguration(buildFileName); > assertNotNull("Could not locate launch configuration for " + buildFileName, config); >- launchAndTerminate(config, 20000); >+ launchAndTerminate(config, 2000000); > } > > /** >@@ -393,7 +393,7 @@ > */ > protected void launchAndTerminate(ILaunchConfiguration config, int timeout) throws CoreException { > DebugEventWaiter waiter= new DebugElementKindEventWaiter(DebugEvent.TERMINATE, IProcess.class); >- waiter.setTimeout(timeout); >+ waiter.setTimeout(40000); > > Object terminatee = launchAndWait(config, waiter); > assertNotNull("Program did not terminate.", terminatee); >Index: test plugin/org/eclipse/ant/tests/ui/testplugin/ProjectHelper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/ProjectHelper.java,v >retrieving revision 1.7 >diff -u -r1.7 ProjectHelper.java >--- test plugin/org/eclipse/ant/tests/ui/testplugin/ProjectHelper.java 4 May 2009 16:11:03 -0000 1.7 >+++ test plugin/org/eclipse/ant/tests/ui/testplugin/ProjectHelper.java 7 Oct 2009 20:08:17 -0000 >@@ -19,7 +19,8 @@ > import java.util.List; > > import org.eclipse.ant.internal.ui.IAntUIConstants; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.resources.IFolder; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IProjectDescription; >@@ -40,7 +41,6 @@ > import org.eclipse.jdt.launching.IVMInstall; > import org.eclipse.jdt.launching.JavaRuntime; > import org.eclipse.ui.dialogs.IOverwriteQuery; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider; > import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider; > import org.eclipse.ui.wizards.datatransfer.ImportOperation; >@@ -167,10 +167,10 @@ > */ > public static void createLaunchConfigurationForSeparateVM(String launchConfigName, String buildFileName) throws Exception { > String bf = buildFileName; >- ILaunchConfigurationType type = AbstractAntUITest.getLaunchManager().getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); >+ ILaunchConfigurationType type = AbstractAntUITest.getLaunchManager().getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); > ILaunchConfigurationWorkingCopy config = type.newInstance(AbstractAntUITest.getJavaProject().getProject().getFolder("launchConfigurations"), launchConfigName); > >- config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"); //$NON-NLS-1$ >+ config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.eclipse.ant.internal.launching.remote.InternalAntRunner"); //$NON-NLS-1$ > config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, "org.eclipse.ant.ui.AntClasspathProvider"); //$NON-NLS-1$ > config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, AbstractAntUITest.getJavaProject().getElementName()); > if (bf == null) { >@@ -216,7 +216,7 @@ > * @throws CoreException > */ > public static ILaunchConfiguration createLaunchConfiguration(String launchConfigName, String path) throws CoreException { >- ILaunchConfigurationType type = AbstractAntUITest.getLaunchManager().getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); >+ ILaunchConfigurationType type = AbstractAntUITest.getLaunchManager().getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); > ILaunchConfigurationWorkingCopy config = type.newInstance(AbstractAntUITest.getJavaProject().getProject().getFolder("launchConfigurations"), launchConfigName); > > config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, AbstractAntUITest.getJavaProject().getElementName()); >#P org.eclipse.ant.ui >Index: .classpath >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/.classpath,v >retrieving revision 1.25 >diff -u -r1.25 .classpath >--- .classpath 11 May 2006 21:57:47 -0000 1.25 >+++ .classpath 7 Oct 2009 20:08:19 -0000 >@@ -1,10 +1,9 @@ > <?xml version="1.0" encoding="UTF-8"?> > <classpath> > <classpathentry kind="src" path="Ant Tools Support"/> >- <classpathentry output="ant_runner_support_bin" kind="src" path="Ant Runner Support"/> >+ <classpathentry kind="src" output="ant_runner_support_bin" path="Ant Runner Support"/> > <classpathentry kind="src" path="Ant Editor"/> >- <classpathentry output="remote_support_bin" kind="src" path="Remote Ant Support"/> >- <classpathentry output="common_ant_support_bin" kind="src" path="Common Ant Support"/> >+ <classpathentry kind="src" output="remote_support_bin" path="Remote Ant Support"/> > <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="output" path="bin"/> >Index: Ant Editor/org/eclipse/ant/internal/ui/editor/actions/RunToLineAdapter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/actions/RunToLineAdapter.java,v >retrieving revision 1.7 >diff -u -r1.7 RunToLineAdapter.java >--- Ant Editor/org/eclipse/ant/internal/ui/editor/actions/RunToLineAdapter.java 11 Aug 2005 16:22:10 -0000 1.7 >+++ Ant Editor/org/eclipse/ant/internal/ui/editor/actions/RunToLineAdapter.java 7 Oct 2009 20:08:19 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * 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 >@@ -13,10 +13,10 @@ > import java.util.HashMap; > import java.util.Map; > >+import org.eclipse.ant.internal.launching.debug.IAntDebugConstants; >+import org.eclipse.ant.internal.launching.debug.model.AntDebugElement; >+import org.eclipse.ant.internal.launching.debug.model.AntLineBreakpoint; > import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.debug.IAntDebugConstants; >-import org.eclipse.ant.internal.ui.debug.model.AntDebugElement; >-import org.eclipse.ant.internal.ui.debug.model.AntLineBreakpoint; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IMarker; > import org.eclipse.core.runtime.CoreException; >Index: Ant Editor/org/eclipse/ant/internal/ui/editor/actions/ToggleLineBreakpointAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/actions/ToggleLineBreakpointAction.java,v >retrieving revision 1.5 >diff -u -r1.5 ToggleLineBreakpointAction.java >--- Ant Editor/org/eclipse/ant/internal/ui/editor/actions/ToggleLineBreakpointAction.java 23 Feb 2005 17:31:01 -0000 1.5 >+++ Ant Editor/org/eclipse/ant/internal/ui/editor/actions/ToggleLineBreakpointAction.java 7 Oct 2009 20:08:19 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2005 IBM Corporation and others. >+ * 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 >@@ -10,8 +10,8 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.editor.actions; > >-import org.eclipse.ant.internal.ui.debug.IAntDebugConstants; >-import org.eclipse.ant.internal.ui.debug.model.AntLineBreakpoint; >+import org.eclipse.ant.internal.launching.debug.IAntDebugConstants; >+import org.eclipse.ant.internal.launching.debug.model.AntLineBreakpoint; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugPlugin; >Index: Ant Editor/org/eclipse/ant/internal/ui/editor/text/AntAnnotationModel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/text/AntAnnotationModel.java,v >retrieving revision 1.4 >diff -u -r1.4 AntAnnotationModel.java >--- Ant Editor/org/eclipse/ant/internal/ui/editor/text/AntAnnotationModel.java 23 Feb 2005 17:31:01 -0000 1.4 >+++ Ant Editor/org/eclipse/ant/internal/ui/editor/text/AntAnnotationModel.java 7 Oct 2009 20:08:19 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2005 IBM Corporation and others. >+ * 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 >@@ -14,8 +14,8 @@ > import java.util.Iterator; > import java.util.List; > >+import org.eclipse.ant.internal.launching.debug.IAntDebugConstants; > import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.debug.IAntDebugConstants; > import org.eclipse.ant.internal.ui.editor.outline.AntEditorMarkerUpdater; > import org.eclipse.ant.internal.ui.model.IProblem; > import org.eclipse.ant.internal.ui.model.IProblemRequestor; >Index: Ant Editor/org/eclipse/ant/internal/ui/editor/text/XMLTextHover.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/text/XMLTextHover.java,v >retrieving revision 1.39 >diff -u -r1.39 XMLTextHover.java >--- Ant Editor/org/eclipse/ant/internal/ui/editor/text/XMLTextHover.java 28 Feb 2008 01:20:38 -0000 1.39 >+++ Ant Editor/org/eclipse/ant/internal/ui/editor/text/XMLTextHover.java 7 Oct 2009 20:08:19 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * 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 >@@ -18,23 +18,18 @@ > import org.apache.tools.ant.types.AbstractFileSet; > import org.apache.tools.ant.types.Path; > import org.apache.tools.ant.types.PatternSet; >- >-import org.eclipse.swt.widgets.Shell; >- >-import org.eclipse.ant.internal.ui.debug.model.AntProperty; >-import org.eclipse.ant.internal.ui.debug.model.AntStackFrame; >-import org.eclipse.ant.internal.ui.debug.model.AntValue; >+import org.eclipse.ant.internal.launching.debug.model.AntProperty; >+import org.eclipse.ant.internal.launching.debug.model.AntStackFrame; >+import org.eclipse.ant.internal.launching.debug.model.AntValue; > import org.eclipse.ant.internal.ui.editor.AntEditor; > import org.eclipse.ant.internal.ui.editor.AntEditorSourceViewerConfiguration; > import org.eclipse.ant.internal.ui.model.AntElementNode; > import org.eclipse.ant.internal.ui.model.AntModel; > import org.eclipse.ant.internal.ui.model.AntPropertyNode; > import org.eclipse.ant.internal.ui.model.IAntModel; >- > import org.eclipse.core.runtime.IAdaptable; >- >+import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.jface.internal.text.html.HTMLPrinter; >- > import org.eclipse.jface.text.BadLocationException; > import org.eclipse.jface.text.DefaultInformationControl; > import org.eclipse.jface.text.IDocument; >@@ -50,11 +45,9 @@ > import org.eclipse.jface.text.source.Annotation; > import org.eclipse.jface.text.source.IAnnotationModel; > import org.eclipse.jface.text.source.ISourceViewer; >- >+import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.editors.text.EditorsUI; > >-import org.eclipse.debug.ui.DebugUITools; >- > > public class XMLTextHover implements ITextHover, ITextHoverExtension, IInformationProviderExtension2 { > >Index: Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/AntSupportMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/AntSupportMessages.java,v >retrieving revision 1.8 >diff -u -r1.8 AntSupportMessages.java >--- Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/AntSupportMessages.java 16 Apr 2005 14:01:17 -0000 1.8 >+++ Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/AntSupportMessages.java 7 Oct 2009 20:08:19 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This >+ * 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 >@@ -19,16 +19,6 @@ > public static String AntInputHandler_Unable_to_respond_to__input__request_4; > public static String AntInputHandler_5; > >- 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, AntSupportMessages.class); >Index: Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/AntSupportMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/AntSupportMessages.properties,v >retrieving revision 1.9 >diff -u -r1.9 AntSupportMessages.properties >--- Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/AntSupportMessages.properties 16 Apr 2005 14:01:32 -0000 1.9 >+++ Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/AntSupportMessages.properties 7 Oct 2009 20:08:19 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2005 IBM Corporation and others. >+# 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 >@@ -13,13 +13,3 @@ > AntInputHandler_Invalid_input_2=Input does not match validargs attribute > AntInputHandler_Unable_to_respond_to__input__request_4=Unable to respond to <input> request > AntInputHandler_5=Unable to respond to input request as a result of the user specified -noinput command >- >-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. >Index: Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessBuildLogger.java >=================================================================== >RCS file: Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessBuildLogger.java >diff -N Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessBuildLogger.java >--- Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessBuildLogger.java 24 Apr 2007 03:42:29 -0000 1.31 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,350 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2007 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 >- * Matt Conway - Patch for Bug 28052 >- *******************************************************************************/ >- >-package org.eclipse.ant.internal.ui.antsupport.logger; >- >-import java.io.BufferedReader; >-import java.io.File; >-import java.io.IOException; >-import java.io.StringReader; >-import java.util.HashMap; >-import java.util.Map; >- >-import org.apache.tools.ant.BuildEvent; >-import org.apache.tools.ant.Location; >-import org.apache.tools.ant.Project; >-import org.apache.tools.ant.Target; >-import org.apache.tools.ant.util.FileUtils; >-import org.eclipse.ant.internal.core.AbstractEclipseBuildLogger; >-import org.eclipse.ant.internal.ui.AntUtil; >-import org.eclipse.ant.internal.ui.ExternalHyperlink; >-import org.eclipse.ant.internal.ui.IAntUIConstants; >-import org.eclipse.ant.internal.ui.antsupport.AntSupportMessages; >-import org.eclipse.ant.internal.ui.antsupport.logger.util.AntDebugState; >-import org.eclipse.ant.internal.ui.launchConfigurations.AntProcess; >-import org.eclipse.ant.internal.ui.launchConfigurations.AntStreamMonitor; >-import org.eclipse.ant.internal.ui.launchConfigurations.AntStreamsProxy; >-import org.eclipse.ant.internal.ui.launchConfigurations.TaskLinkManager; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.runtime.OperationCanceledException; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.model.IProcess; >-import org.eclipse.debug.ui.console.FileLink; >-import org.eclipse.jface.text.IRegion; >-import org.eclipse.jface.text.Region; >-import org.eclipse.ui.console.IHyperlink; >- >-public class AntProcessBuildLogger extends NullBuildLogger { >- >- private File fBuildFileParent= null; >- private long fStartTime; >- private Map fFileNameToIFile= new HashMap(); >- >- /** >- * Associated process - discovered as needed to log messages >- */ >- private AntProcess fProcess = null; >- >- protected void logMessage(String message, BuildEvent event, int overridePriority) { >- int priority= overridePriority; >- if (priority == -1) { >- priority= event.getPriority(); >- } >- >- if (priority > getMessageOutputLevel()) { >- return; >- } >- AntProcess antProcess = getAntProcess(fProcessId); >- if (antProcess == null) { >- return; >- } >- >- StringBuffer fullMessage= new StringBuffer(); >- if (!loggingToLogFile()) { >- fullMessage.append(System.getProperty("line.separator")); //$NON-NLS-1$ >- } >- if (event.getException() == null && event.getTask() != null && !fEmacsMode) { >- adornMessage(event, fullMessage); >- } else { >- fullMessage.append(message); >- } >- message= fullMessage.toString(); >- >- if (loggingToLogFile()) { >- logMessageToLogFile(message, priority); >- } else { >- AntStreamMonitor monitor = getMonitor(priority); >- monitor.append(message); >- } >- } >- >- /** >- * Builds a right justified task prefix for the given build event, placing it >- * in the given string buffer. Creates the hyperlinks for the task prefix. >- * >- * @param event build event >- * @param fullMessage buffer to place task prefix in >- */ >- private void adornMessage(BuildEvent event, StringBuffer fullMessage) { >- String name = event.getTask().getTaskName(); >- if (name == null) { >- name = "null"; //$NON-NLS-1$ >- } >- Location location = event.getTask().getLocation(); >- StringBuffer column= new StringBuffer(); >- int size = IAntUIConstants.LEFT_COLUMN_SIZE - (name.length() + 3); >- for (int i = 0; i < size; i++) { >- column.append(' '); >- } >- StringBuffer labelBuff= new StringBuffer(); >- labelBuff.append('['); >- labelBuff.append(name); >- labelBuff.append("] "); //$NON-NLS-1$ >- >- int offset = Math.max(size, 0) + 1; >- String label= labelBuff.toString(); >- if (event.getMessage() == null) { >- return; >- } >- try { >- BufferedReader r = new BufferedReader(new StringReader(event.getMessage())); >- String line = r.readLine(); >- fullMessage.append(column); >- appendAndLink(fullMessage, location, label, offset, line); >- line = r.readLine(); >- while (line != null) { >- fullMessage.append(System.getProperty("line.separator")); //$NON-NLS-1$ >- fullMessage.append(column); >- appendAndLink(fullMessage, location, label, offset, line); >- line = r.readLine(); >- } >- } catch (IOException e) { >- if (event.getMessage() != null) { >- fullMessage.append(label).append(event.getMessage()); >- } >- } >- } >- >- private void appendAndLink(StringBuffer fullMessage, Location location, String label, int offset, String line) { >- fullMessage.append(label); >- fullMessage.append(line); >- if (location != null) { >- String newLine= (label + line).trim(); >- IRegion region= new Region(offset, label.length() - 3); // only want the name length "[name] " >- IHyperlink link= getLocationLink(location); >- if (link != null) { >- TaskLinkManager.addTaskHyperlink(getAntProcess(fProcessId), link, region, newLine); >- } >- } >- } >- >- private AntStreamMonitor getMonitor(int priority) { >- AntStreamsProxy proxy = (AntStreamsProxy)fProcess.getStreamsProxy(); >- AntStreamMonitor monitor = null; >- switch (priority) { >- case Project.MSG_INFO: >- monitor = (AntStreamMonitor)proxy.getOutputStreamMonitor(); >- break; >- case Project.MSG_ERR: >- monitor = (AntStreamMonitor)proxy.getErrorStreamMonitor(); >- break; >- case Project.MSG_DEBUG: >- monitor = (AntStreamMonitor)proxy.getDebugStreamMonitor(); >- break; >- case Project.MSG_WARN: >- monitor = (AntStreamMonitor)proxy.getWarningStreamMonitor(); >- break; >- case Project.MSG_VERBOSE: >- monitor = (AntStreamMonitor)proxy.getVerboseStreamMonitor(); >- break; >- } >- return monitor; >- } >- >- private void logMessageToLogFile(String message, int priority) { >- if (priority == Project.MSG_ERR) { >- getErrorPrintStream().println(message); >- } else { >- getOutputPrintStream().println(message); >- } >- } >- >- /** >- * Returns a hyperlink for the given task, or <code>null</code> if unable to >- * parse a valid location for the task. The link is set to exist at the specified >- * offset and length. >- * >- * @return hyper link, or <code>null</code> >- */ >- private IHyperlink getLocationLink(Location location) { >- if (location != null && !location.equals(Location.UNKNOWN_LOCATION)) { >- try { >- String fileName= location.getFileName(); >- IFile file= (IFile) fFileNameToIFile.get(fileName); >- int lineNumber= location.getLineNumber(); >- if (file != null) { >- return new FileLink(file, null, -1, -1, lineNumber); >- } >- file= AntUtil.getFileForLocation(fileName, fBuildFileParent); >- if (file != null) { >- fFileNameToIFile.put(fileName, file); >- return new FileLink(file, null, -1, -1, lineNumber); >- } >- //maintain backwards compatibility >- File javaIOFile= FileUtils.newFileUtils().resolveFile(fBuildFileParent, fileName); >- if (javaIOFile.exists()) { >- return new ExternalHyperlink(javaIOFile, lineNumber); >- } >- } catch (NoSuchMethodError e) { >- //support for Ant older than 1.6 >- return AntUtil.getLocationLink(location.toString(), fBuildFileParent); >- } >- } >- return null; >- } >- >- /** >- * Returns the associated Ant process, finding it if necessary, if not >- * already found. >- */ >- protected AntProcess getAntProcess(String processId) { >- if (fProcess == null && processId != null) { >- IProcess[] all = DebugPlugin.getDefault().getLaunchManager().getProcesses(); >- for (int i = 0; i < all.length; i++) { >- IProcess process = all[i]; >- if (process instanceof AntProcess && processId.equals(process.getAttribute(AbstractEclipseBuildLogger.ANT_PROCESS_ID))) { >- fProcess = (AntProcess)process; >- break; >- } >- } >- } >- return fProcess; >- } >- >- /* (non-Javadoc) >- * Set the start time. >- * >- * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) >- */ >- public void buildStarted(BuildEvent event) { >- fStartTime= System.currentTimeMillis(); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#buildFinished(org.apache.tools.ant.BuildEvent) >- */ >- public void buildFinished(BuildEvent event) { >- String message= handleException(event); >- if (message != null) { >- try { >- BufferedReader r = new BufferedReader(new StringReader(message)); >- String line = r.readLine(); >- logMessage(line, event, Project.MSG_ERR); >- line = r.readLine(); >- AntProcess antProcess = getAntProcess(fProcessId); >- while (line != null) { >- logMessage(line, event, Project.MSG_ERR); >- if (!message.startsWith("Total time:")) { //$NON-NLS-1$ >- AntUtil.linkBuildFailedMessage(line, antProcess); >- } >- line = r.readLine(); >- } >- logMessage("", event, Project.MSG_ERR); //$NON-NLS-1$ >- } catch (IOException e) { >- } >- } >- fHandledException= null; >- fBuildFileParent= null; >- if (!(event.getException() instanceof OperationCanceledException)) { >- logMessage(getTimeString(System.currentTimeMillis() - fStartTime), event, fMessageOutputLevel); >- } >- fProcess= null; >- event.getProject().removeBuildListener(this); >- fFileNameToIFile= null; >- } >- >- private String getTimeString(long milliseconds) { >- long seconds = milliseconds / 1000; >- long minutes = seconds / 60; >- seconds= seconds % 60; >- >- StringBuffer result= new StringBuffer(AntSupportMessages.AntProcessBuildLogger_Total_time); >- if (minutes > 0) { >- result.append(minutes); >- if (minutes > 1) { >- result.append(AntSupportMessages.AntProcessBuildLogger__minutes_2); >- } else { >- result.append(AntSupportMessages.AntProcessBuildLogger__minute_3); >- } >- } >- if (seconds > 0) { >- if (minutes > 0) { >- result.append(' '); >- } >- result.append(seconds); >- >- if (seconds > 1) { >- result.append(AntSupportMessages.AntProcessBuildLogger__seconds_4); >- } else { >- result.append(AntSupportMessages.AntProcessBuildLogger__second_5); >- } >- } >- if (seconds == 0 && minutes == 0) { >- result.append(milliseconds); >- result.append(AntSupportMessages.AntProcessBuildLogger__milliseconds_6); >- } >- >- result.append(System.getProperty("line.separator")); //$NON-NLS-1$ >- return result.toString(); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#messageLogged(org.apache.tools.ant.BuildEvent) >- */ >- public void messageLogged(BuildEvent event) { >- if (event.getPriority() > getMessageOutputLevel()) { >- return; >- } >- if (event.getMessage() != null && event.getMessage().length() > 0) { >- logMessage(event.getMessage(), event, -1); >- } >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) >- */ >- public void targetStarted(BuildEvent event) { >- if (Project.MSG_INFO > getMessageOutputLevel()) { >- return; >- } >- Target target= event.getTarget(); >- StringBuffer msg= new StringBuffer(System.getProperty("line.separator")); //$NON-NLS-1$ >- String targetName= target.getName(); >- msg.append(targetName); >- msg.append(':'); >- String message= msg.toString(); >- Location location= AntDebugState.getLocation(target); >- if (location != null && location != Location.UNKNOWN_LOCATION) { >- IRegion region= new Region(0, targetName.length()); >- IHyperlink link= getLocationLink(location); >- if (link != null) { >- TaskLinkManager.addTaskHyperlink(getAntProcess(fProcessId), link, region, message.trim()); >- } >- } >- logMessage(message, event, Project.MSG_INFO); >- } >- >- private boolean loggingToLogFile() { >- //check if user has designated to log to a log file >- return getErrorPrintStream() != null && getErrorPrintStream() != System.err; >- } >-} >Index: Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessDebugBuildLogger.java >=================================================================== >RCS file: Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessDebugBuildLogger.java >diff -N Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessDebugBuildLogger.java >--- Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessDebugBuildLogger.java 4 Aug 2006 01:14:46 -0000 1.24 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,247 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2006 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.ui.antsupport.logger; >- >-import java.io.File; >-import java.util.ArrayList; >-import java.util.List; >- >-import org.apache.tools.ant.BuildEvent; >-import org.apache.tools.ant.Location; >-import org.eclipse.ant.internal.ui.antsupport.AntSupportMessages; >-import org.eclipse.ant.internal.ui.antsupport.logger.util.AntDebugState; >-import org.eclipse.ant.internal.ui.antsupport.logger.util.IDebugBuildLogger; >-import org.eclipse.ant.internal.ui.debug.IAntDebugController; >-import org.eclipse.ant.internal.ui.debug.model.AntDebugTarget; >-import org.eclipse.ant.internal.ui.debug.model.AntThread; >-import org.eclipse.ant.internal.ui.launchConfigurations.AntProcess; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.OperationCanceledException; >-import org.eclipse.debug.core.DebugEvent; >-import org.eclipse.debug.core.ILaunch; >-import org.eclipse.debug.core.model.IBreakpoint; >-import org.eclipse.debug.core.model.ILineBreakpoint; >-import org.eclipse.debug.core.model.IProcess; >- >-public class AntProcessDebugBuildLogger extends AntProcessBuildLogger implements IAntDebugController, IDebugBuildLogger { >- >- private AntDebugState fDebugState= null; >- >- private List fBreakpoints= null; >- >- private AntDebugTarget fAntDebugTarget; >- private boolean fResumed= false; >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) >- */ >- public void buildStarted(BuildEvent event) { >- fDebugState= new AntDebugState(this); >- super.buildStarted(event); >- IProcess process= getAntProcess(fProcessId); >- ILaunch launch= process.getLaunch(); >- fAntDebugTarget= new AntDebugTarget(launch, process, this); >- launch.addDebugTarget(fAntDebugTarget); >- >- fAntDebugTarget.buildStarted(); >- fDebugState.buildStarted(); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#taskFinished(org.apache.tools.ant.BuildEvent) >- */ >- public void taskFinished(BuildEvent event) { >- super.taskFinished(event); >- fDebugState.taskFinished(); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#taskStarted(org.apache.tools.ant.BuildEvent) >- */ >- public void taskStarted(BuildEvent event) { >- super.taskStarted(event); >- fDebugState.taskStarted(event); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.antsupport.logger.util.IDebugBuildLogger#waitIfSuspended() >- */ >- public synchronized void waitIfSuspended() { >- fResumed= false; >- IBreakpoint breakpoint= breakpointAtLineNumber(fDebugState.getBreakpointLocation()); >- if (breakpoint != null) { >- fAntDebugTarget.breakpointHit(breakpoint); >- try { >- while (!fResumed) { >- wait(500); >- checkCancelled(); >- } >- } catch (InterruptedException e) { >- } >- } else if (fDebugState.getCurrentTask() != null) { >- int detail= -1; >- boolean shouldSuspend= true; >- if (fDebugState.isStepIntoSuspend()) { >- detail= DebugEvent.STEP_END; >- fDebugState.setStepIntoSuspend(false); >- } else if ((fDebugState.getLastTaskFinished() != null && fDebugState.getLastTaskFinished() == fDebugState.getStepOverTask()) || fDebugState.shouldSuspend()) { >- detail= DebugEvent.STEP_END; >- fDebugState.setShouldSuspend(false); >- fDebugState.setStepOverTask(null); >- } else if (fDebugState.isClientSuspend()) { >- detail= DebugEvent.CLIENT_REQUEST; >- fDebugState.setClientSuspend(false); >- } else { >- shouldSuspend= false; >- } >- if (shouldSuspend) { >- fAntDebugTarget.suspended(detail); >- try { >- while (!fResumed) { >- wait(500); >- checkCancelled(); >- } >- } catch (InterruptedException e) { >- } >- } >- } >- } >- >- private void checkCancelled() { >- AntProcess process= getAntProcess(fProcessId); >- if (process != null && process.isCanceled()) { >- throw new OperationCanceledException(AntSupportMessages.AntProcessDebugBuildLogger_1); >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#resume() >- */ >- public synchronized void resume() { >- fResumed= true; >- notifyAll(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#suspend() >- */ >- public synchronized void suspend() { >- fDebugState.setClientSuspend(true); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#stepInto() >- */ >- public synchronized void stepInto() { >- fDebugState.setStepIntoSuspend(true); >- fResumed= true; >- notifyAll(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#stepOver() >- */ >- public synchronized void stepOver() { >- fResumed= true; >- fDebugState.stepOver(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#handleBreakpoint(org.eclipse.debug.core.model.IBreakpoint, boolean) >- */ >- public void handleBreakpoint(IBreakpoint breakpoint, boolean added) { >- if (added) { >- if (fBreakpoints == null) { >- fBreakpoints= new ArrayList(); >- } >- if (!fBreakpoints.contains(breakpoint)) { >- fBreakpoints.add(breakpoint); >- } >- } else { >- if (fBreakpoints != null) { >- fBreakpoints.remove(breakpoint); >- } >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#getProperties() >- */ >- public void getProperties() { >- if (!fAntDebugTarget.isSuspended()) { >- return; >- } >- StringBuffer propertiesRepresentation= new StringBuffer(); >- fDebugState.marshallProperties(propertiesRepresentation, false); >- if (fAntDebugTarget.getThreads().length > 0) { >- ((AntThread) fAntDebugTarget.getThreads()[0]).newProperties(propertiesRepresentation.toString()); >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#getStackFrames() >- */ >- public void getStackFrames() { >- StringBuffer stackRepresentation= new StringBuffer(); >- fDebugState.marshalStack(stackRepresentation); >- ((AntThread) fAntDebugTarget.getThreads()[0]).buildStack(stackRepresentation.toString()); >- } >- >- private IBreakpoint breakpointAtLineNumber(Location location) { >- if (fBreakpoints == null || location == null || location == Location.UNKNOWN_LOCATION) { >- return null; >- } >- int lineNumber= fDebugState.getLineNumber(location); >- File locationFile= new File(fDebugState.getFileName(location)); >- for (int i = 0; i < fBreakpoints.size(); i++) { >- ILineBreakpoint breakpoint = (ILineBreakpoint) fBreakpoints.get(i); >- int breakpointLineNumber; >- try { >- if (!breakpoint.isEnabled()) { >- continue; >- } >- breakpointLineNumber = breakpoint.getLineNumber(); >- } catch (CoreException e) { >- return null; >- } >- IFile resource= (IFile) breakpoint.getMarker().getResource(); >- if (breakpointLineNumber == lineNumber && resource.getLocation().toFile().equals(locationFile)) { >- return breakpoint; >- } >- } >- return null; >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) >- */ >- public void targetStarted(BuildEvent event) { >- fDebugState.targetStarted(event); >- waitIfSuspended(); >- super.targetStarted(event); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#targetFinished(org.apache.tools.ant.BuildEvent) >- */ >- public void targetFinished(BuildEvent event) { >- super.targetFinished(event); >- fDebugState.setTargetExecuting(null); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#unescapeString(java.lang.StringBuffer) >- */ >- public StringBuffer unescapeString(StringBuffer propertyValue) { >- return propertyValue; >- } >-} >Index: Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/NullBuildLogger.java >=================================================================== >RCS file: Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/NullBuildLogger.java >diff -N Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/NullBuildLogger.java >--- Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/NullBuildLogger.java 11 Aug 2005 16:26:47 -0000 1.10 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,180 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2005 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.ui.antsupport.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.ant.internal.ui.antsupport.AntSupportMessages; >-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(AntSupportMessages.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(); >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPreferenceInitializer.java,v >retrieving revision 1.6 >diff -u -r1.6 AntUIPreferenceInitializer.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPreferenceInitializer.java 19 Jan 2006 23:19:09 -0000 1.6 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPreferenceInitializer.java 7 Oct 2009 20:08:20 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2006 IBM Corporation and others. >+ * 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 >@@ -34,9 +34,7 @@ > prefs.setDefault(IAntUIPreferenceConstants.ANT_FIND_BUILD_FILE_NAMES, "build.xml"); //$NON-NLS-1$ > > prefs.setDefault(IAntUIPreferenceConstants.DOCUMENTATION_URL, "http://ant.apache.org/manual"); //$NON-NLS-1$ >- >- prefs.setDefault(IAntUIPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, 20000); >- >+ > EditorsUI.useAnnotationsPreferencePage(prefs); > EditorsUI.useQuickDiffPreferencePage(prefs); > if (AntUIPlugin.isMacOS()) { >Index: Ant Tools Support/org/eclipse/ant/internal/ui/AntUtil.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUtil.java,v >retrieving revision 1.38 >diff -u -r1.38 AntUtil.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/AntUtil.java 31 Aug 2009 17:56:26 -0000 1.38 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/AntUtil.java 7 Oct 2009 20:08:20 -0000 >@@ -11,7 +11,6 @@ > package org.eclipse.ant.internal.ui; > > import java.io.File; >-import java.io.IOException; > import java.net.MalformedURLException; > import java.net.URL; > import java.util.ArrayList; >@@ -20,31 +19,26 @@ > import java.util.Iterator; > import java.util.List; > import java.util.Map; >-import java.util.StringTokenizer; > import java.util.regex.Pattern; > >-import org.apache.tools.ant.BuildException; > import org.apache.tools.ant.Target; >-import org.apache.tools.ant.util.FileUtils; > import org.eclipse.ant.core.AntCorePlugin; > import org.eclipse.ant.internal.core.AntCoreUtil; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > import org.eclipse.ant.internal.ui.editor.AntEditor; >-import org.eclipse.ant.internal.ui.launchConfigurations.AntHomeClasspathEntry; >-import org.eclipse.ant.internal.ui.launchConfigurations.TaskLinkManager; > import org.eclipse.ant.internal.ui.model.AntElementNode; > import org.eclipse.ant.internal.ui.model.AntModel; > import org.eclipse.ant.internal.ui.model.AntProjectNode; > import org.eclipse.ant.internal.ui.model.AntTargetNode; > import org.eclipse.ant.internal.ui.model.IAntModel; > import org.eclipse.ant.internal.ui.model.LocationProvider; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.filebuffers.FileBuffers; > import org.eclipse.core.filebuffers.ITextFileBuffer; > import org.eclipse.core.filebuffers.ITextFileBufferManager; > import org.eclipse.core.filebuffers.LocationKind; > 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.IStatus; >@@ -54,17 +48,10 @@ > import org.eclipse.core.variables.IStringVariableManager; > import org.eclipse.core.variables.VariablesPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >-import org.eclipse.debug.core.model.IProcess; > import org.eclipse.debug.ui.console.FileLink; >-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; >-import org.eclipse.jdt.launching.IRuntimeClasspathEntry; >-import org.eclipse.jdt.launching.IRuntimeClasspathEntry2; >-import org.eclipse.jdt.launching.JavaRuntime; > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.text.BadLocationException; > import org.eclipse.jface.text.IDocument; >-import org.eclipse.jface.text.Region; > import org.eclipse.swt.SWT; > import org.eclipse.swt.program.Program; > import org.eclipse.swt.widgets.Shell; >@@ -79,8 +66,6 @@ > import org.eclipse.ui.browser.IWorkbenchBrowserSupport; > import org.eclipse.ui.console.IHyperlink; > import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; >-import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > import org.eclipse.ui.ide.IDE; > import org.eclipse.ui.part.FileEditorInput; > import org.eclipse.ui.texteditor.IDocumentProvider; >@@ -114,19 +99,7 @@ > * <code>null</code> if the array is empty. > */ > public static String combineStrings(String[] strings) { >- if (strings.length == 0) >- return null; >- >- if (strings.length == 1) >- return strings[0]; >- >- StringBuffer buf = new StringBuffer(); >- for (int i = 0; i < strings.length - 1; i++) { >- buf.append(strings[i]); >- buf.append(ATTRIBUTE_SEPARATOR); >- } >- buf.append(strings[strings.length - 1]); >- return buf.toString(); >+ return AntLaunchingUtil.combineStrings(strings); > } > > /** >@@ -138,35 +111,8 @@ > * @throws CoreException if unable to access the associated attribute > */ > public static String[] getTargetNames(ILaunchConfiguration configuration) throws CoreException { >- String attribute= null; >- if (IAntLaunchConfigurationConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE.equals(configuration.getType().getIdentifier())) { >- attribute= getTargetNamesForAntBuilder(configuration); >- } >- if (attribute == null) { >- attribute = configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, (String) null); >- if (attribute == null) { >- return null; >- } >- } >- >- return AntUtil.parseRunTargets(attribute); >+ return AntLaunchingUtil.getTargetNames(configuration); > } >- >- private static String getTargetNamesForAntBuilder(ILaunchConfiguration configuration) throws CoreException { >- String buildType= ExternalToolBuilder.getBuildType(); >- String targets= null; >- if (IExternalToolConstants.BUILD_TYPE_AUTO.equals(buildType)) { >- targets= configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS, (String)null); >- } else if (IExternalToolConstants.BUILD_TYPE_CLEAN.equals(buildType)) { >- targets = configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS, (String) null); >- } else if (IExternalToolConstants.BUILD_TYPE_FULL.equals(buildType)) { >- targets = configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, (String) null); >- } else if (IExternalToolConstants.BUILD_TYPE_INCREMENTAL.equals(buildType)) { >- targets = configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS, (String) null); >- } >- >- return targets; >- } > > /** > * Returns a map of properties to be defined for the build, or >@@ -177,9 +123,8 @@ > * @return map of properties (name --> value), or <code>null</code> > * @throws CoreException if unable to access the associated attribute > */ >- public static Map getProperties(ILaunchConfiguration configuration) throws CoreException { >- Map map = configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES, (Map) null); >- return map; >+ public static Map getProperties(ILaunchConfiguration configuration) throws CoreException { >+ return AntLaunchingUtil.getProperties(configuration); > } > > /** >@@ -190,17 +135,7 @@ > * @throws CoreException if unable to access the associated attribute > */ > public static String getAntHome(ILaunchConfiguration configuration) throws CoreException { >- IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedRuntimeClasspath(configuration); >- for (int i = 0; i < entries.length; i++) { >- IRuntimeClasspathEntry entry = entries[i]; >- if (entry.getType() == IRuntimeClasspathEntry.OTHER) { >- IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2)entry; >- if (entry2.getTypeId().equals(AntHomeClasspathEntry.TYPE_ID)) { >- return ((AntHomeClasspathEntry)entry2).getAntHome(); >- } >- } >- } >- return null; >+ return AntLaunchingUtil.getAntHome(configuration); > } > > /** >@@ -213,7 +148,7 @@ > * @throws CoreException if unable to access the associated attribute > */ > public static String[] getPropertyFiles(ILaunchConfiguration configuration) throws CoreException { >- String attribute = configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTY_FILES, (String) null); >+ String attribute = configuration.getAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTY_FILES, (String) null); > if (attribute == null) { > return null; > } >@@ -412,30 +347,7 @@ > * @throws CoreException if file does not exist, IO problems, or invalid format. > */ > public static URL[] getCustomClasspath(ILaunchConfiguration config) throws CoreException { >- boolean useDefault = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true); >- if (useDefault) { >- return null; >- } >- IRuntimeClasspathEntry[] unresolved = JavaRuntime.computeUnresolvedRuntimeClasspath(config); >- // don't consider bootpath entries >- List userEntries = new ArrayList(unresolved.length); >- for (int i = 0; i < unresolved.length; i++) { >- IRuntimeClasspathEntry entry = unresolved[i]; >- if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { >- userEntries.add(entry); >- } >- } >- IRuntimeClasspathEntry[] entries = JavaRuntime.resolveRuntimeClasspath((IRuntimeClasspathEntry[])userEntries.toArray(new IRuntimeClasspathEntry[userEntries.size()]), config); >- URL[] urls = new URL[entries.length]; >- for (int i = 0; i < entries.length; i++) { >- IRuntimeClasspathEntry entry = entries[i]; >- try { >- urls[i] = new URL("file:"+entry.getLocation()); //$NON-NLS-1$ >- } catch (MalformedURLException e) { >- throw new CoreException(new Status(IStatus.ERROR, AntUIPlugin.getUniqueIdentifier(), AntUIPlugin.INTERNAL_ERROR, AntUIModelMessages.AntUtil_7, e)); >- } >- } >- return urls; >+ return AntLaunchingUtil.getCustomClasspath(config); > } > > private static String expandVariableString(String variableString, String invalidMessage) throws CoreException { >@@ -456,7 +368,7 @@ > * @return a list of target names > */ > public static String[] parseRunTargets(String extraAttibuteValue) { >- return parseString(extraAttibuteValue, ATTRIBUTE_SEPARATOR); >+ return AntLaunchingUtil.parseRunTargets(extraAttibuteValue); > } > > /** >@@ -466,19 +378,7 @@ > * @return a list of Strings > */ > public static String[] parseString(String delimString, String delim) { >- if (delimString == null) { >- return new String[0]; >- } >- >- // Need to handle case where separator character is >- // actually part of the target name! >- StringTokenizer tokenizer = new StringTokenizer(delimString, delim); >- String[] results = new String[tokenizer.countTokens()]; >- for (int i = 0; i < results.length; i++) { >- results[i] = tokenizer.nextToken(); >- } >- >- return results; >+ return AntLaunchingUtil.parseString(delimString, delim); > } > > /** >@@ -486,8 +386,7 @@ > * The returned IFile may or may not exist. > */ > public static IFile getFile(String fullPath) { >- IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); >- return root.getFile(new Path(fullPath)); >+ return AntLaunchingUtil.getFile(fullPath); > } > > public static IHyperlink getLocationLink(String path, File buildFileParent) { >@@ -540,48 +439,7 @@ > * @see org.eclipse.core.resources.IWorkspaceRoot#findFilesForLocation(IPath) > */ > public static IFile getFileForLocation(String path, File buildFileParent) { >- if (path == null) { >- return null; >- } >- IPath filePath= new Path(path); >- IFile file = null; >- IFile[] files= ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(filePath); >- if (files.length > 0) { >- file= files[0]; >- } >- if (file == null) { >- //relative path >- File relativeFile= null; >- try { >- //this call is ok if buildFileParent is null >- relativeFile= FileUtils.getFileUtils().resolveFile(buildFileParent, path); >- filePath= new Path(relativeFile.getAbsolutePath()); >- files= ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(filePath); >- if (files.length > 0) { >- file= files[0]; >- } else { >- return null; >- } >- } catch (BuildException be) { >- return null; >- } >- } >- >- if (file.exists()) { >- return file; >- } >- File ioFile= file.getLocation().toFile(); >- if (ioFile.exists()) {//needs to handle case insensitivity on WINOS >- try { >- files= ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(ioFile.getCanonicalPath())); >- if (files.length > 0) { >- return files[0]; >- } >- } catch (IOException e) { >- } >- } >- >- return null; >+ return AntLaunchingUtil.getFileForLocation(path, buildFileParent); > } > > /** >@@ -594,40 +452,7 @@ > * @since 3.0 > */ > public static void migrateToNewClasspathFormat(ILaunchConfiguration configuration) throws CoreException { >- String oldClasspath = configuration.getAttribute(org.eclipse.ant.internal.ui.launchConfigurations.IAntLaunchConfigurationConstants.ATTR_ANT_CUSTOM_CLASSPATH, (String)null); >- String oldAntHome = configuration.getAttribute(org.eclipse.ant.internal.ui.launchConfigurations.IAntLaunchConfigurationConstants.ATTR_ANT_HOME, (String)null); >- String provider = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, (String)null); >- if (oldClasspath != null || oldAntHome != null || provider == null) { >- ILaunchConfigurationWorkingCopy workingCopy = null; >- if (configuration.isWorkingCopy()) { >- workingCopy = (ILaunchConfigurationWorkingCopy) configuration; >- } else { >- workingCopy = configuration.getWorkingCopy(); >- } >- workingCopy.setAttribute(org.eclipse.ant.internal.ui.launchConfigurations.IAntLaunchConfigurationConstants.ATTR_ANT_CUSTOM_CLASSPATH, (String)null); >- workingCopy.setAttribute(org.eclipse.ant.internal.ui.launchConfigurations.IAntLaunchConfigurationConstants.ATTR_ANT_HOME, (String)null); >- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, "org.eclipse.ant.ui.AntClasspathProvider"); //$NON-NLS-1$ >- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true); >- if (oldAntHome != null) { >- IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedRuntimeClasspath(workingCopy); >- List mementos = new ArrayList(entries.length); >- for (int i = 0; i < entries.length; i++) { >- IRuntimeClasspathEntry entry = entries[i]; >- if (entry.getType() == IRuntimeClasspathEntry.OTHER) { >- IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2) entry; >- if (entry2.getTypeId().equals(AntHomeClasspathEntry.TYPE_ID)) { >- AntHomeClasspathEntry homeEntry = new AntHomeClasspathEntry(oldAntHome); >- mementos.add(homeEntry.getMemento()); >- continue; >- } >- } >- mementos.add(entry.getMemento()); >- } >- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false); >- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, mementos); >- } >- workingCopy.doSave(); >- } >+ AntLaunchingUtil.migrateToNewClasspathFormat(configuration); > } > > private static int getOffset(int line, int column, ITextEditor editor) { >@@ -749,49 +574,6 @@ > } > > public static boolean isSeparateJREAntBuild(ILaunchConfiguration configuration) { >- boolean separateJRE= true; >- try { >- //always null for same JRE >- separateJRE = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, (String)null) != null; >- } catch (CoreException e) { >- AntUIPlugin.log(AntUIModelMessages.AntUtil_2, e); >- } >- >- return separateJRE; >- } >- >- public static void linkBuildFailedMessage(String message, IProcess process) { >- String fileName = null; >- String lineNumber = ""; //$NON-NLS-1$ >- int fileStart = 0; >- int index = message.indexOf("xml"); //$NON-NLS-1$ >- if (index > 0) { >- int numberStart= index + 4; >- int numberEnd= message.indexOf(':', numberStart); >- int fileEnd = index + 3; >- if (numberStart > 0 && fileEnd > 0) { >- fileName = message.substring(fileStart, fileEnd).trim(); >- if (numberEnd > 0) { >- lineNumber = message.substring(numberStart, numberEnd).trim(); >- } >- } >- } >- >- if (fileName != null) { >- int num = -1; >- try { >- num = Integer.parseInt(lineNumber); >- } catch (NumberFormatException e) { >- } >- IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(fileName)); >- IFile file= null; >- if (files.length > 0) { >- file= files[0]; >- } >- if (file != null && file.exists()) { >- FileLink link = new FileLink(file, null, -1, -1, num); >- TaskLinkManager.addTaskHyperlink(process, link, new Region(0, message.length()), message); >- } >- } >+ return AntLaunchingUtil.isSeparateJREAntBuild(configuration); > } > } >\ No newline at end of file >Index: Ant Tools Support/org/eclipse/ant/internal/ui/IAntUIConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/IAntUIConstants.java,v >retrieving revision 1.15 >diff -u -r1.15 IAntUIConstants.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/IAntUIConstants.java 14 Aug 2008 13:12:39 -0000 1.15 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/IAntUIConstants.java 7 Oct 2009 20:08:20 -0000 >@@ -105,8 +105,8 @@ > /** > * Size of left-hand column for right-justified task name. > * Used for Ant Build logging. >- * @see org.eclipse.ant.internal.ui.antsupport.logger.AntProcessBuildLogger >- * @see org.eclipse.ant.internal.ui.launchConfigurations.RemoteAntBuildListener >+ * @see org.eclipse.ant.internal.launching.runtime.logger.AntProcessBuildLogger >+ * @see org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntBuildListener > */ > public static final int LEFT_COLUMN_SIZE = 15; > >Index: Ant Tools Support/org/eclipse/ant/internal/ui/IAntUIPreferenceConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/IAntUIPreferenceConstants.java,v >retrieving revision 1.6 >diff -u -r1.6 IAntUIPreferenceConstants.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/IAntUIPreferenceConstants.java 28 Mar 2006 00:43:40 -0000 1.6 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/IAntUIPreferenceConstants.java 7 Oct 2009 20:08:20 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * 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 >@@ -34,12 +34,6 @@ > public static final String CONSOLE_DEBUG_COLOR = "org.eclipse.ant.ui.debugColor"; //$NON-NLS-1$ > > public static final String ANT_TOOLS_JAR_WARNING= "toolsJAR"; //$NON-NLS-1$ >- >- /** >- * 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$ > > public static final String ANT_ERROR_DIALOG= "errorDialog"; //$NON-NLS-1$ > >Index: Ant Tools Support/org/eclipse/ant/internal/ui/console/AntConsoleColorProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/console/AntConsoleColorProvider.java,v >retrieving revision 1.7 >diff -u -r1.7 AntConsoleColorProvider.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/console/AntConsoleColorProvider.java 23 Feb 2005 17:31:21 -0000 1.7 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/console/AntConsoleColorProvider.java 7 Oct 2009 20:08:20 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * 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 >@@ -10,10 +10,9 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.console; > >+import org.eclipse.ant.internal.launching.launchConfigurations.AntStreamsProxy; > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants; >-import org.eclipse.ant.internal.ui.launchConfigurations.AntProcess; >-import org.eclipse.ant.internal.ui.launchConfigurations.AntStreamsProxy; > import org.eclipse.debug.core.model.IProcess; > import org.eclipse.debug.ui.IDebugUIConstants; > import org.eclipse.debug.ui.console.ConsoleColorProvider; >@@ -58,9 +57,6 @@ > //an AntStreamsProxy. The remote Ant builds make use of the > // org.eclipse.debug.core.processFactories extension point > AntStreamsProxy proxy = (AntStreamsProxy)process.getStreamsProxy(); >- if (process instanceof AntProcess) { >- ((AntProcess)process).setConsole(console); >- } > if (proxy != null) { > console.connect(proxy.getDebugStreamMonitor(), AntStreamsProxy.ANT_DEBUG_STREAM); > console.connect(proxy.getWarningStreamMonitor(), AntStreamsProxy.ANT_WARNING_STREAM); >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntDebugMessages.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntDebugMessages.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntDebugMessages.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntDebugMessages.java 2 Jun 2005 22:57:32 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,23 +0,0 @@ >-/********************************************************************** >- * Copyright (c) 2005 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.ui.debug; >- >-import org.eclipse.osgi.util.NLS; >- >-public class AntDebugMessages extends NLS { >- private static final String BUNDLE_NAME = "org.eclipse.ant.internal.ui.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 >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntDebugMessages.properties >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntDebugMessages.properties >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntDebugMessages.properties >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntDebugMessages.properties 2 Jun 2005 23:00:54 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,12 +0,0 @@ >-############################################################################### >-# Copyright (c) 2005 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 >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceContainer.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceContainer.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceContainer.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceContainer.java 2 Jun 2005 22:57:32 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,73 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2005 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.ui.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 >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceLookupDirector.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceLookupDirector.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceLookupDirector.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceLookupDirector.java 2 Jun 2005 22:57:32 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,36 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.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 >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceLookupParticipant.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceLookupParticipant.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceLookupParticipant.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourceLookupParticipant.java 2 Jun 2005 16:36:16 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,36 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.debug; >- >-import org.eclipse.ant.internal.ui.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; >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourcePathComputerDelegate.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourcePathComputerDelegate.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourcePathComputerDelegate.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/AntSourcePathComputerDelegate.java 2 Jun 2005 20:58:21 -0000 1.10 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,33 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.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 >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/IAntDebugConstants.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/IAntDebugConstants.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/IAntDebugConstants.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/IAntDebugConstants.java 23 Feb 2005 17:31:22 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,33 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.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$ >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/IAntDebugController.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/IAntDebugController.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/IAntDebugController.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/IAntDebugController.java 11 Apr 2005 03:03:36 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,66 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.debug; >- >-import org.eclipse.debug.core.model.IBreakpoint; >- >-public interface IAntDebugController { >- >- /** >- * Resume the Ant build >- */ >- public void resume(); >- >- /** >- * Suspend the Ant build >- */ >- public void suspend(); >- >- /** >- * Step into the current Ant task >- */ >- public void stepInto(); >- >- /** >- * Step over the current Ant task >- */ >- public void stepOver(); >- >- /** >- * The provided breakpoint has been added or removed depending on the <code>added</code> parameter. >- * Updates the controller for this change. >- * >- * @param breakpoint the breakpoint that has been added or removed >- * @param added whether or not the breakpoint has been added >- */ >- public void handleBreakpoint(IBreakpoint breakpoint, boolean added); >- >- /** >- * Retrieve the properties of the Ant build. >- * May occur asynchronously depending on implementation. >- */ >- public void getProperties(); >- >- /** >- * Retrieve the stack frames of the Ant build. >- * May occur asynchronously depending on implementation. >- */ >- public void getStackFrames(); >- >- /** >- * Some strings are escaped when marshalled for socket communication. >- * The Ant debug controller will properly unescape these Strings if required. >- * >- * @param value The buffer of the string to unescape >- * @return The unescaped string >- */ >- public StringBuffer unescapeString(StringBuffer value); >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugElement.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugElement.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugElement.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugElement.java 29 May 2008 16:05:22 -0000 1.11 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,54 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2007 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.ui.debug.model; >- >-import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.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, AntUIPlugin.getUniqueIdentifier(), >- DebugException.TARGET_REQUEST_FAILED, message, null)); >- } >- >- protected AntDebugTarget getAntDebugTarget() { >- return (AntDebugTarget)super.getDebugTarget(); >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugModelPresentation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugModelPresentation.java,v >retrieving revision 1.22 >diff -u -r1.22 AntDebugModelPresentation.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugModelPresentation.java 30 Jan 2008 02:31:16 -0000 1.22 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugModelPresentation.java 7 Oct 2009 20:08:20 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2008 IBM Corporation and others. >+ * 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 >@@ -13,6 +13,11 @@ > > import java.io.File; > >+import org.eclipse.ant.internal.launching.debug.model.AntLineBreakpoint; >+import org.eclipse.ant.internal.launching.debug.model.AntProperties; >+import org.eclipse.ant.internal.launching.debug.model.AntProperty; >+import org.eclipse.ant.internal.launching.debug.model.AntStackFrame; >+import org.eclipse.ant.internal.launching.debug.model.AntThread; > import org.eclipse.ant.internal.ui.AntUIImages; > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.preferences.AntObjectLabelProvider; >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugTarget.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugTarget.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugTarget.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntDebugTarget.java 23 Mar 2006 19:11:23 -0000 1.29 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,463 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2006 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.ui.debug.model; >- >-import java.util.ArrayList; >-import java.util.Iterator; >-import java.util.List; >- >-import org.eclipse.ant.internal.ui.debug.IAntDebugConstants; >-import org.eclipse.ant.internal.ui.debug.IAntDebugController; >-import org.eclipse.core.resources.IMarkerDelta; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.variables.VariablesPlugin; >-import org.eclipse.debug.core.DebugEvent; >-import org.eclipse.debug.core.DebugException; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.IBreakpointManager; >-import org.eclipse.debug.core.IBreakpointManagerListener; >-import org.eclipse.debug.core.IDebugEventSetListener; >-import org.eclipse.debug.core.ILaunch; >-import org.eclipse.debug.core.model.IBreakpoint; >-import org.eclipse.debug.core.model.IDebugTarget; >-import org.eclipse.debug.core.model.ILineBreakpoint; >-import org.eclipse.debug.core.model.IMemoryBlock; >-import org.eclipse.debug.core.model.IProcess; >-import org.eclipse.debug.core.model.IThread; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >- >-/** >- * Ant Debug Target >- */ >-public class AntDebugTarget extends AntDebugElement implements IDebugTarget, IDebugEventSetListener, IBreakpointManagerListener { >- >- // associated system process (Ant Build) >- private IProcess fProcess; >- >- // containing launch object >- private ILaunch fLaunch; >- >- // Build file name >- private String fName; >- >- // suspend state >- private boolean fSuspended= false; >- >- // terminated state >- private boolean fTerminated= false; >- >- // threads >- private AntThread fThread; >- private IThread[] fThreads; >- >- private IAntDebugController fController; >- >- private List fRunToLineBreakpoints; >- >- /** >- * Constructs a new debug target in the given launch for the >- * associated Ant build process. >- * >- * @param launch containing launch >- * @param process Ant build process >- * @param controller the controller to communicate to the Ant build >- */ >- public AntDebugTarget(ILaunch launch, IProcess process, IAntDebugController controller) { >- super(null); >- fLaunch = launch; >- fProcess = process; >- >- fController= controller; >- >- fThread = new AntThread(this); >- fThreads = new IThread[] {fThread}; >- >- DebugPlugin.getDefault().getBreakpointManager().addBreakpointManagerListener(this); >- DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this); >- DebugPlugin.getDefault().addDebugEventListener(this); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IDebugTarget#getProcess() >- */ >- public IProcess getProcess() { >- return fProcess; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IDebugTarget#getThreads() >- */ >- public IThread[] getThreads() { >- return fThreads; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IDebugTarget#hasThreads() >- */ >- public boolean hasThreads() throws DebugException { >- return !fTerminated && fThreads.length > 0; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IDebugTarget#getName() >- */ >- public String getName() throws DebugException { >- if (fName == null) { >- try { >- fName= getLaunch().getLaunchConfiguration().getAttribute(IExternalToolConstants.ATTR_LOCATION, DebugModelMessages.AntDebugTarget_0); >- fName= VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(fName); >- } catch (CoreException e) { >- fName = DebugModelMessages.AntDebugTarget_0; >- } >- } >- return fName; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint) >- */ >- public boolean supportsBreakpoint(IBreakpoint breakpoint) { >- if (breakpoint.getModelIdentifier().equals(IAntDebugConstants.ID_ANT_DEBUG_MODEL)) { >- //need to consider all breakpoints as no way to tell which set >- //of buildfiles will be executed (ant task) >- return true; >- } >- return false; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget() >- */ >- public IDebugTarget getDebugTarget() { >- return this; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IDebugElement#getLaunch() >- */ >- public ILaunch getLaunch() { >- return fLaunch; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ITerminate#canTerminate() >- */ >- public boolean canTerminate() { >- return !fTerminated; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ITerminate#isTerminated() >- */ >- public boolean isTerminated() { >- return fTerminated; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ITerminate#terminate() >- */ >- public void terminate() throws DebugException { >- terminated(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ISuspendResume#canResume() >- */ >- public boolean canResume() { >- return !isTerminated() && isSuspended(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() >- */ >- public boolean canSuspend() { >- return !isTerminated() && !isSuspended(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() >- */ >- public boolean isSuspended() { >- return fSuspended; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ISuspendResume#resume() >- */ >- public void resume() throws DebugException { >- fSuspended= false; >- fController.resume(); >- } >- >- /** >- * Notification the target has suspended for the given reason >- * >- * @param detail reason for the suspend >- */ >- public void suspended(int detail) { >- fSuspended = true; >- fThread.setStepping(false); >- fThread.fireSuspendEvent(detail); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ISuspendResume#suspend() >- */ >- public void suspend() throws DebugException { >- fController.suspend(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint) >- */ >- public void breakpointAdded(IBreakpoint breakpoint) { >- fController.handleBreakpoint(breakpoint, true); >- if (breakpoint instanceof AntLineBreakpoint) { >- if (((AntLineBreakpoint) breakpoint).isRunToLine()) { >- if (fRunToLineBreakpoints == null) { >- fRunToLineBreakpoints= new ArrayList(); >- } >- fRunToLineBreakpoints.add(breakpoint); >- } >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta) >- */ >- public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { >- fController.handleBreakpoint(breakpoint, false); >- if (fRunToLineBreakpoints != null) { >- if (fRunToLineBreakpoints.remove(breakpoint) && fRunToLineBreakpoints.isEmpty()) { >- fRunToLineBreakpoints= null; >- } >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta) >- */ >- public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { >- if (supportsBreakpoint(breakpoint)) { >- try { >- if (breakpoint.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled()) { >- breakpointAdded(breakpoint); >- } else { >- breakpointRemoved(breakpoint, null); >- } >- } catch (CoreException e) { >- } >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IDisconnect#canDisconnect() >- */ >- public boolean canDisconnect() { >- return false; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IDisconnect#disconnect() >- */ >- public void disconnect() throws DebugException { >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IDisconnect#isDisconnected() >- */ >- public boolean isDisconnected() { >- return false; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval() >- */ >- public boolean supportsStorageRetrieval() { >- return false; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long) >- */ >- public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException { >- return null; >- } >- >- /** >- * Notification we have connected to the Ant build logger and it has started. >- * Resume the build. >- */ >- public void buildStarted() { >- fireCreationEvent(); >- installDeferredBreakpoints(); >- try { >- resume(); >- } catch (DebugException e) { >- } >- } >- >- /** >- * Install breakpoints that are already registered with the breakpoint >- * manager if the breakpoint manager is enabled and the breakpoint is enabled. >- */ >- private void installDeferredBreakpoints() { >- IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager(); >- if (!manager.isEnabled()) { >- return; >- } >- IBreakpoint[] breakpoints = manager.getBreakpoints(IAntDebugConstants.ID_ANT_DEBUG_MODEL); >- for (int i = 0; i < breakpoints.length; i++) { >- IBreakpoint breakpoint= breakpoints[i]; >- try { >- if (breakpoint.isEnabled()) { >- breakpointAdded(breakpoints[i]); >- } >- } catch (CoreException e) { >- } >- } >- } >- >- /** >- * Called when this debug target terminates. >- */ >- protected void terminated() { >- fThreads= new IThread[0]; >- fTerminated = true; >- fSuspended = false; >- if (DebugPlugin.getDefault() != null) { >- DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this); >- DebugPlugin.getDefault().removeDebugEventListener(this); >- DebugPlugin.getDefault().getBreakpointManager().removeBreakpointManagerListener(this); >- } >- if (!getProcess().isTerminated()) { >- try { >- fProcess.terminate(); >- resume(); >- } catch (DebugException e) { >- } >- } >- if (DebugPlugin.getDefault() != null) { >- fireTerminateEvent(); >- } >- } >- >- /** >- * Single step the Ant build. >- * >- * @throws DebugException if the request fails >- */ >- protected void stepOver() { >- fSuspended= false; >- fController.stepOver(); >- } >- >- /** >- * Step-into the Ant build. >- * >- * @throws DebugException if the request fails >- */ >- protected void stepInto() { >- fSuspended= false; >- fController.stepInto(); >- } >- >- /** >- * Notification a breakpoint was encountered. Determine >- * which breakpoint was hit and fire a suspend event. >- * >- * @param event debug event >- */ >- protected void breakpointHit(String event) { >- // determine which breakpoint was hit, and set the thread's breakpoint >- String[] datum= event.split(DebugMessageIds.MESSAGE_DELIMITER); >- String fileName= datum[1]; >- int lineNumber = Integer.parseInt(datum[2]); >- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IAntDebugConstants.ID_ANT_DEBUG_MODEL); >- boolean found= false; >- for (int i = 0; i < breakpoints.length; i++) { >- ILineBreakpoint lineBreakpoint = (ILineBreakpoint)breakpoints[i]; >- if (setThreadBreakpoint(lineBreakpoint, lineNumber, fileName)) { >- found= true; >- break; >- } >- } >- if (!found && fRunToLineBreakpoints != null) { >- Iterator iter= fRunToLineBreakpoints.iterator(); >- while (iter.hasNext()) { >- ILineBreakpoint lineBreakpoint = (ILineBreakpoint) iter.next(); >- if (setThreadBreakpoint(lineBreakpoint, lineNumber, fileName)) { >- break; >- } >- } >- } >- suspended(DebugEvent.BREAKPOINT); >- } >- >- private boolean setThreadBreakpoint(ILineBreakpoint lineBreakpoint, int lineNumber, String fileName) { >- try { >- if (lineBreakpoint.getLineNumber() == lineNumber && >- fileName.equals(lineBreakpoint.getMarker().getResource().getLocation().toOSString())) { >- fThread.setBreakpoints(new IBreakpoint[]{lineBreakpoint}); >- return true; >- } >- } catch (CoreException e) { >- } >- return false; >- } >- >- public void breakpointHit (IBreakpoint breakpoint) { >- fThread.setBreakpoints(new IBreakpoint[]{breakpoint}); >- suspended(DebugEvent.BREAKPOINT); >- } >- >- protected void getStackFrames() { >- fController.getStackFrames(); >- } >- >- protected void getProperties() { >- fController.getProperties(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) >- */ >- public void handleDebugEvents(DebugEvent[] events) { >- for (int i = 0; i < events.length; i++) { >- DebugEvent event = events[i]; >- if (event.getKind() == DebugEvent.TERMINATE && event.getSource().equals(fProcess)) { >- terminated(); >- } >- } >- } >- >- /** >- * When the breakpoint manager disables, remove all registered breakpoints >- * requests from the VM. When it enables, reinstall them. >- * >- * @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean) >- */ >- public void breakpointManagerEnablementChanged(boolean enabled) { >- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IAntDebugConstants.ID_ANT_DEBUG_MODEL); >- for (int i = 0; i < breakpoints.length; i++) { >- IBreakpoint breakpoint = breakpoints[i]; >- if (enabled) { >- breakpointAdded(breakpoint); >- } else { >- breakpointRemoved(breakpoint, null); >- } >- } >- } >- >- public IAntDebugController getAntDebugController() { >- return fController; >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntLineBreakpoint.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntLineBreakpoint.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntLineBreakpoint.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntLineBreakpoint.java 11 Apr 2006 14:43:28 -0000 1.10 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,112 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2006 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.ui.debug.model; >- >-import com.ibm.icu.text.MessageFormat; >-import java.util.HashMap; >-import java.util.Map; >- >-import org.eclipse.ant.internal.ui.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); >- } >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntProperties.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntProperties.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntProperties.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntProperties.java 12 May 2005 21:10:52 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,109 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2005 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.ui.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; >- } >- >- protected 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; >- } >- >- protected synchronized void setValid(boolean valid) { >- fValid= valid; >- notifyAll(); >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntPropertiesValue.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntPropertiesValue.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntPropertiesValue.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntPropertiesValue.java 12 May 2008 17:18:55 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,71 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2005, 2008 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.ui.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); >- } >- >- protected List getProperties() { >- return fProperties; >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntProperty.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntProperty.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntProperty.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntProperty.java 12 May 2008 17:18:55 -0000 1.8 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,121 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2008 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.ui.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()); >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntStackFrame.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntStackFrame.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntStackFrame.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntStackFrame.java 2 Jun 2005 16:34:26 -0000 1.15 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,314 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.debug.model; >- >-import org.eclipse.ant.internal.ui.AntUtil; >-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 thread >- * @param id stack frame id (0 is the top of the stack) >- */ >- public AntStackFrame(AntThread thread, int id, String name, String fullPath, int lineNumber) { >- super((AntDebugTarget) thread.getDebugTarget()); >- fId = id; >- fThread = thread; >- fLineNumber= lineNumber; >- fName= name; >- setFilePath(fullPath); >- } >- >- protected 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; >- } >- >- protected void setLineNumber(int lineNumber) { >- fLineNumber= lineNumber; >- } >- >- protected void setFilePath(String fullPath) { >- fFullPath= fullPath; >- IFile file= AntUtil.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; >- } >- >- protected 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; >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntThread.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntThread.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntThread.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntThread.java 17 Feb 2006 01:22:10 -0000 1.24 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,479 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2006 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.ui.debug.model; >- >-import java.util.ArrayList; >-import java.util.List; >- >-import org.eclipse.debug.core.DebugEvent; >-import org.eclipse.debug.core.DebugException; >-import org.eclipse.debug.core.model.IBreakpoint; >-import org.eclipse.debug.core.model.IStackFrame; >-import org.eclipse.debug.core.model.IThread; >-import org.eclipse.debug.core.model.IVariable; >- >-/** >- * An Ant build thread. >- */ >-public class AntThread extends AntDebugElement implements IThread { >- >- /** >- * Breakpoints this thread is suspended at or <code>null</code> >- * if none. >- */ >- private IBreakpoint[] fBreakpoints; >- >- /** >- * The stackframes associated with this thread >- */ >- private List fFrames= new ArrayList(1); >- >- /** >- * The stackframes to be reused on suspension >- */ >- private List fOldFrames; >- >- /** >- * Whether this thread is stepping >- */ >- private boolean fStepping = false; >- >- private boolean fRefreshProperties= true; >- >- /** >- * The user properties associated with this thread >- */ >- private AntProperties fUserProperties; >- >- /** >- * The system properties associated with this thread >- */ >- private AntProperties fSystemProperties; >- >- /** >- * The properties set during the build associated with this thread >- */ >- private AntProperties fRuntimeProperties; >- >- private Object fPropertiesLock= new Object(); >- >- /** >- * Constructs a new thread for the given target >- * >- * @param target the Ant Build >- */ >- public AntThread(AntDebugTarget target) { >- super(target); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IThread#getStackFrames() >- */ >- public synchronized IStackFrame[] getStackFrames() throws DebugException { >- if (isSuspended()) { >- if (fFrames.size() == 0) { >- getStackFrames0(); >- } >- } >- >- return (IStackFrame[]) fFrames.toArray(new IStackFrame[fFrames.size()]); >- } >- >- /** >- * Retrieves the current stack frames in the thread >- * possibly waiting until the frames are populated >- * >- */ >- private void getStackFrames0() throws DebugException { >- synchronized (fFrames) { >- getAntDebugTarget().getStackFrames(); >- if (fFrames.size() > 0) { >- //frames set..no need to wait >- return; >- } >- int attempts= 0; >- try { >- while (fFrames.size() == 0 && !isTerminated()) { >- fFrames.wait(50); >- if (attempts == 20 && fFrames.size() == 0 && !isTerminated()) { >- throwDebugException(DebugModelMessages.AntThread_3); >- } >- attempts++; >- } >- } catch (InterruptedException e) { >- } >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IThread#hasStackFrames() >- */ >- public boolean hasStackFrames() throws DebugException { >- return isSuspended(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IThread#getPriority() >- */ >- public int getPriority() throws DebugException { >- return 0; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IThread#getTopStackFrame() >- */ >- public synchronized IStackFrame getTopStackFrame() throws DebugException { >- if (isSuspended()) { >- if (fFrames.size() == 0) { >- getStackFrames0(); >- } >- if (fFrames.size() > 0) { >- return (IStackFrame)fFrames.get(0); >- } >- } >- return null; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IThread#getName() >- */ >- public String getName() { >- return "Thread [Ant Build]"; //$NON-NLS-1$ >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IThread#getBreakpoints() >- */ >- public IBreakpoint[] getBreakpoints() { >- if (fBreakpoints == null) { >- return new IBreakpoint[0]; >- } >- return fBreakpoints; >- } >- >- /** >- * Sets the breakpoints this thread is suspended at, or <code>null</code> >- * if none. >- * >- * @param breakpoints the breakpoints this thread is suspended at, or <code>null</code> >- * if none >- */ >- protected void setBreakpoints(IBreakpoint[] breakpoints) { >- fBreakpoints = breakpoints; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ISuspendResume#canResume() >- */ >- public boolean canResume() { >- return isSuspended(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() >- */ >- public boolean canSuspend() { >- return !isSuspended(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() >- */ >- public boolean isSuspended() { >- return getDebugTarget().isSuspended(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ISuspendResume#resume() >- */ >- public synchronized void resume() throws DebugException { >- aboutToResume(DebugEvent.CLIENT_REQUEST, false); >- getDebugTarget().resume(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ISuspendResume#suspend() >- */ >- public synchronized void suspend() throws DebugException { >- getDebugTarget().suspend(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IStep#canStepInto() >- */ >- public boolean canStepInto() { >- return isSuspended(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IStep#canStepOver() >- */ >- public boolean canStepOver() { >- return isSuspended(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IStep#canStepReturn() >- */ >- public boolean canStepReturn() { >- return false; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IStep#isStepping() >- */ >- public boolean isStepping() { >- return fStepping; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IStep#stepInto() >- */ >- public synchronized void stepInto() throws DebugException { >- aboutToResume(DebugEvent.STEP_INTO, true); >- ((AntDebugTarget)getDebugTarget()).stepInto(); >- } >- >- private void aboutToResume(int detail, boolean stepping) { >- fRefreshProperties= true; >- fOldFrames= new ArrayList(fFrames); >- fFrames.clear(); >- setPropertiesValid(false); >- setStepping(stepping); >- setBreakpoints(null); >- fireResumeEvent(detail); >- } >- >- private void setPropertiesValid(boolean valid) { >- if (fUserProperties != null) { >- fUserProperties.setValid(valid); >- fSystemProperties.setValid(valid); >- fRuntimeProperties.setValid(valid); >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IStep#stepOver() >- */ >- public synchronized void stepOver() throws DebugException { >- aboutToResume(DebugEvent.STEP_OVER, true); >- ((AntDebugTarget)getDebugTarget()).stepOver(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.IStep#stepReturn() >- */ >- public synchronized void stepReturn() throws DebugException { >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ITerminate#canTerminate() >- */ >- public boolean canTerminate() { >- return !isTerminated(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ITerminate#isTerminated() >- */ >- public boolean isTerminated() { >- return getDebugTarget().isTerminated(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.ITerminate#terminate() >- */ >- public void terminate() throws DebugException { >- fFrames.clear(); >- getDebugTarget().terminate(); >- } >- >- /** >- * Sets whether this thread is stepping >- * >- * @param stepping whether stepping >- */ >- protected void setStepping(boolean stepping) { >- fStepping = stepping; >- } >- >- public void buildStack(String data) { >- synchronized (fFrames) { >- String[] strings= data.split(DebugMessageIds.MESSAGE_DELIMITER); >- //0 STACK message >- //1 targetName >- //2 taskName >- //3 filePath >- //4 lineNumber >- //5 ... >- if (fOldFrames != null && (strings.length - 1)/ 4 != fOldFrames.size()) { >- fOldFrames= null; //stack size changed..do not preserve >- } >- StringBuffer name; >- String filePath; >- int lineNumber; >- int stackFrameId= 0; >- String taskName; >- for (int i = 1; i < strings.length; i++) { >- if (strings[i].length() > 0) { >- name= new StringBuffer(strings[i]); >- taskName= strings[++i]; >- if (taskName.length() > 0) { >- name.append(": "); //$NON-NLS-1$ >- name.append(taskName); >- } >- } else { >- name= new StringBuffer(strings[++i]); >- } >- filePath= strings[++i]; >- lineNumber= Integer.parseInt(strings[++i]); >- addFrame(stackFrameId++, name.toString(), filePath, lineNumber); >- } >- //wake up the call from getStackFrames >- fFrames.notifyAll(); >- } >- } >- >- private void addFrame(int stackFrameId, String name, String filePath, int lineNumber) { >- AntStackFrame frame= getOldFrame(); >- >- if (frame == null || !frame.getFilePath().equals(filePath)) { >- frame= new AntStackFrame(this, stackFrameId, name, filePath, lineNumber); >- } else { >- frame.setFilePath(filePath); >- frame.setId(stackFrameId); >- frame.setLineNumber(lineNumber); >- frame.setName(name); >- } >- fFrames.add(frame); >- } >- >- private AntStackFrame getOldFrame() { >- if (fOldFrames == null) { >- return null; >- } >- AntStackFrame frame= (AntStackFrame) fOldFrames.remove(0); >- if (fOldFrames.isEmpty()) { >- fOldFrames= null; >- } >- return frame; >- } >- >- public void newProperties(String data) { >- synchronized (fPropertiesLock) { >- try { >- String[] datum= data.split(DebugMessageIds.MESSAGE_DELIMITER); >- if (fUserProperties == null) { >- initializePropertyGroups(); >- } >- >- List userProperties= ((AntPropertiesValue)fUserProperties.getLastValue()).getProperties(); >- List systemProperties= ((AntPropertiesValue)fSystemProperties.getLastValue()).getProperties(); >- List runtimeProperties= ((AntPropertiesValue)fRuntimeProperties.getLastValue()).getProperties(); >- //0 PROPERTIES message >- //1 propertyName length >- //2 propertyName >- //3 propertyValue length >- //3 propertyValue >- //4 propertyType >- //5 ... >- if (datum.length > 1) { //new properties >- StringBuffer propertyName; >- StringBuffer propertyValue; >- int propertyNameLength; >- int propertyValueLength; >- for (int i = 1; i < datum.length; i++) { >- propertyNameLength= Integer.parseInt(datum[i]); >- propertyName= new StringBuffer(datum[++i]); >- while (propertyName.length() != propertyNameLength) { >- propertyName.append(DebugMessageIds.MESSAGE_DELIMITER); >- propertyName.append(datum[++i]); >- } >- >- propertyName= getAntDebugTarget().getAntDebugController().unescapeString(propertyName); >- >- propertyValueLength= Integer.parseInt(datum[++i]); >- if (propertyValueLength == 0 && i + 1 == datum.length) { //bug 81299 >- propertyValue= new StringBuffer(""); //$NON-NLS-1$ >- } else { >- propertyValue= new StringBuffer(datum[++i]); >- } >- while (propertyValue.length() != propertyValueLength) { >- propertyValue.append(DebugMessageIds.MESSAGE_DELIMITER); >- propertyValue.append(datum[++i]); >- } >- >- propertyValue= getAntDebugTarget().getAntDebugController().unescapeString(propertyValue); >- >- int propertyType= Integer.parseInt(datum[++i]); >- addProperty(userProperties, systemProperties, runtimeProperties, propertyName.toString(), propertyValue.toString(), propertyType); >- } >- } >- } finally { >- fRefreshProperties= false; >- setPropertiesValid(true); >- //wake up the call from getVariables >- fPropertiesLock.notifyAll(); >- } >- } >- } >- >- private void addProperty(List userProperties, List systemProperties, List runtimeProperties, String propertyName, String propertyValue, int propertyType) { >- AntProperty property= new AntProperty((AntDebugTarget) getDebugTarget(), propertyName, propertyValue); >- switch (propertyType) { >- case DebugMessageIds.PROPERTY_SYSTEM: >- systemProperties.add(property); >- break; >- case DebugMessageIds.PROPERTY_USER: >- userProperties.add(property); >- break; >- case DebugMessageIds.PROPERTY_RUNTIME: >- runtimeProperties.add(property); >- break; >- } >- } >- >- private void initializePropertyGroups() { >- AntDebugTarget target= getAntDebugTarget(); >- fUserProperties= new AntProperties(target, DebugModelMessages.AntThread_0); >- fUserProperties.setValue(new AntPropertiesValue(target)); >- fSystemProperties= new AntProperties(target, DebugModelMessages.AntThread_1); >- fSystemProperties.setValue(new AntPropertiesValue(target)); >- fRuntimeProperties= new AntProperties(target, DebugModelMessages.AntThread_2); >- fRuntimeProperties.setValue(new AntPropertiesValue(target)); >- } >- >- protected IVariable[] getVariables() throws DebugException { >- synchronized (fPropertiesLock) { >- if (fRefreshProperties) { >- getAntDebugTarget().getProperties(); >- if (fRefreshProperties) { >- //properties have not been set; need to wait >- try { >- int attempts= 0; >- while (fRefreshProperties && !isTerminated()) { >- fPropertiesLock.wait(50); >- if (attempts == 20 && fRefreshProperties && !isTerminated()) { >- throwDebugException(DebugModelMessages.AntThread_4); >- } >- attempts++; >- } >- } catch (InterruptedException ie) { >- } >- } >- } >- if (fSystemProperties == null) { >- return new IVariable[0]; >- } >- return new IVariable[]{fSystemProperties, fUserProperties, fRuntimeProperties}; >- } >- } >-} >\ No newline at end of file >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntValue.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntValue.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntValue.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/AntValue.java 26 Feb 2005 00:19:32 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,71 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.debug.model; >- >-import org.eclipse.ant.internal.ui.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; >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugMessageIds.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugMessageIds.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugMessageIds.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugMessageIds.java 23 Feb 2005 17:20:44 -0000 1.9 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,48 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.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; >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.java,v >retrieving revision 1.6 >diff -u -r1.6 DebugModelMessages.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.java 12 May 2005 21:06:40 -0000 1.6 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.java 7 Oct 2009 20:08:20 -0000 >@@ -14,8 +14,6 @@ > public class DebugModelMessages extends NLS { > private static final String BUNDLE_NAME = "org.eclipse.ant.internal.ui.debug.model.DebugModelMessages";//$NON-NLS-1$ > >- public static String AntDebugTarget_0; >- > public static String AntDebugModelPresentation_0; > public static String AntDebugModelPresentation_1; > public static String AntDebugModelPresentation_2; >@@ -23,14 +21,6 @@ > public static String AntDebugModelPresentation_4; > public static String AntDebugModelPresentation_5; > >- 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 >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.properties,v >retrieving revision 1.7 >diff -u -r1.7 DebugModelMessages.properties >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.properties 12 May 2005 21:06:24 -0000 1.7 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.properties 7 Oct 2009 20:08:20 -0000 >@@ -9,20 +9,9 @@ > # IBM Corporation - initial API and implementation > ############################################################################### > >-AntDebugTarget_0=Ant Build >- > AntDebugModelPresentation_0=<not available> > AntDebugModelPresentation_1=\ line: {0} > AntDebugModelPresentation_2=(breakpoint at line {0} in {1}) > AntDebugModelPresentation_3=\ (Suspended {0}) > AntDebugModelPresentation_4=\ (Suspended) > AntDebugModelPresentation_5=(run to line {0} in {1}) >- >-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 >Index: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/RemoteAntDebugBuildListener.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/RemoteAntDebugBuildListener.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/RemoteAntDebugBuildListener.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/RemoteAntDebugBuildListener.java 20 Mar 2006 22:51:29 -0000 1.22 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,321 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2003, 2006 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.ui.debug.model; >- >-import java.io.BufferedReader; >-import java.io.IOException; >-import java.io.InputStreamReader; >-import java.io.PrintWriter; >-import java.net.Socket; >-import java.net.UnknownHostException; >- >-import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.debug.IAntDebugController; >-import org.eclipse.ant.internal.ui.launchConfigurations.RemoteAntBuildListener; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.debug.core.DebugEvent; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.ILaunch; >-import org.eclipse.debug.core.model.IBreakpoint; >-import org.eclipse.debug.core.model.ILineBreakpoint; >-import org.eclipse.debug.core.model.IProcess; >- >-public class RemoteAntDebugBuildListener extends RemoteAntBuildListener implements IAntDebugController { >- >- // sockets to communicate with the remote Ant debug build logger >- private Socket fRequestSocket; >- private PrintWriter fRequestWriter; >- private BufferedReader fResponseReader; >- >- private int fRequestPort= -1; >- private Thread fReaderThread; >- >- private AntDebugTarget fTarget; >- >- /** >- * Reader thread that processes request responses from the remote Ant debug build logger >- */ >- private class ReaderThread extends Thread { >- public ReaderThread() { >- super("Ant Request Response Reader Thread"); //$NON-NLS-1$ >- setDaemon(true); >- } >- >- public void run(){ >- try { >- String message= null; >- while (fResponseReader != null) { >- synchronized (RemoteAntDebugBuildListener.this) { >- if (fResponseReader != null && (message= fResponseReader.readLine()) != null) { >- receiveMessage(message); >- } >- } >- } >- } catch (IOException ie) { //the other end has shutdown >- RemoteAntDebugBuildListener.this.shutDown(); >- } catch (Exception e) { >- AntUIPlugin.log("Internal error processing remote response", e); //$NON-NLS-1$ >- RemoteAntDebugBuildListener.this.shutDown(); >- } >- } >- } >- >- public RemoteAntDebugBuildListener(ILaunch launch) { >- super(launch); >- //fDebug= true; >- } >- >- protected void receiveMessage(String message) { >- if (message.startsWith(DebugMessageIds.BUILD_STARTED)) { >- buildStarted(); >- } else if (message.startsWith(DebugMessageIds.SUSPENDED)){ >- handleSuspendMessage(message); >- } else if (message.startsWith(DebugMessageIds.TERMINATED)){ >- fTarget.terminated(); >- } else if (message.startsWith(DebugMessageIds.STACK)){ >- AntThread thread= (AntThread) fTarget.getThreads()[0]; >- thread.buildStack(message); >- } else if (message.startsWith(DebugMessageIds.PROPERTIES)){ >- AntThread thread= (AntThread) fTarget.getThreads()[0]; >- thread.newProperties(message); >- } else { >- super.receiveMessage(message); >- } >- } >- >- private void handleSuspendMessage(String message) { >- if (message.endsWith(DebugMessageIds.CLIENT_REQUEST)) { >- fTarget.suspended(DebugEvent.CLIENT_REQUEST); >- } else if (message.endsWith(DebugMessageIds.STEP)) { >- fTarget.suspended(DebugEvent.STEP_END); >- } else if (message.indexOf(DebugMessageIds.BREAKPOINT) >= 0) { >- fTarget.breakpointHit(message); >- } >- } >- >- private void buildStarted() { >- IProcess process= getProcess(); >- while(process == null) { >- try { >- synchronized (this) { >- wait(400); >- } >- process= getProcess(); >- } catch (InterruptedException ie) { >- } >- } >- fTarget= new AntDebugTarget(fLaunch, process, this); >- fLaunch.addDebugTarget(fTarget); >- >- if (!connectRequest()) { >- RemoteAntDebugBuildListener.this.shutDown(); >- return; >- } >- >- fTarget.buildStarted(); >- } >- >- private boolean connectRequest() { >- Exception exception= null; >- for (int i= 1; i < 20; i++) { >- try { >- fRequestSocket = new Socket("localhost", fRequestPort); //$NON-NLS-1$ >- fRequestWriter = new PrintWriter(fRequestSocket.getOutputStream(), true); >- fResponseReader = new BufferedReader(new InputStreamReader(fRequestSocket.getInputStream())); >- >- fReaderThread= new ReaderThread(); >- fReaderThread.start(); >- return true; >- } catch (UnknownHostException e) { >- exception= e; >- break; >- } catch (IOException e) { >- exception= e; >- } >- try { >- Thread.sleep(500); >- } catch(InterruptedException e) { >- } >- } >- AntUIPlugin.log("Internal error attempting to connect to debug target", exception); //$NON-NLS-1$ >- return false; >- } >- >- /** >- * Start listening to an Ant build. Start a server connection that >- * the RemoteAntDebugBuildLogger can connect to. >- * >- * @param eventPort The port number to create the server connection on >- * @param requestPort The port number to use for sending requests to the remote logger >- */ >- public synchronized void startListening(int eventPort, int requestPort) { >- super.startListening(eventPort); >- fRequestPort= requestPort; >- } >- >- /** >- * Sends a request to the Ant build >- * >- * @param request debug command >- */ >- protected void sendRequest(String request) { >- if (fRequestSocket == null) { >- return; >- } >- synchronized (fRequestSocket) { >- fRequestWriter.println(request); >- } >- } >- >- protected synchronized void shutDown() { >- if (fTarget != null) { >- fTarget.terminated(); >- fTarget= null; >- } >- fLaunch= null; >- if (DebugPlugin.getDefault() != null) { >- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this); >- } >- try { >- if (fReaderThread != null) { >- // interrupt reader thread so that we don't block on close >- // on a lock held by the BufferedReader >- // see bug: 38955 >- fReaderThread.interrupt(); >- } >- if (fResponseReader != null) { >- fResponseReader.close(); >- fResponseReader= null; >- } >- } catch(IOException e) { >- } >- if (fRequestWriter != null) { >- fRequestWriter.close(); >- fRequestWriter= null; >- } >- try{ >- if(fRequestSocket != null) { >- fRequestSocket.close(); >- fRequestSocket= null; >- } >- } catch(IOException e) { >- } >- super.shutDown(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#resume() >- */ >- public void resume() { >- sendRequest(DebugMessageIds.RESUME); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#suspend() >- */ >- public void suspend() { >- sendRequest(DebugMessageIds.SUSPEND); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#stepInto() >- */ >- public void stepInto() { >- sendRequest(DebugMessageIds.STEP_INTO); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#stepOver() >- */ >- public void stepOver() { >- sendRequest(DebugMessageIds.STEP_OVER); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#handleBreakpoint(IBreakpoint, boolean) >- */ >- public void handleBreakpoint(IBreakpoint breakpoint, boolean add) { >- if (fTarget == null || !fTarget.supportsBreakpoint(breakpoint)) { >- return; >- } >- StringBuffer message= new StringBuffer(); >- if (add) { >- try { >- if (!breakpoint.isEnabled()) { >- return; >- } >- } catch (CoreException e) { >- AntUIPlugin.log(e); >- return; >- } >- message.append(DebugMessageIds.ADD_BREAKPOINT); >- } else { >- message.append(DebugMessageIds.REMOVE_BREAKPOINT); >- } >- message.append(DebugMessageIds.MESSAGE_DELIMITER); >- message.append(breakpoint.getMarker().getResource().getLocation().toOSString()); >- message.append(DebugMessageIds.MESSAGE_DELIMITER); >- try { >- message.append(((ILineBreakpoint)breakpoint).getLineNumber()); >- sendRequest(message.toString()); >- } catch (CoreException ce) { >- AntUIPlugin.log(ce); >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#getProperties() >- */ >- public void getProperties() { >- sendRequest(DebugMessageIds.PROPERTIES); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#getStackFrames() >- */ >- public void getStackFrames() { >- sendRequest(DebugMessageIds.STACK); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.debug.IAntDebugController#unescapeString(java.lang.StringBuffer) >- */ >- public StringBuffer unescapeString(StringBuffer property) { >- if (property.indexOf("\\r") == -1 && property.indexOf("\\n") == -1) { //$NON-NLS-1$ //$NON-NLS-2$ >- return property; >- } >- for (int i= 0; i < property.length(); i++) { >- if ('\\' == property.charAt(i)) { >- String newString= ""; //$NON-NLS-1$ >- if ('r' == property.charAt(i + 1)) { >- if (i-1 > - 1 && '\\' == property.charAt(i-1)) { >- newString= "r"; //$NON-NLS-1$ >- } else { >- newString+= '\r'; >- } >- } else if ('n' == property.charAt(i + 1)) { >- if (i-1 > - 1 && '\\' == property.charAt(i-1)) { >- newString= "n"; //$NON-NLS-1$ >- } else { >- newString+= '\n'; >- } >- >- } >- if (newString.length() > 0) { >- property.replace(i, i + 2, newString); >- } >- } >- } >- >- return property; >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntBuilderTargetsTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntBuilderTargetsTab.java,v >retrieving revision 1.8 >diff -u -r1.8 AntBuilderTargetsTab.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntBuilderTargetsTab.java 13 Aug 2008 15:32:18 -0000 1.8 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntBuilderTargetsTab.java 7 Oct 2009 20:08:20 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * 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 >@@ -17,6 +17,9 @@ > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.AntUtil; > import org.eclipse.ant.internal.ui.IAntUIConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.model.BuilderCoreUtils; > import org.eclipse.core.resources.IncrementalProjectBuilder; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchConfiguration; >@@ -36,8 +39,6 @@ > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.externaltools.internal.model.BuilderUtils; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds; > > public class AntBuilderTargetsTab extends AbstractLaunchConfigurationTab { >@@ -68,16 +69,16 @@ > Object source = e.getSource(); > Text text= null; > if (source == fAfterCleanTarget) { >- attribute= org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS; >+ attribute= IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS; > text= fAfterCleanTargetText; > } else if (source == fManualBuildTarget) { >- attribute= org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS; >+ attribute= IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS; > text= fManualBuildTargetText; > } else if (source == fAutoBuildTarget) { >- attribute= org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS; >+ attribute= IAntLaunchConstants.ATTR_ANT_AUTO_TARGETS; > text= fAutoBuildTargetText; > } else if (source == fDuringCleanTarget) { >- attribute= org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS; >+ attribute= IAntLaunchConstants.ATTR_ANT_CLEAN_TARGETS; > text= fDuringCleanTargetText; > } > >@@ -147,7 +148,7 @@ > } catch (CoreException e) { > return; > } >- copy.setAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, (String)fAttributeToTargets.get(attribute)); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, (String)fAttributeToTargets.get(attribute)); > SetTargetsDialog dialog= new SetTargetsDialog(getShell(), copy); > if (dialog.open() != Window.OK) { > return; >@@ -211,7 +212,7 @@ > > public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { > configuration.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true); >- configuration.setAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_TARGETS_UPDATED, true); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_TARGETS_UPDATED, true); > } > > public void initializeFrom(ILaunchConfiguration configuration) { >@@ -233,19 +234,19 @@ > String afterCleanTargets= null; > String duringCleanTargets= null; > try { >- if (!configuration.getAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_TARGETS_UPDATED, false)) { >+ if (!configuration.getAttribute(IAntLaunchConstants.ATTR_TARGETS_UPDATED, false)) { > //not yet migrated to new format >- configTargets= configuration.getAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, (String)null); >+ configTargets= configuration.getAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, (String)null); > } > >- autoTargets= configuration.getAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS, (String)null); >- manualTargets= configuration.getAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS, (String)null); >- afterCleanTargets= configuration.getAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, (String)null); >- duringCleanTargets= configuration.getAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS, (String)null); >- initializeAttributeToTargets(fAutoBuildTargetText, autoTargets, configTargets, org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS); >- initializeAttributeToTargets(fManualBuildTargetText, manualTargets, configTargets, org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS); >- initializeAttributeToTargets(fDuringCleanTargetText, duringCleanTargets, configTargets, org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS); >- initializeAttributeToTargets(fAfterCleanTargetText, afterCleanTargets, configTargets, org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS); >+ autoTargets= configuration.getAttribute(IAntLaunchConstants.ATTR_ANT_AUTO_TARGETS, (String)null); >+ manualTargets= configuration.getAttribute(IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS, (String)null); >+ afterCleanTargets= configuration.getAttribute(IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, (String)null); >+ duringCleanTargets= configuration.getAttribute(IAntLaunchConstants.ATTR_ANT_CLEAN_TARGETS, (String)null); >+ initializeAttributeToTargets(fAutoBuildTargetText, autoTargets, configTargets, IAntLaunchConstants.ATTR_ANT_AUTO_TARGETS); >+ initializeAttributeToTargets(fManualBuildTargetText, manualTargets, configTargets, IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS); >+ initializeAttributeToTargets(fDuringCleanTargetText, duringCleanTargets, configTargets, IAntLaunchConstants.ATTR_ANT_CLEAN_TARGETS); >+ initializeAttributeToTargets(fAfterCleanTargetText, afterCleanTargets, configTargets, IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS); > } catch (CoreException ce) { > AntUIPlugin.log("Error reading configuration", ce); //$NON-NLS-1$ > } >@@ -273,7 +274,7 @@ > } catch (CoreException e) { > AntUIPlugin.log("Error reading configuration", e); //$NON-NLS-1$ > } >- int buildTypes[]= BuilderUtils.buildTypesToArray(buildKindString); >+ int buildTypes[]= BuilderCoreUtils.buildTypesToArray(buildKindString); > for (int i = 0; i < buildTypes.length; i++) { > switch (buildTypes[i]) { > case IncrementalProjectBuilder.FULL_BUILD: >@@ -308,16 +309,15 @@ > } > configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString()); > >- String targets= (String) fAttributeToTargets.get(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS); >- configuration.setAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, targets); >- targets= (String) fAttributeToTargets.get(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS); >- configuration.setAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS, targets); >- targets= (String) fAttributeToTargets.get(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS); >- configuration.setAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS, targets); >- targets= (String) fAttributeToTargets.get(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS); >- configuration.setAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS, targets); >- >- configuration.setAttribute(org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_TARGETS_UPDATED, true); >+ String targets= (String) fAttributeToTargets.get(IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, targets); >+ targets= (String) fAttributeToTargets.get(IAntLaunchConstants.ATTR_ANT_AUTO_TARGETS); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_AUTO_TARGETS, targets); >+ targets= (String) fAttributeToTargets.get(IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS, targets); >+ targets= (String) fAttributeToTargets.get(IAntLaunchConstants.ATTR_ANT_CLEAN_TARGETS); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_CLEAN_TARGETS, targets); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_TARGETS_UPDATED, true); > } > > /* (non-Javadoc) >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntClasspathProvider.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntClasspathProvider.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntClasspathProvider.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntClasspathProvider.java 1 Dec 2005 22:56:18 -0000 1.13 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,50 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2005 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.ui.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); >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntClasspathTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntClasspathTab.java,v >retrieving revision 1.28 >diff -u -r1.28 AntClasspathTab.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntClasspathTab.java 11 Aug 2005 16:30:00 -0000 1.28 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntClasspathTab.java 7 Oct 2009 20:08:20 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * 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 >@@ -11,6 +11,7 @@ > package org.eclipse.ant.internal.ui.launchConfigurations; > > import org.eclipse.ant.internal.ui.AntUtil; >+import org.eclipse.ant.internal.launching.launchConfigurations.AntHomeClasspathEntry; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.ui.ILaunchConfigurationTab; >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntHomeClasspathEntry.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntHomeClasspathEntry.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntHomeClasspathEntry.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntHomeClasspathEntry.java 11 Apr 2006 14:45:04 -0000 1.11 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,209 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2006 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.ui.launchConfigurations; >- >-import java.io.File; >-import com.ibm.icu.text.MessageFormat; >-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; >- >-/** >- * 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 >- */ >- protected 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; >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntJRETab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntJRETab.java,v >retrieving revision 1.45 >diff -u -r1.45 AntJRETab.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntJRETab.java 1 Sep 2009 19:44:20 -0000 1.45 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntJRETab.java 7 Oct 2009 20:08:20 -0000 >@@ -16,7 +16,8 @@ > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.IAntUIConstants; > import org.eclipse.ant.internal.ui.IAntUIHelpContextIds; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.variables.IStringVariableManager; > import org.eclipse.core.variables.VariablesPlugin; >@@ -35,11 +36,10 @@ > import org.eclipse.swt.widgets.Composite; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > public class AntJRETab extends JavaJRETab { > >- private static final String MAIN_TYPE_NAME= "org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"; //$NON-NLS-1$ >+ private static final String MAIN_TYPE_NAME= "org.eclipse.ant.internal.launching.remote.InternalAntRunner"; //$NON-NLS-1$ > > private VMArgumentsBlock fVMArgumentsBlock= new VMArgumentsBlock(); > private AntWorkingDirectoryBlock fWorkingDirectoryBlock= new AntWorkingDirectoryBlock(); >@@ -102,14 +102,14 @@ > configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String)null); > configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, (String)null); > configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String)null); >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_DEFAULT_VM_INSTALL, false); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_DEFAULT_VM_INSTALL, false); > } else { > super.performApply(configuration); > > if (useDefaultSeparateJRE(configuration)) { >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_DEFAULT_VM_INSTALL, true); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_DEFAULT_VM_INSTALL, true); > } else { >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_DEFAULT_VM_INSTALL, false); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_DEFAULT_VM_INSTALL, false); > } > > applySeparateVMAttributes(configuration); >@@ -190,7 +190,7 @@ > */ > public void initializeFrom(ILaunchConfiguration configuration) { > try { >- boolean isDefaultVMInstall= configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_DEFAULT_VM_INSTALL, false); >+ boolean isDefaultVMInstall= configuration.getAttribute(IAntLaunchConstants.ATTR_DEFAULT_VM_INSTALL, false); > if (isDefaultVMInstall) { > ILaunchConfigurationWorkingCopy copy = null; > if (configuration instanceof ILaunchConfigurationWorkingCopy) { >@@ -275,7 +275,7 @@ > config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, "org.eclipse.ant.ui.AntClasspathProvider"); //$NON-NLS-1$ > IVMInstall defaultVMInstall= getDefaultVMInstall(config); > if (defaultVMInstall != null) { >- config.setAttribute(IAntLaunchConfigurationConstants.ATTR_DEFAULT_VM_INSTALL, true); >+ config.setAttribute(IAntLaunchConstants.ATTR_DEFAULT_VM_INSTALL, true); > setDefaultVMInstallAttributes(defaultVMInstall, config); > applySeparateVMAttributes(config); > } >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.java,v >retrieving revision 1.8 >diff -u -r1.8 AntLaunchConfigurationMessages.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.java 12 Dec 2007 21:00:26 -0000 1.8 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.java 7 Oct 2009 20:08:20 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved. This >+ * 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 >@@ -20,14 +20,6 @@ > public static String AddVariableStringAction_3; > public static String AddVariableStringAction_4; > >- 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 AntLaunchShortcut_Unable; > public static String AntLaunchShortcut_2; > public static String AntLaunchShortcut_3; >@@ -45,9 +37,7 @@ > > public static String AntJRETab_2; > public static String AntJRETab_3; >- >- public static String AntHomeClasspathEntry_8; >- public static String AntHomeClasspathEntry_9; >+ > public static String AntBuilderTargetsTab_0; > public static String AntBuilderTargetsTab_1; > public static String AntBuilderTargetsTab_2; >@@ -58,8 +48,6 @@ > public static String AntBuilderTargetsTab_7; > public static String AntBuilderTargetsTab_8; > public static String AntBuilderTargetsTab_10; >- public static String AntHomeClasspathEntry_10; >- public static String AntHomeClasspathEntry_11; > > public static String AntMainTab__Select_a_build_file__1; > public static String AntMainTab_3; >@@ -86,8 +74,6 @@ > public static String AntTargetsTab_1; > public static String AntClasspathTab_0; > >- public static String ContributedClasspathEntriesEntry_1; >- > public static String EditAntHomeEntryAction_1; > > public static String TargetOrderDialog_Order_Targets_1; >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.properties,v >retrieving revision 1.44 >diff -u -r1.44 AntLaunchConfigurationMessages.properties >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.properties 12 Dec 2007 21:00:25 -0000 1.44 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.properties 7 Oct 2009 20:08:20 -0000 >@@ -15,14 +15,6 @@ > AddVariableStringAction_3=&Variables... > AddVariableStringAction_4=Add Variable Classpath Entry > >-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... >- > AntLaunchShortcut_Unable=Unable to find an Ant file to run. > AntLaunchShortcut_2=An exception occurred while creating a default Ant launch configuration for {0} > AntLaunchShortcut_3=An exception occurred while retrieving Ant launch configurations. >@@ -41,8 +33,6 @@ > AntJRETab_2=Run in the same &JRE as the workspace > AntJRETab_3=Se¶te JRE: > >-AntHomeClasspathEntry_8=Ant Home (Default) >-AntHomeClasspathEntry_9=Ant Home ({0}) > AntBuilderTargetsTab_0=<Builder is not set to run for this build kind> > AntBuilderTargetsTab_1=After a "Clean": > AntBuilderTargetsTab_2=&Set Targets... >@@ -53,8 +43,6 @@ > AntBuilderTargetsTab_7=During a "Clean": > AntBuilderTargetsTab_8=Set Tar&gets... > AntBuilderTargetsTab_10=<default target selected> >-AntHomeClasspathEntry_10=Ant Home {0} does not exist >-AntHomeClasspathEntry_11=Ant Home {0} does not contain a "lib" directory > > AntMainTab__Select_a_build_file__1=&Select a buildfile: > AntMainTab_3=Base Direct&ory: >@@ -81,8 +69,6 @@ > AntTargetsTab_1=No targets could be determined for the buildfile > AntClasspathTab_0=Add F&olders... > >-ContributedClasspathEntriesEntry_1=Additional Tasks & Support >- > EditAntHomeEntryAction_1=Ant &Home... > > TargetOrderDialog_Order_Targets_1=Order Targets >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchDelegate.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchDelegate.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchDelegate.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchDelegate.java 6 Apr 2009 21:06:45 -0000 1.82 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,761 +0,0 @@ >-/******************************************************************************* >- * 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 >- * Juan A. Hernandez - bug 89926 >- * dakshinamurthy.karra@gmail.com - bug 165371 >- *******************************************************************************/ >-package org.eclipse.ant.internal.ui.launchConfigurations; >- >-import java.io.File; >-import java.io.IOException; >-import java.net.URL; >-import java.util.HashMap; >-import java.util.Iterator; >-import java.util.List; >-import java.util.Map; >- >-import org.apache.tools.ant.ProjectHelper; >-import org.eclipse.ant.core.AntCorePlugin; >-import org.eclipse.ant.core.AntCorePreferences; >-import org.eclipse.ant.core.AntRunner; >-import org.eclipse.ant.core.Property; >-import org.eclipse.ant.core.Task; >-import org.eclipse.ant.core.Type; >-import org.eclipse.ant.internal.core.AbstractEclipseBuildLogger; >-import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.AntUtil; >-import org.eclipse.ant.internal.ui.IAntUIConstants; >-import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants; >-import org.eclipse.ant.internal.ui.debug.IAntDebugConstants; >-import org.eclipse.ant.internal.ui.debug.model.RemoteAntDebugBuildListener; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >-import org.eclipse.core.resources.IProject; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.FileLocator; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.Path; >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.core.runtime.Status; >-import org.eclipse.core.runtime.SubProgressMonitor; >-import org.eclipse.core.variables.VariablesPlugin; >-import org.eclipse.debug.core.DebugEvent; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.IBreakpointManager; >-import org.eclipse.debug.core.IDebugEventSetListener; >-import org.eclipse.debug.core.ILaunch; >-import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >-import org.eclipse.debug.core.ILaunchManager; >-import org.eclipse.debug.core.model.IBreakpoint; >-import org.eclipse.debug.core.model.IProcess; >-import org.eclipse.debug.core.model.LaunchConfigurationDelegate; >-import org.eclipse.debug.ui.CommonTab; >-import org.eclipse.debug.ui.IDebugUIConstants; >-import org.eclipse.debug.ui.RefreshTab; >-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; >-import org.eclipse.jdt.launching.IVMInstall; >-import org.eclipse.jdt.launching.JavaRuntime; >-import org.eclipse.jdt.launching.SocketUtil; >-import org.eclipse.jface.dialogs.MessageDialogWithToggle; >-import org.eclipse.jface.preference.IPreferenceStore; >-import org.eclipse.osgi.service.resolver.BundleDescription; >-import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab; >-import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >-import org.eclipse.ui.externaltools.internal.program.launchConfigurations.BackgroundResourceRefresher; >-import org.osgi.framework.Bundle; >- >-import com.ibm.icu.text.MessageFormat; >- >-/** >- * Launch delegate for Ant builds >- */ >-public class AntLaunchDelegate extends LaunchConfigurationDelegate { >- >- private static final String ANT_LOGGER_CLASS = "org.eclipse.ant.internal.ui.antsupport.logger.AntProcessBuildLogger"; //$NON-NLS-1$ >- private static final String ANT_DEBUG_LOGGER_CLASS = "org.eclipse.ant.internal.ui.antsupport.logger.AntProcessDebugBuildLogger"; //$NON-NLS-1$ >- private static final String NULL_LOGGER_CLASS = "org.eclipse.ant.internal.ui.antsupport.logger.NullBuildLogger"; //$NON-NLS-1$ >- private static final String REMOTE_ANT_LOGGER_CLASS = "org.eclipse.ant.internal.ui.antsupport.logger.RemoteAntBuildLogger"; //$NON-NLS-1$ >- private static final String REMOTE_ANT_DEBUG_LOGGER_CLASS = "org.eclipse.ant.internal.ui.antsupport.logger.debug.RemoteAntDebugBuildLogger"; //$NON-NLS-1$ >- private static final String BASE_DIR_PREFIX = "-Dbasedir="; //$NON-NLS-1$ >- private static final String INPUT_HANDLER_CLASS = "org.eclipse.ant.internal.ui.antsupport.inputhandler.AntInputHandler"; //$NON-NLS-1$ >- private static final String REMOTE_INPUT_HANDLER_CLASS = "org.eclipse.ant.internal.ui.antsupport.inputhandler.ProxyInputHandler"; //$NON-NLS-1$ >- >- private static final IProject[] NO_PROJECTS = new IProject[0]; >- >- /** >- * String attribute identifying the build scope for a launch configuration. >- * <code>null</code> indicates the default workspace build. >- */ >- private static final String ATTR_BUILD_SCOPE = AntUIPlugin.getUniqueIdentifier() + ".ATTR_BUILD_SCOPE"; //$NON-NLS-1$ >- >- /** >- * Attribute identifier specifying whether referenced projects should be >- * considered when computing the projects to build. Default value is >- * <code>true</code>. >- */ >- private static final String ATTR_INCLUDE_REFERENCED_PROJECTS = AntUIPlugin.getUniqueIdentifier() + ".ATTR_INCLUDE_REFERENCED_PROJECTS"; //$NON-NLS-1$ >- >- >- private static String fgSWTLibraryLocation; >- >- private String fMode; >- private boolean fUserSpecifiedLogger= false; >- >- private String getProgramArguments(ILaunchConfiguration configuration) throws CoreException { >- String arguments = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, ""); //$NON-NLS-1$ >- return VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(arguments); >- } >- >- /** >- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, >- * java.lang.String, org.eclipse.debug.core.ILaunch, >- * org.eclipse.core.runtime.IProgressMonitor) >- */ >- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { >- if (monitor.isCanceled()) { >- return; >- } >- fUserSpecifiedLogger= false; >- fMode= mode; >- >- // migrate the config to the new classpath format if required >- AntUtil.migrateToNewClasspathFormat(configuration); >- >- boolean isSeparateJRE= AntUtil.isSeparateJREAntBuild(configuration); >- >- if (CommonTab.isLaunchInBackground(configuration)) { >- monitor.beginTask(MessageFormat.format(AntLaunchConfigurationMessages.AntLaunchDelegate_Launching__0__1, new String[] {configuration.getName()}), 10); >- } else { >- monitor.beginTask(MessageFormat.format(AntLaunchConfigurationMessages.AntLaunchDelegate_Running__0__2, new String[] {configuration.getName()}), 100); >- } >- >- // resolve location >- IPath location = ExternalToolsUtil.getLocation(configuration); >- monitor.worked(1); >- >- if (monitor.isCanceled()) { >- return; >- } >- >- if (!isSeparateJRE && AntRunner.isBuildRunning()) { >- IStatus status= new Status(IStatus.ERROR, IAntUIConstants.PLUGIN_ID, 1, MessageFormat.format(AntLaunchConfigurationMessages.AntLaunchDelegate_Build_In_Progress, new String[]{location.toOSString()}), null); >- throw new CoreException(status); >- } >- >- // resolve working directory >- IPath workingDirectory = ExternalToolsUtil.getWorkingDirectory(configuration); >- String basedir = null; >- if (workingDirectory != null) { >- basedir= workingDirectory.toOSString(); >- } >- monitor.worked(1); >- >- if (monitor.isCanceled()) { >- return; >- } >- >- // link the process to its build logger via a timestamp >- long timeStamp = System.currentTimeMillis(); >- String idStamp = Long.toString(timeStamp); >- StringBuffer idProperty = new StringBuffer("-D"); //$NON-NLS-1$ >- idProperty.append(AbstractEclipseBuildLogger.ANT_PROCESS_ID); >- idProperty.append('='); >- idProperty.append(idStamp); >- >- // resolve arguments >- String[] arguments = null; >- if (isSeparateJRE) { >- arguments = new String[] {getProgramArguments(configuration)}; >- } else { >- arguments = ExternalToolsUtil.getArguments(configuration); >- } >- >- Map userProperties= AntUtil.getProperties(configuration); >- if (userProperties != null) {//create a copy so as to not affect the configuration with transient properties >- userProperties= new HashMap(userProperties); >- } >- String[] propertyFiles= AntUtil.getPropertyFiles(configuration); >- String[] targets = AntUtil.getTargetNames(configuration); >- URL[] customClasspath= AntUtil.getCustomClasspath(configuration); >- String antHome= AntUtil.getAntHome(configuration); >- >- boolean setInputHandler= true; >- try { >- //check if set specify inputhandler >- setInputHandler = configuration.getAttribute(IAntUIConstants.SET_INPUTHANDLER, true); >- } catch (CoreException ce) { >- AntUIPlugin.log(ce); >- } >- >- AntRunner runner= null; >- if (!isSeparateJRE) { >- runner = configureAntRunner(configuration, location, basedir, idProperty, arguments, userProperties, propertyFiles, targets, customClasspath, antHome, setInputHandler); >- } >- >- monitor.worked(1); >- >- if (monitor.isCanceled()) { >- return; >- } >- boolean captureOutput= ExternalToolsUtil.getCaptureOutput(configuration); >- int port= -1; >- int requestPort= -1; >- if (isSeparateJRE && captureOutput) { >- if (userProperties == null) { >- userProperties= new HashMap(); >- } >- port= SocketUtil.findFreePort(); >- userProperties.put(AbstractEclipseBuildLogger.ANT_PROCESS_ID, idStamp); >- userProperties.put("eclipse.connect.port", Integer.toString(port)); //$NON-NLS-1$ >- if (fMode.equals(ILaunchManager.DEBUG_MODE)) { >- requestPort= SocketUtil.findFreePort(); >- userProperties.put("eclipse.connect.request_port", Integer.toString(requestPort)); //$NON-NLS-1$ >- } >- } >- >- StringBuffer commandLine= generateCommandLine(location, arguments, userProperties, propertyFiles, targets, antHome, basedir, isSeparateJRE, captureOutput, setInputHandler); >- >- if (isSeparateJRE) { >- monitor.beginTask(MessageFormat.format(AntLaunchConfigurationMessages.AntLaunchDelegate_Launching__0__1, new String[] {configuration.getName()}), 10); >- runInSeparateVM(configuration, launch, monitor, idStamp, antHome, port, requestPort, commandLine, captureOutput, setInputHandler); >- } else { >- runInSameVM(configuration, launch, monitor, location, idStamp, runner, commandLine, captureOutput); >- } >- >- monitor.done(); >- } >- >- private void runInSameVM(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor, IPath location, String idStamp, AntRunner runner, StringBuffer commandLine, boolean captureOutput) throws CoreException { >- Map attributes= new HashMap(2); >- attributes.put(IProcess.ATTR_PROCESS_TYPE, IAntLaunchConfigurationConstants.ID_ANT_PROCESS_TYPE); >- attributes.put(AbstractEclipseBuildLogger.ANT_PROCESS_ID, idStamp); >- >- final AntProcess process = new AntProcess(location.toOSString(), launch, attributes); >- setProcessAttributes(process, idStamp, commandLine, captureOutput); >- boolean debug= fMode.equals(ILaunchManager.DEBUG_MODE); >- if (debug || CommonTab.isLaunchInBackground(configuration)) { >- final AntRunner finalRunner= runner; >- Runnable r = new Runnable() { >- public void run() { >- try { >- finalRunner.run(process); >- } catch (CoreException e) { >- handleException(e, AntLaunchConfigurationMessages.AntLaunchDelegate_Failure); >- } >- process.terminated(); >- } >- }; >- Thread background = new Thread(r); >- background.setDaemon(true); >- background.start(); >- monitor.worked(1); >- //refresh resources after process finishes >- if (RefreshTab.getRefreshScope(configuration) != null) { >- BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(configuration, process); >- refresher.startBackgroundRefresh(); >- } >- } else { >- // execute the build >- try { >- runner.run(monitor); >- } catch (CoreException e) { >- process.terminated(); >- monitor.done(); >- handleException(e, AntLaunchConfigurationMessages.AntLaunchDelegate_23); >- return; >- } >- process.terminated(); >- >- // refresh resources >- RefreshTab.refreshResources(configuration, monitor); >- } >- } >- >- private AntRunner configureAntRunner(ILaunchConfiguration configuration, IPath location, String baseDir, StringBuffer idProperty, String[] arguments, Map userProperties, String[] propertyFiles, String[] targets, URL[] customClasspath, String antHome, boolean setInputHandler) throws CoreException { >- int argLength = 1; // at least one user property - timestamp >- if (arguments != null) { >- argLength += arguments.length; >- } >- if (baseDir != null && baseDir.length() > 0) { >- argLength++; >- } >- String[] runnerArgs = new String[argLength]; >- if (arguments != null) { >- System.arraycopy(arguments, 0, runnerArgs, 0, arguments.length); >- } >- if (baseDir != null && baseDir.length() > 0) { >- runnerArgs[runnerArgs.length - 2] = BASE_DIR_PREFIX + baseDir; >- } >- runnerArgs[runnerArgs.length -1] = idProperty.toString(); >- >- AntRunner runner= new AntRunner(); >- runner.setBuildFileLocation(location.toOSString()); >- boolean captureOutput= ExternalToolsUtil.getCaptureOutput(configuration); >- if (captureOutput) { >- if (fMode.equals(ILaunchManager.DEBUG_MODE)) { >- runner.addBuildLogger(ANT_DEBUG_LOGGER_CLASS); >- } else { >- runner.addBuildLogger(ANT_LOGGER_CLASS); >- } >- } else { >- runner.addBuildLogger(NULL_LOGGER_CLASS); >- } >- if (setInputHandler) { >- runner.setInputHandler(INPUT_HANDLER_CLASS); >- } else { >- runner.setInputHandler(""); //$NON-NLS-1$ >- } >- runner.setArguments(runnerArgs); >- if (userProperties != null) { >- runner.addUserProperties(userProperties); >- } >- >- if (propertyFiles != null) { >- runner.setPropertyFiles(propertyFiles); >- } >- >- if (targets != null) { >- runner.setExecutionTargets(targets); >- } >- >- if (customClasspath != null) { >- runner.setCustomClasspath(customClasspath); >- } >- >- if (antHome != null) { >- runner.setAntHome(antHome); >- } >- return runner; >- } >- >- private void handleException(final CoreException e, final String title) { >- IPreferenceStore store= AntUIPlugin.getDefault().getPreferenceStore(); >- if (store.getBoolean(IAntUIPreferenceConstants.ANT_ERROR_DIALOG)) { >- AntUIPlugin.getStandardDisplay().asyncExec(new Runnable() { >- public void run() { >- MessageDialogWithToggle.openError(null, title, e.getMessage(), AntLaunchConfigurationMessages.AntLaunchDelegate_22, false, AntUIPlugin.getDefault().getPreferenceStore(), IAntUIPreferenceConstants.ANT_ERROR_DIALOG); >- } >- }); >- } >- } >- >- private void setProcessAttributes(IProcess process, String idStamp, StringBuffer commandLine, boolean captureOutput) { >- // link the process to the Eclipse build logger via a timestamp >- if (!fUserSpecifiedLogger) { >- process.setAttribute(AbstractEclipseBuildLogger.ANT_PROCESS_ID, idStamp); >- } >- >- // create "fake" command line for the process >- if (commandLine != null) { >- process.setAttribute(IProcess.ATTR_CMDLINE, commandLine.toString()); >- } >- if (captureOutput && !fUserSpecifiedLogger) { >- TaskLinkManager.registerAntBuild(process); >- } >- } >- >- private StringBuffer generateCommandLine(IPath location, String[] arguments, Map userProperties, String[] propertyFiles, String[] targets, String antHome, String basedir, boolean separateVM, boolean captureOutput, boolean setInputHandler) { >- StringBuffer commandLine= new StringBuffer(); >- >- if (!separateVM) { >- commandLine.append("ant"); //$NON-NLS-1$ >- } >- >- if (arguments != null) { >- for (int i = 0; i < arguments.length; i++) { >- commandLine.append(' '); >- commandLine.append(arguments[i]); >- } >- } >- >- AntCorePreferences prefs= AntCorePlugin.getPlugin().getPreferences(); >- if (propertyFiles == null) { //global >- String[] files= prefs.getCustomPropertyFiles(); >- for (int i = 0; i < files.length; i++) { >- String path = files[i]; >- commandLine.append(" -propertyfile \""); //$NON-NLS-1$ >- commandLine.append(path); >- commandLine.append('\"'); >- } >- } else {//"local" configuration >- for (int i = 0; i < propertyFiles.length; i++) { >- String path = propertyFiles[i]; >- commandLine.append(" -propertyfile \""); //$NON-NLS-1$ >- commandLine.append(path); >- commandLine.append('\"'); >- } >- } >- //"local" configuration >- if (userProperties != null) { >- Iterator keys = userProperties.keySet().iterator(); >- String key; >- while (keys.hasNext()) { >- key= (String)keys.next(); >- appendProperty(commandLine, key, (String)userProperties.get(key)); >- } >- } >- >- //global >- List properties= null; >- if (!separateVM) { >- properties= prefs.getProperties(); >- } else { >- properties= prefs.getRemoteAntProperties(); >- } >- >- //if we have user properties this means that the user has chosen to override the global properties >- //if in a separate VM and have only two (or three if debug) user properties these are really only Eclipse generated properties >- //and the user is still using the global properties >- int numberOfEclipseProperties= 2; >- if (userProperties != null && userProperties.get("eclipse.connect.request_port") != null){ //$NON-NLS-1$ >- numberOfEclipseProperties= 3; //debug mode >- } >- boolean useGlobalProperties = userProperties == null || (separateVM && userProperties.size() == numberOfEclipseProperties); >- if (useGlobalProperties) { >- for (Iterator iter = properties.iterator(); iter.hasNext();) { >- Property property = (Property) iter.next(); >- String key= property.getName(); >- String value= property.getValue(false); >- if (value != null) { >- appendProperty(commandLine, key, value); >- } >- } >- } >- >- if (basedir != null && basedir.length() > 0) { >- appendProperty(commandLine, "basedir", basedir); //$NON-NLS-1$ >- } >- >- if (antHome != null) { >- commandLine.append(" \"-Dant.home="); //$NON-NLS-1$ >- commandLine.append(antHome); >- commandLine.append('\"'); >- } >- >- if (separateVM) { >- if (commandLine.indexOf("-logger") == -1) { //$NON-NLS-1$ >- if (captureOutput) { >- commandLine.append(" -logger "); //$NON-NLS-1$ >- if (fMode.equals(ILaunchManager.DEBUG_MODE)) { >- commandLine.append(REMOTE_ANT_DEBUG_LOGGER_CLASS); >- } else { >- commandLine.append(REMOTE_ANT_LOGGER_CLASS); >- } >- } >- } else { >- fUserSpecifiedLogger= true; >- } >- if (commandLine.indexOf("-inputhandler") == -1 && setInputHandler) { //$NON-NLS-1$ >- commandLine.append(" -inputhandler "); //$NON-NLS-1$ >- commandLine.append(REMOTE_INPUT_HANDLER_CLASS); >- } >- } else { >- if (commandLine.indexOf("-inputhandler") == -1 && setInputHandler) { //$NON-NLS-1$ >- commandLine.append(" -inputhandler "); //$NON-NLS-1$ >- commandLine.append(INPUT_HANDLER_CLASS); >- } >- if (commandLine.indexOf("-logger") == -1) { //$NON-NLS-1$ >- commandLine.append(" -logger "); //$NON-NLS-1$ >- if (fMode.equals(ILaunchManager.DEBUG_MODE)) { >- commandLine.append(ANT_DEBUG_LOGGER_CLASS); >- } else if (captureOutput) { >- commandLine.append(ANT_LOGGER_CLASS); >- } else { >- commandLine.append(NULL_LOGGER_CLASS); >- } >- } >- } >- >- if (separateVM) { >- appendTaskAndTypes(prefs, commandLine); >- } >- commandLine.append(" -buildfile \""); //$NON-NLS-1$ >- commandLine.append(location.toOSString()); >- commandLine.append('\"'); >- >- if (targets != null) { >- for (int i = 0; i < targets.length; i++) { >- commandLine.append(" \""); //$NON-NLS-1$ >- commandLine.append(targets[i]); >- commandLine.append('\"'); >- } >- } >- return commandLine; >- } >- >- private void appendTaskAndTypes(AntCorePreferences prefs, StringBuffer commandLine) { >- List tasks= prefs.getRemoteTasks(); >- Iterator itr= tasks.iterator(); >- while (itr.hasNext()) { >- Task task = (Task) itr.next(); >- commandLine.append(" -eclipseTask "); //$NON-NLS-1$ >- String name= ProjectHelper.genComponentName(task.getURI(), task.getTaskName()); >- commandLine.append(name); >- commandLine.append(','); >- commandLine.append(task.getClassName()); >- } >- >- List types= prefs.getRemoteTypes(); >- itr= types.iterator(); >- while (itr.hasNext()) { >- Type type = (Type) itr.next(); >- commandLine.append(" -eclipseType "); //$NON-NLS-1$ >- String name= ProjectHelper.genComponentName(type.getURI(), type.getTypeName()); >- commandLine.append(name); >- commandLine.append(','); >- commandLine.append(type.getClassName()); >- } >- } >- >- private void appendProperty(StringBuffer commandLine, String name, String value) { >- commandLine.append(" \"-D"); //$NON-NLS-1$ >- commandLine.append(name); >- commandLine.append('='); >- commandLine.append(value); >- if (value.length() > 0 && value.charAt(value.length() - 1) == File.separatorChar) { >- commandLine.append(File.separatorChar); >- } >- commandLine.append("\""); //$NON-NLS-1$ >- } >- >- private void runInSeparateVM(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor, String idStamp, String antHome, int port, int requestPort, StringBuffer commandLine, boolean captureOutput, boolean setInputHandler) throws CoreException { >- boolean debug= fMode.equals(ILaunchManager.DEBUG_MODE); >- if (captureOutput) { >- if (debug) { >- RemoteAntDebugBuildListener listener= new RemoteAntDebugBuildListener(launch); >- if (requestPort != -1) { >- listener.startListening(port, requestPort); >- } >- } else if (!fUserSpecifiedLogger) { >- RemoteAntBuildListener client= new RemoteAntBuildListener(launch); >- if (port != -1) { >- client.startListening(port); >- } >- } >- } >- >- ILaunchConfigurationWorkingCopy copy= configuration.getWorkingCopy(); >- setDefaultWorkingDirectory(copy); >- copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, commandLine.toString()); >- StringBuffer vmArgs= generateVMArguments(copy, setInputHandler, antHome); >- copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs.toString()); >- copy.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true); >- if (copy.getAttribute(IAntLaunchConfigurationConstants.ATTR_DEFAULT_VM_INSTALL, false)) { >- setDefaultVM(configuration, copy); >- } >- if (debug) { //do not allow launch in foreground bug 83254 >- copy.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true); >- } >- >- //set the ANT_HOME environment variable >- if (antHome != null) { >- Map vars = copy.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new HashMap(1)); >- vars.put("ANT_HOME", antHome); //$NON-NLS-1$ >- copy.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, vars); >- } >- >- //copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"); >- IProgressMonitor subMonitor= new SubProgressMonitor(monitor, 10); >- AntJavaLaunchDelegate delegate= new AntJavaLaunchDelegate(); >- delegate.preLaunchCheck(copy, ILaunchManager.RUN_MODE, subMonitor); >- delegate.launch(copy, ILaunchManager.RUN_MODE, launch, subMonitor); >- final IProcess[] processes= launch.getProcesses(); >- for (int i = 0; i < processes.length; i++) { >- setProcessAttributes(processes[i], idStamp, null, captureOutput); >- } >- >- if (CommonTab.isLaunchInBackground(copy)) { >- // refresh resources after process finishes >- if (RefreshTab.getRefreshScope(configuration) != null) { >- BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(configuration, processes[0]); >- refresher.startBackgroundRefresh(); >- } >- } else { >- final boolean[] terminated= new boolean[1]; >- terminated[0]= launch.isTerminated(); >- IDebugEventSetListener listener= new IDebugEventSetListener() { >- public void handleDebugEvents(DebugEvent[] events) { >- for (int i = 0; i < events.length; i++) { >- DebugEvent event = events[i]; >- for (int j= 0, numProcesses= processes.length; j < numProcesses; j++) { >- if (event.getSource() == processes[j] && event.getKind() == DebugEvent.TERMINATE) { >- terminated[0]= true; >- break; >- } >- } >- } >- } >- }; >- DebugPlugin.getDefault().addDebugEventListener(listener); >- monitor.subTask(AntLaunchConfigurationMessages.AntLaunchDelegate_28); >- while (!monitor.isCanceled() && !terminated[0]) { >- try { >- Thread.sleep(50); >- } catch (InterruptedException e) { >- } >- } >- DebugPlugin.getDefault().removeDebugEventListener(listener); >- if (!monitor.isCanceled()) { >- // refresh resources >- RefreshTab.refreshResources(configuration, monitor); >- } >- } >- } >- >- private void setDefaultVM(ILaunchConfiguration configuration, ILaunchConfigurationWorkingCopy copy) { >- try { >- JavaRuntime.getJavaProject(configuration); >- //remove the vm name, install type and jre container path for the Java launching concept of default VM >- copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, (String)null); >- copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, (String)null); >- copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String)null); >- } catch (CoreException ce) { >- //not in a Java project >- IVMInstall defaultVMInstall= JavaRuntime.getDefaultVMInstall(); >- copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, defaultVMInstall.getName()); >- copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, defaultVMInstall.getVMInstallType().getId()); >- } >- } >- >- private StringBuffer generateVMArguments(ILaunchConfiguration config, boolean setInputHandler, String antHome) { >- StringBuffer vmArgs= new StringBuffer(); >- try { >- String configArgs= config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, (String)null); >- if (configArgs != null) { >- vmArgs.append(configArgs); >- vmArgs.append(' '); >- } >- } catch (CoreException e) { >- } >- >- if (antHome != null) { >- vmArgs.append("-Dant.home=\""); //$NON-NLS-1$ >- vmArgs.append(antHome); >- vmArgs.append("\" "); //$NON-NLS-1$ >- >- File antLibDir= new File(antHome, "lib"); //$NON-NLS-1$ >- vmArgs.append("-Dant.library.dir=\""); //$NON-NLS-1$ >- vmArgs.append(antLibDir.getAbsolutePath()); >- vmArgs.append('\"'); >- } >- if (setInputHandler) { >- String swtLocation= getSWTLibraryLocation(); >- if (swtLocation != null) { >- vmArgs.append(" -Djava.library.path=\""); //$NON-NLS-1$ >- String javaLibPath= System.getProperty("java.library.path"); //$NON-NLS-1$ >- javaLibPath= stripUnescapedQuotes(javaLibPath); >- if (javaLibPath != null) { >- vmArgs.append(javaLibPath); >- if (vmArgs.charAt(vmArgs.length() - 1) != File.pathSeparatorChar) { >- vmArgs.append(File.pathSeparatorChar); >- } >- } >- vmArgs.append(swtLocation); >- vmArgs.append('"'); >- } >- } >- return vmArgs; >- } >- >- private String stripUnescapedQuotes(String javaLibPath) { >- StringBuffer buf = new StringBuffer(javaLibPath.length()); >- for (int i = 0; i < javaLibPath.length(); i++) { >- char c = javaLibPath.charAt(i); >- switch (c) { >- case '"': >- if (i != 0 && javaLibPath.charAt(i-1) == '\\') { >- buf.append(c); >- } >- break; >- default: >- buf.append(c); >- break; >- } >- } >- return buf.toString(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String) >- */ >- protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException { >- IProject[] projects = ExternalToolsBuildTab.getBuildProjects(configuration, ATTR_BUILD_SCOPE); >- if (projects == null) { >- return NO_PROJECTS; >- } >- boolean isRef = ExternalToolsBuildTab.isIncludeReferencedProjects(configuration, ATTR_INCLUDE_REFERENCED_PROJECTS); >- if (isRef) { >- return computeReferencedBuildOrder(projects); >- } >- return computeBuildOrder(projects); >- } >- >- private String getSWTLibraryLocation() { >- if (fgSWTLibraryLocation == null) { >- Bundle bundle= Platform.getBundle("org.eclipse.swt"); //$NON-NLS-1$ >- BundleDescription description= Platform.getPlatformAdmin().getState(false).getBundle(bundle.getBundleId()); >- BundleDescription[] fragments= description.getFragments(); >- if (fragments == null || fragments.length == 0) { >- return null; >- } >- Bundle fragBundle= Platform.getBundle(fragments[0].getSymbolicName()); >- try { >- URL url= FileLocator.toFileURL(fragBundle.getEntry("/")); //$NON-NLS-1$ >- IPath path= new Path(url.getPath()); >- path= path.removeTrailingSeparator(); >- fgSWTLibraryLocation= path.toOSString(); >- } catch (IOException e) { >- } >- } >- return fgSWTLibraryLocation; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBreakpoints(org.eclipse.debug.core.ILaunchConfiguration) >- */ >- protected IBreakpoint[] getBreakpoints(ILaunchConfiguration configuration) { >- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); >- if (!breakpointManager.isEnabled()) { >- // no need to check breakpoints individually. >- return null; >- } >- return breakpointManager.getBreakpoints(IAntDebugConstants.ID_ANT_DEBUG_MODEL); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#saveBeforeLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) >- */ >- protected boolean saveBeforeLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException { >- if (IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY.equals( >- configuration.getType().getCategory())) { >- // don't prompt for builders >- return true; >- } >- return super.saveBeforeLaunch(configuration, mode, monitor); >- } >- >- /** >- * Sets the default working directory to be the parent folder of the buildfile if >- * the user has not explicitly set the working directory. >- */ >- private void setDefaultWorkingDirectory(ILaunchConfigurationWorkingCopy copy) { >- try { >- String wd = copy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String)null); >- if (wd == null) { >- wd= ExternalToolsUtil.getLocation(copy).removeLastSegments(1).toOSString(); >- copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, wd); >- } >- } catch (CoreException e) { >- AntUIPlugin.log(e.getStatus()); >- } >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchShortcut.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchShortcut.java,v >retrieving revision 1.43 >diff -u -r1.43 AntLaunchShortcut.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchShortcut.java 20 Jan 2009 17:07:07 -0000 1.43 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchShortcut.java 7 Oct 2009 20:08:20 -0000 >@@ -22,6 +22,8 @@ > import org.eclipse.ant.internal.ui.model.AntProjectNode; > import org.eclipse.ant.internal.ui.model.AntTargetNode; > import org.eclipse.ant.internal.ui.model.AntTaskNode; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.resources.IContainer; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IProject; >@@ -55,7 +57,6 @@ > import org.eclipse.ui.dialogs.ElementListSelectionDialog; > import org.eclipse.ui.editors.text.ILocationProvider; > import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > import com.ibm.icu.text.MessageFormat; > >@@ -166,7 +167,7 @@ > */ > protected List collectConfigurations(IPath filepath) { > ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); >- ILaunchConfigurationType type = manager.getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); >+ ILaunchConfigurationType type = manager.getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); > if(type != null) { > try { > ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type); >@@ -260,13 +261,13 @@ > // set the target to run, if applicable > if (configuration != null) { > try { >- if (targetAttribute != null && !targetAttribute.equals(configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, DEFAULT_TARGET))) { >+ if (targetAttribute != null && !targetAttribute.equals(configuration.getAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, DEFAULT_TARGET))) { > ILaunchConfigurationWorkingCopy copy = configuration.getWorkingCopy(); > String attrValue = null; > if (!DEFAULT_TARGET.equals(targetAttribute)) { > attrValue = targetAttribute; > } >- copy.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, attrValue); >+ copy.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, attrValue); > configuration = copy.doSave(); > } > } catch (CoreException exception) { >@@ -367,7 +368,7 @@ > */ > public static ILaunchConfiguration createDefaultLaunchConfiguration(IPath filePath, IProject project) { > ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); >- ILaunchConfigurationType type = manager.getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); >+ ILaunchConfigurationType type = manager.getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); > > String projectName= project != null ? project.getName() : null; > String name = getNewLaunchConfigurationName(filePath, projectName, null); >@@ -415,7 +416,7 @@ > IPath filePath = file.getLocation(); > if(filePath != null) { > ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); >- ILaunchConfigurationType type = manager.getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); >+ ILaunchConfigurationType type = manager.getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); > if (type != null) { > try { > ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type); >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntMainTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntMainTab.java,v >retrieving revision 1.24 >diff -u -r1.24 AntMainTab.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntMainTab.java 17 Apr 2007 03:34:13 -0000 1.24 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntMainTab.java 7 Oct 2009 20:08:20 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * 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 >@@ -14,6 +14,7 @@ > import org.eclipse.ant.internal.ui.AntUtil; > import org.eclipse.ant.internal.ui.IAntUIConstants; > import org.eclipse.ant.internal.ui.IAntUIHelpContextIds; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.ResourcesPlugin; >@@ -35,7 +36,6 @@ > import org.eclipse.swt.widgets.Composite; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsMainTab; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > import org.eclipse.ui.externaltools.internal.ui.FileSelectionDialog; > > public class AntMainTab extends ExternalToolsMainTab { >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntMigrationDelegate.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntMigrationDelegate.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntMigrationDelegate.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntMigrationDelegate.java 3 Apr 2006 02:12:47 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,77 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2006 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.ui.launchConfigurations; >- >-import org.eclipse.ant.internal.ui.AntUtil; >-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; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >- >-/** >- * 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= AntUtil.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 >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntProcess.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntProcess.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntProcess.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntProcess.java 10 Feb 2006 18:11:38 -0000 1.12 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,193 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2006 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.ui.launchConfigurations; >- >- >-import java.util.HashMap; >-import java.util.Map; >- >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.PlatformObject; >-import org.eclipse.debug.core.DebugEvent; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.ILaunch; >-import org.eclipse.debug.core.model.IProcess; >-import org.eclipse.debug.core.model.IStreamsProxy; >-import org.eclipse.debug.ui.console.IConsole; >- >-public class AntProcess extends PlatformObject implements IProcess, IProgressMonitor { >- >- private AntStreamsProxy fProxy; >- private String fLabel = null; >- private ILaunch fLaunch = null; >- private Map fAttributes = null; >- private boolean fTerminated = false; >- private boolean fCancelled = false; >- private IConsole fConsole = null; >- >- public AntProcess(String label, ILaunch launch, Map attributes) { >- fLabel = label; >- fLaunch = launch; >- if (attributes == null) { >- fAttributes = new HashMap(); >- } else { >- fAttributes = attributes; >- } >- String captureOutput= launch.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT); >- if(!("false".equals(captureOutput))) { //$NON-NLS-1$ >- fProxy= new AntStreamsProxy(); >- } >- launch.addProcess(this); >- } >- >- /** >- * @see org.eclipse.debug.core.model.IProcess#getLabel() >- */ >- public String getLabel() { >- return fLabel; >- } >- >- /** >- * @see org.eclipse.debug.core.model.IProcess#getLaunch() >- */ >- public ILaunch getLaunch() { >- return fLaunch; >- } >- >- /** >- * @see org.eclipse.debug.core.model.IProcess#getStreamsProxy() >- */ >- public IStreamsProxy getStreamsProxy() { >- return fProxy; >- } >- >- /** >- * @see org.eclipse.debug.core.model.IProcess#setAttribute(java.lang.String, java.lang.String) >- */ >- public void setAttribute(String key, String value) { >- fAttributes.put(key, value); >- } >- >- /** >- * @see org.eclipse.debug.core.model.IProcess#getAttribute(java.lang.String) >- */ >- public String getAttribute(String key) { >- return (String)fAttributes.get(key); >- } >- >- /** >- * @see org.eclipse.debug.core.model.IProcess#getExitValue() >- */ >- public int getExitValue() { >- return 0; >- } >- >- /** >- * @see org.eclipse.debug.core.model.ITerminate#canTerminate() >- */ >- public boolean canTerminate() { >- return !isCanceled() && !isTerminated(); >- } >- >- /** >- * @see org.eclipse.debug.core.model.ITerminate#isTerminated() >- */ >- public boolean isTerminated() { >- return fTerminated; >- } >- >- protected void terminated() { >- if (!fTerminated) { >- fTerminated = true; >- if (DebugPlugin.getDefault() != null) { >- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {new DebugEvent(this, DebugEvent.TERMINATE)}); >- } >- } >- } >- >- /** >- * @see org.eclipse.debug.core.model.ITerminate#terminate() >- */ >- public void terminate() { >- setCanceled(true); >- } >- >- /** >- * Returns the console associated with this process, or <code>null</code> if >- * none. >- * >- * @return console, or <code>null</code> >- */ >- public IConsole getConsole() { >- return fConsole; >- } >- >- /** >- * Sets the console associated with this process. >- * >- * @param console >- */ >- public void setConsole(IConsole console) { >- fConsole = console; >- } >- >- // IProgressMonitor implemented to support termination. >- >- /** >- * @see org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String, int) >- */ >- public void beginTask(String name, int totalWork) { >- } >- >- /** >- * @see org.eclipse.core.runtime.IProgressMonitor#done() >- */ >- public void done() { >- } >- >- /** >- * @see org.eclipse.core.runtime.IProgressMonitor#internalWorked(double) >- */ >- public void internalWorked(double work) { >- } >- >- /** >- * @see org.eclipse.core.runtime.IProgressMonitor#isCanceled() >- */ >- public boolean isCanceled() { >- return fCancelled; >- } >- >- /** >- * @see org.eclipse.core.runtime.IProgressMonitor#setCanceled(boolean) >- */ >- public void setCanceled(boolean value) { >- fCancelled = value; >- } >- >- /** >- * @see org.eclipse.core.runtime.IProgressMonitor#setTaskName(java.lang.String) >- */ >- public void setTaskName(String name) { >- } >- >- /** >- * @see org.eclipse.core.runtime.IProgressMonitor#subTask(java.lang.String) >- */ >- public void subTask(String name) { >- } >- >- /** >- * @see org.eclipse.core.runtime.IProgressMonitor#worked(int) >- */ >- public void worked(int work) { >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntPropertiesTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntPropertiesTab.java,v >retrieving revision 1.15 >diff -u -r1.15 AntPropertiesTab.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntPropertiesTab.java 24 Feb 2009 16:29:02 -0000 1.15 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntPropertiesTab.java 7 Oct 2009 20:08:21 -0000 >@@ -24,7 +24,7 @@ > import org.eclipse.ant.internal.ui.IAntUIHelpContextIds; > import org.eclipse.ant.internal.ui.preferences.AntPropertiesBlock; > import org.eclipse.ant.internal.ui.preferences.IAntBlockContainer; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >@@ -116,14 +116,14 @@ > setMessage(null); > Map properties= null; > try { >- properties= configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES, (Map)null); >+ properties= configuration.getAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTIES, (Map)null); > } catch (CoreException ce) { > AntUIPlugin.log(AntLaunchConfigurationMessages.AntPropertiesTab_Error_reading_configuration_9, ce); > } > > String propertyFiles= null; > try { >- propertyFiles= configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTY_FILES, (String)null); >+ propertyFiles= configuration.getAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTY_FILES, (String)null); > } catch (CoreException ce) { > AntUIPlugin.log(AntLaunchConfigurationMessages.AntPropertiesTab_Error_reading_configuration_9, ce); > } >@@ -160,8 +160,8 @@ > */ > public void performApply(ILaunchConfigurationWorkingCopy configuration) { > if (fUseDefaultButton.getSelection()) { >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES, (Map)null); >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTY_FILES, (String)null); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTIES, (Map)null); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTY_FILES, (String)null); > return; > } > >@@ -175,7 +175,7 @@ > } > } > >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES, properties); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTIES, properties); > > items= fAntPropertiesBlock.getPropertyFiles(); > String files= null; >@@ -189,7 +189,7 @@ > files= buff.toString(); > } > >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTY_FILES, files); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_PROPERTY_FILES, files); > > fAntPropertiesBlock.saveSettings(); > } >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntStreamMonitor.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntStreamMonitor.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntStreamMonitor.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntStreamMonitor.java 13 Dec 2005 20:11:39 -0000 1.7 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,83 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2005 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.ui.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; >- } >-} >- >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntStreamsProxy.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntStreamsProxy.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntStreamsProxy.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntStreamsProxy.java 23 Feb 2005 17:20:11 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,65 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2005 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.ui.launchConfigurations; >- >- >-import org.eclipse.ant.internal.ui.IAntUIConstants; >-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 = IAntUIConstants.PLUGIN_ID + ".ANT_DEBUG_STREAM"; //$NON-NLS-1$ >- public static final String ANT_VERBOSE_STREAM = IAntUIConstants.PLUGIN_ID + ".ANT_VERBOSE_STREAM"; //$NON-NLS-1$ >- public static final String ANT_WARNING_STREAM = IAntUIConstants.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; >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java,v >retrieving revision 1.15 >diff -u -r1.15 AntTabGroup.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java 30 Jul 2007 02:20:37 -0000 1.15 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java 7 Oct 2009 20:08:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * 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 >@@ -11,6 +11,7 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.launchConfigurations; > >+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; >@@ -27,7 +28,6 @@ > import org.eclipse.debug.ui.RefreshTab; > import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; > import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > public class AntTabGroup extends AbstractLaunchConfigurationTabGroup { > >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTargetsTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTargetsTab.java,v >retrieving revision 1.55 >diff -u -r1.55 AntTargetsTab.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTargetsTab.java 13 Aug 2008 15:32:18 -0000 1.55 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTargetsTab.java 7 Oct 2009 20:08:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * 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 >@@ -28,7 +28,8 @@ > import org.eclipse.ant.internal.ui.model.AntProjectNode; > import org.eclipse.ant.internal.ui.model.AntTargetNode; > import org.eclipse.ant.internal.ui.model.InternalTargetFilter; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; >@@ -72,7 +73,6 @@ > import org.eclipse.swt.widgets.TableColumn; > import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > import com.ibm.icu.text.MessageFormat; > >@@ -613,7 +613,7 @@ > setDirty(true); > boolean hideInternal= false; > try { >- hideInternal = fLaunchConfiguration.getAttribute(IAntLaunchConfigurationConstants.ATTR_HIDE_INTERNAL_TARGETS, false); >+ hideInternal = fLaunchConfiguration.getAttribute(IAntLaunchConstants.ATTR_HIDE_INTERNAL_TARGETS, false); > } catch (CoreException e) { > AntUIPlugin.log(e); > } >@@ -621,7 +621,7 @@ > handleFilterTargetsSelected(); > int sort= SORT_NONE; > try { >- sort = fLaunchConfiguration.getAttribute(IAntLaunchConfigurationConstants.ATTR_SORT_TARGETS, sort); >+ sort = fLaunchConfiguration.getAttribute(IAntLaunchConstants.ATTR_SORT_TARGETS, sort); > } catch (CoreException e) { > AntUIPlugin.log(e); > } >@@ -631,7 +631,7 @@ > String newLocation= null; > > try { >- configTargets= configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, (String)null); >+ configTargets= configuration.getAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, (String)null); > newLocation= configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String)null); > } catch (CoreException ce) { > AntUIPlugin.log(AntLaunchConfigurationMessages.AntTargetsTab_Error_reading_configuration_12, ce); >@@ -697,25 +697,25 @@ > public void performApply(ILaunchConfigurationWorkingCopy configuration) { > // attribute added in 3.0, so null must be used instead of false for backwards compatibility > if (fFilterInternalTargets.getSelection()) { >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_HIDE_INTERNAL_TARGETS, true); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_HIDE_INTERNAL_TARGETS, true); > } else { >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_HIDE_INTERNAL_TARGETS, (String)null); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_HIDE_INTERNAL_TARGETS, (String)null); > } > //attribute added in 3.0, so null must be used instead of 0 for backwards compatibility > if (fSortDirection != SORT_NONE) { >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_SORT_TARGETS, fSortDirection); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_SORT_TARGETS, fSortDirection); > } else { >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_SORT_TARGETS, (String)null); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_SORT_TARGETS, (String)null); > } > > if (fOrderedTargets.size() == 1) { > AntTargetNode item = (AntTargetNode)fOrderedTargets.get(0); > if (item.isDefaultTarget()) { >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, (String)null); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, (String)null); > return; > } > } else if (fOrderedTargets.size() == 0) { >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, (String)null); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, (String)null); > return; > } > >@@ -731,7 +731,7 @@ > targets= buff.toString(); > } > >- configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, targets); >+ configuration.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, targets); > } > > /* (non-Javadoc) >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntWorkingDirectoryBlock.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntWorkingDirectoryBlock.java,v >retrieving revision 1.19 >diff -u -r1.19 AntWorkingDirectoryBlock.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntWorkingDirectoryBlock.java 28 Jan 2008 15:54:05 -0000 1.19 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntWorkingDirectoryBlock.java 7 Oct 2009 20:08:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * 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 >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/ContributedClasspathEntriesEntry.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/ContributedClasspathEntriesEntry.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/ContributedClasspathEntriesEntry.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/ContributedClasspathEntriesEntry.java 15 Feb 2006 17:41:23 -0000 1.20 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,246 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2006 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.ui.launchConfigurations; >- >-import java.io.File; >-import java.io.FilenameFilter; >-import java.io.IOException; >-import java.net.MalformedURLException; >-import java.net.URL; >-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.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.AntUtil; >-import org.eclipse.ant.internal.ui.IAntUIConstants; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.FileLocator; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.Path; >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.jdt.internal.launching.AbstractRuntimeClasspathEntry; >-import org.eclipse.jdt.launching.IRuntimeClasspathEntry; >-import org.eclipse.jdt.launching.IVMInstall; >-import org.eclipse.jdt.launching.JavaRuntime; >-import org.eclipse.osgi.service.resolver.BundleDescription; >-import org.osgi.framework.Bundle; >-import org.w3c.dom.Document; >-import org.w3c.dom.Element; >- >-/** >- * A classpath entry that contains a contributed classpath entries >- * via the <code>extraClasspathEntries</code> extension point. >- * >- * @since 3.0 >- */ >-public class ContributedClasspathEntriesEntry extends AbstractRuntimeClasspathEntry { >- >- public static final String TYPE_ID = "org.eclipse.ant.ui.classpathentry.extraClasspathEntries"; //$NON-NLS-1$ >- >- public static List fgSWTEntries= null; >- >- /** >- * Default contructor required to instantiate persisted extensions. >- */ >- public ContributedClasspathEntriesEntry() { >- } >- >- /* (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 { >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.launching.IRuntimeClasspathEntry2#initializeFrom(org.w3c.dom.Element) >- */ >- public void initializeFrom(Element memento) throws CoreException { >- } >- >- /* (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 { >- boolean separateVM= AntUtil.isSeparateJREAntBuild(configuration); >- boolean setInputHandler= configuration.getAttribute(IAntUIConstants.SET_INPUTHANDLER, true); >- AntCorePreferences prefs= AntCorePlugin.getPlugin().getPreferences(); >- IAntClasspathEntry[] antClasspathEntries = prefs.getContributedClasspathEntries(); >- IAntClasspathEntry[] userEntries = prefs.getAdditionalClasspathEntries(); >- List rtes = new ArrayList(antClasspathEntries.length + userEntries.length); >- IAntClasspathEntry entry; >- for (int i = 0; i < antClasspathEntries.length; i++) { >- entry= antClasspathEntries[i]; >- if (!separateVM || (separateVM && !entry.isEclipseRuntimeRequired())) { >- rtes.add(JavaRuntime.newStringVariableClasspathEntry(entry.getLabel())); >- } >- } >- boolean haveToolsEntry= false; >- String path; >- for (int i = 0; i < userEntries.length; i++) { >- entry = userEntries[i]; >- path= entry.getLabel(); >- IPath toolsPath= new Path(path); >- if (toolsPath.lastSegment().equals("tools.jar")) { //$NON-NLS-1$ >- haveToolsEntry= true; >- // replace with dynamically resolved tools.jar based on >- // the JRE being used >- addToolsJar(configuration, rtes, path); >- } else { >- rtes.add(JavaRuntime.newStringVariableClasspathEntry(path)); >- } >- } >- if (!haveToolsEntry) { >- addToolsJar(configuration, rtes, null); >- } >- >- if (setInputHandler && separateVM) { >- addSWTJars(rtes); >- } >- >- return (IRuntimeClasspathEntry[]) rtes.toArray(new IRuntimeClasspathEntry[rtes.size()]); >- } >- >- private void addToolsJar(ILaunchConfiguration configuration, List rtes, String path) { >- IRuntimeClasspathEntry tools = getToolsJar(configuration); >- if (tools == null) { >- if (path != null) { >- //use the global entry >- rtes.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(path))); >- } else { >- //use the default vm install to try to find a tools.jar >- IVMInstall install= JavaRuntime.getDefaultVMInstall(); >- if (install != null) { >- IAntClasspathEntry entry = AntCorePlugin.getPlugin().getPreferences().getToolsJarEntry(new Path(install.getInstallLocation().getAbsolutePath())); >- if (entry != null) { >- rtes.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(entry.getEntryURL().getPath()))); >- } >- } >- } >- } else { >- rtes.add(tools); >- } >- } >- >- private void addSWTJars(List rtes) { >- if (fgSWTEntries == null) { >- fgSWTEntries= new ArrayList(); >- Bundle bundle= Platform.getBundle("org.eclipse.swt"); //$NON-NLS-1$ >- BundleDescription description= Platform.getPlatformAdmin().getState(false).getBundle(bundle.getBundleId()); >- BundleDescription[] fragments= description.getFragments(); >- for (int i = 0; i < fragments.length; i++) { >- Bundle fragmentBundle= Platform.getBundle(fragments[i].getName()); >- URL bundleURL; >- try { >- bundleURL = FileLocator.resolve(fragmentBundle.getEntry("/")); //$NON-NLS-1$ >- } catch (IOException e) { >- AntUIPlugin.log(e); >- continue; >- } >- String urlFileName= bundleURL.getFile(); >- if (urlFileName.startsWith("file:")) { //$NON-NLS-1$ >- try { >- urlFileName= new URL(urlFileName).getFile(); >- if (urlFileName.endsWith("!/")) { //$NON-NLS-1$ >- urlFileName= urlFileName.substring(0, urlFileName.length() - 2); >- } >- } catch (MalformedURLException e) { >- AntUIPlugin.log(e); >- continue; >- } >- } >- IPath fragmentPath= new Path(urlFileName); >- if (fragmentPath.getFileExtension() != null) { //JAR file >- fgSWTEntries.add(JavaRuntime.newArchiveRuntimeClasspathEntry(fragmentPath)); >- } else { // folder >- File bundleFolder= fragmentPath.toFile(); >- if (!bundleFolder.isDirectory()) { >- continue; >- } >- String[] names= bundleFolder.list(new FilenameFilter() { >- public boolean accept(File dir, String name) { >- return name.endsWith(".jar"); //$NON-NLS-1$ >- } >- }); >- for (int j = 0; j < names.length; j++) { >- String jarName = names[j]; >- fgSWTEntries.add(JavaRuntime.newArchiveRuntimeClasspathEntry(fragmentPath.append(jarName))); >- } >- } >- } >- } >- rtes.addAll(fgSWTEntries); >- } >- >- /** >- * Returns the tools.jar to use for this launch configuration, or <code>null</code> >- * if none. >- * >- * @param configuration configuration to resolve a tools.jar for >- * @return associated tools.jar archive, or <code>null</code> >- */ >- private IRuntimeClasspathEntry getToolsJar(ILaunchConfiguration configuration) { >- try { >- IVMInstall install = JavaRuntime.computeVMInstall(configuration); >- if (install != null) { >- IAntClasspathEntry entry = AntCorePlugin.getPlugin().getPreferences().getToolsJarEntry(new Path(install.getInstallLocation().getAbsolutePath())); >- if (entry != null) { >- return JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(entry.getEntryURL().getPath())); >- } >- } >- } catch (CoreException ce) { >- //likely dealing with a non-Java project >- } >- >- return null; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getName() >- */ >- public String getName() { >- return AntLaunchConfigurationMessages.ContributedClasspathEntriesEntry_1; >- } >- /* (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 ContributedClasspathEntriesEntry; >- } >- /* (non-Javadoc) >- * @see java.lang.Object#hashCode() >- */ >- public int hashCode() { >- return getClass().hashCode(); >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/EditAntHomeEntryAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/EditAntHomeEntryAction.java,v >retrieving revision 1.8 >diff -u -r1.8 EditAntHomeEntryAction.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/EditAntHomeEntryAction.java 11 Aug 2005 16:30:00 -0000 1.8 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/EditAntHomeEntryAction.java 7 Oct 2009 20:08:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * 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 >@@ -12,6 +12,7 @@ > > import org.eclipse.ant.core.AntCorePlugin; > import org.eclipse.ant.core.AntCorePreferences; >+import org.eclipse.ant.internal.launching.launchConfigurations.AntHomeClasspathEntry; > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.IAntUIConstants; > import org.eclipse.ant.internal.ui.preferences.AntPreferencesMessages; >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/IAntLaunchConfigurationConstants.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/IAntLaunchConfigurationConstants.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/IAntLaunchConfigurationConstants.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/IAntLaunchConfigurationConstants.java 8 Sep 2008 15:03:02 -0000 1.14 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,156 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2003, 2008 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.ui.launchConfigurations; >- >-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >- >-/** >- * Constant definitions for Ant launch configurations. >- * <p> >- * Constant definitions only; not to be implemented. >- * </p> >- * @since 3.0 >- * @noimplement This interface is not intended to be implemented by clients. >- */ >-public interface IAntLaunchConfigurationConstants { >- >- /** >- * String attribute indicating the custom runtime classpath to use for an Ant >- * build. Default value is <code>null</code> which indicates that the global >- * classpath is to be used. Format is a comma separated listing of URLs. >- * @deprecated no longer supported: use {@link IJavaLaunchConfigurationConstants#ATTR_CLASSPATH_PROVIDER} >- * @see IJavaLaunchConfigurationConstants#ATTR_DEFAULT_CLASSPATH >- */ >- public static final String ATTR_ANT_CUSTOM_CLASSPATH = IExternalToolConstants.PLUGIN_ID + ".ATTR_ANT_CUSTOM_CLASSPATH"; //$NON-NLS-1$ >- /** >- * String attribute indicating the custom Ant home to use for an Ant build. >- * Default value is <code>null</code> which indicates that no Ant home is to >- * be set >- * @deprecated no longer supported: use {@link IJavaLaunchConfigurationConstants#ATTR_CLASSPATH_PROVIDER} >- * @see IJavaLaunchConfigurationConstants#ATTR_DEFAULT_CLASSPATH >- */ >- public static final String ATTR_ANT_HOME = IExternalToolConstants.PLUGIN_ID + ".ATTR_ANT_HOME"; //$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. >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ATTR_ANT_TARGETS = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS; >- /** >- * 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. >- * @since 3.1 >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ATTR_ANT_AFTER_CLEAN_TARGETS = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS; >- /** >- * 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. >- * @since 3.1 >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ATTR_ANT_MANUAL_TARGETS = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS; >- /** >- * 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. >- * @since 3.1 >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ATTR_ANT_AUTO_TARGETS = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS; >- /** >- * 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. >- * @since 3.1 >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ATTR_ANT_CLEAN_TARGETS = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS; >- /** >- * Boolean attribute indicating whether or not target specification for an Ant builder has been updated for >- * 3.1 >- * >- * @since 3.1 >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ATTR_TARGETS_UPDATED = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_TARGETS_UPDATED; >- /** >- * 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. >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ATTR_ANT_PROPERTIES = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES; >- /** >- * 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. >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ATTR_ANT_PROPERTY_FILES = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTY_FILES; >- /** >- * 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. >- * >- * @since 3.0 >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ATTR_HIDE_INTERNAL_TARGETS = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_HIDE_INTERNAL_TARGETS; >- /** >- * 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. >- * >- * @since 3.0 >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ATTR_SORT_TARGETS = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_SORT_TARGETS; >- /** >- * Ant launch configuration type identifier. >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ID_ANT_LAUNCH_CONFIGURATION_TYPE = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE; >- /** >- * Ant builder launch configuration type identifier. Ant project builders >- * are of this type. >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE; >- /** >- * 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. >- * >- * @deprecated This constant has been migrated to {@link org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants} >- */ >- public static final String ID_ANT_PROCESS_TYPE = org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ID_ANT_PROCESS_TYPE; >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/MessageIds.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/MessageIds.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/MessageIds.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/MessageIds.java 13 May 2005 20:56:09 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,21 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2003, 2005 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.ui.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$ >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntBuildListener.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntBuildListener.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntBuildListener.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntBuildListener.java 4 May 2009 16:10:59 -0000 1.32 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,396 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2003, 2008 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.ui.launchConfigurations; >- >-import java.io.BufferedReader; >-import java.io.File; >-import java.io.IOException; >-import java.io.InputStreamReader; >-import java.net.ServerSocket; >-import java.net.Socket; >-import java.net.SocketException; >-import java.net.SocketTimeoutException; >-import java.util.ArrayList; >-import java.util.HashMap; >-import java.util.Iterator; >-import java.util.List; >-import java.util.Map; >-import java.util.StringTokenizer; >- >-import org.apache.tools.ant.Project; >-import org.apache.tools.ant.util.FileUtils; >-import org.eclipse.ant.internal.core.AbstractEclipseBuildLogger; >-import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.AntUtil; >-import org.eclipse.ant.internal.ui.ExternalHyperlink; >-import org.eclipse.ant.internal.ui.IAntUIConstants; >-import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.runtime.ISafeRunnable; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.ILaunch; >-import org.eclipse.debug.core.ILaunchesListener; >-import org.eclipse.debug.core.model.IProcess; >-import org.eclipse.debug.ui.console.FileLink; >-import org.eclipse.jface.preference.IPreferenceStore; >-import org.eclipse.jface.text.Region; >-import org.eclipse.ui.console.IHyperlink; >- >-/** >- * Parts adapted from org.eclipse.jdt.internal.junit.ui.RemoteTestRunnerClient >- * The client side of the RemoteAntBuildLogger. Handles the >- * marshalling of the different messages. >- */ >-public class RemoteAntBuildListener implements ILaunchesListener { >- public abstract class ListenerSafeRunnable implements ISafeRunnable { >- public void handleException(Throwable exception) { >- AntUIPlugin.log(exception); >- } >- } >- >- /** >- * The server socket >- */ >- private ServerSocket fServerSocket; >- private Socket fSocket; >- private BufferedReader fBufferedReader; >- private IProcess fProcess; >- private String fProcessId; >- private File fBuildFileParent= null; >- private List fMessageQueue; >- protected ILaunch fLaunch; >- private Map fFileNameToIFile= new HashMap(); >- private String fLastFileName= null; >- private String fLastTaskName= null; >- private boolean fBuildFailed= false; >- >- /** >- * Reads the message stream from the RemoteAntBuildLogger >- */ >- private class ServerConnection extends Thread { >- private int fServerPort; >- >- public ServerConnection(int port) { >- super("Ant Build Server Connection"); //$NON-NLS-1$ >- setDaemon(true); >- fServerPort= port; >- } >- >- public void run() { >- Exception exception= null; >- try { >- fServerSocket= new ServerSocket(fServerPort); >- IPreferenceStore prefs = AntUIPlugin.getDefault().getPreferenceStore(); >- int socketTimeout= prefs.getInt(IAntUIPreferenceConstants.ANT_COMMUNICATION_TIMEOUT); >- fServerSocket.setSoTimeout(socketTimeout); >- fSocket= fServerSocket.accept(); >- fBufferedReader= new BufferedReader(new InputStreamReader(fSocket.getInputStream(), "UTF-8")); //$NON-NLS-1$ >- String message; >- while(fBufferedReader != null && (message= fBufferedReader.readLine()) != null) { >- receiveMessage(message); >- } >- } catch (SocketException e) { >- } catch (SocketTimeoutException e) { >- exception= e; >- } catch (IOException e) { >- // fall through >- exception= e; >- } >- if (exception != null) { >- AntUIPlugin.log(exception); >- } >- shutDown(); >- } >- } >- >- public RemoteAntBuildListener(ILaunch launch) { >- super(); >- fLaunch= launch; >- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); >- } >- >- /** >- * Start listening to an Ant build. Start a server connection that >- * the RemoteAntBuildLogger can connect to. >- * >- * @param eventPort The port number to create the server connection on >- */ >- public synchronized void startListening(int eventPort){ >- ServerConnection connection = new ServerConnection(eventPort); >- connection.start(); >- } >- >- protected synchronized void shutDown() { >- fLaunch= null; >- fFileNameToIFile= null; >- if (DebugPlugin.getDefault() != null) { >- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this); >- } >- try { >- if (fBufferedReader != null) { >- fBufferedReader.close(); >- fBufferedReader= null; >- } >- } catch(IOException e) { >- } >- try{ >- if(fSocket != null) { >- fSocket.close(); >- fSocket= null; >- } >- } catch(IOException e) { >- } >- try{ >- if(fServerSocket != null) { >- fServerSocket.close(); >- fServerSocket= null; >- } >- } catch(IOException e) { >- } >- } >- >- protected void receiveMessage(String message) { >- if (message.startsWith(MessageIds.TASK)) { >- receiveTaskMessage(message); >- } else if (message.startsWith(MessageIds.TARGET)) { >- receiveTargetMessage(message); >- } else if (message.startsWith(MessageIds.PROCESS_ID)) { >- message= message.substring(MessageIds.PROCESS_ID.length()); >- fProcessId= message; >- } else { >- int index= message.indexOf(','); >- if (index > 0) { >- int priority= Integer.parseInt(message.substring(0, index)); >- message= message.substring(index + 1); >- >- writeMessage(message + System.getProperty("line.separator"), priority); //$NON-NLS-1$ >- if (message.startsWith("BUILD FAILED")) { //$NON-NLS-1$ >- fBuildFailed= true; >- } else if (fBuildFailed) { >- if (message.startsWith("Total time:")) { //$NON-NLS-1$ >- fBuildFailed= false; >- } else { >- AntUtil.linkBuildFailedMessage(message, getProcess()); >- } >- } >- } >- } >- } >- >- private void receiveTargetMessage(String message) { >- message= message.substring(MessageIds.TARGET.length()); >- StringTokenizer tokenizer= new StringTokenizer(message, ","); //$NON-NLS-1$ >- message= tokenizer.nextToken(); >- if (tokenizer.hasMoreTokens()) { >- int locationLength= Integer.parseInt(tokenizer.nextToken()); >- String location= tokenizer.nextToken(); >- while (location.length() < locationLength) { //path with a comma in it >- location+=","; //$NON-NLS-1$ >- location+= tokenizer.nextToken(); >- } >- int lineNumber= Integer.parseInt(tokenizer.nextToken()); >- generateLink(message, location, lineNumber, 0, message.length() - 1); >- } >- writeMessage(message + System.getProperty("line.separator"), Project.MSG_INFO); //$NON-NLS-1$ >- } >- >- private void receiveTaskMessage(String message) { >- message= message.substring(MessageIds.TASK.length()); >- >- int index= message.indexOf(','); >- int priority= Integer.parseInt(message.substring(0, index)); >- int index2= message.indexOf(',', index + 1); >- String taskName= message.substring(index + 1, index2); >- if (taskName.length() == 0) { >- taskName= fLastTaskName; >- } >- int index3= message.indexOf(',', index2 + 1); >- int lineLength= Integer.parseInt(message.substring(index2 + 1, index3)); >- int index4= index3 + 1 + lineLength; >- >- String line= message.substring(index3 + 1, index4); >- StringBuffer labelBuff= new StringBuffer(); >- labelBuff.append('['); >- labelBuff.append(taskName); >- labelBuff.append("] "); //$NON-NLS-1$ >- labelBuff.append(line); >- line= labelBuff.toString(); >- >- fLastTaskName= taskName; >- >- int locationIndex= message.indexOf(',', index4 + 1); >- int finalIndex= locationIndex + 1; >- String fileName= message.substring(index4 + 1, locationIndex); >- int locationLength= 0; >- if (fileName.length() == 0) { >- fileName= fLastFileName; >- } else { >- finalIndex= message.indexOf(',', locationIndex) + 1; >- locationLength= Integer.parseInt(fileName); >- fileName= message.substring(finalIndex, finalIndex + locationLength); >- locationLength+=1; //set past delimiter >- } >- fLastFileName= fileName; >- int lineNumber= Integer.parseInt(message.substring(finalIndex + locationLength)); >- >- int size = IAntUIConstants.LEFT_COLUMN_SIZE - (taskName.length() + 3); >- int offset = Math.max(size - 2, 1); >- int length = IAntUIConstants.LEFT_COLUMN_SIZE - size - 3; >- if (fileName != null) { >- generateLink(line, fileName, lineNumber, offset, length); >- } >- >- StringBuffer fullMessage= new StringBuffer(); >- adornMessage(taskName, line, fullMessage); >- writeMessage(fullMessage.append(System.getProperty("line.separator")).toString(), priority); //$NON-NLS-1$ >- } >- >- private void generateLink(String line, String fileName, int lineNumber, int offset, int length) { >- IHyperlink taskLink= null; >- if (lineNumber == -1) { >- //fileName will actually be the String representation of Location >- taskLink = AntUtil.getLocationLink(fileName, fBuildFileParent); >- } else { >- IFile file= (IFile) fFileNameToIFile.get(fileName); >- if (file == null) { >- file= AntUtil.getFileForLocation(fileName, fBuildFileParent); >- if (file != null) { >- fFileNameToIFile.put(fileName, file); >- taskLink= new FileLink(file, null, -1, -1, lineNumber); >- } else { >- File javaIOFile= FileUtils.getFileUtils().resolveFile(fBuildFileParent, fileName); >- if (javaIOFile.exists()) { >- taskLink= new ExternalHyperlink(javaIOFile, lineNumber); >- } >- } >- } else { >- taskLink= new FileLink(file, null, -1, -1, lineNumber); >- } >- } >- if (taskLink != null) { >- TaskLinkManager.addTaskHyperlink(getProcess(), taskLink, new Region(offset, length), line); >- } >- } >- >- /** >- * Returns the associated process, finding it if necessary. >- */ >- protected IProcess getProcess() { >- if (fProcess == null) { >- if (fProcessId != null) { >- IProcess[] all = DebugPlugin.getDefault().getLaunchManager().getProcesses(); >- for (int i = 0; i < all.length; i++) { >- IProcess process = all[i]; >- if (fProcessId.equals(process.getAttribute(AbstractEclipseBuildLogger.ANT_PROCESS_ID))) { >- fProcess = process; >- break; >- } >- } >- } >- } >- return fProcess; >- } >- >- private AntStreamMonitor getMonitor(int priority) { >- IProcess process= getProcess(); >- if (process == null) { >- return null; >- } >- AntStreamsProxy proxy = (AntStreamsProxy)process.getStreamsProxy(); >- if (proxy == null) { >- return null; >- } >- AntStreamMonitor monitor = null; >- switch (priority) { >- case Project.MSG_INFO: >- monitor = (AntStreamMonitor)proxy.getOutputStreamMonitor(); >- break; >- case Project.MSG_ERR: >- monitor = (AntStreamMonitor)proxy.getErrorStreamMonitor(); >- break; >- case Project.MSG_DEBUG: >- monitor = (AntStreamMonitor)proxy.getDebugStreamMonitor(); >- break; >- case Project.MSG_WARN: >- monitor = (AntStreamMonitor)proxy.getWarningStreamMonitor(); >- break; >- case Project.MSG_VERBOSE: >- monitor = (AntStreamMonitor)proxy.getVerboseStreamMonitor(); >- break; >- } >- return monitor; >- } >- >- /** >- * Builds a right justified task prefix for the given build event, placing it >- * in the given string buffer. >- * >- * @param event build event >- * @param fullMessage buffer to place task prefix in >- */ >- private void adornMessage(String taskName, String line, StringBuffer fullMessage) { >- if (taskName == null) { >- taskName = "null"; //$NON-NLS-1$ >- } >- >- int size = IAntUIConstants.LEFT_COLUMN_SIZE - (taskName.length() + 6); >- for (int i = 0; i < size; i++) { >- fullMessage.append(' '); >- } >- >- fullMessage.append(line); >- } >- >- protected void writeMessage(String message, int priority) { >- AntStreamMonitor monitor= getMonitor(priority); >- if (monitor == null) { >- if (fMessageQueue == null) { >- fMessageQueue= new ArrayList(); >- } >- fMessageQueue.add(message); >- return; >- } >- if (fMessageQueue != null) { >- for (Iterator iter = fMessageQueue.iterator(); iter.hasNext();) { >- String oldMessage = (String) iter.next(); >- monitor.append(oldMessage); >- } >- fMessageQueue= null; >- } >- monitor.append(message); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchesListener#launchesAdded(org.eclipse.debug.core.ILaunch[]) >- */ >- public void launchesAdded(ILaunch[] launches) { >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchesListener#launchesChanged(org.eclipse.debug.core.ILaunch[]) >- */ >- public void launchesChanged(ILaunch[] launches) { >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchesListener#launchesRemoved(org.eclipse.debug.core.ILaunch[]) >- */ >- public void launchesRemoved(ILaunch[] launches) { >- for (int i = 0; i < launches.length; i++) { >- ILaunch launch = launches[i]; >- if (launch.equals(fLaunch)) { >- shutDown(); >- return; >- } >- } >- } >-} >\ No newline at end of file >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntProcessFactory.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntProcessFactory.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntProcessFactory.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntProcessFactory.java 13 Aug 2008 15:32:18 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,34 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2008 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.ui.launchConfigurations; >- >-import java.util.HashMap; >-import java.util.Map; >- >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >-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, IAntLaunchConfigurationConstants.ID_ANT_PROCESS_TYPE); >- return new RemoteAntRuntimeProcess(launch, process, label, attributes); >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntRuntimeProcess.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntRuntimeProcess.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntRuntimeProcess.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/RemoteAntRuntimeProcess.java 21 Jun 2006 16:49:20 -0000 1.9 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,37 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2006 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.ui.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(); >- } >-} >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/SetTargetsDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/SetTargetsDialog.java,v >retrieving revision 1.8 >diff -u -r1.8 SetTargetsDialog.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/SetTargetsDialog.java 13 Aug 2008 15:32:18 -0000 1.8 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/SetTargetsDialog.java 7 Oct 2009 20:08:21 -0000 >@@ -11,7 +11,7 @@ > package org.eclipse.ant.internal.ui.launchConfigurations; > > import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.jface.dialogs.Dialog; >@@ -64,7 +64,7 @@ > defaultValue= ""; //$NON-NLS-1$ > } > try { >- return fConfiguration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, defaultValue); >+ return fConfiguration.getAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, defaultValue); > } catch (CoreException e) { > return defaultValue; > } >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/TaskLinkManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/TaskLinkManager.java,v >retrieving revision 1.7 >diff -u -r1.7 TaskLinkManager.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/TaskLinkManager.java 23 Feb 2005 17:20:11 -0000 1.7 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/TaskLinkManager.java 7 Oct 2009 20:08:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * 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 >@@ -10,14 +10,18 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.launchConfigurations; > >- >-import java.util.ArrayList; >+import java.io.File; > import java.util.HashMap; > import java.util.Iterator; > import java.util.List; > import java.util.Map; > >+import org.apache.tools.ant.util.FileUtils; >+import org.eclipse.ant.internal.launching.AntLaunch; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.ant.internal.launching.LinkDescriptor; > import org.eclipse.ant.internal.ui.AntUtil; >+import org.eclipse.ant.internal.ui.ExternalHyperlink; > import org.eclipse.core.resources.IFile; > import org.eclipse.debug.core.model.IProcess; > import org.eclipse.debug.ui.console.FileLink; >@@ -38,121 +42,59 @@ > * may be stored to process future incoming tasks hyperlinks. > */ > public class TaskLinkManager { >- >- /** >- * A map of processes to lists of queued task hyperlink entries >- */ >- private static Map fgProcessToLinks; >- >- /** >- * A map of processes to lists of queued new line regions >- */ >- private static Map fgProcessToNewLines; >- >- private static List fgAntBuilds; >- >- private static class HyperlinkEntry { >- private IHyperlink fLink; >- private IRegion fRegion; >- private String fMessage; >- >- public HyperlinkEntry(IHyperlink link, IRegion region, String message) { >- fLink = link; >- fRegion = region; >- fMessage = message; >- } >- >- public IRegion getRegion() { >- return fRegion; >- } >- >- public IHyperlink getLink() { >- return fLink; >- } >- >- public String getMessage() { >- return fMessage; >- } >- } >- >- private static class LineEntry { >- private IConsole fConsole; >- private IRegion fRegion; >- >- public LineEntry(IConsole console, IRegion region) { >- fConsole = console; >- fRegion = region; >- } >- >- public IRegion getRegion() { >- return fRegion; >- } >- >- public IConsole getConsole() { >- return fConsole; >- } >- } > >+ private static Map fFileNameToIFile = new HashMap(); >+ > /** > * Not to be called. > */ > private TaskLinkManager() { > super(); > } >- >- /** >- * Registers a hyperlink for the given process and task name. The given >- * region is relative to the beginning of the line (not the document). >- * >- * @param process the process associated with the link >- * @param link the link for the process >- * @param region The region within the line >- * @param message The message related to the link >- */ >- public static synchronized void addTaskHyperlink(IProcess process, IHyperlink link, IRegion region, String message) { >- if (fgProcessToNewLines != null) { >- List newLines = (List)fgProcessToNewLines.get(process); >- if (newLines != null) { >- for (int index= 0; index < newLines.size(); index++) { >- LineEntry newLine = (LineEntry) newLines.get(index); >- if (addLink(newLine.getConsole(), link, newLine.getRegion(), region, message)) { >- newLines.subList(0, index + 1).clear(); >- return; >+ >+ private static IHyperlink createHyperlink(LinkDescriptor linkDescriptor) { >+ String fileName = linkDescriptor.getFileName(); >+ int lineNumber = linkDescriptor.getLineNumber(); >+ >+ IHyperlink taskLink = null; >+ if (lineNumber == -1) { >+ // fileName will actually be the String representation of Location >+ taskLink = AntUtil.getLocationLink(fileName, null); >+ } else { >+ IFile file = (IFile) fFileNameToIFile.get(fileName); >+ if (file == null) { >+ file = AntLaunchingUtil.getFileForLocation(fileName, null); >+ if (file != null) { >+ fFileNameToIFile.put(fileName, file); >+ taskLink = new FileLink(file, null, -1, -1, lineNumber); >+ } else if(fileName!=null){ >+ File javaIOFile = FileUtils.getFileUtils().resolveFile(null, fileName); >+ if (javaIOFile.exists()) { >+ taskLink = new ExternalHyperlink(javaIOFile, lineNumber); > } > } >+ } else { >+ taskLink = new FileLink(file, null, -1, -1, lineNumber); > } > } >- >- if (fgProcessToLinks == null) { >- fgProcessToLinks = new HashMap(); >- >- } >- List links = (List)fgProcessToLinks.get(process); >- if (links == null) { >- links = new ArrayList(10); >- fgProcessToLinks.put(process, links); >- } >- >- links.add(new HyperlinkEntry(link, region, message)); >+ return taskLink; > } > >- private static boolean addLink(IConsole console, IHyperlink link, IRegion lineRegion, IRegion region, String message) { >- >- int length = region.getLength(); >- >- String text; >+ private static boolean addLink(IConsole console, IRegion lineRegion, LinkDescriptor descriptor) { > try { >- text = console.getDocument().get(lineRegion.getOffset(), lineRegion.getLength()); >+ String text = console.getDocument().get(lineRegion.getOffset(), lineRegion.getLength()); >+ if (text.trim().equals(descriptor.getLine())) { >+ int offset = lineRegion.getOffset() + descriptor.getOffset(); >+ IHyperlink link = createHyperlink(descriptor); >+ if (link != null) { >+ console.addLink(link, offset, descriptor.getLength()); >+ } >+ return true; >+ } > } catch (BadLocationException e) { >- return false; >- } >- if (text.trim().equals(message)) { >- int offset = lineRegion.getOffset() + region.getOffset(); >- console.addLink(link, offset, length); >- return true; > } > return false; >- } >+ } > > /** > * A new line has been added to the given console. Adds any task hyperlink >@@ -163,45 +105,25 @@ > * @param newLine > */ > public static synchronized void processNewLine(IConsole console, IRegion newLine) { >- IProcess process = console.getProcess(); >- if (fgAntBuilds != null && fgAntBuilds.contains(process)) { >- if (linkBuildFileMessage(console, newLine)) { >- fgAntBuilds.remove(process); >- return; >- } >- } >- if (fgProcessToLinks == null) { >- addNewLine(console, newLine, process); >+ AntLaunch launch = (AntLaunch) console.getProcess().getLaunch(); >+ List links = launch.getLinkDescriptors(); >+ >+ if (linkBuildFileMessage(console, newLine)) { > return; > } >- >- List links = (List)fgProcessToLinks.get(process); >- if (links == null) { >- addNewLine(console, newLine, process); >+ >+ if (links == null || links.isEmpty()) { > return; > } >- >- for (int index= 0; index < links.size(); index++) { >- HyperlinkEntry link = (HyperlinkEntry) links.get(index); >- if (addLink(console, link.getLink(), newLine, link.getRegion(), link.getMessage())) { >- links.subList(0, index + 1).clear(); >+ >+ for (Iterator i = links.iterator(); i.hasNext();) { >+ LinkDescriptor descriptor = (LinkDescriptor) i.next(); >+ if (addLink(console, newLine, descriptor)) { >+ launch.removeLinkDescriptor(descriptor); > return; > } > } > } >- >- private static void addNewLine(IConsole console, IRegion newLine, IProcess process) { >- if (fgProcessToNewLines == null) { >- fgProcessToNewLines = new HashMap(); >- } >- List newLines = (List)fgProcessToNewLines.get(process); >- if (newLines == null) { >- newLines= new ArrayList(); >- } >- >- newLines.add(new LineEntry(console, newLine)); >- fgProcessToNewLines.put(process, newLines); >- } > > /** > * Disposes any information stored for the given process. >@@ -209,43 +131,10 @@ > * @param process > */ > public static void dispose(IProcess process) { >- if (fgProcessToLinks != null) { >- fgProcessToLinks.remove(process); >- } >- if (fgProcessToNewLines != null) { >- fgProcessToNewLines.remove(process); >- } >- if (fgAntBuilds != null) { >- fgAntBuilds.remove(process); >- } >+ AntLaunch launch = (AntLaunch) process.getLaunch(); >+ launch.clearLinkDescriptors(); > } >- >- /** >- * Registers the specified process as an Ant build process. >- * Allows for the generation of the "Buildfile: somefile" link in the >- * Ant output. >- * >- * @param process >- */ >- public static synchronized void registerAntBuild(IProcess process) { >- if (fgProcessToNewLines != null) { >- List newLines = (List)fgProcessToNewLines.get(process); >- if (newLines != null) { >- for (Iterator iter = newLines.iterator(); iter.hasNext();) { >- LineEntry newLine = (LineEntry) iter.next(); >- if (linkBuildFileMessage(newLine.getConsole(), newLine.getRegion())){ >- iter.remove(); >- return; >- } >- } >- } >- } >- if (fgAntBuilds == null) { >- fgAntBuilds= new ArrayList(); >- } >- fgAntBuilds.add(process); >- } >- >+ > private static boolean linkBuildFileMessage(IConsole console, IRegion region) { > > String message= ""; //$NON-NLS-1$ >Index: Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModelCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModelCore.java,v >retrieving revision 1.7 >diff -u -r1.7 AntModelCore.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModelCore.java 23 Feb 2007 18:59:28 -0000 1.7 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModelCore.java 7 Oct 2009 20:08:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * 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 >@@ -10,14 +10,13 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.model; > >-import com.ibm.icu.text.MessageFormat; > import java.util.ArrayList; > import java.util.Iterator; > import java.util.List; > >+import org.eclipse.ant.internal.launching.debug.model.AntLineBreakpoint; >+import org.eclipse.ant.internal.launching.debug.model.DebugModelMessages; > import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.debug.model.AntLineBreakpoint; >-import org.eclipse.ant.internal.ui.debug.model.DebugModelMessages; > import org.eclipse.core.resources.IMarker; > import org.eclipse.core.resources.IMarkerDelta; > import org.eclipse.core.resources.IWorkspaceRunnable; >@@ -28,6 +27,8 @@ > import org.eclipse.debug.core.IBreakpointsListener; > import org.eclipse.debug.core.model.IBreakpoint; > >+import com.ibm.icu.text.MessageFormat; >+ > public class AntModelCore implements IBreakpointsListener { > > private static AntModelCore inst; >Index: Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPreferencePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPreferencePage.java,v >retrieving revision 1.24 >diff -u -r1.24 AntPreferencePage.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPreferencePage.java 10 Apr 2006 15:39:25 -0000 1.24 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPreferencePage.java 7 Oct 2009 20:08:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * 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 >@@ -10,12 +10,14 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.preferences; > >- >-import com.ibm.icu.text.MessageFormat; >- >+import org.eclipse.ant.internal.launching.AntLaunching; >+import org.eclipse.ant.internal.launching.IAntLaunchingPreferenceConstants; > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.IAntUIHelpContextIds; > import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences; >+import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.jface.preference.BooleanFieldEditor; > import org.eclipse.jface.preference.FieldEditorPreferencePage; > import org.eclipse.jface.preference.IPreferenceStore; >@@ -40,11 +42,14 @@ > import org.eclipse.ui.IWorkbenchPreferencePage; > import org.eclipse.ui.PlatformUI; > >+import com.ibm.icu.text.MessageFormat; >+ > public class AntPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { > > private List fConsoleColorList; > private ColorEditor fConsoleColorEditor; >- >+ private IntegerFieldEditor timeout; >+ > private BooleanFieldEditor fToolsWarningEditor= null; > > // Array containing the message to display, the preference key, and the >@@ -84,9 +89,12 @@ > > StringFieldEditor editor = new StringFieldEditor(IAntUIPreferenceConstants.ANT_FIND_BUILD_FILE_NAMES, AntPreferencesMessages.AntPreferencePage__Names__3, getFieldEditorParent()); > addField(editor); >- >- IntegerFieldEditor timeout = new IntegerFieldEditor(IAntUIPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, AntPreferencesMessages.AntPreferencePage_13, getFieldEditorParent()); >- int minValue= AntUIPlugin.getDefault().getPreferenceStore().getDefaultInt(IAntUIPreferenceConstants.ANT_COMMUNICATION_TIMEOUT); >+ >+ timeout = new IntegerFieldEditor(IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, AntPreferencesMessages.AntPreferencePage_13, getFieldEditorParent()); >+ int minValue= Platform.getPreferencesService().getInt( >+ AntLaunching.getUniqueIdentifier(), >+ IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, >+ 20000, null); > int maxValue = 1200000; > timeout.setValidRange(minValue, maxValue); > timeout.setErrorMessage(MessageFormat.format(AntPreferencesMessages.AntPreferencePage_14, new Object[] {new Integer(minValue), new Integer(maxValue)})); >@@ -147,6 +155,16 @@ > String preference = fAppearanceColorListModel[i][1]; > fAppearanceColorListModel[i][2]= store.getString(preference); > } >+ >+ IEclipsePreferences node = new InstanceScope() >+ .getNode(AntLaunching.getUniqueIdentifier()); >+ String t = node.get( >+ IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, >+ "2000"); //$NON-NLS-1$ >+ if (timeout != null) { >+ t = new Integer(timeout.getIntValue()).toString(); >+ } >+ node.put(IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, t); > } > > private void createColorComposite() { >Index: Ant Tools Support/org/eclipse/ant/internal/ui/refactoring/LaunchConfigurationBuildfileChange.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/refactoring/LaunchConfigurationBuildfileChange.java,v >retrieving revision 1.9 >diff -u -r1.9 LaunchConfigurationBuildfileChange.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/refactoring/LaunchConfigurationBuildfileChange.java 23 Sep 2008 14:45:18 -0000 1.9 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/refactoring/LaunchConfigurationBuildfileChange.java 7 Oct 2009 20:08:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2008 IBM Corporation and others. >+ * 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 >@@ -15,7 +15,8 @@ > > import org.eclipse.ant.core.AntCorePlugin; > import org.eclipse.ant.internal.ui.AntUtil; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.resources.IContainer; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IProject; >@@ -39,7 +40,6 @@ > import org.eclipse.ltk.core.refactoring.Change; > import org.eclipse.ltk.core.refactoring.CompositeChange; > import org.eclipse.ltk.core.refactoring.RefactoringStatus; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > import com.ibm.icu.text.MessageFormat; > >@@ -91,7 +91,7 @@ > private static ILaunchConfiguration[] getAntLaunchConfigurations() throws CoreException { > ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager(); > // Ant launch configurations >- ILaunchConfigurationType configurationType= manager.getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); >+ ILaunchConfigurationType configurationType= manager.getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); > ILaunchConfiguration[] configs= manager.getLaunchConfigurations(configurationType); > return configs; > } >Index: Ant Tools Support/org/eclipse/ant/ui/launching/IAntLaunchConfigurationConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/ui/launching/IAntLaunchConfigurationConstants.java,v >retrieving revision 1.1 >diff -u -r1.1 IAntLaunchConfigurationConstants.java >--- Ant Tools Support/org/eclipse/ant/ui/launching/IAntLaunchConfigurationConstants.java 13 Aug 2008 15:32:18 -0000 1.1 >+++ Ant Tools Support/org/eclipse/ant/ui/launching/IAntLaunchConfigurationConstants.java 7 Oct 2009 20:08:21 -0000 >@@ -11,109 +11,136 @@ > > package org.eclipse.ant.ui.launching; > >-import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.IAntUIConstants; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >+import org.eclipse.ant.launching.IAntLaunchConstants; > > /** > * Constant definitions for Ant launch configurations. > * > * @since 3.4 > * @noimplement This interface is not intended to be implemented by clients. >+ * @deprecated use {@link IAntLaunchConstants} > */ > public interface IAntLaunchConfigurationConstants { > > /** > * Ant launch configuration type identifier. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ID_ANT_LAUNCH_CONFIGURATION_TYPE} > */ >- public static final String ID_ANT_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ant.AntLaunchConfigurationType"; //$NON-NLS-1$ >+ public static final String ID_ANT_LAUNCH_CONFIGURATION_TYPE = IAntLaunchConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE; > > /** > * Ant builder launch configuration type identifier. Ant project builders > * are of this type. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE} > */ >- public static final String ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ant.AntBuilderLaunchConfigurationType"; //$NON-NLS-1$ >+ public static final String ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE = IAntLaunchConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE; > > /** > * 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. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_ANT_TARGETS} > */ >- public static final String ATTR_ANT_TARGETS = IExternalToolConstants.PLUGIN_ID + ".ATTR_ANT_TARGETS"; //$NON-NLS-1$ >+ public static final String ATTR_ANT_TARGETS = IAntLaunchConstants.ATTR_ANT_TARGETS; > > /** > * 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. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_ANT_AFTER_CLEAN_TARGETS} > */ >- public static final String ATTR_ANT_AFTER_CLEAN_TARGETS = IAntUIConstants.PLUGIN_ID + ".ATTR_ANT_AFTER_CLEAN_TARGETS"; //$NON-NLS-1$ >+ public static final String ATTR_ANT_AFTER_CLEAN_TARGETS = IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS; > > /** > * 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. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_ANT_MANUAL_TARGETS} > */ >- public static final String ATTR_ANT_MANUAL_TARGETS = IAntUIConstants.PLUGIN_ID + ".ATTR_ANT_MANUAL_TARGETS"; //$NON-NLS-1$ >+ public static final String ATTR_ANT_MANUAL_TARGETS = IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS; > > /** > * 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. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_ANT_AUTO_TARGETS} > */ >- public static final String ATTR_ANT_AUTO_TARGETS = IAntUIConstants.PLUGIN_ID + ".ATTR_ANT_AUTO_TARGETS"; //$NON-NLS-1$ >+ public static final String ATTR_ANT_AUTO_TARGETS = IAntLaunchConstants.ATTR_ANT_AUTO_TARGETS; > > /** > * 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. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_ANT_CLEAN_TARGETS} > */ >- public static final String ATTR_ANT_CLEAN_TARGETS = IAntUIConstants.PLUGIN_ID + ".ATTR_ANT_CLEAN_TARGETS"; //$NON-NLS-1$ >+ public static final String ATTR_ANT_CLEAN_TARGETS = IAntLaunchConstants.ATTR_ANT_CLEAN_TARGETS; > > /** > * Boolean attribute indicating whether or not target specification for an Ant builder > * has been updated for 3.1 >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_TARGETS_UPDATED} > */ >- public static final String ATTR_TARGETS_UPDATED = IAntUIConstants.PLUGIN_ID + ".ATTR_TARGETS_UPDATED"; //$NON-NLS-1$ >+ public static final String ATTR_TARGETS_UPDATED = IAntLaunchConstants.ATTR_TARGETS_UPDATED; > > /** > * 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. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_ANT_PROPERTIES} > */ >- public static final String ATTR_ANT_PROPERTIES = IExternalToolConstants.PLUGIN_ID + ".ATTR_ANT_PROPERTIES"; //$NON-NLS-1$ >+ public static final String ATTR_ANT_PROPERTIES = IAntLaunchConstants.ATTR_ANT_PROPERTIES; > > /** > * 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. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_ANT_PROPERTY_FILES} > */ >- public static final String ATTR_ANT_PROPERTY_FILES = IExternalToolConstants.PLUGIN_ID + ".ATTR_ANT_PROPERTY_FILES"; //$NON-NLS-1$ >+ public static final String ATTR_ANT_PROPERTY_FILES = IAntLaunchConstants.ATTR_ANT_PROPERTY_FILES; > > /** > * 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. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_HIDE_INTERNAL_TARGETS} > */ >- public static final String ATTR_HIDE_INTERNAL_TARGETS = IExternalToolConstants.PLUGIN_ID + ".ATTR_HIDE_INTERNAL_TARGETS"; //$NON-NLS-1$ >+ public static final String ATTR_HIDE_INTERNAL_TARGETS = IAntLaunchConstants.ATTR_HIDE_INTERNAL_TARGETS; > > /** > * 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. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_SORT_TARGETS} > */ >- public static final String ATTR_SORT_TARGETS = IExternalToolConstants.PLUGIN_ID + "ATTR_SORT_TARGETS"; //$NON-NLS-1$ >+ public static final String ATTR_SORT_TARGETS = IAntLaunchConstants.ATTR_SORT_TARGETS; > > /** > * 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 >+ * >+ * @deprecated use {@link IAntLaunchConstants#ATTR_DEFAULT_VM_INSTALL} > */ >- public static final String ATTR_DEFAULT_VM_INSTALL = AntUIPlugin.PI_ANTUI + ".DEFAULT_VM_INSTALL"; //$NON-NLS-1$ >+ public static final String ATTR_DEFAULT_VM_INSTALL = IAntLaunchConstants.ATTR_DEFAULT_VM_INSTALL; > > /** > * 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. >+ * >+ * @deprecated use {@link IAntLaunchConstants#ID_ANT_PROCESS_TYPE} > */ >- public static final String ID_ANT_PROCESS_TYPE = "org.eclipse.ant.ui.antProcess"; //$NON-NLS-1$ >+ public static final String ID_ANT_PROCESS_TYPE = IAntLaunchConstants.ID_ANT_PROCESS_TYPE; > } >Index: Common Ant Support/META-INF/eclipse.inf >=================================================================== >RCS file: Common Ant Support/META-INF/eclipse.inf >diff -N Common Ant Support/META-INF/eclipse.inf >--- Common Ant Support/META-INF/eclipse.inf 25 Apr 2007 20:31:36 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1 +0,0 @@ >-jarprocessor.exclude.sign=true >\ No newline at end of file >Index: Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/AntDebugState.java >=================================================================== >RCS file: Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/AntDebugState.java >diff -N Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/AntDebugState.java >--- Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/AntDebugState.java 1 Mar 2007 21:15:37 -0000 1.16 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,529 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2005, 2007 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.ui.antsupport.logger.util; >- >-import java.util.HashMap; >-import java.util.Hashtable; >-import java.util.Iterator; >-import java.util.Map; >-import java.util.Stack; >-import java.util.Vector; >- >-import org.apache.tools.ant.BuildEvent; >-import org.apache.tools.ant.Location; >-import org.apache.tools.ant.Project; >-import org.apache.tools.ant.Target; >-import org.apache.tools.ant.Task; >-import org.apache.tools.ant.taskdefs.MacroInstance; >- >-public class AntDebugState { >- >- private static final String fgAntTaskName= "ant"; //$NON-NLS-1$ >- private static final String fgAntCallTaskName= "antcall"; //$NON-NLS-1$ >- >- private IDebugBuildLogger fLogger; >- private Stack fTasks= new Stack(); >- private Map fTaskToProxies= new HashMap(); >- private Task fCurrentTask; >- private Task fStepOverTask; >- private Task fStepIntoTask; >- private Task fLastTaskFinished; >- >- //properties set before execution >- private Map fInitialProperties= null; >- private Map fProperties= null; >- >- private Map fProjectToTargetNames= null; >- private Map fProjectToMapOfTargetToBuildSequence= null; >- private Stack fTargetsToExecute= new Stack(); >- private Stack fTargetsExecuting= new Stack(); >- >- private boolean fConsiderTargetBreakpoints= false; >- private boolean fShouldSuspend; >- private boolean fClientSuspend= false; >- private boolean fStepIntoSuspend= false; >- private boolean fIsAfterTaskEvent= false; >- >- >- public AntDebugState(IDebugBuildLogger logger) { >- fLogger= logger; >- } >- >- public void waitIfSuspended() { >- fLogger.waitIfSuspended(); >- } >- >- public Task getLastTaskFinished() { >- return fLastTaskFinished; >- } >- >- private void setLastTaskFinished(Task lastTaskFinished) { >- fLastTaskFinished= lastTaskFinished; >- >- } >- >- public Task getCurrentTask() { >- return fCurrentTask; >- } >- >- public void setCurrentTask(Task currentTask) { >- fCurrentTask= currentTask; >- >- } >- >- private Map getInitialProperties() { >- return fInitialProperties; >- } >- >- public Task getStepOverTask() { >- return fStepOverTask; >- } >- >- public void setStepOverTask(Task stepOverTask) { >- fStepOverTask= stepOverTask; >- >- } >- >- private boolean considerTargetBreakpoints() { >- return fConsiderTargetBreakpoints; >- } >- >- private void setConsiderTargetBreakpoints(boolean considerTargetBreakpoints) { >- fConsiderTargetBreakpoints= considerTargetBreakpoints; >- } >- >- private Stack getTasks() { >- return fTasks; >- } >- >- public void setShouldSuspend(boolean shouldSuspend) { >- fShouldSuspend= shouldSuspend; >- } >- >- public boolean shouldSuspend() { >- return fShouldSuspend; >- } >- >- private Map getTargetToBuildSequence(Project project) { >- return (Map) fProjectToMapOfTargetToBuildSequence.get(project); >- } >- >- public void setTargetToExecute(Target target) { >- if (target == null) { >- fTargetsToExecute.pop(); >- } else { >- fTargetsToExecute.push(target); >- } >- } >- >- public void setTargetExecuting(Target target) { >- if (target == null) { >- fTargetsExecuting.pop(); >- } else { >- fTargetsExecuting.push(target); >- } >- } >- >- private Target getTargetToExecute() { >- if (fTargetsToExecute.isEmpty()) { >- return null; >- } >- return (Target) fTargetsToExecute.peek(); >- } >- >- private Target getTargetExecuting() { >- if (fTargetsExecuting.isEmpty()) { >- return null; >- } >- return (Target) fTargetsExecuting.peek(); >- } >- >- public boolean isStepIntoSuspend() { >- return isAfterTaskEvent() && fStepIntoSuspend; >- } >- >- public void setStepIntoSuspend(boolean stepIntoSuspend) { >- fStepIntoSuspend = stepIntoSuspend; >- } >- >- public boolean isClientSuspend() { >- return fClientSuspend; >- } >- >- public void setClientSuspend(boolean clientSuspend) { >- fClientSuspend = clientSuspend; >- } >- >- public Task getStepIntoTask() { >- return fStepIntoTask; >- } >- >- public void setStepIntoTask(Task stepIntoTask) { >- fStepIntoTask = stepIntoTask; >- } >- >- public void resume() { >- fLogger.notifyAll(); >- } >- >- public Map getProperties() { >- return fProperties; >- } >- >- public Location getBreakpointLocation() { >- if (isAfterTaskEvent() && getCurrentTask() != null) { >- return getCurrentTask().getLocation(); >- } >- if (considerTargetBreakpoints()) { >- Target targetExecuting= getTargetExecuting(); >- if (targetExecuting != null) { >- return getLocation(targetExecuting); >- } >- } >- return null; >- } >- >- private boolean isAfterTaskEvent() { >- return fIsAfterTaskEvent; >- } >- >- private void setAfterTaskEvent(boolean isAfterTaskEvent) { >- fIsAfterTaskEvent = isAfterTaskEvent; >- } >- >- public void taskStarted(BuildEvent event) { >- setAfterTaskEvent(true); >- if (getInitialProperties() == null) {//implicit or top level target does not fire targetStarted() >- fInitialProperties= event.getProject().getProperties(); >- } >- >- setCurrentTask(event.getTask()); >- setConsiderTargetBreakpoints(false); >- if (!getTasks().isEmpty()) { >- //cache the parent task proxy as when that task is started or finished the >- //proxy is not yet available or is nulled out >- Task parentTask = (Task) getTasks().peek(); >- Object proxy = parentTask.getRuntimeConfigurableWrapper().getProxy(); >- if (proxy != null) { >- fTaskToProxies.put(parentTask, proxy); >- } >- } >- getTasks().push(getCurrentTask()); >- waitIfSuspended(); >- } >- >- >- public void taskFinished() { >- Task lastTask= (Task)getTasks().pop(); >- setLastTaskFinished(lastTask); >- setCurrentTask(null); >- String taskName= lastTask.getTaskName(); >- >- if (getStepOverTask() != null) { >- if ((fgAntCallTaskName.equals(taskName) || fgAntTaskName.equals(taskName)) && (!fgAntCallTaskName.equals(getStepOverTask().getTaskName()) && !fgAntTaskName.equals(getStepOverTask().getTaskName()))) { >- setShouldSuspend(true); >- } else if (fTaskToProxies.remove(lastTask) instanceof MacroInstance) { >- setShouldSuspend(true); >- } >- } >- waitIfSuspended(); >- } >- >- public void stepOver() { >- setStepOverTask(getCurrentTask()); >- if (getCurrentTask() == null) { >- //stepping over target breakpoint >- setShouldSuspend(true); >- } >- resume(); >- } >- >- public void targetStarted(BuildEvent event) { >- setAfterTaskEvent(false); >- Project eventProject = event.getProject(); >- if (getInitialProperties() == null) { >- fInitialProperties= eventProject.getProperties(); >- } >- if (fProjectToTargetNames.get(eventProject) == null) { >- Object ref= eventProject.getReference("eclipse.ant.targetVector"); //$NON-NLS-1$ >- if (ref != null) { >- fProjectToTargetNames.put(eventProject, ref); >- Map targetToBuildSequence= new HashMap(); >- setTargetToExecute(initializeBuildSequenceInformation(event, targetToBuildSequence)); >- fProjectToMapOfTargetToBuildSequence.put(eventProject, targetToBuildSequence); >- } >- } >- >- setTargetExecuting(event.getTarget()); >- if (event.getTarget().equals(getTargetToExecute())) { >- //the dependencies of the target to execute have been met >- //prepare for the next target >- Vector targets= (Vector) fProjectToTargetNames.get(eventProject); >- if (!targets.isEmpty()) { >- setTargetToExecute((Target) eventProject.getTargets().get(targets.remove(0))); >- } else { >- setTargetToExecute(null); >- } >- } >- setConsiderTargetBreakpoints(true); >- } >- >- public int getLineNumber(Location location) { >- try { //succeeds with Ant newer than 1.6 >- return location.getLineNumber(); >- } catch (NoSuchMethodError e) { >- //Ant before 1.6 >- String locationString= location.toString(); >- if (locationString.length() == 0) { >- return 0; >- } >- //filename: lineNumber: ("c:\buildfile.xml: 12: ") >- int lastIndex= locationString.lastIndexOf(':'); >- int index =locationString.lastIndexOf(':', lastIndex - 1); >- if (index != -1) { >- try { >- return Integer.parseInt(locationString.substring(index+1, lastIndex)); >- } catch (NumberFormatException nfe) { >- return 0; >- } >- } >- return 0; >- } >- } >- >- public static Location getLocation(Target target) { >- try {//succeeds with Ant newer than 1.6.2 >- return target.getLocation(); >- } catch (NoSuchMethodError e) { >- return Location.UNKNOWN_LOCATION; >- } >- } >- >- public String getFileName(Location location) { >- try {//succeeds with Ant newer than 1.6 >- return location.getFileName(); >- } catch (NoSuchMethodError e) { >- //Ant before 1.6 >- String locationString= location.toString(); >- if (locationString.length() == 0) { >- return null; >- } >- //filename: lineNumber: ("c:\buildfile.xml: 12: ") >- int lastIndex= locationString.lastIndexOf(':'); >- int index =locationString.lastIndexOf(':', lastIndex-1); >- if (index == -1) { >- index= lastIndex; //only the filename is known >- } >- if (index != -1) { >- //bug 84403 >- //if (locationString.startsWith("file:")) { >- // return FileUtils.newFileUtils().fromURI(locationString); >- //} >- //remove file: >- return locationString.substring(5, index); >- } >- return null; >- } >- } >- >- private void appendToStack(StringBuffer stackRepresentation, String targetName, String taskName, Location location) { >- stackRepresentation.append(targetName); >- stackRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- stackRepresentation.append(taskName); >- stackRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- >- stackRepresentation.append(getFileName(location)); >- stackRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- stackRepresentation.append(getLineNumber(location)); >- stackRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- } >- >- public void marshalStack(StringBuffer stackRepresentation) { >- Stack tasks= getTasks(); >- >- stackRepresentation.append(DebugMessageIds.STACK); >- stackRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- >- Target targetToExecute= getTargetToExecute(); >- Target targetExecuting= getTargetExecuting(); >- >- Project projectExecuting= null; >- if (targetExecuting != null) { >- projectExecuting= targetExecuting.getProject(); >- } else { //no target...must be a task >- Task task= (Task) tasks.peek(); >- projectExecuting= task.getProject(); >- } >- >- if (!isAfterTaskEvent()) { >- appendToStack(stackRepresentation, targetExecuting.getName(), "", getLocation(targetExecuting)); //$NON-NLS-1$ >- } >- for (int i = tasks.size() - 1; i >= 0 ; i--) { >- Task task= (Task) tasks.get(i); >- if (task.getProject() == projectExecuting) { >- appendToStack(stackRepresentation, task.getOwningTarget().getName(), task.getTaskName(), task.getLocation()); >- } else { >- //sub build target dependencies >- String targetName= task.getOwningTarget().getName(); >- if (targetName != null && targetName.length() != 0) { //skip for implicit target >- Iterator itr= fTargetsToExecute.iterator(); >- while (itr.hasNext()) { >- Target target= (Target) itr.next(); >- if (target.getProject() != projectExecuting) { >- targetToExecute= target; >- continue; >- } >- marshalTargetDependancyStack(stackRepresentation, target, targetExecuting); >- } >- } >- projectExecuting= task.getProject(); >- targetExecuting= task.getOwningTarget(); >- appendToStack(stackRepresentation, targetExecuting.getName(), task.getTaskName(), task.getLocation()); >- } >- } >- >- //target dependency stack >- marshalTargetDependancyStack(stackRepresentation, targetToExecute, targetExecuting); >- } >- >- private void marshalTargetDependancyStack(StringBuffer stackRepresentation, Target targetToExecute, Target targetExecuting) { >- if (targetToExecute != null) { >- Vector buildSequence= (Vector) getTargetToBuildSequence(targetToExecute.getProject()).get(targetToExecute); >- int startIndex= buildSequence.indexOf(targetExecuting) + 1; >- int dependancyStackDepth= buildSequence.indexOf(targetToExecute); >- >- Target stackTarget; >- for (int i = startIndex; i <= dependancyStackDepth; i++) { >- stackTarget= (Target) buildSequence.get(i); >- if (stackTarget.dependsOn(targetExecuting.getName())) { >- appendToStack(stackRepresentation, stackTarget.getName(), "", getLocation(stackTarget)); //$NON-NLS-1$ >- } >- } >- } >- } >- >- public void marshallProperties(StringBuffer propertiesRepresentation, boolean escapeLineSep) { >- if (getTasks().isEmpty()) { >- return; >- } >- propertiesRepresentation.append(DebugMessageIds.PROPERTIES); >- propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- >- Project project= ((Task)getTasks().peek()).getProject(); >- Map lastProperties= getProperties(); >- >- Map currentProperties= project.getProperties(); >- if (lastProperties != null && currentProperties.size() == lastProperties.size()) { >- //no new properties >- return; >- } >- >- Map initialProperties= getInitialProperties(); >- Map currentUserProperties= project.getUserProperties(); >- Iterator iter= currentProperties.keySet().iterator(); >- String propertyName; >- String originalPropertyName; >- String propertyValue; >- while (iter.hasNext()) { >- propertyName = (String) iter.next(); >- originalPropertyName= propertyName; >- if (lastProperties == null || lastProperties.get(propertyName) == null) { //new property >- if (escapeLineSep) { >- propertyName= escapeLineSeparator(propertyName); >- } >- propertiesRepresentation.append(propertyName.length()); >- propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- propertiesRepresentation.append(propertyName); >- propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- propertyValue= (String) currentProperties.get(originalPropertyName); >- if (escapeLineSep) { >- propertyValue= escapeLineSeparator(propertyValue); >- } >- propertiesRepresentation.append(propertyValue.length()); >- propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- propertiesRepresentation.append(propertyValue); >- propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- propertiesRepresentation.append(getPropertyType(initialProperties, currentUserProperties, originalPropertyName)); >- propertiesRepresentation.append(DebugMessageIds.MESSAGE_DELIMITER); >- } >- } >- >- propertiesRepresentation.deleteCharAt(propertiesRepresentation.length() - 1); >- fProperties= currentProperties; >- } >- >- private int getPropertyType(Map initialProperties, Map currentUserProperties, String propertyName) { >- if (initialProperties.get(propertyName) != null) { //properties set before the start of the build >- if (currentUserProperties.get(propertyName) == null) { >- return DebugMessageIds.PROPERTY_SYSTEM; >- } >- return DebugMessageIds.PROPERTY_USER; >- } else if (currentUserProperties.get(propertyName) == null){ >- return DebugMessageIds.PROPERTY_RUNTIME; >- } else { >- return DebugMessageIds.PROPERTY_USER; >- } >- } >- >- private String escapeLineSeparator(String stringToEscape) { >- if (!(stringToEscape.indexOf('\r') != -1 || stringToEscape.indexOf('\n') != -1 || stringToEscape.indexOf("\\r") != -1 || stringToEscape.indexOf("\\n") != -1)) { //$NON-NLS-1$ //$NON-NLS-2$ >- return stringToEscape; >- } >- StringBuffer escapedValue= new StringBuffer(stringToEscape); >- for (int i= 0; i < escapedValue.length(); i++) { >- switch (escapedValue.charAt(i)) { >- case '\r': >- escapedValue.replace(i, i+1, "\\r"); //$NON-NLS-1$ >- i++; >- break; >- case '\n': >- escapedValue.replace(i, i+1, "\\n"); //$NON-NLS-1$ >- i++; >- break; >- case '\\': >- if (escapedValue.charAt(i + 1) == 'r' || escapedValue.charAt(i + 1) == 'n') { >- escapedValue.replace(i, i+1, "\\\\"); //$NON-NLS-1$ >- i++; >- } >- break; >- default: >- break; >- } >- } >- >- return escapedValue.toString(); >- } >- >- private Target initializeBuildSequenceInformation(BuildEvent event, Map targetToBuildSequence) { >- Project antProject= event.getProject(); >- Vector targets= (Vector) antProject.getReference("eclipse.ant.targetVector"); //$NON-NLS-1$ >- if (targets == null) { >- return null; >- } >- Iterator itr= targets.iterator(); >- Hashtable allTargets= antProject.getTargets(); >- String targetName; >- Vector sortedTargets; >- while (itr.hasNext()) { >- targetName= (String) itr.next(); >- sortedTargets= antProject.topoSort(targetName, allTargets); >- targetToBuildSequence.put(allTargets.get(targetName), sortedTargets); >- } >- //the target to execute >- return (Target) allTargets.get(targets.remove(0)); >- } >- >- public void buildStarted() { >- fProjectToTargetNames= new HashMap(); >- fProjectToMapOfTargetToBuildSequence= new HashMap(); >- } >-} >Index: Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/DebugMessageIds.java >=================================================================== >RCS file: Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/DebugMessageIds.java >diff -N Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/DebugMessageIds.java >--- Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/DebugMessageIds.java 23 Feb 2005 17:20:53 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,47 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.antsupport.logger.util; >- >- >-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; >-} >Index: Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/IDebugBuildLogger.java >=================================================================== >RCS file: Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/IDebugBuildLogger.java >diff -N Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/IDebugBuildLogger.java >--- Common Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/util/IDebugBuildLogger.java 25 Mar 2005 17:45:24 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,21 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2005 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.ui.antsupport.logger.util; >- >- >-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 >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.32 >diff -u -r1.32 MANIFEST.MF >--- META-INF/MANIFEST.MF 2 Sep 2009 16:14:59 -0000 1.32 >+++ META-INF/MANIFEST.MF 7 Oct 2009 20:08:21 -0000 >@@ -2,14 +2,13 @@ > Bundle-ManifestVersion: 2 > Bundle-Name: %pluginName > Bundle-SymbolicName: org.eclipse.ant.ui; singleton:=true >-Bundle-Version: 3.4.0.qualifier >+Bundle-Version: 3.5.0.qualifier > Bundle-Activator: org.eclipse.ant.internal.ui.AntUIPlugin > Bundle-Vendor: %providerName > Bundle-Localization: plugin > Export-Package: org.eclipse.ant.internal.ui;x-internal:=true, > org.eclipse.ant.internal.ui.console;x-internal:=true, > org.eclipse.ant.internal.ui.datatransfer;x-internal:=true, >- org.eclipse.ant.internal.ui.debug;x-internal:=true, > org.eclipse.ant.internal.ui.debug.model;x-internal:=true, > org.eclipse.ant.internal.ui.dtd;x-internal:=true, > org.eclipse.ant.internal.ui.dtd.schema;x-internal:=true, >@@ -51,7 +50,9 @@ > org.eclipse.team.core;bundle-version="[3.2.0,4.0.0)", > org.eclipse.ltk.core.refactoring;bundle-version="[3.2.0,4.0.0)", > org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)", >- org.eclipse.jdt.junit;bundle-version="[3.5.0,4.0.0)" >+ org.eclipse.jdt.junit;bundle-version="[3.5.0,4.0.0)", >+ org.eclipse.ant.launching;bundle-version="1.0.0", >+ org.eclipse.core.externaltools;bundle-version="1.0.0" > Bundle-ActivationPolicy: lazy > Import-Package: com.ibm.icu.text > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/AntSecurityException.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/AntSecurityException.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/AntSecurityException.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/AntSecurityException.java 11 Apr 2005 15:25:32 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,23 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2005 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.ui.antsupport; >- >-/** >- * 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; >- >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/AntSecurityManager.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/AntSecurityManager.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/AntSecurityManager.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/AntSecurityManager.java 11 Apr 2005 15:08:38 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,371 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2005 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.ui.antsupport; >- >- >-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(); >- } >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/DemuxInputStreamSetter.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/DemuxInputStreamSetter.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/DemuxInputStreamSetter.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/DemuxInputStreamSetter.java 23 Feb 2005 17:31:22 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,26 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.antsupport; >- >- >-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)); >- } >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/EclipseDefaultExecutor.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/EclipseDefaultExecutor.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/EclipseDefaultExecutor.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/EclipseDefaultExecutor.java 26 May 2005 04:09:10 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,41 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2005 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.ui.antsupport; >- >-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; >- } >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/EclipseSingleCheckExecutor.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/EclipseSingleCheckExecutor.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/EclipseSingleCheckExecutor.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/EclipseSingleCheckExecutor.java 26 May 2005 04:09:10 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,39 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2005 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.ui.antsupport; >- >-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; >- } >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/ExecutorSetter.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/ExecutorSetter.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/ExecutorSetter.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/ExecutorSetter.java 26 May 2005 04:09:10 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,26 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2005 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.ui.antsupport; >- >-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); >- } >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InputHandlerSetter.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InputHandlerSetter.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InputHandlerSetter.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InputHandlerSetter.java 11 Apr 2006 14:45:05 -0000 1.8 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,44 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2006 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.ui.antsupport; >- >- >-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); >- } >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InternalAntRunner.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InternalAntRunner.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InternalAntRunner.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InternalAntRunner.java 24 Apr 2007 03:43:10 -0000 1.40 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,1231 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >- * Portions Copyright 2000-2005 The Apache Software Foundation >- * All rights reserved. This program and the accompanying materials are made >- * available under the terms of the Apache Software License v2.0 which >- * accompanies this distribution and is available at >- * http://www.apache.org/licenses/LICENSE-2.0. >- * >- * Contributors: >- * IBM Corporation - derived implementation >- *******************************************************************************/ >- >-package org.eclipse.ant.internal.ui.antsupport; >- >-import java.io.File; >-import java.io.FileInputStream; >-import java.io.FileNotFoundException; >-import java.io.FileOutputStream; >-import java.io.IOException; >-import java.io.InputStream; >-import java.io.PrintStream; >-import java.text.MessageFormat; // can't use ICU, used by ant build >-import java.util.ArrayList; >-import java.util.Collections; >-import java.util.Enumeration; >-import java.util.HashMap; >-import java.util.Iterator; >-import java.util.List; >-import java.util.Map; >-import java.util.Properties; >-import java.util.Vector; >- >-import org.apache.tools.ant.AntTypeDefinition; >-import org.apache.tools.ant.BuildEvent; >-import org.apache.tools.ant.BuildException; >-import org.apache.tools.ant.BuildListener; >-import org.apache.tools.ant.BuildLogger; >-import org.apache.tools.ant.ComponentHelper; >-import org.apache.tools.ant.DefaultLogger; >-import org.apache.tools.ant.DemuxOutputStream; >-import org.apache.tools.ant.Diagnostics; >-import org.apache.tools.ant.Main; >-import org.apache.tools.ant.Project; >-import org.apache.tools.ant.ProjectHelper; >-import org.apache.tools.ant.Target; >-import org.apache.tools.ant.Task; >-import org.apache.tools.ant.TaskAdapter; >-import org.apache.tools.ant.util.FileUtils; >-import org.eclipse.ant.internal.ui.antsupport.logger.RemoteAntBuildLogger; >- >-/** >- * Eclipse application entry point into Ant in a separate VM. Derived from the original Ant Main class >- * to ensure that the functionality is equivalent when running in the platform. >- */ >-public class InternalAntRunner { >- >- /** >- * Message priority for project help messages. >- */ >- public static final int MSG_PROJECT_HELP= Project.MSG_DEBUG + 1; >- >- private List buildListeners; >- >- private String buildFileLocation; >- >- /** >- * Targets we want to run. >- */ >- private Vector targets; >- >- private Map userProperties; >- >- private Project currentProject; >- >- private BuildLogger buildLogger= null; >- >- private Map eclipseSpecifiedTasks; >- private Map eclipseSpecifiedTypes; >- >- /** >- * Cache of the Ant version number when it has been loaded >- */ >- private String antVersionNumber= null; >- >- /** Our current message output status. Follows Project.MSG_XXX */ >- private int messageOutputLevel = Project.MSG_INFO; >- >- /** Indicates whether output to the log is to be unadorned. */ >- private boolean emacsMode = false; >- >- /** Indicates we should only parse and display the project help information */ >- private boolean projectHelp = false; >- >- /** Stream that we are using for logging */ >- private PrintStream out = System.out; >- >- /** Stream that we are using for logging error messages */ >- private PrintStream err = System.err; >- >- /** >- * The Ant logger class. There may be only one logger. It will have the >- * right to use the 'out' PrintStream. The class must implement the BuildLogger >- * interface. An empty String indicates that no logger is to be used. A <code>null</code> >- * name indicates that the <code>org.apache.tools.ant.DefaultLogger</code> will be used. >- */ >- private String loggerClassname = null; >- >- /** Extra arguments to be parsed as command line arguments. */ >- private String[] extraArguments = null; >- >- private boolean scriptExecuted= false; >- >- private List propertyFiles= new ArrayList(); >- >- /** >- * The Ant InputHandler class. There may be only one input handler. >- */ >- private String inputHandlerClassname = null; >- >- /** >- * Indicates whether to execute all targets that >- * do not depend on failed targets >- * @since Ant 1.6.0 >- */ >- private boolean keepGoing= false; >- >- /** >- * Indicates whether this build is to support interactive input >- * @since Ant 1.6.0 >- */ >- private boolean allowInput = true; >- >- private String fEarlyErrorMessage= null; >- >- public static void main(String[] args) { >- try { >- new InternalAntRunner().run(getArrayList(args)); >- } catch (Throwable t) { >- t.printStackTrace(); >- System.exit(1); >- } >- System.exit(0); >- } >- >- private void addBuildListeners(Project project) { >- String className= null; >- try { >- BuildLogger logger= createLogger(); >- if (logger != null) { >- project.addBuildListener(logger); >- } >- if (buildListeners != null) { >- for (Iterator iterator = buildListeners.iterator(); iterator.hasNext();) { >- className = (String) iterator.next(); >- Class listener = Class.forName(className); >- project.addBuildListener((BuildListener) listener.newInstance()); >- } >- } >- } catch (ClassCastException e) { >- String message = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.{0}_which_was_specified_to_be_a_build_listener_is_not_an_instance_of_org.apache.tools.ant.BuildListener._1"), new String[]{className}); //$NON-NLS-1$ >- logMessage(null, message, Project.MSG_ERR); >- throw new BuildException(message, e); >- } catch (BuildException e) { >- throw e; >- } catch (Exception e) { >- throw new BuildException(e); >- } >- } >- >- /** >- * Parses the build file and adds necessary information into >- * the given project. >- * @param project The project to configure >- */ >- private void parseBuildFile(Project project) { >- File buildFile = new File(getBuildFileLocation()); >- if (!buildFile.exists()) { >- throw new BuildException(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Buildfile__{0}_does_not_exist_!_1"), //$NON-NLS-1$ >- new String[]{buildFile.getAbsolutePath()})); >- } >- if (!buildFile.isFile()) { >- throw new BuildException(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Buildfile__{0}_is_not_a_file_1"), //$NON-NLS-1$ >- new String[]{buildFile.getAbsolutePath()})); >- } >- >- if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >- parseBuildFile(project, buildFile); >- } else { >- ProjectHelper helper = ProjectHelper.getProjectHelper(); >- project.addReference("ant.projectHelper", helper); //$NON-NLS-1$ >- helper.parse(project, buildFile); >- } >- } >- >- /** >- * @deprecated support for Ant older than 1.5 >- */ >- private void parseBuildFile(Project project, File buildFile) { >- ProjectHelper.configureProject(project, buildFile); >- } >- >- private void printArguments(Project project) { >- if ((messageOutputLevel != Project.MSG_DEBUG) && (messageOutputLevel != Project.MSG_VERBOSE)) { >- return; >- } >- StringBuffer sb = new StringBuffer(); >- for (int i = 0; i < extraArguments.length; i++) { >- sb.append(extraArguments[i]); >- sb.append(' '); >- } >- project.log(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Arguments__{0}_2"), new String[]{sb.toString().trim()})); //$NON-NLS-1$ >- } >- >- >- /** >- * Logs a message with the client that lists the targets >- * in a project >- * >- * @param project the project to list targets from >- */ >- private void printTargets(Project project) { >- //notify the logger that project help message are coming >- //since there is no buildstarted or targetstarted to >- //to be used to establish the connection >- logMessage(project, "", MSG_PROJECT_HELP); //$NON-NLS-1$ >- // find the target with the longest name >- int maxLength = 0; >- Enumeration ptargets = project.getTargets().elements(); >- String targetName; >- String targetDescription; >- Target currentTarget; >- // split the targets in top-level and sub-targets depending >- // on the presence of a description >- List topNames = new ArrayList(); >- List topDescriptions = new ArrayList(); >- List subNames = new ArrayList(); >- >- while (ptargets.hasMoreElements()) { >- currentTarget = (Target) ptargets.nextElement(); >- targetName = currentTarget.getName(); >- targetDescription = currentTarget.getDescription(); >- if (targetDescription == null) { >- subNames.add(targetName); >- } else { >- topNames.add(targetName); >- topDescriptions.add(targetDescription); >- if (targetName.length() > maxLength) { >- maxLength = targetName.length(); >- } >- } >- } >- >- Collections.sort(subNames); >- Collections.sort(topNames); >- Collections.sort(topDescriptions); >- >- String defaultTargetName = project.getDefaultTarget(); >- if (defaultTargetName != null && !"".equals(defaultTargetName)) { // shouldn't need to check but... //$NON-NLS-1$ >- List defaultName = new ArrayList(1); >- List defaultDesc = null; >- defaultName.add(defaultTargetName); >- >- int indexOfDefDesc = topNames.indexOf(defaultTargetName); >- if (indexOfDefDesc >= 0) { >- defaultDesc = new ArrayList(1); >- defaultDesc.add(topDescriptions.get(indexOfDefDesc)); >- } >- printTargets(project, defaultName, defaultDesc, RemoteAntMessages.getString("InternalAntRunner.Default_target__3"), maxLength); //$NON-NLS-1$ >- >- } >- >- printTargets(project, topNames, topDescriptions, RemoteAntMessages.getString("InternalAntRunner.Main_targets__4"), maxLength); //$NON-NLS-1$ >- printTargets(project, subNames, null, RemoteAntMessages.getString("InternalAntRunner.Subtargets__5"), 0); //$NON-NLS-1$ >- } >- >- /** >- * Logs a message with the client that lists the target names and optional descriptions >- * >- * @param project the enclosing target >- * @param names the targets names >- * @param descriptions the corresponding descriptions >- * @param heading the message heading >- * @param maxlen maximum length that can be allocated for a name >- */ >- private void printTargets(Project project, List names, List descriptions, String heading, int maxlen) { >- // now, start printing the targets and their descriptions >- String lSep = System.getProperty("line.separator"); //$NON-NLS-1$ >- >- String spaces = " "; //$NON-NLS-1$ >- while (spaces.length() < maxlen) { >- spaces += spaces; >- } >- StringBuffer msg = new StringBuffer(); >- msg.append(heading + lSep + lSep); >- for (int i = 0; i < names.size(); i++) { >- msg.append(' '); >- msg.append(names.get(i)); >- if (descriptions != null) { >- msg.append(spaces.substring(0, maxlen - ((String) names.get(i)).length() + 2)); >- msg.append(descriptions.get(i)); >- } >- msg.append(lSep); >- } >- logMessage(project, msg.toString(), Project.MSG_INFO); >- } >- >- /* >- * Note that the list passed to this method must support >- * List#remove(Object) >- */ >- private void run(List argList) { >- setCurrentProject(new Project()); >- if (isVersionCompatible("1.6.3")) { //$NON-NLS-1$ >- new ExecutorSetter().setExecutor(getCurrentProject()); >- } >- Throwable error = null; >- PrintStream originalErr = System.err; >- PrintStream originalOut = System.out; >- InputStream originalIn= System.in; >- >- SecurityManager originalSM= System.getSecurityManager(); >- scriptExecuted= true; >- try { >- if (argList != null && (argList.remove("-projecthelp") || argList.remove("-p"))) { //$NON-NLS-1$ //$NON-NLS-2$ >- projectHelp = true; >- } >- getCurrentProject().init(); >- if (argList != null) { >- scriptExecuted= preprocessCommandLine(argList); >- >- if (!scriptExecuted) { >- return; >- } >- } >- >- boolean exceptionState= processProperties(argList); >- >- addBuildListeners(getCurrentProject()); >- >- addInputHandler(getCurrentProject()); >- >- remapSystemIn(); >- System.setOut(new PrintStream(new DemuxOutputStream(getCurrentProject(), false))); >- System.setErr(new PrintStream(new DemuxOutputStream(getCurrentProject(), true))); >- >- if (!projectHelp) { >- fireBuildStarted(getCurrentProject()); >- } >- >- if (fEarlyErrorMessage != null) { >- //an error occurred processing the properties >- //build started has fired and we have >- //listeners/loggers to report the error >- logMessage(getCurrentProject(), fEarlyErrorMessage, Project.MSG_ERR); >- if (exceptionState) { >- throw new BuildException(fEarlyErrorMessage); >- } >- } >- >- //properties can only be set after buildStarted as some listeners/loggers >- //depend on this (e.g. XMLLogger) >- setProperties(getCurrentProject()); >- >- if (argList != null && !argList.isEmpty()) { >- try { >- scriptExecuted= processCommandLine(argList); >- } catch (BuildException e) { >- scriptExecuted= false; >- throw e; >- } >- } >- if (!scriptExecuted) { >- return; >- } >- >- //needs to occur after processCommandLine(List) >- if (allowInput && (inputHandlerClassname != null && inputHandlerClassname.length() > 0)) { >- if (isVersionCompatible("1.6")) { //$NON-NLS-1$ >- getCurrentProject().setDefaultInputStream(originalIn); >- } >- } else { >- //set the system property that any input handler >- //can check to see if handling input is allowed >- System.setProperty("eclipse.ant.noInput", "true"); //$NON-NLS-1$//$NON-NLS-2$ >- if (isVersionCompatible("1.5") && (inputHandlerClassname == null || inputHandlerClassname.length() == 0)) { //$NON-NLS-1$ >- InputHandlerSetter setter= new InputHandlerSetter(); >- setter.setInputHandler(getCurrentProject(), "org.eclipse.ant.internal.ui.antsupport.inputhandler.FailInputHandler"); //$NON-NLS-1$ >- } >- } >- >- getCurrentProject().log(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Build_file__{0}_1"), new String[]{getBuildFileLocation()})); //$NON-NLS-1$ >- >- setTasks(); >- setTypes(); >- >- if (isVersionCompatible("1.6")) { //$NON-NLS-1$ >- getCurrentProject().setKeepGoingMode(keepGoing); >- } >- >- parseBuildFile(getCurrentProject()); >- >- if (projectHelp) { >- printHelp(getCurrentProject()); >- scriptExecuted= false; >- return; >- } >- >- if (extraArguments != null) { >- printArguments(getCurrentProject()); >- } >- >- System.setSecurityManager(new AntSecurityManager(originalSM, Thread.currentThread())); >- >- if (targets == null) { >- targets= new Vector(1); >- } >- if (targets.isEmpty() && getCurrentProject().getDefaultTarget() != null) { >- targets.add(getCurrentProject().getDefaultTarget()); >- } >- if (!isVersionCompatible("1.6.3")) { //$NON-NLS-1$ >- getCurrentProject().addReference("eclipse.ant.targetVector", targets); //$NON-NLS-1$ >- } >- getCurrentProject().executeTargets(targets); >- } catch (AntSecurityException e) { >- //expected >- } catch (Throwable e) { >- error = e; >- } finally { >- System.setErr(originalErr); >- System.setOut(originalOut); >- System.setIn(originalIn); >- if (System.getSecurityManager() instanceof AntSecurityManager) { >- System.setSecurityManager(originalSM); >- } >- >- if (!projectHelp) { >- fireBuildFinished(getCurrentProject(), error); >- } >- >- //close any user specified build log >- if (err != originalErr) { >- err.close(); >- } >- if (out != originalOut) { >- out.close(); >- } >- } >- } >- >- private void setTasks() { >- if (eclipseSpecifiedTasks != null) { >- Iterator itr= eclipseSpecifiedTasks.keySet().iterator(); >- String taskName; >- String taskClassName; >- while (itr.hasNext()) { >- taskName= (String) itr.next(); >- taskClassName= (String) eclipseSpecifiedTasks.get(taskName); >- >- if (isVersionCompatible("1.6")) { //$NON-NLS-1$ >- AntTypeDefinition def= new AntTypeDefinition(); >- def.setName(taskName); >- def.setClassName(taskClassName); >- def.setClassLoader(this.getClass().getClassLoader()); >- def.setAdaptToClass(Task.class); >- def.setAdapterClass(TaskAdapter.class); >- ComponentHelper.getComponentHelper(getCurrentProject()).addDataTypeDefinition(def); >- } else { >- try { >- Class taskClass = Class.forName(taskClassName); >- getCurrentProject().addTaskDefinition(taskName, taskClass); >- } catch (ClassNotFoundException e) { >- String message= MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.161"), new String[]{taskClassName, taskName}); //$NON-NLS-1$ >- getCurrentProject().log(message, Project.MSG_WARN); >- } >- } >- } >- } >- } >- >- private void setTypes() { >- if (eclipseSpecifiedTypes != null) { >- Iterator itr= eclipseSpecifiedTypes.keySet().iterator(); >- String typeName; >- String typeClassName; >- while (itr.hasNext()) { >- typeName = (String) itr.next(); >- typeClassName= (String) eclipseSpecifiedTypes.get(typeName); >- if (isVersionCompatible("1.6")) { //$NON-NLS-1$ >- AntTypeDefinition def = new AntTypeDefinition(); >- def.setName(typeName); >- def.setClassName(typeClassName); >- def.setClassLoader(this.getClass().getClassLoader()); >- ComponentHelper.getComponentHelper(getCurrentProject()).addDataTypeDefinition(def); >- } else { >- try { >- Class typeClass = Class.forName(typeClassName); >- getCurrentProject().addDataTypeDefinition(typeName, typeClass); >- } catch (ClassNotFoundException e) { >- String message= MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.162"), new String[]{typeClassName, typeName}); //$NON-NLS-1$ >- getCurrentProject().log(message, Project.MSG_WARN); >- } >- } >- } >- } >- } >- >- private void remapSystemIn() { >- if (!isVersionCompatible("1.6")) { //$NON-NLS-1$ >- return; >- } >- DemuxInputStreamSetter setter= new DemuxInputStreamSetter(); >- setter.remapSystemIn(getCurrentProject()); >- } >- >- /** >- * Creates and returns the default build logger for logging build events to the ant log. >- * >- * @return the default build logger for logging build events to the ant log >- * can return <code>null</code> if no logging is to occur >- */ >- private BuildLogger createLogger() { >- if (loggerClassname == null) { >- buildLogger= new DefaultLogger(); >- } else if (!"".equals(loggerClassname)) { //$NON-NLS-1$ >- try { >- buildLogger = (BuildLogger) (Class.forName(loggerClassname).newInstance()); >- } catch (ClassCastException e) { >- String message = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.{0}_which_was_specified_to_perform_logging_is_not_an_instance_of_org.apache.tools.ant.BuildLogger._2"), new String[]{loggerClassname}); //$NON-NLS-1$ >- logMessage(null, message, Project.MSG_ERR); >- throw new BuildException(message, e); >- } catch (Exception e) { >- String message = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Unable_to_instantiate_logger__{0}_6"), new String[]{loggerClassname}); //$NON-NLS-1$ >- logMessage(null, message, Project.MSG_ERR); >- throw new BuildException(message, e); >- } >- } >- >- if (buildLogger != null) { >- buildLogger.setMessageOutputLevel(messageOutputLevel); >- buildLogger.setOutputPrintStream(out); >- buildLogger.setErrorPrintStream(err); >- buildLogger.setEmacsMode(emacsMode); >- if (buildLogger instanceof RemoteAntBuildLogger) { >- ((RemoteAntBuildLogger) buildLogger).configure(userProperties); >- } >- } >- >- return buildLogger; >- } >- >- /** >- * Project.fireBuildStarted is protected in Ant earlier than 1.5.*. >- * Provides backwards compatibility with old Ant installs. >- */ >- private void fireBuildStarted(Project project) { >- if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >- BuildEvent event = new BuildEvent(project); >- for (Iterator iterator = project.getBuildListeners().iterator(); iterator.hasNext();) { >- BuildListener listener = (BuildListener) iterator.next(); >- listener.buildStarted(event); >- } >- } else { >- project.fireBuildStarted(); >- } >- } >- >- private void fireBuildFinished(Project project, Throwable error) { >- if (error == null && scriptExecuted) { >- logMessage(project, RemoteAntMessages.getString("InternalAntRunner.BUILD_SUCCESSFUL_1"), messageOutputLevel); //$NON-NLS-1$ >- } >- if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >- BuildEvent event = new BuildEvent(project); >- event.setException(error); >- Iterator iter = project.getBuildListeners().iterator(); >- while (iter.hasNext()) { >- BuildListener listener = (BuildListener) iter.next(); >- listener.buildFinished(event); >- } >- } else { >- project.fireBuildFinished(error); >- } >- } >- >- private void logMessage(Project project, String message, int priority) { >- if (project != null) { >- project.log(message, priority); >- } else { >- if (buildListeners != null) { >- project = new Project(); >- BuildEvent event = new BuildEvent(project); >- event.setMessage(message, priority); >- //notify the build listeners that are not registered as >- //no project existed >- for (Iterator iterator = buildListeners.iterator(); iterator.hasNext();) { >- try { >- BuildListener listener = (BuildListener) iterator.next(); >- listener.messageLogged(event); >- } catch (ClassCastException e) { >- //ignore we could be trying to log that a build listener is the >- //wrong type of class >- } >- } >- } >- } >- } >- >- /** >- * Sets the buildFileLocation. >- * >- * @param buildFileLocation the file system location of the build file >- */ >- private void setBuildFileLocation(String buildFileLocation) { >- this.buildFileLocation = buildFileLocation; >- if (getCurrentProject() != null) { >- getCurrentProject().setUserProperty("ant.file", buildFileLocation); //$NON-NLS-1$ >- } >- } >- >- private String getBuildFileLocation() { >- if (buildFileLocation == null) { >- buildFileLocation = new File("build.xml").getAbsolutePath(); //$NON-NLS-1$ >- } >- return buildFileLocation; >- } >- >- /** >- * Sets the message output level. Use -1 for none. >- * @param level The message output level >- */ >- private void setMessageOutputLevel(int level) { >- messageOutputLevel = level; >- if (buildLogger != null) { >- buildLogger.setMessageOutputLevel(level); >- } >- } >- >- /* >- * Returns a String representation of the Ant version number as specified >- * in the version.txt file. >- */ >- private String getAntVersionNumber() throws BuildException { >- if (antVersionNumber == null) { >- try { >- Properties props = new Properties(); >- InputStream in = Main.class.getResourceAsStream("/org/apache/tools/ant/version.txt"); //$NON-NLS-1$ >- props.load(in); >- in.close(); >- String versionNumber= props.getProperty("VERSION"); //$NON-NLS-1$ >- antVersionNumber= versionNumber; >- } catch (IOException ioe) { >- throw new BuildException(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Could_not_load_the_version_information._{0}_9"), new String[]{ioe.getMessage()})); //$NON-NLS-1$ >- } catch (NullPointerException npe) { >- throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.Could_not_load_the_version_information._10")); //$NON-NLS-1$ >- } >- } >- return antVersionNumber; >- } >- >- /* >- * Returns whether the given version is compatible with the >- * current Ant version. A version is compatible if it is less >- * than or equal to the current version. >- */ >- private boolean isVersionCompatible(String comparison) { >- String version= getAntVersionNumber(); >- return version.compareTo(comparison) >= 0; >- } >- >- private boolean preprocessCommandLine(List commands) { >- >- String arg = getArgument(commands, "-listener"); //$NON-NLS-1$ >- while (arg != null) { >- if (arg.length() == 0) { >- throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_classname_when_using_the_-listener_argument_1")); //$NON-NLS-1$ >- } >- if (buildListeners == null) { >- buildListeners= new ArrayList(1); >- } >- buildListeners.add(arg); >- arg = getArgument(commands, "-listener"); //$NON-NLS-1$ >- } >- >- arg = getArgument(commands, "-logger"); //$NON-NLS-1$ >- if (arg != null) { >- //allow empty string to mean no logger >- loggerClassname = arg; >- } >- arg = getArgument(commands, "-logger"); //$NON-NLS-1$ >- if (arg != null) { >- throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.Only_one_logger_class_may_be_specified_1")); //$NON-NLS-1$ >- } >- >- arg = getArgument(commands, "-inputhandler"); //$NON-NLS-1$ >- if (arg != null) { >- if (arg.length() == 0) { >- throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_classname_when_using_the_-inputhandler_argument_1")); //$NON-NLS-1$ >- } >- inputHandlerClassname = arg; >- } >- arg = getArgument(commands, "-inputhandler"); //$NON-NLS-1$ >- if (arg != null) { >- throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.Only_one_input_handler_class_may_be_specified._2")); //$NON-NLS-1$ >- } >- return true; >- } >- >- /* >- * Looks for interesting command line arguments. >- * Returns whether it is OK to run the script. >- */ >- private boolean processCommandLine(List commands) { >- >- if (commands.remove("-help") || commands.remove("-h")) { //$NON-NLS-1$ //$NON-NLS-2$ >- printUsage(); >- return false; >- } >- >- if (commands.remove("-version")) { //$NON-NLS-1$ >- printVersion(); >- return false; >- } >- >- if (commands.remove("-verbose") || commands.remove("-v")) { //$NON-NLS-1$ //$NON-NLS-2$ >- printVersion(); >- setMessageOutputLevel(Project.MSG_VERBOSE); >- } >- >- if (commands.remove("-debug") || commands.remove("-d")) { //$NON-NLS-1$ //$NON-NLS-2$ >- printVersion(); >- setMessageOutputLevel(Project.MSG_DEBUG); >- } >- >- if (commands.remove("-quiet") || commands.remove("-q")) { //$NON-NLS-1$ //$NON-NLS-2$ >- setMessageOutputLevel(Project.MSG_WARN); >- } >- >- if (commands.remove("-emacs") || commands.remove("-e")) { //$NON-NLS-1$ //$NON-NLS-2$ >- emacsMode = true; >- if (buildLogger != null) { >- buildLogger.setEmacsMode(true); >- } >- } >- >- if (commands.remove("-diagnostics")) { //$NON-NLS-1$ >- if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >- throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.The_diagnositics_options_is_an_Ant_1.5.*_feature._Please_update_your_Ant_classpath_to_include_an_Ant_version_greater_than_this._4")); //$NON-NLS-1$ >- } >- try { >- Diagnostics.doReport(System.out); >- } catch (NullPointerException e) { >- logMessage(getCurrentProject(), RemoteAntMessages.getString("InternalAntRunner.ANT_HOME_must_be_set_to_use_Ant_diagnostics_2"), Project.MSG_ERR); //$NON-NLS-1$ >- } >- return false; >- } >- >- String arg = getArgument(commands, "-logfile"); //$NON-NLS-1$ >- if (arg == null) { >- arg = getArgument(commands, "-l"); //$NON-NLS-1$ >- } >- if (arg != null) { >- if (arg.length() == 0) { >- String message= RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_log_file_when_using_the_-log_argument_3"); //$NON-NLS-1$ >- logMessage(currentProject, message, Project.MSG_ERR); >- throw new BuildException(message); >- } >- try { >- createLogFile(arg); >- } catch (IOException e) { >- // just log message and ignore exception >- logMessage(getCurrentProject(), MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Could_not_write_to_the_specified_log_file__{0}._Make_sure_the_path_exists_and_you_have_write_permissions._2"), new String[]{arg}), Project.MSG_ERR); //$NON-NLS-1$ >- return false; >- } >- >- } >- >- arg = getArgument(commands, "-buildfile"); //$NON-NLS-1$ >- if (arg == null) { >- arg = getArgument(commands, "-file"); //$NON-NLS-1$ >- if (arg == null) { >- arg = getArgument(commands, "-f"); //$NON-NLS-1$ >- } >- } >- >- if (arg != null) { >- if (arg.length() == 0) { >- String message= RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_buildfile_when_using_the_-buildfile_argument_4"); //$NON-NLS-1$ >- logMessage(currentProject, message, Project.MSG_ERR); >- throw new BuildException(message); >- } >- setBuildFileLocation(arg); >- } >- >- if (isVersionCompatible("1.6")) { //$NON-NLS-1$ >- if (commands.remove("-k") || commands.remove("-keep-going")) { //$NON-NLS-1$ //$NON-NLS-2$ >- keepGoing= true; >- } >- if (commands.remove("-noinput")) { //$NON-NLS-1$ >- allowInput= false; >- } >- arg= getArgument(commands, "-lib"); //$NON-NLS-1$ >- if (arg != null) { >- logMessage(currentProject, RemoteAntMessages.getString("InternalAntRunner.157"), Project.MSG_ERR); //$NON-NLS-1$ >- return false; >- } >- } >- >- arg= getArgument(commands, "-find"); //$NON-NLS-1$ >- if (arg == null) { >- arg= getArgument(commands, "-s"); //$NON-NLS-1$ >- } >- if (arg != null) { >- logMessage(currentProject, RemoteAntMessages.getString("InternalAntRunner.-find_not_supported"), Project.MSG_ERR); //$NON-NLS-1$ >- return false; >- } >- >- processTasksAndTypes(commands); >- >- if (!commands.isEmpty()) { >- processUnrecognizedCommands(commands); >- } >- >- if (!commands.isEmpty()) { >- processTargets(commands); >- } >- >- return true; >- } >- >- private void processTasksAndTypes(List commands) { >- String arg = getArgument(commands, "-eclipseTask"); //$NON-NLS-1$ >- while (arg != null) { >- if (eclipseSpecifiedTasks == null) { >- eclipseSpecifiedTasks= new HashMap(); >- } >- int index= arg.indexOf(','); >- if (index != -1) { >- String name= arg.substring(0, index); >- String className= arg.substring(index + 1); >- eclipseSpecifiedTasks.put(name, className); >- } >- arg = getArgument(commands, "-eclipseTask"); //$NON-NLS-1$ >- } >- >- arg = getArgument(commands, "-eclipseType"); //$NON-NLS-1$ >- while (arg != null) { >- if (eclipseSpecifiedTypes == null) { >- eclipseSpecifiedTypes= new HashMap(); >- } >- int index= arg.indexOf(','); >- if (index != -1) { >- String name= arg.substring(0, index); >- String className= arg.substring(index + 1); >- eclipseSpecifiedTypes.put(name, className); >- } >- arg = getArgument(commands, "-eclipseType"); //$NON-NLS-1$ >- } >- } >- >- /* >- * Checks for unrecognized arguments on the command line. >- * Since there is no syntactic way to distingush between >- * ant -foo target1 target2 >- * ant -foo fooarg target >- * we remove everything up to the last argument that >- * begins with a '-'. In the latter case, above, that >- * means that there will be an extra target, 'fooarg', >- * left lying around. >- */ >- private void processUnrecognizedCommands(List commands) { >- int p = -1; >- >- // find the last arg that begins with '-' >- for (int i = commands.size() - 1; i >= 0; i--) { >- if (((String) commands.get(0)).startsWith("-")) { //$NON-NLS-1$ >- p = i; >- break; >- } >- } >- if (p < 0) { return; } >- >- // remove everything preceding that last '-arg' >- String s = ""; //$NON-NLS-1$ >- for (int i = 0; i <= p; i++) { >- s += " " + ((String) commands.get(0)); //$NON-NLS-1$ >- commands.remove(0); >- } >- >- // warn of ignored commands >- String message = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Unknown_argument__{0}_2"), new Object[]{ s.substring(1) }); //$NON-NLS-1$ >- logMessage(currentProject, message, Project.MSG_WARN); >- } >- >- >- /* >- * Checks for targets specified at the command line. >- */ >- private void processTargets(List commands) { >- if (targets == null) { >- targets = new Vector(commands.size()); >- } >- for (Iterator iter = commands.iterator(); iter.hasNext();) { >- targets.add(iter.next()); >- } >- } >- >- /* >- * Creates the log file with the name specified by the user. >- * If the fileName is not absolute, the file will be created in the >- * working directory if specified or in the same directory as the location >- * of the build file. >- */ >- private void createLogFile(String fileName) throws FileNotFoundException, IOException { >- File logFile = getFileRelativeToBaseDir(fileName); >- >- //this stream is closed in the finally block of run(list) >- out = new PrintStream(new FileOutputStream(logFile)); >- err = out; >- logMessage(getCurrentProject(), MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Using_{0}_file_as_build_log._1"), new String[]{logFile.getCanonicalPath()}), Project.MSG_INFO); //$NON-NLS-1$ >- if (buildLogger != null) { >- buildLogger.setErrorPrintStream(err); >- buildLogger.setOutputPrintStream(out); >- } >- } >- >- private File getFileRelativeToBaseDir(String fileName) { >- File parentFile= null; >- >- String base= getCurrentProject().getUserProperty("basedir"); //$NON-NLS-1$ >- if (base != null) { >- parentFile= new File(base); >- } else { >- //relative to the build file location >- parentFile= new File(getBuildFileLocation()).getParentFile(); >- } >- >- //remain backwards compatible for older Ant usage >- return FileUtils.newFileUtils().resolveFile(parentFile, fileName); >- } >- >- /* >- * Processes cmd line properties and adds the user properties >- * Any user properties that have been explicitly set are set as well. >- * Ensures that -D properties take precedence. >- */ >- private boolean processProperties(List commands) { >- boolean exceptionToBeThrown= false; >- //MULTIPLE property files are allowed >- String arg= getArgument(commands, "-propertyfile"); //$NON-NLS-1$ >- while (arg != null) { >- if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >- fEarlyErrorMessage= RemoteAntMessages.getString("InternalAntRunner.Specifying_property_files_is_a_Ant_1.5.*_feature._Please_update_your_Ant_classpath._6"); //$NON-NLS-1$ >- break; >- } >- if (arg.length() == 0) { >- fEarlyErrorMessage= RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_property_filename_when_using_the_-propertyfile_argument_3"); //$NON-NLS-1$ >- exceptionToBeThrown= true; >- break; >- } >- >- propertyFiles.add(arg); >- arg= getArgument(commands, "-propertyfile"); //$NON-NLS-1$ >- } >- >- if (propertyFiles != null && !propertyFiles.isEmpty()) { >- loadPropertyFiles(); >- } >- >- if (commands != null) { >- processMinusDProperties(commands); >- } >- return exceptionToBeThrown; >- } >- >- private void processMinusDProperties(List commands) { >- String[] args = (String[]) commands.toArray(new String[commands.size()]); >- for (int i = 0; i < args.length; i++) { >- String arg = args[i]; >- if (arg.startsWith("-D")) { //$NON-NLS-1$ >- String name = arg.substring(2, arg.length()); >- String value = null; >- int posEq = name.indexOf("="); //$NON-NLS-1$ >- if (posEq == 0) { >- value= name.substring(1); >- name= ""; //$NON-NLS-1$ >- } else if (posEq > 0 && posEq != name.length() - 1) { >- value = name.substring(posEq + 1).trim(); >- name = name.substring(0, posEq); >- } >- >- if (value == null) { >- //the user has specified something like "-Debug" >- continue; >- } >- if (userProperties == null) { >- userProperties= new HashMap(); >- } >- userProperties.put(name, value); >- commands.remove(args[i]); >- } >- } >- } >- >- private void setProperties(Project project) { >- setBuiltInProperties(project); >- if (userProperties != null) { >- for (Iterator iterator = userProperties.entrySet().iterator(); iterator.hasNext();) { >- Map.Entry entry = (Map.Entry) iterator.next(); >- project.setUserProperty((String) entry.getKey(), (String) entry.getValue()); >- } >- } >- } >- >- private void setBuiltInProperties(Project project) { >- project.setUserProperty("ant.file", getBuildFileLocation()); //$NON-NLS-1$ >- project.setUserProperty("ant.version", Main.getAntVersion()); //$NON-NLS-1$ >- } >- >- /* >- * Print the project description, if any >- */ >- private void printHelp(Project project) { >- if (project.getDescription() != null) { >- logMessage(project, project.getDescription(), Project.MSG_INFO); >- } >- printTargets(project); >- } >- >- /* >- * Logs a message with the client indicating the version of <b>Ant</b> that this class >- * fronts. >- */ >- private void printVersion() { >- logMessage(getCurrentProject(), Main.getAntVersion(), Project.MSG_INFO); >- } >- >- /* >- * Logs a message with the client outlining the usage of <b>Ant</b>. >- */ >- private void printUsage() { >- String lSep = System.getProperty("line.separator"); //$NON-NLS-1$ >- StringBuffer msg = new StringBuffer(); >- msg.append("ant ["); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.options_13")); //$NON-NLS-1$ >- msg.append("] ["); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.target_15")); //$NON-NLS-1$ >- msg.append(" ["); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.target_15")); //$NON-NLS-1$ >- msg.append("2 ["); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.target_15")); //$NON-NLS-1$ >- msg.append("3] ...]]"); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append(RemoteAntMessages.getString("InternalAntRunner.Options___21")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-help, -h\t\t\t\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.print_this_message_23")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-projecthelp, -p\t\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.print_project_help_information_25")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-version\t\t\t\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.print_the_version_information_and_exit_27")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-diagnostics\t\t\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.12")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append(RemoteAntMessages.getString("InternalAntRunner.13")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-quiet, -q\t\t\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.be_extra_quiet_29")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-verbose, -v\t\t\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.be_extra_verbose_31")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-debug, -d\t\t\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.print_debugging_information_33")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-emacs, -e\t\t\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.produce_logging_information_without_adornments_35")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-logfile\t<file>\t\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.use_given_file_for_log_37")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t\t-l\t<file>"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.1")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-logger <classname>\t\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.the_class_which_is_to_perform_logging_39")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-listener <classname>\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.add_an_instance_of_class_as_a_project_listener_41")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-noinput\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.158")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-buildfile\t<file>\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.use_given_buildfile_43")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t\t-file\t<file>"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.1")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t\t-f\t\t<file>"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.1")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-D<property>=<value>\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.use_value_for_given_property_45")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-keep-going, -k"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.159")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append(RemoteAntMessages.getString("InternalAntRunner.160")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-propertyfile <name>\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.19")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append(RemoteAntMessages.getString("InternalAntRunner.20")); //$NON-NLS-1$ >- msg.append(lSep); >- msg.append("\t-inputhandler <class>\t"); //$NON-NLS-1$ >- msg.append(RemoteAntMessages.getString("InternalAntRunner.22")); //$NON-NLS-1$ >- msg.append(lSep); >- >- logMessage(getCurrentProject(), msg.toString(), Project.MSG_INFO); >- } >- >- /* >- * From a command line list, return the argument for the given parameter. >- * The parameter and its argument are removed from the list. >- * >- * @return <code>null</code> if the parameter is not found >- * or an empty String if no arguments are found >- */ >- private String getArgument(List commands, String param) { >- if (commands == null) { >- return null; >- } >- int index = commands.indexOf(param); >- if (index == -1) { >- return null; >- } >- commands.remove(index); >- if (index == commands.size()) {// if this is the last command >- return ""; //$NON-NLS-1$ >- } >- >- String command = (String) commands.get(index); >- if (command.startsWith("-")) { //new parameter //$NON-NLS-1$ >- return ""; //$NON-NLS-1$ >- } >- >- commands.remove(index); >- return command; >- } >- >- /* >- * Helper method to ensure an array is converted into an ArrayList. >- */ >- private static ArrayList getArrayList(String[] args) { >- if (args == null) { >- return null; >- } >- // We could be using Arrays.asList() here, but it does not specify >- // what kind of list it will return. We need a list that >- // implements the method List.remove(Object) and ArrayList does. >- ArrayList result = new ArrayList(args.length); >- for (int i = 0; i < args.length; i++) { >- result.add(args[i]); >- } >- return result; >- } >- >- private Project getCurrentProject() { >- return currentProject; >- } >- >- private void setCurrentProject(Project currentProject) { >- this.currentProject = currentProject; >- } >- >- /** >- * Load all properties from the files >- * specified by -propertyfile. >- */ >- private void loadPropertyFiles() { >- Iterator itr= propertyFiles.iterator(); >- while (itr.hasNext()) { >- String filename= (String) itr.next(); >- File file= getFileRelativeToBaseDir(filename); >- Properties props = new Properties(); >- FileInputStream fis = null; >- try { >- fis = new FileInputStream(file); >- props.load(fis); >- } catch (IOException e) { >- fEarlyErrorMessage= MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Could_not_load_property_file_{0}__{1}_4"), new String[]{filename, e.getMessage()}); //$NON-NLS-1$ >- } finally { >- if (fis != null) { >- try { >- fis.close(); >- } catch (IOException e){ >- } >- } >- } >- >- if (userProperties == null) { >- userProperties= new HashMap(); >- } >- Enumeration propertyNames = props.propertyNames(); >- while (propertyNames.hasMoreElements()) { >- String name = (String) propertyNames.nextElement(); >- //most specific to global >- //do not overwrite specific with a global property >- if (userProperties.get(name) == null) { >- userProperties.put(name, props.getProperty(name)); >- } >- } >- } >- } >- >- /* >- * Creates the InputHandler and adds it to the project. >- * >- * @exception BuildException if a specified InputHandler >- * implementation could not be loaded. >- */ >- private void addInputHandler(Project project) { >- if (!isVersionCompatible("1.5")) { //$NON-NLS-1$ >- return; >- } >- InputHandlerSetter setter= new InputHandlerSetter(); >- setter.setInputHandler(project, inputHandlerClassname); >- } >-} >\ No newline at end of file >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/RemoteAntMessages.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/RemoteAntMessages.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/RemoteAntMessages.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/RemoteAntMessages.java 8 Apr 2005 18:53:47 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,33 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2005 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.ui.antsupport; >- >- >-import java.util.MissingResourceException; >-import java.util.ResourceBundle; >- >-public class RemoteAntMessages { >- >- private static final String BUNDLE_NAME = "org.eclipse.ant.internal.ui.antsupport.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 + '!'; >- } >- } >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/RemoteAntMessages.properties >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/RemoteAntMessages.properties >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/RemoteAntMessages.properties >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/RemoteAntMessages.properties 29 May 2008 16:05:22 -0000 1.12 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,83 +0,0 @@ >-############################################################################### >-# Copyright (c) 2000, 2008 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 >- >-SWTInputHandler.0=Unable to respond to input request as a result of the user specified -noinput command >-SWTInputHandler.1=Ant Input Request >-SWTInputHandler.2=Unable to respond to <input> request >-SWTInputHandler.3=Input does not match validargs attribute >-SWTInputHandler.4=OK >-SWTInputHandler.5=Cancel >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/FailInputHandler.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/FailInputHandler.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/FailInputHandler.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/FailInputHandler.java 17 May 2005 03:56:04 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,29 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2005 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.ui.antsupport.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(); >- } >- }; >- } >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/RemoteAntMessages.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/RemoteAntMessages.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/RemoteAntMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/RemoteAntMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,33 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 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.ui.antsupport.inputhandler; >+ >+ >+import java.util.MissingResourceException; >+import java.util.ResourceBundle; >+ >+public class RemoteAntMessages { >+ >+ private static final String BUNDLE_NAME = "org.eclipse.ant.internal.ui.antsupport.inputhandler.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 + '!'; >+ } >+ } >+} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/RemoteAntMessages.properties >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/RemoteAntMessages.properties >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/RemoteAntMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/RemoteAntMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+############################################################################### >+# 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 >+############################################################################### >+ >+SWTInputHandler.0=Unable to respond to input request as a result of the user specified -noinput command >+SWTInputHandler.1=Ant Input Request >+SWTInputHandler.2=Unable to respond to <input> request >+SWTInputHandler.3=Input does not match validargs attribute >+SWTInputHandler.4=OK >+SWTInputHandler.5=Cancel >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/SWTInputHandler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/SWTInputHandler.java,v >retrieving revision 1.17 >diff -u -r1.17 SWTInputHandler.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/SWTInputHandler.java 12 Jul 2007 18:32:11 -0000 1.17 >+++ Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/SWTInputHandler.java 7 Oct 2009 20:08:25 -0000 >@@ -18,7 +18,6 @@ > import org.apache.tools.ant.input.DefaultInputHandler; > import org.apache.tools.ant.input.InputRequest; > import org.apache.tools.ant.input.MultipleChoiceInputRequest; >-import org.eclipse.ant.internal.ui.antsupport.RemoteAntMessages; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.ModifyEvent; > import org.eclipse.swt.events.ModifyListener; >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/MessageIds.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/MessageIds.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/MessageIds.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/MessageIds.java 13 May 2005 20:56:09 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,21 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2003, 2005 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.ui.antsupport.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$ >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/RemoteAntBuildLogger.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/RemoteAntBuildLogger.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/RemoteAntBuildLogger.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/RemoteAntBuildLogger.java 24 Apr 2007 05:04:45 -0000 1.24 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,396 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2003, 2007 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.ui.antsupport.logger; >- >- >-import java.io.BufferedReader; >-import java.io.IOException; >-import java.io.PrintStream; >-import java.io.PrintWriter; >-import java.io.StringReader; >-import java.net.Socket; >-import java.util.ArrayList; >-import java.util.Iterator; >-import java.util.List; >-import java.util.Map; >- >-import org.apache.tools.ant.BuildEvent; >-import org.apache.tools.ant.BuildException; >-import org.apache.tools.ant.DefaultLogger; >-import org.apache.tools.ant.Location; >-import org.apache.tools.ant.Project; >-import org.apache.tools.ant.Target; >-import org.apache.tools.ant.util.StringUtils; >-import org.eclipse.ant.internal.ui.antsupport.AntSecurityException; >-import org.eclipse.ant.internal.ui.antsupport.InternalAntRunner; >-import org.eclipse.ant.internal.ui.antsupport.RemoteAntMessages; >-import org.eclipse.ant.internal.ui.antsupport.logger.util.AntDebugState; >- >-/** >- * Parts adapted from org.eclipse.jdt.internal.junit.runner.RemoteTestRunner >- * A build logger that reports via a socket connection. >- * See MessageIds for more information about the protocol. >- */ >-public class RemoteAntBuildLogger extends DefaultLogger { >- >- /** Time of the start of the build */ >- private long fStartTime = System.currentTimeMillis(); >- >- /** >- * The client socket. >- */ >- private Socket fEventSocket; >- /** >- * Print writer for sending messages >- */ >- private PrintWriter fWriter; >- /** >- * Host to connect to, default is the localhost >- */ >- protected String fHost= ""; //$NON-NLS-1$ >- /** >- * Port to connect to. >- */ >- private int fEventPort= -1; >- >- private String fProcessId= null; >- >- /** >- * Is the debug mode enabled? >- */ >- protected boolean fDebugMode= false; >- >- protected boolean fSentProcessId= false; >- >- private List fEventQueue; >- >- private String fLastFileName= null; >- private String fLastTaskName= null; >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.DefaultLogger#printMessage(java.lang.String, java.io.PrintStream, int) >- */ >- protected void printMessage(String message, PrintStream stream, int priority) { >- marshalMessage(priority, message); >- } >- >- /** >- * Connect to the remote Ant build listener. >- */ >- protected void connect() { >- if (fDebugMode) { >- System.out.println("RemoteAntBuildLogger: trying to connect" + fHost + ":" + fEventPort); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- >- for (int i= 1; i < 5; i++) { >- try{ >- fEventSocket= new Socket(fHost, fEventPort); >- fWriter= new PrintWriter(fEventSocket.getOutputStream(), true); >- return; >- } catch(IOException e){ >- } >- try { >- Thread.sleep(500); >- } catch(InterruptedException e) { >- } >- } >- shutDown(); >- } >- >- /** >- * Shutdown the connection to the remote build listener. >- */ >- protected void shutDown() { >- if (fEventQueue != null) { >- fEventQueue.clear(); >- } >- if (fWriter != null) { >- fWriter.close(); >- fWriter= null; >- } >- >- try { >- if (fEventSocket != null) { >- fEventSocket.close(); >- fEventSocket= null; >- } >- } catch(IOException e) { >- } >- } >- >- private void sendMessage(String msg) { >- if (fWriter == null) { >- return; >- } >- >- fWriter.println(msg); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#buildFinished(org.apache.tools.ant.BuildEvent) >- */ >- public void buildFinished(BuildEvent event) { >- if (!fSentProcessId) { >- establishConnection(); >- } >- handleException(event); >- printMessage( getTimeString(System.currentTimeMillis() - fStartTime), out, Project.MSG_INFO); >- shutDown(); >- } >- >- protected void handleException(BuildEvent event) { >- Throwable exception = event.getException(); >- if (exception == null || exception instanceof AntSecurityException) { >- return; >- } >- >- StringBuffer message= new StringBuffer(); >- message.append(StringUtils.LINE_SEP); >- message.append(RemoteAntMessages.getString("RemoteAntBuildLogger.1")); //$NON-NLS-1$ >- message.append(StringUtils.LINE_SEP); >- if (Project.MSG_VERBOSE <= this.msgOutputLevel || !(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); >- } >- } >- message.append(StringUtils.LINE_SEP); >- printMessage(message.toString(), out, Project.MSG_ERR); >- } >- >- private String getTimeString(long milliseconds) { >- long seconds = milliseconds / 1000; >- long minutes = seconds / 60; >- seconds= seconds % 60; >- >- StringBuffer result= new StringBuffer(RemoteAntMessages.getString("RemoteAntBuildLogger.Total_time")); //$NON-NLS-1$ >- if (minutes > 0) { >- result.append(minutes); >- if (minutes > 1) { >- result.append(RemoteAntMessages.getString("RemoteAntBuildLogger._minutes_2")); //$NON-NLS-1$ >- } else { >- result.append(RemoteAntMessages.getString("RemoteAntBuildLogger._minute_3")); //$NON-NLS-1$ >- } >- } >- if (seconds > 0) { >- if (minutes > 0) { >- result.append(' '); >- } >- result.append(seconds); >- >- if (seconds > 1) { >- result.append(RemoteAntMessages.getString("RemoteAntBuildLogger._seconds_4")); //$NON-NLS-1$ >- } else { >- result.append(RemoteAntMessages.getString("RemoteAntBuildLogger._second_5")); //$NON-NLS-1$ >- } >- } >- if (seconds == 0 && minutes == 0) { >- result.append(milliseconds); >- result.append(RemoteAntMessages.getString("RemoteAntBuildLogger._milliseconds_6")); //$NON-NLS-1$ >- } >- return result.toString(); >- } >- >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) >- */ >- public void targetStarted(BuildEvent event) { >- if (!fSentProcessId) { >- establishConnection(); >- } >- >- if (Project.MSG_INFO <= msgOutputLevel) { >- marshalTargetMessage(event); >- } >- } >- >- protected void establishConnection() { >- if (fEventPort != -1) { >- connect(); >- } else { >- shutDown(); >- return; >- } >- >- fSentProcessId= true; >- StringBuffer message= new StringBuffer(MessageIds.PROCESS_ID); >- message.append(fProcessId); >- sendMessage(message.toString()); >- if (fEventQueue != null) { >- for (Iterator iter = fEventQueue.iterator(); iter.hasNext();) { >- processEvent((BuildEvent)iter.next()); >- } >- fEventQueue= null; >- } >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#messageLogged(org.apache.tools.ant.BuildEvent) >- */ >- public void messageLogged(BuildEvent event) { >- if (event.getPriority() > msgOutputLevel && event.getPriority() != InternalAntRunner.MSG_PROJECT_HELP) { >- return; >- } >- >- if (!fSentProcessId) { >- if (event.getPriority() == InternalAntRunner.MSG_PROJECT_HELP) { >- if (Project.MSG_INFO > msgOutputLevel) { >- return; >- } >- //no buildstarted or project started for project help option >- establishConnection(); >- return; >- } >- if (fEventQueue == null){ >- fEventQueue= new ArrayList(10); >- } >- fEventQueue.add(event); >- return; >- } >- >- processEvent(event); >- } >- >- private void processEvent(BuildEvent event) { >- if (event.getTask() != null & !emacsMode) { >- try { >- marshalTaskMessage(event); >- } catch (IOException e) { >- } >- } else { >- marshalMessage(event); >- } >- } >- >- private void marshalMessage(BuildEvent event) { >- String eventMessage= event.getMessage(); >- if (eventMessage.length() == 0) { >- return; >- } >- marshalMessage(event.getPriority(), eventMessage); >- } >- >- protected void marshalMessage(int priority, String message) { >- try { >- BufferedReader r = new BufferedReader(new StringReader(message)); >- String line = r.readLine(); >- StringBuffer messageLine; >- while (line != null) { >- messageLine= new StringBuffer(); >- if (priority != -1) { >- messageLine.append(priority); >- messageLine.append(','); >- } >- messageLine.append(line); >- sendMessage(messageLine.toString()); >- line = r.readLine(); >- } >- } catch (IOException e) { >- } >- } >- >- private void marshalTaskMessage(BuildEvent event) throws IOException { >- String eventMessage= event.getMessage(); >- if (eventMessage.length() == 0) { >- return; >- } >- BufferedReader r = new BufferedReader(new StringReader(eventMessage)); >- String line = r.readLine(); >- StringBuffer message; >- String taskName= event.getTask().getTaskName(); >- if (taskName != null && taskName.equals(fLastTaskName)) { >- taskName= ""; //$NON-NLS-1$ >- } else { >- fLastTaskName= taskName; >- } >- Location location= event.getTask().getLocation(); >- String fileName= null; >- int lineNumber= -1; >- try { >- fileName= location.getFileName(); >- lineNumber= location.getLineNumber(); >- } catch (NoSuchMethodError e) { >- //older Ant >- fileName= location.toString(); >- } >- if (location.equals(Location.UNKNOWN_LOCATION)) { >- fileName= location.toString(); >- lineNumber= -1; >- } >- int priority= event.getPriority(); >- while (line != null) { >- message= new StringBuffer(MessageIds.TASK); >- message.append(priority); >- message.append(','); >- message.append(taskName); >- message.append(','); >- message.append(line.length()); >- message.append(','); >- message.append(line); >- message.append(','); >- if (!fileName.equals(fLastFileName)) { >- message.append(fileName.length()); >- message.append(','); >- message.append(fileName); >- } >- message.append(','); >- message.append(lineNumber); >- sendMessage(message.toString()); >- fLastFileName= fileName; >- line= r.readLine(); >- } >- } >- >- private void marshalTargetMessage(BuildEvent event) { >- Target target= event.getTarget(); >- Location location= AntDebugState.getLocation(target); >- >- StringBuffer message= new StringBuffer(); >- message.append(MessageIds.TARGET); >- message.append(','); >- message.append(target.getName()); >- message.append(':'); >- message.append(','); >- if (location != null && location != Location.UNKNOWN_LOCATION) { >- //if a target has a valid location then we are on an Ant that is >- //new enough to have the accessor methods on Location >- String fileName= location.getFileName(); >- message.append(fileName.length()); >- message.append(','); >- message.append(fileName); >- message.append(','); >- message.append(location.getLineNumber()); >- } >- sendMessage(message.toString()); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) >- */ >- public void buildStarted(BuildEvent event) { >- establishConnection(); >- super.buildStarted(event); >- } >- >- public void configure(Map userProperties) { >- String portProperty= (String) userProperties.remove("eclipse.connect.port"); //$NON-NLS-1$ >- >- if (portProperty != null) { >- fEventPort= Integer.parseInt(portProperty); >- } >- >- fProcessId= (String) userProperties.remove("org.eclipse.ant.core.ANT_PROCESS_ID"); //$NON-NLS-1$ >- } >-} >\ No newline at end of file >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/debug/RemoteAntBreakpoint.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/debug/RemoteAntBreakpoint.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/debug/RemoteAntBreakpoint.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/debug/RemoteAntBreakpoint.java 23 Feb 2005 17:21:19 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,73 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2005 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.ui.antsupport.logger.debug; >- >-import java.io.File; >-import org.eclipse.ant.internal.ui.antsupport.logger.util.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; >- } >-} >Index: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/debug/RemoteAntDebugBuildLogger.java >=================================================================== >RCS file: Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/debug/RemoteAntDebugBuildLogger.java >diff -N Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/debug/RemoteAntDebugBuildLogger.java >--- Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/logger/debug/RemoteAntDebugBuildLogger.java 19 May 2005 22:14:35 -0000 1.31 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,354 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2003, 2005 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.ui.antsupport.logger.debug; >- >-import java.io.BufferedReader; >-import java.io.IOException; >-import java.io.InputStreamReader; >-import java.io.PrintWriter; >-import java.net.ServerSocket; >-import java.net.Socket; >-import java.net.SocketTimeoutException; >-import java.util.ArrayList; >-import java.util.Iterator; >-import java.util.List; >-import java.util.Map; >- >-import org.apache.tools.ant.BuildEvent; >-import org.apache.tools.ant.Location; >-import org.apache.tools.ant.Task; >-import org.eclipse.ant.internal.ui.antsupport.logger.RemoteAntBuildLogger; >-import org.eclipse.ant.internal.ui.antsupport.logger.util.AntDebugState; >-import org.eclipse.ant.internal.ui.antsupport.logger.util.DebugMessageIds; >-import org.eclipse.ant.internal.ui.antsupport.logger.util.IDebugBuildLogger; >- >-/** >- * Parts adapted from org.eclipse.jdt.internal.junit.runner.RemoteTestRunner >- * A build logger that reports via a socket connection. >- * See DebugMessageIds and MessageIds for more information about the protocol. >- */ >-public class RemoteAntDebugBuildLogger extends RemoteAntBuildLogger implements IDebugBuildLogger { >- >- private ServerSocket fServerSocket; >- private static final int fgServerSocketTimeout= 5000; >- private Socket fRequestSocket; >- >- private PrintWriter fRequestWriter; >- >- private BufferedReader fRequestReader; >- >- private boolean fBuildStartedSuspend= true; >- >- private Task fStepOverTaskInterrupted; >- >- private List fBreakpoints= null; >- >- /** >- * Request port to connect to. >- * Used for debug connections >- */ >- private int fRequestPort= -1; >- private AntDebugState fDebugState; >- >- /** >- * Reader thread that processes requests from the debug client. >- */ >- private class ReaderThread extends Thread { >- public ReaderThread() { >- super("ReaderThread"); //$NON-NLS-1$ >- setDaemon(true); >- } >- >- public void run(){ >- try { >- String message= null; >- while (fRequestReader != null) { >- if ((message= fRequestReader.readLine()) != null) { >- >- if (message.startsWith(DebugMessageIds.STEP_INTO)){ >- synchronized(RemoteAntDebugBuildLogger.this) { >- fDebugState.setStepIntoSuspend(true); >- fDebugState.setStepIntoTask(fDebugState.getCurrentTask()); >- RemoteAntDebugBuildLogger.this.notifyAll(); >- } >- } if (message.startsWith(DebugMessageIds.STEP_OVER)){ >- synchronized(RemoteAntDebugBuildLogger.this) { >- fDebugState.stepOver(); >- } >- } else if (message.startsWith(DebugMessageIds.SUSPEND)) { >- synchronized(RemoteAntDebugBuildLogger.this) { >- fDebugState.setStepIntoTask(null); >- fDebugState.setStepOverTask(null); >- fStepOverTaskInterrupted= null; >- fDebugState.setClientSuspend(true); >- } >- } else if (message.startsWith(DebugMessageIds.RESUME)) { >- synchronized(RemoteAntDebugBuildLogger.this) { >- fDebugState.setStepIntoTask(null); >- fDebugState.setStepOverTask(null); >- fStepOverTaskInterrupted= null; >- RemoteAntDebugBuildLogger.this.notifyAll(); >- } >- } else if (message.startsWith(DebugMessageIds.TERMINATE)) { >- sendRequestResponse(DebugMessageIds.TERMINATED); >- shutDown(); >- } else if (message.startsWith(DebugMessageIds.STACK)) { >- marshallStack(); >- } else if (message.startsWith(DebugMessageIds.ADD_BREAKPOINT)) { >- addBreakpoint(message); >- } else if (message.startsWith(DebugMessageIds.REMOVE_BREAKPOINT)) { >- removeBreakpoint(message); >- } else if (message.startsWith(DebugMessageIds.PROPERTIES)) { >- marshallProperties(); >- } >- } >- } >- } catch (Exception e) { >- RemoteAntDebugBuildLogger.this.shutDown(); >- } >- } >- } >- >- private void requestConnect() { >- if (fDebugMode) { >- System.out.println("RemoteAntDebugBuildLogger: trying to connect" + fHost + ":" + fRequestPort); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- >- try{ >- fServerSocket.setSoTimeout(fgServerSocketTimeout); >- fRequestSocket= fServerSocket.accept(); >- fRequestWriter= new PrintWriter(fRequestSocket.getOutputStream(), true); >- fRequestReader = new BufferedReader(new InputStreamReader(fRequestSocket.getInputStream())); >- >- ReaderThread readerThread= new ReaderThread(); >- readerThread.setDaemon(true); >- readerThread.start(); >- return; >- } catch(SocketTimeoutException e){ >- } catch(IOException e) { >- } >- shutDown(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.antsupport.logger.RemoteAntBuildLogger#shutDown() >- */ >- protected void shutDown() { >- if (fRequestWriter != null) { >- fRequestWriter.close(); >- fRequestWriter= null; >- } >- >- if (fRequestReader != null) { >- try { >- fRequestReader.close(); >- } catch (IOException e) { >- } >- fRequestReader= null; >- } >- >- if (fRequestSocket != null) { >- try { >- fRequestSocket.close(); >- } catch(IOException e) { >- } >- } >- fRequestSocket= null; >- >- super.shutDown(); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) >- */ >- public synchronized void buildStarted(BuildEvent event) { >- fDebugState= new AntDebugState(this); >- super.buildStarted(event); >- marshalMessage(-1, DebugMessageIds.BUILD_STARTED); >- if (fRequestPort != -1) { >- try { >- fServerSocket= new ServerSocket(fRequestPort); >- } catch (IOException ioe) { >- shutDown(); >- } >- requestConnect(); >- } else { >- shutDown(); >- } >- fDebugState.buildStarted(); >- fDebugState.setShouldSuspend(true); >- waitIfSuspended(); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#taskStarted(org.apache.tools.ant.BuildEvent) >- */ >- public void taskStarted(BuildEvent event) { >- super.taskStarted(event); >- fDebugState.taskStarted(event); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#taskFinished(org.apache.tools.ant.BuildEvent) >- */ >- public synchronized void taskFinished(BuildEvent event) { >- super.taskFinished(event); >- fDebugState.taskFinished(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.antsupport.logger.util.IDebugBuildLogger#waitIfSuspended() >- */ >- public synchronized void waitIfSuspended() { >- String detail= null; >- boolean shouldSuspend= true; >- RemoteAntBreakpoint breakpoint= breakpointAtLineNumber(fDebugState.getBreakpointLocation()); >- if (breakpoint != null) { >- detail= breakpoint.toMarshallString(); >- fDebugState.setShouldSuspend(false); >- if (fDebugState.getStepOverTask() != null) { >- fStepOverTaskInterrupted= fDebugState.getStepOverTask(); >- fDebugState.setStepOverTask(null); >- } >- } else if (fDebugState.getCurrentTask() != null) { >- if (fDebugState.isStepIntoSuspend()) { >- detail= DebugMessageIds.STEP; >- fDebugState.setStepIntoSuspend(false); >- } else if ((fDebugState.getLastTaskFinished() != null && fDebugState.getLastTaskFinished() == fDebugState.getStepOverTask()) || fDebugState.shouldSuspend()) { >- //suspend as a step over has finished >- detail= DebugMessageIds.STEP; >- fDebugState.setStepOverTask(null); >- fDebugState.setShouldSuspend(false); >- } else if (fDebugState.getLastTaskFinished() != null && fDebugState.getLastTaskFinished() == fDebugState.getStepIntoTask()) { >- //suspend as a task that was stepped into has finally completed >- detail= DebugMessageIds.STEP; >- fDebugState.setStepIntoTask(null); >- } else if (fDebugState.getLastTaskFinished() != null && fDebugState.getLastTaskFinished() == fStepOverTaskInterrupted) { >- //suspend as a task that was stepped over but hit a breakpoint has finally completed >- detail= DebugMessageIds.STEP; >- fStepOverTaskInterrupted= null; >- } else if (fDebugState.isClientSuspend()) { >- detail= DebugMessageIds.CLIENT_REQUEST; >- fDebugState.setClientSuspend(false); >- } else { >- shouldSuspend= false; >- } >- } else if (fDebugState.shouldSuspend() && fBuildStartedSuspend) { >- fBuildStartedSuspend= false; >- fDebugState.setShouldSuspend(false); >- } else { >- shouldSuspend= false; >- } >- >- if (shouldSuspend) { >- if (detail != null) { >- StringBuffer message= new StringBuffer(DebugMessageIds.SUSPENDED); >- message.append(detail); >- sendRequestResponse(message.toString()); >- } >- try { >- wait(); >- shouldSuspend= false; >- } catch (InterruptedException e) { >- } >- } >- } >- >- private RemoteAntBreakpoint breakpointAtLineNumber(Location location) { >- if (fBreakpoints == null || location == null || location == Location.UNKNOWN_LOCATION) { >- return null; >- } >- String fileName= fDebugState.getFileName(location); >- int lineNumber= fDebugState.getLineNumber(location); >- for (int i = 0; i < fBreakpoints.size(); i++) { >- RemoteAntBreakpoint breakpoint = (RemoteAntBreakpoint) fBreakpoints.get(i); >- if (breakpoint.isAt(fileName, lineNumber)) { >- return breakpoint; >- } >- } >- return null; >- } >- >- private void sendRequestResponse(String message) { >- if (fRequestWriter == null) { >- return; >- } >- >- fRequestWriter.println(message); >- } >- >- protected void marshallStack() { >- StringBuffer stackRepresentation= new StringBuffer(); >- fDebugState.marshalStack(stackRepresentation); >- sendRequestResponse(stackRepresentation.toString()); >- } >- >- protected void marshallProperties() { >- StringBuffer propertiesRepresentation= new StringBuffer(); >- fDebugState.marshallProperties(propertiesRepresentation, true); >- sendRequestResponse(propertiesRepresentation.toString()); >- } >- >- protected void addBreakpoint(String breakpointRepresentation) { >- if (fBreakpoints == null) { >- fBreakpoints= new ArrayList(); >- } >- RemoteAntBreakpoint newBreakpoint= new RemoteAntBreakpoint(breakpointRepresentation); >- if (!fBreakpoints.contains(newBreakpoint)) { >- fBreakpoints.add(newBreakpoint); >- } >- } >- >- protected void removeBreakpoint(String breakpointRepresentation) { >- if (fBreakpoints == null) { >- return; >- } >- RemoteAntBreakpoint equivalentBreakpoint= new RemoteAntBreakpoint(breakpointRepresentation); >- for (Iterator iter = fBreakpoints.iterator(); iter.hasNext(); ) { >- RemoteAntBreakpoint breakpoint = (RemoteAntBreakpoint) iter.next(); >- if (breakpoint.equals(equivalentBreakpoint)) { >- iter.remove(); >- return; >- } >- } >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) >- */ >- public void targetStarted(BuildEvent event) { >- fDebugState.targetStarted(event); >- if (!fSentProcessId) { >- establishConnection(); >- } >- waitIfSuspended(); >- super.targetStarted(event); >- } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#targetFinished(org.apache.tools.ant.BuildEvent) >- */ >- public void targetFinished(BuildEvent event) { >- super.targetFinished(event); >- fDebugState.setTargetExecuting(null); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.antsupport.logger.RemoteAntBuildLogger#configure(java.util.Map) >- */ >- public void configure(Map userProperties) { >- super.configure(userProperties); >- String requestPortProperty= (String) userProperties.remove("eclipse.connect.request_port"); //$NON-NLS-1$ >- if (requestPortProperty != null) { >- fRequestPort= Integer.parseInt(requestPortProperty); >- } >- } >-} >Index: buildfiles/buildRemoteExtraJAR.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/buildfiles/buildRemoteExtraJAR.xml,v >retrieving revision 1.19 >diff -u -r1.19 buildRemoteExtraJAR.xml >--- buildfiles/buildRemoteExtraJAR.xml 18 Nov 2005 20:19:58 -0000 1.19 >+++ buildfiles/buildRemoteExtraJAR.xml 7 Oct 2009 20:08:25 -0000 >@@ -30,11 +30,12 @@ > <classpath> > <dirset dir="${basedir}/.."> > <include name="org.eclipse.swt*/bin"/> >- <include name="org.eclipse.ant.ui/common_ant_support_bin"/> >+ <include name="org.eclipse.ant.launching/common_bin"/> > </dirset> > <fileset dir="${eclipse.home}"> > <include name="plugins/org.eclipse.swt*.jar"/> > <include name="plugins/org.eclipse.osgi*.jar"/> >+ <include name="plugins/org.eclipse.ant.launching*.jar"/> > </fileset> > </classpath> > <src path="Remote Ant Support/"/> >@@ -42,7 +43,6 @@ > <!-- copy necessary resources --> > <copy todir="${destdir}"> > <fileset dir="Remote Ant Support/" excludes="**/*.java"/> >- <fileset dir="${basedir}/common_ant_support_bin"/> > </copy> > <mkdir dir="${build.result.folder}/lib"/> > <jar destfile="${build.result.folder}/lib/remoteAnt.jar" basedir="${destdir}"/> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/plugin.properties,v >retrieving revision 1.77 >diff -u -r1.77 plugin.properties >--- plugin.properties 13 Apr 2009 15:17:12 -0000 1.77 >+++ plugin.properties 7 Oct 2009 20:08:25 -0000 >@@ -12,17 +12,11 @@ > pluginName = Ant UI > providerName = Eclipse.org > >-AntBuild = Ant Build >-AntBuilder.name=Ant Builder > AntLaunchShortcut.label = Ant Build > AntLaunchShortcutWithDialog.label = Ant Build... > antLaunchConfigurationTabGroup.description=Run an Ant build file. > antBuilderLaunchConfigurationTabGroup.description=Create a configuration that will run an Ant build file during a build. > >-AntLaunchDelegate.name=Eclipse Ant Launcher >-AntLaunchDelegate.description=The Eclipse Ant Launcher supports running and debugging Ant build files. >-AntBuilderLaunchDelegate.name= Eclipse Ant Builder Launcher >-AntBuilderLaunchDelegate.description=The Eclipse Ant Builder Launcher supports running Ant build files. > AntBuild...Shortcut.description=Launches an Ant build and allows it to be configured > AntBuildShortcut.description=Launches an Ant build with default settings > >@@ -106,5 +100,3 @@ > AntElementHyperlinkDetector.description= A hyperlink detector for Ant buildfile elements > AntElementHyperlinkDetector.label= Ant Element > AntEditorHyperlinkTarget.name= Ant Editor >- >-AntLineBreakpoint.name = Ant Line Breakpoint >\ No newline at end of file >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/plugin.xml,v >retrieving revision 1.153 >diff -u -r1.153 plugin.xml >--- plugin.xml 4 May 2009 16:10:59 -0000 1.153 >+++ plugin.xml 7 Oct 2009 20:08:25 -0000 >@@ -24,48 +24,6 @@ > </editor> > </extension> > <extension >- point="org.eclipse.debug.core.launchConfigurationTypes"> >- <launchConfigurationType >- category="org.eclipse.ui.externaltools" >- delegate="org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDelegate" >- delegateDescription="%AntLaunchDelegate.description" >- delegateName="%AntLaunchDelegate.name" >- id="org.eclipse.ant.AntLaunchConfigurationType" >- migrationDelegate="org.eclipse.ant.internal.ui.launchConfigurations.AntMigrationDelegate" >- modes="run, debug" >- name="%AntBuild" >- sourceLocatorId="org.eclipse.ant.ui.debug.sourceLookupDirector" >- sourcePathComputerId="org.eclipse.ant.ui.debug.sourcePathComputer"> >- </launchConfigurationType> >- <launchConfigurationType >- category="org.eclipse.ui.externaltools.builder" >- delegate="org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDelegate" >- delegateDescription="%AntBuilderLaunchDelegate.description" >- delegateName="%AntBuilderLaunchDelegate.name" >- id="org.eclipse.ant.AntBuilderLaunchConfigurationType" >- modes="run" >- name="%AntBuilder.name"> >- </launchConfigurationType> >- </extension> >- <extension >- point="org.eclipse.jdt.launching.classpathProviders"> >- <classpathProvider >- class="org.eclipse.ant.internal.ui.launchConfigurations.AntClasspathProvider" >- id="org.eclipse.ant.ui.AntClasspathProvider"> >- </classpathProvider> >- </extension> >- <extension >- point="org.eclipse.jdt.launching.runtimeClasspathEntries"> >- <runtimeClasspathEntry >- class="org.eclipse.ant.internal.ui.launchConfigurations.AntHomeClasspathEntry" >- id="org.eclipse.ant.ui.classpathentry.antHome"> >- </runtimeClasspathEntry> >- <runtimeClasspathEntry >- class="org.eclipse.ant.internal.ui.launchConfigurations.ContributedClasspathEntriesEntry" >- id="org.eclipse.ant.ui.classpathentry.extraClasspathEntries"> >- </runtimeClasspathEntry> >- </extension> >- <extension > point="org.eclipse.ui.views"> > <category > name="%CategoryView.antViews" >@@ -553,13 +511,6 @@ > id="org.eclipse.ant.ui.statusHandler.runAntInit"> > </statusHandler> > </extension> >- <extension >- point="org.eclipse.debug.core.processFactories"> >- <processFactory >- class="org.eclipse.ant.internal.ui.launchConfigurations.RemoteAntProcessFactory" >- id="org.eclipse.ant.ui.remoteAntProcessFactory"> >- </processFactory> >- </extension> > > <extension > point="org.eclipse.ui.editors.templates"> >@@ -648,14 +599,14 @@ > point="org.eclipse.debug.core.sourceLocators"> > <sourceLocator > name="%antSourceLookupDirector.name" >- class="org.eclipse.ant.internal.ui.debug.AntSourceLookupDirector" >+ class="org.eclipse.ant.internal.launching.debug.AntSourceLookupDirector" > id="org.eclipse.ant.ui.debug.sourceLookupDirector"> > </sourceLocator> > </extension> > <extension > point="org.eclipse.debug.core.sourcePathComputers"> > <sourcePathComputer >- class="org.eclipse.ant.internal.ui.debug.AntSourcePathComputerDelegate" >+ class="org.eclipse.ant.internal.launching.debug.AntSourcePathComputerDelegate" > id="org.eclipse.ant.ui.debug.sourcePathComputer"> > </sourcePathComputer> > </extension> >@@ -668,23 +619,6 @@ > </extension> > > <extension >- point="org.eclipse.debug.core.breakpoints"> >- <breakpoint >- markerType="org.eclipse.ant.ui.antLineBreakpointMarker" >- class="org.eclipse.ant.internal.ui.debug.model.AntLineBreakpoint" >- id="org.eclipse.ant.ui.lineBreakpoint" >- name="%antBreakpointGroupName"> >- </breakpoint> >- </extension> >- <extension >- id="antLineBreakpointMarker" >- name="%AntLineBreakpoint.name" >- point="org.eclipse.core.resources.markers"> >- <super type="org.eclipse.debug.core.lineBreakpointMarker"/> >- <persistent value="true"/> >- </extension> >- >- <extension > point="org.eclipse.ui.editorActions"> > <editorContribution > targetID="org.eclipse.ant.ui.internal.editor.AntEditor" >#P org.eclipse.core.externaltools >Index: .settings/org.eclipse.pde.prefs >=================================================================== >RCS file: .settings/org.eclipse.pde.prefs >diff -N .settings/org.eclipse.pde.prefs >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .settings/org.eclipse.pde.prefs 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+#Wed Oct 07 13:13:28 CDT 2009 >+compilers.f.unresolved-features=1 >+compilers.f.unresolved-plugins=1 >+compilers.incompatible-environment=1 >+compilers.p.build=1 >+compilers.p.deprecated=1 >+compilers.p.discouraged-class=1 >+compilers.p.internal=1 >+compilers.p.missing-packages=1 >+compilers.p.missing-version-export-package=2 >+compilers.p.missing-version-import-package=2 >+compilers.p.missing-version-require-bundle=1 >+compilers.p.no-required-att=0 >+compilers.p.not-externalized-att=1 >+compilers.p.unknown-attribute=1 >+compilers.p.unknown-class=1 >+compilers.p.unknown-element=1 >+compilers.p.unknown-identifier=1 >+compilers.p.unknown-resource=1 >+compilers.p.unresolved-ex-points=0 >+compilers.p.unresolved-import=0 >+compilers.s.create-docs=false >+compilers.s.doc-folder=doc >+compilers.s.open-tags=1 >+eclipse.preferences.version=1 >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.externaltools/META-INF/MANIFEST.MF,v >retrieving revision 1.1 >diff -u -r1.1 MANIFEST.MF >--- META-INF/MANIFEST.MF 16 Sep 2009 14:58:41 -0000 1.1 >+++ META-INF/MANIFEST.MF 7 Oct 2009 20:08:26 -0000 >@@ -1,13 +1,17 @@ > Manifest-Version: 1.0 > Bundle-ManifestVersion: 2 > Bundle-Name: %pluginName >-Bundle-SymbolicName: org.eclipse.core.externaltools >+Bundle-Localization: plugin >+Bundle-SymbolicName: org.eclipse.core.externaltools;singleton:=true > Bundle-Version: 1.0.0.qualifier >-Bundle-Activator: org.eclipse.core.internal.externaltools.ExternalToolsCore >+Bundle-Activator: org.eclipse.core.externaltools.internal.ExternalToolsCore > Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", > org.eclipse.debug.core;bundle-version="[3.6.0,4.0.0)", > org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)" > Bundle-RequiredExecutionEnvironment: J2SE-1.4 > Bundle-ActivationPolicy: lazy > Bundle-Vendor: %providerName >-Export-Package: org.eclipse.core.internal.externaltools;x-internal:=true >+Export-Package: org.eclipse.core.externaltools.internal;x-friends:="org.eclipse.ant.launching,org.eclipse.ui.externaltools", >+ org.eclipse.core.externaltools.internal.launchConfigurations;x-friends:="org.eclipse.ant.launching,org.eclipse.ui.externaltools", >+ org.eclipse.core.externaltools.internal.model;x-friends:="org.eclipse.ant.launching,org.eclipse.ui.externaltools", >+ org.eclipse.core.externaltools.internal.registry;x-friends:="org.eclipse.ui.externaltools" >Index: build.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.externaltools/build.properties,v >retrieving revision 1.1 >diff -u -r1.1 build.properties >--- build.properties 16 Sep 2009 14:50:42 -0000 1.1 >+++ build.properties 7 Oct 2009 20:08:26 -0000 >@@ -1,4 +1,6 @@ > source.. = src/ > output.. = bin/ > bin.includes = META-INF/,\ >- . >+ .,\ >+ plugin.xml,\ >+ plugin.properties >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.externaltools/plugin.properties,v >retrieving revision 1.1 >diff -u -r1.1 plugin.properties >--- plugin.properties 16 Sep 2009 14:50:42 -0000 1.1 >+++ plugin.properties 7 Oct 2009 20:08:26 -0000 >@@ -10,4 +10,7 @@ > ############################################################################### > > pluginName=External Tools Headless Support >-providerName=Eclipse.org >\ No newline at end of file >+providerName=Eclipse.org >+ >+Program.externalTools = Program >+Builder.externalTools = Integrated External Tool Builder >\ No newline at end of file >Index: plugin.xml >=================================================================== >RCS file: plugin.xml >diff -N plugin.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ plugin.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,32 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<?eclipse version="3.4"?> >+<plugin> >+ <extension >+ point="org.eclipse.debug.core.launchConfigurationTypes"> >+ <launchConfigurationType >+ name="%Program.externalTools" >+ delegate="org.eclipse.core.externaltools.internal.launchConfigurations.ProgramLaunchDelegate" >+ category="org.eclipse.ui.externaltools" >+ modes="run" >+ id="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"> >+ </launchConfigurationType> >+ <launchConfigurationType >+ name="%Program.externalTools" >+ delegate="org.eclipse.core.externaltools.internal.launchConfigurations.ProgramLaunchDelegate" >+ category="org.eclipse.ui.externaltools.builder" >+ modes="run" >+ id="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"> >+ </launchConfigurationType> >+ </extension> >+ <extension >+ id="org.eclipse.ui.externaltools.ExternalToolBuilder" >+ name="%Builder.externalTools" >+ point="org.eclipse.core.resources.builders"> >+ <builder >+ isConfigurable= "true"> >+ <run >+ class="org.eclipse.core.externaltools.internal.model.ExternalToolBuilder"> >+ </run> >+ </builder> >+ </extension> >+</plugin> >Index: src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java >diff -N src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,118 @@ >+/******************************************************************************* >+ * 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.core.externaltools.internal; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Plugin; >+import org.eclipse.core.runtime.Status; >+import org.osgi.framework.BundleContext; >+ >+/** >+ * Controls the plug-in life cycle >+ */ >+public class ExternalToolsCore extends Plugin { >+ >+ // The plug-in ID >+ public static final String PLUGIN_ID = "org.eclipse.core.externaltools"; //$NON-NLS-1$ >+ >+ private static final String EMPTY_STRING= ""; //$NON-NLS-1$ >+ >+ /** >+ * Status code indicating an unexpected internal error. >+ * @since 2.1 >+ */ >+ public static final int INTERNAL_ERROR = 120; >+ >+ // The shared instance >+ private static ExternalToolsCore plugin; >+ >+ /** >+ * The constructor >+ */ >+ public ExternalToolsCore() { >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) >+ */ >+ public void start(BundleContext context) throws Exception { >+ super.start(context); >+ plugin = this; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) >+ */ >+ public void stop(BundleContext context) throws Exception { >+ plugin = null; >+ super.stop(context); >+ } >+ >+ /** >+ * Returns the shared instance >+ * >+ * @return the shared instance >+ */ >+ public static ExternalToolsCore getDefault() { >+ return plugin; >+ } >+ >+ /** >+ * Logs the specified throwable with this plug-in's log. >+ * >+ * @param t throwable to log >+ */ >+ public static void log(Throwable t) { >+ IStatus status= new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR, "Error logged from Ant UI: ", t); //$NON-NLS-1$ >+ log(status); >+ } >+ >+ /** >+ * Logs the specified status with this plug-in's log. >+ * >+ * @param status status >+ */ >+ public static void log(IStatus status) { >+ getDefault().getLog().log(status); >+ } >+ >+ /** >+ * Writes the message to the plug-in's log >+ * >+ * @param message the text to write to the log >+ */ >+ public static void log(String message, Throwable exception) { >+ IStatus status = newErrorStatus(message, exception); >+ log(status); >+ } >+ >+ /** >+ * Returns a new <code>IStatus</code> for this plug-in >+ */ >+ public static IStatus newErrorStatus(String message, Throwable exception) { >+ if (message == null) { >+ message= EMPTY_STRING; >+ } >+ return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, exception); >+ } >+ >+ /** >+ * Returns a new <code>CoreException</code> for this plug-in >+ */ >+ public static CoreException newError(String message, Throwable exception) { >+ return new CoreException(new Status(IStatus.ERROR, >+ IExternalToolConstants.PLUGIN_ID, 0, message, exception)); >+ } >+ >+} >Index: src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java >diff -N src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,243 @@ >+/******************************************************************************* >+ * 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 >+ *******************************************************************************/ >+ >+package org.eclipse.core.externaltools.internal; >+/** >+ * Defines the constants available for client use. >+ * <p> >+ * This interface is not intended to be extended or implemented by clients. >+ * </p> >+ */ >+public interface IExternalToolConstants { >+ /** >+ * Plug-in identifier for external tools UI (value <code>org.eclipse.ui.externaltools</code>). >+ */ >+ public static final String UI_PLUGIN_ID = "org.eclipse.ui.externaltools"; //$NON-NLS-1$; >+ >+ /** >+ * Plug-in identifier for external tools core (value <code>org.eclipse.core.externaltools</code>). >+ */ >+ public static final String PLUGIN_ID = "org.eclipse.core.externaltools"; //$NON-NLS-1$; >+ >+ // ------- Extensions Points ------- >+ /** >+ * Extension point to declare the launch configuration type that should be >+ * created when duplicating an existing configuration as a project builder. >+ */ >+ public static final String EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS = "configurationDuplicationMaps"; //$NON-NLS-1$ >+ // ------- Refresh Variables ------- >+ /** >+ * Variable that expands to the workspace root object (value <code>workspace</code>). >+ */ >+ public static final String VAR_WORKSPACE = "workspace"; //$NON-NLS-1$ >+ /** >+ * Variable that expands to the project resource (value <code>project</code>). >+ */ >+ public static final String VAR_PROJECT = "project"; //$NON-NLS-1$ >+ /** >+ * Variable that expands to the container resource (value <code>container</code>). >+ */ >+ public static final String VAR_CONTAINER = "container"; //$NON-NLS-1$ >+ /** >+ * Variable that expands to a resource (value <code>resource</code>). >+ */ >+ public static final String VAR_RESOURCE = "resource"; //$NON-NLS-1$ >+ /** >+ * Variable that expands to the working set object (value <code>working_set</code>). >+ */ >+ public static final String VAR_WORKING_SET = "working_set"; //$NON-NLS-1$ >+ // ------- Tool Types ------- >+ /** >+ * External tool type for programs such as executables, batch files, >+ * shell scripts, etc (value <code>programType</code>). >+ */ >+ public static final String TOOL_TYPE_PROGRAM = "programType"; //$NON-NLS-1$; >+ >+ // ------- Build Types ------- >+ /** >+ * Build type indicating an incremental project build request for >+ * the external tool running as a builder (value <code>incremental</code>). >+ */ >+ public static final String BUILD_TYPE_INCREMENTAL = "incremental"; //$NON-NLS-1$ >+ >+ /** >+ * Build type indicating a full project build request for >+ * the external tool running as a builder (value <code>full</code>). >+ */ >+ public static final String BUILD_TYPE_FULL = "full"; //$NON-NLS-1$ >+ >+ /** >+ * Build type indicating an automatic project build request for >+ * the external tool running as a builder (value <code>auto</code>). >+ */ >+ public static final String BUILD_TYPE_AUTO = "auto"; //$NON-NLS-1$ >+ >+ /** >+ * Build type indicating a clean project build request for >+ * the external tool running as a builder (value <code>clean</code>). >+ */ >+ public static final String BUILD_TYPE_CLEAN = "clean"; //$NON-NLS-1$ >+ >+ /** >+ * Build type indicating no project build request for >+ * the external tool running as a builder (value <code>none</code>). >+ */ >+ public static final String BUILD_TYPE_NONE = "none"; //$NON-NLS-1$ >+ >+ // ------- Images ------- >+ >+ /** >+ * Main tab image. >+ */ >+ public static final String IMG_TAB_MAIN = UI_PLUGIN_ID + ".IMG_TAB_MAIN"; //$NON-NLS-1$ >+ >+ /** >+ * Build tab image >+ */ >+ public static final String IMG_TAB_BUILD = UI_PLUGIN_ID + ".IMG_TAB_BUILD"; //$NON-NLS-1$ >+ >+ // ------- Launch configuration types -------- >+ /** >+ * Program launch configuration type identifier. >+ */ >+ public static final String ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"; //$NON-NLS-1$ >+ >+ /** >+ * Program builder launch configuration type identifier. Program project >+ * builders are of this type. >+ */ >+ public static final String ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"; //$NON-NLS-1$ >+ >+ // ------- Launch configuration category -------- >+ /** >+ * Identifier for external tools launch configuration category. Launch >+ * configuration types for external tools that appear in the external tools >+ * launch configuration dialog should belong to this category. >+ */ >+ public static final String ID_EXTERNAL_TOOLS_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools"; //$NON-NLS-1$ >+ /** >+ * Identifier for external tools launch configuration builders category. >+ * Launch configuration types that can be added as project builders should >+ * belong to this category. >+ */ >+ public static final String ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools.builder"; //$NON-NLS-1$ >+ >+ // ------- Launch configuration groups -------- >+ /** >+ * Identifier for external tools launch configuration group. The external >+ * tools launch configuration group corresponds to the external tools >+ * category in run mode. >+ */ >+ public static final String ID_EXTERNAL_TOOLS_LAUNCH_GROUP = "org.eclipse.ui.externaltools.launchGroup"; //$NON-NLS-1$ >+ /** >+ * Identifier for external tools launch configuration group >+ */ >+ public static final String ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_GROUP = "org.eclipse.ui.externaltools.launchGroup.builder"; //$NON-NLS-1$ >+ >+ // ------- Common External Tool Launch Configuration Attributes ------- >+ >+ /** >+ * Boolean attribute indicating if external tool output should be captured. >+ * Default value is <code>false</code>. >+ * @deprecated since 3.1 Replaced by <code>org.eclipse.debug.core.DebugPlugin.ATTR_CAPTURE_OUTPUT</code> >+ */ >+ public static final String ATTR_CAPTURE_OUTPUT = UI_PLUGIN_ID + ".ATTR_CAPTURE_OUTPUT"; //$NON-NLS-1$ >+ /** >+ * String attribute identifying the location of an external. Default value >+ * is <code>null</code>. Encoding is tool specific. >+ */ >+ public static final String ATTR_LOCATION = UI_PLUGIN_ID + ".ATTR_LOCATION"; //$NON-NLS-1$ >+ >+ /** >+ * Boolean attribute indicating if the user should be prompted for >+ * arguments before running a tool. Default value is <code>false</code>. >+ * THIS ATTRIBUTE IS NOT USED. >+ */ >+ public static final String ATTR_PROMPT_FOR_ARGUMENTS = UI_PLUGIN_ID + ".ATTR_PROMPT_FOR_ARGUMENTS"; //$NON-NLS-1$ >+ >+ /** >+ * String attribute identifying the scope of resources that should trigger an >+ * external tool to run. Default value is <code>null</code> >+ * indicating that the builder will be triggered for all changes. >+ */ >+ public static final String ATTR_BUILDER_SCOPE = UI_PLUGIN_ID + ".ATTR_BUILD_SCOPE"; //$NON-NLS-1$ >+ >+ /** >+ * String attribute containing an array of build kinds for which an >+ * external tool builder should be run. >+ */ >+ public static final String ATTR_RUN_BUILD_KINDS = UI_PLUGIN_ID + ".ATTR_RUN_BUILD_KINDS"; //$NON-NLS-1$ >+ >+ /** >+ * Boolean attribute indicating if the console should be shown on external >+ * tool output. Default value is <code>false</code>. >+ */ >+ public static final String ATTR_SHOW_CONSOLE = UI_PLUGIN_ID + ".ATTR_SHOW_CONSOLE"; //$NON-NLS-1$ >+ >+ /** >+ * String attribute containing the arguments that should be passed to the >+ * tool. Default value is <code>null</code>, and encoding is tool specific. >+ */ >+ public static final String ATTR_TOOL_ARGUMENTS = UI_PLUGIN_ID + ".ATTR_TOOL_ARGUMENTS"; //$NON-NLS-1$ >+ >+ /** >+ * String attribute identifying the working directory of an external tool. >+ * Default value is <code>null</code>, which indicates a default working >+ * directory, which is tool specific. >+ */ >+ public static final String ATTR_WORKING_DIRECTORY = UI_PLUGIN_ID + ".ATTR_WORKING_DIRECTORY"; //$NON-NLS-1$ >+ >+ /** >+ * String attribute identifying whether an external tool builder configuration >+ * is enabled. The default value is <code>true</code>, which indicates >+ * that the configuration will be executed as appropriate by the builder. >+ */ >+ public static final String ATTR_BUILDER_ENABLED = UI_PLUGIN_ID + ".ATTR_BUILDER_ENABLED"; //$NON-NLS-1$ >+ >+ /** >+ * Boolean attribute identifying whether an external tool launcher should execute >+ * synchronously (value <code>false</code>) or asynchronously (value <code>true</code>). >+ * Default value is >+ */ >+ public static final String ATTR_LAUNCH_IN_BACKGROUND = "org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND"; //$NON-NLS-1$ >+ >+ /** >+ * Status code indicating an unexpected internal error. >+ */ >+ public static final int ERR_INTERNAL_ERROR = 150; >+ >+ /** >+ * String attribute identifying a non-external tool builder launch configuration that is disabled >+ * The value is the name of the disabled builder. >+ */ >+ public static final String ATTR_DISABLED_BUILDER = UI_PLUGIN_ID + ".ATTR_DISABLED_BUILDER"; //$NON-NLS-1$ >+ >+ /** >+ * boolean attribute identifying that an external tool builder has been configured for triggering >+ * using the <code>ICommand.setBuilding(int)</code> mechanism >+ * @since 3.1 >+ */ >+ public static final String ATTR_TRIGGERS_CONFIGURED = UI_PLUGIN_ID + ".ATTR_TRIGGERS_CONFIGURED"; //$NON-NLS-1$ >+ >+ /** >+ * String attribute identifying the build scope for a launch configuration. >+ * <code>null</code> indicates the default workspace build. >+ */ >+ public static final String ATTR_BUILD_SCOPE = UI_PLUGIN_ID + ".ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE"; //$NON-NLS-1$ >+ >+ /** >+ * Attribute identifier specifying whether referenced projects should be >+ * considered when computing the projects to build. Default value is >+ * <code>true</code>. >+ */ >+ public static final String ATTR_INCLUDE_REFERENCED_PROJECTS = UI_PLUGIN_ID + ".ATTR_INCLUDE_REFERENCED_PROJECTS"; //$NON-NLS-1$ >+} >Index: src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java >diff -N src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,89 @@ >+/******************************************************************************* >+ * 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.core.externaltools.internal.launchConfigurations; >+ >+ >+import org.eclipse.core.externaltools.internal.ExternalToolsCore; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.debug.core.DebugEvent; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.IDebugEventSetListener; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.RefreshUtil; >+import org.eclipse.debug.core.model.IProcess; >+ >+/** >+ * Refreshes resources as specified by a launch configuration, when >+ * an associated process terminates. >+ */ >+public class BackgroundResourceRefresher implements IDebugEventSetListener { >+ >+ private ILaunchConfiguration fConfiguration; >+ private IProcess fProcess; >+ >+ >+ >+ public BackgroundResourceRefresher(ILaunchConfiguration configuration, IProcess process) { >+ fConfiguration = configuration; >+ fProcess = process; >+ } >+ >+ /** >+ * If the process has already terminated, resource refreshing is done >+ * immediately in the current thread. Otherwise, refreshing is done when the >+ * process terminates. >+ */ >+ public void startBackgroundRefresh() { >+ synchronized (fProcess) { >+ if (fProcess.isTerminated()) { >+ refresh(); >+ } else { >+ DebugPlugin.getDefault().addDebugEventListener(this); >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) >+ */ >+ public void handleDebugEvents(DebugEvent[] events) { >+ for (int i = 0; i < events.length; i++) { >+ DebugEvent event = events[i]; >+ if (event.getSource() == fProcess && event.getKind() == DebugEvent.TERMINATE) { >+ DebugPlugin.getDefault().removeDebugEventListener(this); >+ refresh(); >+ break; >+ } >+ } >+ } >+ >+ /** >+ * Submits a job to do the refresh >+ */ >+ protected void refresh() { >+ Job job= new Job(ExternalToolsProgramMessages.BackgroundResourceRefresher_0) { >+ public IStatus run(IProgressMonitor monitor) { >+ try { >+ RefreshUtil.refreshResources(fConfiguration, monitor); >+ } catch (CoreException e) { >+ ExternalToolsCore.log(e); >+ return e.getStatus(); >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ job.schedule(); >+ } >+} >Index: src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java >diff -N src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,274 @@ >+/******************************************************************************* >+ * 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 >+ * Keith Seitz (keiths@redhat.com) - Bug 27243 (environment variables contribution) >+ * dakshinamurthy.karra@gmail.com - bug 165371 >+ *******************************************************************************/ >+package org.eclipse.core.externaltools.internal.launchConfigurations; >+ >+ >+import java.io.File; >+ >+import org.eclipse.core.externaltools.internal.ExternalToolsCore; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+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.IStatus; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.variables.IStringVariableManager; >+import org.eclipse.core.variables.VariablesPlugin; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.RefreshUtil; >+import org.eclipse.osgi.util.NLS; >+ >+/** >+ * Utilities for external tool launch configurations. >+ * <p> >+ * This class it not intended to be instantiated. >+ * </p> >+ */ >+public class ExternalToolsCoreUtil { >+ >+ /** >+ * Throws a core exception with an error status object built from >+ * the given message, lower level exception, and error code. >+ * @param message the status message >+ * @param exception lower level exception associated with the >+ * error, or <code>null</code> if none >+ * @param code error code >+ */ >+ protected static void abort(String message, Throwable exception, int code) throws CoreException { >+ throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, code, message, exception)); >+ } >+ >+ /** >+ * Expands and returns the location attribute of the given launch >+ * configuration. The location is >+ * verified to point to an existing file, in the local file system. >+ * >+ * @param configuration launch configuration >+ * @return an absolute path to a file in the local file system >+ * @throws CoreException if unable to retrieve the associated launch >+ * configuration attribute, if unable to resolve any variables, or if the >+ * resolved location does not point to an existing file in the local file >+ * system >+ */ >+ public static IPath getLocation(ILaunchConfiguration configuration) throws CoreException { >+ String location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null); >+ if (location == null) { >+ abort(NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_Location_not_specified_by__0__1, new String[] { configuration.getName()}), null, 0); >+ } else { >+ String expandedLocation = getStringVariableManager().performStringSubstitution(location); >+ if (expandedLocation == null || expandedLocation.length() == 0) { >+ String msg = NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_invalidLocation__0_, new Object[] { configuration.getName()}); >+ abort(msg, null, 0); >+ } else { >+ File file = new File(expandedLocation); >+ if (file.isFile()) { >+ return new Path(expandedLocation); >+ } >+ >+ String msg = NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_invalidLocation__0_, new Object[] { configuration.getName()}); >+ abort(msg, null, 0); >+ } >+ } >+ // execution will not reach here >+ return null; >+ } >+ >+ /** >+ * Returns a boolean specifying whether or not output should be captured for >+ * the given configuration >+ * >+ * @param configuration the configuration from which the value will be >+ * extracted >+ * @return boolean specifying whether or not output should be captured >+ * @throws CoreException if unable to access the associated attribute >+ */ >+ public static boolean getCaptureOutput(ILaunchConfiguration configuration) throws CoreException { >+ return configuration.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true); >+ } >+ >+ /** >+ * Expands and returns the working directory attribute of the given launch >+ * configuration. Returns <code>null</code> if a working directory is not >+ * specified. If specified, the working is verified to point to an existing >+ * directory in the local file system. >+ * >+ * @param configuration launch configuration >+ * @return an absolute path to a directory in the local file system, or >+ * <code>null</code> if unspecified >+ * @throws CoreException if unable to retrieve the associated launch >+ * configuration attribute, if unable to resolve any variables, or if the >+ * resolved location does not point to an existing directory in the local >+ * file system >+ */ >+ public static IPath getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException { >+ String location = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) null); >+ if (location != null) { >+ String expandedLocation = getStringVariableManager().performStringSubstitution(location); >+ if (expandedLocation.length() > 0) { >+ File path = new File(expandedLocation); >+ if (path.isDirectory()) { >+ return new Path(expandedLocation); >+ } >+ String msg = NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_invalidDirectory__0_, new Object[] { expandedLocation, configuration.getName()}); >+ abort(msg, null, 0); >+ } >+ } >+ return null; >+ } >+ >+ /** >+ * Expands and returns the arguments attribute of the given launch >+ * configuration. Returns <code>null</code> if arguments are not specified. >+ * >+ * @param configuration launch configuration >+ * @return an array of resolved arguments, or <code>null</code> if >+ * unspecified >+ * @throws CoreException if unable to retrieve the associated launch >+ * configuration attribute, or if unable to resolve any variables >+ */ >+ public static String[] getArguments(ILaunchConfiguration configuration) throws CoreException { >+ String args = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null); >+ if (args != null) { >+ String expanded = getStringVariableManager().performStringSubstitution(args); >+ return parseStringIntoList(expanded); >+ } >+ return null; >+ } >+ >+ private static IStringVariableManager getStringVariableManager() { >+ return VariablesPlugin.getDefault().getStringVariableManager(); >+ } >+ >+ /** >+ * Returns whether the given launch configuration is enabled. This property >+ * is intended only to apply to external tool builder configurations and >+ * determines whether the project builder will launch the configuration >+ * when it builds. >+ * >+ * @param configuration the configuration for which the enabled state should >+ * be determined. >+ * @return whether the given configuration is enabled to be run when a build occurs. >+ * @throws CoreException if unable to access the associated attribute >+ */ >+ public static boolean isBuilderEnabled(ILaunchConfiguration configuration) throws CoreException { >+ return configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_ENABLED, true); >+ } >+ >+ /** >+ * Returns the collection of resources for the build scope as specified by the given launch configuration. >+ * >+ * @param configuration launch configuration >+ * @throws CoreException if an exception occurs while retrieving the resources >+ */ >+ public static IResource[] getResourcesForBuildScope(ILaunchConfiguration configuration) throws CoreException { >+ String scope = configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, (String) null); >+ if (scope == null) { >+ return null; >+ } >+ >+ return RefreshUtil.toResources(scope); >+ } >+ >+ /** >+ * Parses the argument text into an array of individual >+ * strings using the space character as the delimiter. >+ * An individual argument containing spaces must have a >+ * double quote (") at the start and end. Two double >+ * quotes together is taken to mean an embedded double >+ * quote in the argument text. >+ * >+ * @param arguments the arguments as one string >+ * @return the array of arguments >+ */ >+ public static String[] parseStringIntoList(String arguments) { >+ if (arguments == null || arguments.length() == 0) { >+ return new String[0]; >+ } >+ String[] res= DebugPlugin.parseArguments(arguments); >+ return res; >+ } >+ /** >+ * Returns a collection of projects referenced by a build scope attribute. >+ * >+ * @return collection of projects referred to by configuration >+ */ >+ public static IProject[] getBuildProjects(ILaunchConfiguration configuration, String buildScopeId) { >+ >+ String scope = null; >+ String id = buildScopeId ; >+ if (id == null) { >+ id = IExternalToolConstants.ATTR_BUILD_SCOPE ; >+ } >+ try { >+ scope = configuration.getAttribute(id, (String)null); >+ } catch (CoreException e) { >+ return null; >+ } >+ if (scope == null) { >+ return null; >+ } >+ if (scope.startsWith("${projects:")) { //$NON-NLS-1$ >+ String pathString = scope.substring(11, scope.length() - 1); >+ if (pathString.length() > 1) { >+ String[] names = pathString.split(","); //$NON-NLS-1$ >+ IProject[] projects = new IProject[names.length]; >+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); >+ for (int i = 0; i < names.length; i++) { >+ projects[i] = root.getProject(names[i]); >+ } >+ return projects; >+ } >+ } else if (scope.equals("${project}")) { //$NON-NLS-1$ >+ if(configuration.getFile()!=null) >+ return new IProject[]{((IResource)configuration.getFile()).getProject()}; >+ } >+ return new IProject[0]; >+ } >+ >+ /** >+ * Whether referenced projects should be considered when building. Only valid >+ * when a set of projects is to be built. >+ * >+ * @param configuration >+ * @return whether referenced projects should be considerd when building >+ * @throws CoreException if unable to access the associated attribute >+ */ >+ public static boolean isIncludeReferencedProjects(ILaunchConfiguration configuration, String includeReferencedProjectsId) throws CoreException { >+ String id = includeReferencedProjectsId; >+ if (id == null) { >+ id = IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS ; >+ } >+ return configuration.getAttribute(id, true); >+ } >+ >+ /** >+ * Returns whether the given external builder configuration should build asynchronously. >+ * >+ * @param configuration the configuration >+ * @return whether the configuration is configured to build asynchronously >+ */ >+ public static boolean isAsynchronousBuild(ILaunchConfiguration configuration) { >+ boolean launchInBackground= false; >+ try { >+ launchInBackground= configuration.getAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, false); >+ } catch (CoreException ce) { >+ ExternalToolsCore.log(ce); >+ } >+ return launchInBackground; >+ } >+} >Index: src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java >diff -N src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+/********************************************************************** >+ * 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.core.externaltools.internal.launchConfigurations; >+ >+import org.eclipse.osgi.util.NLS; >+ >+public class ExternalToolsProgramMessages extends NLS { >+ private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsProgramMessages";//$NON-NLS-1$ >+ >+ public static String BackgroundResourceRefresher_0; >+ >+ public static String ProgramLaunchDelegate_3; >+ public static String ProgramLaunchDelegate_4; >+ >+ public static String ExternalToolsUtil_Location_not_specified_by__0__1; >+ public static String ExternalToolsUtil_invalidLocation__0_; >+ public static String ExternalToolsUtil_invalidDirectory__0_; >+ >+ static { >+ // load message values from bundle file >+ NLS.initializeMessages(BUNDLE_NAME, ExternalToolsProgramMessages.class); >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties >diff -N src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -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 >+############################################################################### >+ >+BackgroundResourceRefresher_0=Refreshing resources... >+ >+ProgramLaunchDelegate_Workbench_Closing_1=Workbench Closing >+ProgramLaunchDelegate_The_workbench_is_exiting=The workbench is exiting and a program launched from an external tool appears to still be running. These programs will be terminated when the workbench exits. It is recommended that you exit any external programs launched from the workbench before you proceed.\n\nClick OK to continue exiting the workbench. >+ProgramLaunchDelegate_3=Running {0}... >+ProgramLaunchDelegate_4=An IProcess could not be created for the launch >+ >+ProgramMainTab_Select=&Select a program: >+ >+ExternalToolsUtil_Location_not_specified_by__0__1=Location not specified by {0} >+ExternalToolsUtil_invalidLocation__0_ = The file does not exist for the external tool named {0}. >+ExternalToolsUtil_invalidDirectory__0_ = The working directory {0} does not exist for the external tool named {1}. >\ No newline at end of file >Index: src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java >diff -N src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,207 @@ >+/******************************************************************************* >+ * 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 >+ * Keith Seitz (keiths@redhat.com) - environment variables contribution (Bug 27243) >+ * dakshinamurthy.karra@gmail.com - bug 165371 >+ *******************************************************************************/ >+package org.eclipse.core.externaltools.internal.launchConfigurations; >+ >+import java.io.File; >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.RefreshUtil; >+import org.eclipse.debug.core.model.IProcess; >+import org.eclipse.debug.core.model.LaunchConfigurationDelegate; >+import org.eclipse.osgi.util.NLS; >+ >+/** >+ * Launch delegate for a program. >+ */ >+public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { >+ >+ /** >+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, >+ * java.lang.String, org.eclipse.debug.core.ILaunch, >+ * org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public void launch(ILaunchConfiguration configuration, String mode, >+ ILaunch launch, IProgressMonitor monitor) throws CoreException { >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ // resolve location >+ IPath location = ExternalToolsCoreUtil.getLocation(configuration); >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ // resolve working directory >+ IPath workingDirectory = ExternalToolsCoreUtil >+ .getWorkingDirectory(configuration); >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ // resolve arguments >+ String[] arguments = ExternalToolsCoreUtil.getArguments(configuration); >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ int cmdLineLength = 1; >+ if (arguments != null) { >+ cmdLineLength += arguments.length; >+ } >+ String[] cmdLine = new String[cmdLineLength]; >+ cmdLine[0] = location.toOSString(); >+ if (arguments != null) { >+ System.arraycopy(arguments, 0, cmdLine, 1, arguments.length); >+ } >+ >+ File workingDir = null; >+ if (workingDirectory != null) { >+ workingDir = workingDirectory.toFile(); >+ } >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ String[] envp = DebugPlugin.getDefault().getLaunchManager() >+ .getEnvironment(configuration); >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ Process p = DebugPlugin.exec(cmdLine, workingDir, envp); >+ IProcess process = null; >+ >+ // add process type to process attributes >+ Map processAttributes = new HashMap(); >+ String programName = location.lastSegment(); >+ String extension = location.getFileExtension(); >+ if (extension != null) { >+ programName = programName.substring(0, programName.length() >+ - (extension.length() + 1)); >+ } >+ programName = programName.toLowerCase(); >+ processAttributes.put(IProcess.ATTR_PROCESS_TYPE, programName); >+ >+ if (p != null) { >+ monitor.beginTask(NLS.bind( >+ ExternalToolsProgramMessages.ProgramLaunchDelegate_3, >+ new String[] { configuration.getName() }), >+ IProgressMonitor.UNKNOWN); >+ process = DebugPlugin.newProcess(launch, p, location.toOSString(), >+ processAttributes); >+ } >+ if (p == null || process == null) { >+ if (p != null) >+ p.destroy(); >+ throw new CoreException(new Status(IStatus.ERROR, >+ IExternalToolConstants.PLUGIN_ID, >+ IExternalToolConstants.ERR_INTERNAL_ERROR, >+ ExternalToolsProgramMessages.ProgramLaunchDelegate_4, null)); >+ } >+ process.setAttribute(IProcess.ATTR_CMDLINE, >+ generateCommandLine(cmdLine)); >+ >+// if (launchManager.isLaunchInBackground(configuration)) { >+// // refresh resources after process finishes >+// if (launchManager.getRefreshScope(configuration) != null) { >+// BackgroundResourceRefresher refresher = new BackgroundResourceRefresher( >+// configuration, process); >+// refresher.startBackgroundRefresh(); >+// } >+// } else { >+ // wait for process to exit >+ while (!process.isTerminated()) { >+ try { >+ if (monitor.isCanceled()) { >+ process.terminate(); >+ break; >+ } >+ Thread.sleep(50); >+ } catch (InterruptedException e) { >+ } >+ } >+ >+ // refresh resources >+ RefreshUtil.refreshResources(configuration, monitor); >+// } >+ } >+ >+ private String generateCommandLine(String[] commandLine) { >+ if (commandLine.length < 1) >+ return ""; //$NON-NLS-1$ >+ StringBuffer buf = new StringBuffer(); >+ for (int i = 0; i < commandLine.length; i++) { >+ buf.append(' '); >+ char[] characters = commandLine[i].toCharArray(); >+ StringBuffer command = new StringBuffer(); >+ boolean containsSpace = false; >+ for (int j = 0; j < characters.length; j++) { >+ char character = characters[j]; >+ if (character == '\"') { >+ command.append('\\'); >+ } else if (character == ' ') { >+ containsSpace = true; >+ } >+ command.append(character); >+ } >+ if (containsSpace) { >+ buf.append('\"'); >+ buf.append(command); >+ buf.append('\"'); >+ } else { >+ buf.append(command); >+ } >+ } >+ return buf.toString(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder >+ * (org.eclipse.debug.core.ILaunchConfiguration, java.lang.String) >+ */ >+ protected IProject[] getBuildOrder(ILaunchConfiguration configuration, >+ String mode) throws CoreException { >+ IProject[] projects = ExternalToolsCoreUtil.getBuildProjects( >+ configuration, null); >+ if (projects == null) { >+ return null; >+ } >+ boolean isRef = ExternalToolsCoreUtil.isIncludeReferencedProjects( >+ configuration, null); >+ if (isRef) { >+ return computeReferencedBuildOrder(projects); >+ } >+ return computeBuildOrder(projects); >+ } >+} >Index: src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java >diff -N src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,341 @@ >+/******************************************************************************* >+ * 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.core.externaltools.internal.model; >+ >+import java.util.HashMap; >+import java.util.Map; >+import java.util.StringTokenizer; >+ >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.registry.ExternalToolMigration; >+import org.eclipse.core.resources.ICommand; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IFolder; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IncrementalProjectBuilder; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.debug.core.ILaunchManager; >+ >+/** >+ * Utility methods for working with external tool project builders. >+ */ >+public class BuilderCoreUtils { >+ >+ public static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$ >+ >+ /** >+ * Constant used to find a builder using the 3.0-interim format >+ */ >+ public static final String BUILDER_FOLDER_NAME = ".externalToolBuilders"; //$NON-NLS-1$ >+ /** >+ * Constant used to represent the current project in the 3.0-final format. >+ */ >+ public static final String PROJECT_TAG = "<project>"; //$NON-NLS-1$ >+ >+ public static final String VERSION_1_0 = "1.0"; //$NON-NLS-1$ >+ public static final String VERSION_2_1 = "2.1"; //$NON-NLS-1$ >+ // The format shipped up to and including Eclipse 3.0 RC1 >+ public static final String VERSION_3_0_interim = "3.0.interim"; //$NON-NLS-1$ >+ // The format shipped in Eclipse 3.0 final >+ public static final String VERSION_3_0_final = "3.0"; //$NON-NLS-1$ >+ >+ private static final String BUILD_TYPE_SEPARATOR = ","; //$NON-NLS-1$ >+ private static final int[] DEFAULT_BUILD_TYPES = new int[] { >+ IncrementalProjectBuilder.INCREMENTAL_BUILD, >+ IncrementalProjectBuilder.FULL_BUILD }; >+ >+ /** >+ * Returns a launch configuration from the given ICommand arguments. If the >+ * given arguments are from an old-style external tool, an unsaved working >+ * copy will be created from the arguments and returned. >+ * >+ * @param commandArgs >+ * the builder ICommand arguments >+ * @return a launch configuration, a launch configuration working copy, or >+ * <code>null</code> if not possible. >+ */ >+ public static ILaunchConfiguration configFromBuildCommandArgs( >+ IProject project, Map commandArgs, String[] version) { >+ String configHandle = (String) commandArgs.get(LAUNCH_CONFIG_HANDLE); >+ if (configHandle == null) { >+ // Probably an old-style (Eclipse 1.0 or 2.0) external tool. Try to >+ // migrate. >+ version[0] = VERSION_1_0; >+ return ExternalToolMigration.configFromArgumentMap(commandArgs); >+ } >+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); >+ ILaunchConfiguration configuration = null; >+ if (configHandle.startsWith(PROJECT_TAG)) { >+ version[0] = VERSION_3_0_final; >+ IPath path = new Path(configHandle); >+ IFile file = project.getFile(path.removeFirstSegments(1)); >+ if (file.exists()) { >+ configuration = manager.getLaunchConfiguration(file); >+ } >+ } else { >+ // Try treating the handle as a file name. >+ // This is the format used in 3.0 RC1. >+ IPath path = new Path(BUILDER_FOLDER_NAME).append(configHandle); >+ IFile file = project.getFile(path); >+ if (file.exists()) { >+ version[0] = VERSION_3_0_interim; >+ configuration = manager.getLaunchConfiguration(file); >+ } else { >+ try { >+ // Treat the configHandle as a memento. This is the format >+ // used in Eclipse 2.1. >+ configuration = manager >+ .getLaunchConfiguration(configHandle); >+ } catch (CoreException e) { >+ } >+ if (configuration != null) { >+ version[0] = VERSION_2_1; >+ } >+ } >+ } >+ return configuration; >+ } >+ >+ public static void configureTriggers(ILaunchConfiguration config, >+ ICommand newCommand) throws CoreException { >+ newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, false); >+ newCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, >+ false); >+ newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false); >+ newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, false); >+ String buildKinds = config.getAttribute( >+ IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) null); >+ int[] triggers = BuilderCoreUtils.buildTypesToArray(buildKinds); >+ for (int i = 0; i < triggers.length; i++) { >+ switch (triggers[i]) { >+ case IncrementalProjectBuilder.FULL_BUILD: >+ newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, >+ true); >+ break; >+ case IncrementalProjectBuilder.INCREMENTAL_BUILD: >+ newCommand.setBuilding( >+ IncrementalProjectBuilder.INCREMENTAL_BUILD, true); >+ break; >+ case IncrementalProjectBuilder.AUTO_BUILD: >+ newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, >+ true); >+ break; >+ case IncrementalProjectBuilder.CLEAN_BUILD: >+ newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, >+ true); >+ break; >+ } >+ } >+ if (!config.getAttribute( >+ IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false)) { >+ ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy(); >+ copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, >+ true); >+ copy.doSave(); >+ } >+ } >+ >+ /** >+ * Returns whether the given configuration is an "unmigrated" builder. >+ * Unmigrated builders are external tools that are stored in an old format >+ * but have not been migrated by the user. Old format builders are always >+ * translated into launch config working copies in memory, but they're not >+ * considered "migrated" until the config has been saved and the project >+ * spec updated. >+ * >+ * @param config >+ * the config to examine >+ * @return whether the given config represents an unmigrated builder >+ */ >+ public static boolean isUnmigratedConfig(ILaunchConfiguration config) { >+ return config.isWorkingCopy() >+ && ((ILaunchConfigurationWorkingCopy) config).getOriginal() == null; >+ } >+ >+ /** >+ * Converts the given config to a build command which is stored in the given >+ * command. >+ * >+ * @return the configured build command >+ */ >+ public static ICommand toBuildCommand(IProject project, >+ ILaunchConfiguration config, ICommand command) throws CoreException { >+ Map args = null; >+ if (isUnmigratedConfig(config)) { >+ // This config represents an old external tool builder that hasn't >+ // been edited. Try to find the old ICommand and reuse the >+ // arguments. >+ // The goal here is to not change the storage format of old, >+ // unedited builders. >+ ICommand[] commands = project.getDescription().getBuildSpec(); >+ for (int i = 0; i < commands.length; i++) { >+ ICommand projectCommand = commands[i]; >+ String name = ExternalToolMigration >+ .getNameFromCommandArgs(projectCommand.getArguments()); >+ if (name != null && name.equals(config.getName())) { >+ args = projectCommand.getArguments(); >+ break; >+ } >+ } >+ } else { >+ if (config instanceof ILaunchConfigurationWorkingCopy) { >+ ILaunchConfigurationWorkingCopy workingCopy = (ILaunchConfigurationWorkingCopy) config; >+ if (workingCopy.getOriginal() != null) { >+ config = workingCopy.getOriginal(); >+ } >+ } >+ args = new HashMap(); >+ // Launch configuration builders are stored with a project-relative >+ // path >+ StringBuffer buffer = new StringBuffer(PROJECT_TAG); >+ // Append the project-relative path (workspace path minus first >+ // segment) >+ buffer.append('/').append( >+ config.getFile().getFullPath().removeFirstSegments(1)); >+ args.put(LAUNCH_CONFIG_HANDLE, buffer.toString()); >+ } >+ command.setBuilderName(ExternalToolBuilder.ID); >+ command.setArguments(args); >+ return command; >+ } >+ >+ /** >+ * Returns the folder where project builders should be stored or >+ * <code>null</code> if the folder could not be created >+ */ >+ public static IFolder getBuilderFolder(IProject project, boolean create) { >+ IFolder folder = project.getFolder(BUILDER_FOLDER_NAME); >+ if (!folder.exists() && create) { >+ try { >+ folder.create(true, true, new NullProgressMonitor()); >+ } catch (CoreException e) { >+ return null; >+ } >+ } >+ return folder; >+ } >+ >+ /** >+ * Migrates the launch configuration working copy, which is based on an old- >+ * style external tool builder, to a new, saved launch configuration. The >+ * returned launch configuration will contain the same attributes as the >+ * given working copy with the exception of the configuration name, which >+ * may be changed during the migration. The name of the configuration will >+ * only be changed if the current name is not a valid name for a saved >+ * config. >+ * >+ * @param workingCopy >+ * the launch configuration containing attributes from an >+ * old-style project builder. >+ * @return ILaunchConfiguration a new, saved launch configuration whose >+ * attributes match those of the given working copy as well as >+ * possible >+ * @throws CoreException >+ * if an exception occurs while attempting to save the new >+ * launch configuration >+ */ >+ public static ILaunchConfiguration migrateBuilderConfiguration( >+ IProject project, ILaunchConfigurationWorkingCopy workingCopy) >+ throws CoreException { >+ workingCopy.setContainer(getBuilderFolder(project, true)); >+ // Before saving, make sure the name is valid >+ String name = workingCopy.getName(); >+ name = name.replace('/', '.'); >+ if (name.charAt(0) == ('.')) { >+ name = name.substring(1); >+ } >+ IStatus status = ResourcesPlugin.getWorkspace().validateName(name, >+ IResource.FILE); >+ if (!status.isOK()) { >+ name = "ExternalTool"; //$NON-NLS-1$ >+ } >+ name = DebugPlugin.getDefault().getLaunchManager() >+ .generateUniqueLaunchConfigurationNameFrom(name); >+ workingCopy.rename(name); >+ return workingCopy.doSave(); >+ } >+ >+ /** >+ * Converts the build types string into an array of build kinds. >+ * >+ * @param buildTypes >+ * the string of built types to convert >+ * @return the array of build kinds. >+ */ >+ public static int[] buildTypesToArray(String buildTypes) { >+ if (buildTypes == null || buildTypes.length() == 0) { >+ return DEFAULT_BUILD_TYPES; >+ } >+ >+ int count = 0; >+ boolean incremental = false; >+ boolean full = false; >+ boolean auto = false; >+ boolean clean = false; >+ >+ StringTokenizer tokenizer = new StringTokenizer(buildTypes, >+ BUILD_TYPE_SEPARATOR); >+ while (tokenizer.hasMoreTokens()) { >+ String token = tokenizer.nextToken(); >+ if (IExternalToolConstants.BUILD_TYPE_INCREMENTAL.equals(token)) { >+ if (!incremental) { >+ incremental = true; >+ count++; >+ } >+ } else if (IExternalToolConstants.BUILD_TYPE_FULL.equals(token)) { >+ if (!full) { >+ full = true; >+ count++; >+ } >+ } else if (IExternalToolConstants.BUILD_TYPE_AUTO.equals(token)) { >+ if (!auto) { >+ auto = true; >+ count++; >+ } >+ } else if (IExternalToolConstants.BUILD_TYPE_CLEAN.equals(token)) { >+ if (!clean) { >+ clean = true; >+ count++; >+ } >+ } >+ } >+ >+ int[] results = new int[count]; >+ count = 0; >+ if (incremental) { >+ results[count] = IncrementalProjectBuilder.INCREMENTAL_BUILD; >+ count++; >+ } >+ if (full) { >+ results[count] = IncrementalProjectBuilder.FULL_BUILD; >+ count++; >+ } >+ if (auto) { >+ results[count] = IncrementalProjectBuilder.AUTO_BUILD; >+ count++; >+ } >+ if (clean) { >+ results[count] = IncrementalProjectBuilder.CLEAN_BUILD; >+ count++; >+ } >+ >+ return results; >+ } >+} >Index: src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java >diff -N src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,290 @@ >+/******************************************************************************* >+ * 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 >+ * Matthew Conway - Bug 175186 >+ *******************************************************************************/ >+package org.eclipse.core.externaltools.internal.model; >+ >+ >+import java.util.Map; >+ >+import org.eclipse.core.externaltools.internal.ExternalToolsCore; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; >+import org.eclipse.core.externaltools.internal.registry.ExternalToolMigration; >+import org.eclipse.core.resources.ICommand; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IProjectDescription; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IResourceDelta; >+import org.eclipse.core.resources.IResourceDeltaVisitor; >+import org.eclipse.core.resources.IncrementalProjectBuilder; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.debug.core.ILaunchManager; >+import org.eclipse.osgi.util.NLS; >+import org.osgi.framework.Bundle; >+ >+/** >+ * This project builder implementation will run an external tool during the >+ * build process. >+ */ >+public final class ExternalToolBuilder extends IncrementalProjectBuilder { >+ private final class IgnoreTeamPrivateChanges implements IResourceDeltaVisitor { >+ private boolean[] fTrueChange; >+ private IgnoreTeamPrivateChanges(boolean[] trueChange) { >+ super(); >+ fTrueChange= trueChange; >+ } >+ public boolean visit(IResourceDelta visitDelta) throws CoreException { >+ IResource resource= visitDelta.getResource(); >+ if (resource instanceof IFile) { >+ fTrueChange[0]= true; >+ return false; >+ } >+ return true; >+ } >+ } >+ >+ public static final String ID = "org.eclipse.ui.externaltools.ExternalToolBuilder"; //$NON-NLS-1$; >+ >+ private static String buildType = IExternalToolConstants.BUILD_TYPE_NONE; >+ >+ private static IProject buildProject= null; >+ private static IResourceDelta buildDelta= null; >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { >+ if (ExternalToolsCore.getDefault().getBundle().getState() != Bundle.ACTIVE) { >+ return null; >+ } >+ >+ ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[1]); >+ if (config == null) { >+ throw ExternalToolsCore.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null); >+ } >+ IProject[] projectsWithinScope= null; >+ IResource[] resources = ExternalToolsCoreUtil.getResourcesForBuildScope(config); >+ if (resources != null) { >+ projectsWithinScope= new IProject[resources.length]; >+ for (int i = 0; i < resources.length; i++) { >+ projectsWithinScope[i]= resources[i].getProject(); >+ } >+ } >+ boolean kindCompatible= commandConfiguredForKind(config, kind); >+ if (kindCompatible && configEnabled(config)) { >+ doBuildBasedOnScope(resources, kind, config, monitor); >+ } >+ >+ return projectsWithinScope; >+ } >+ >+ private boolean commandConfiguredForKind(ILaunchConfiguration config, int kind) { >+ try { >+ if (!(config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) { >+ ICommand command= getCommand(); >+ //adapt the builder command to make use of the 3.1 support for setting command build kinds >+ //this will only happen once for builder/command defined before the support existed >+ BuilderCoreUtils.configureTriggers(config, command); >+ IProjectDescription desc= getProject().getDescription(); >+ ICommand[] commands= desc.getBuildSpec(); >+ int index= getBuilderCommandIndex(commands, command); >+ if (index != -1) { >+ commands[index]= command; >+ desc.setBuildSpec(commands); >+ getProject().setDescription(desc, null); >+ ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); >+ copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true); >+ copy.doSave(); >+ } >+ return command.isBuilding(kind); >+ } >+ } catch (CoreException e) { >+ ExternalToolsCore.log(e); >+ return true; >+ } >+ return true; >+ } >+ >+ private int getBuilderCommandIndex(ICommand[] buildSpec, ICommand command) { >+ Map commandArgs= command.getArguments(); >+ if (commandArgs == null) { >+ return -1; >+ } >+ String handle= (String) commandArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE); >+ if (handle == null) { >+ return -1; >+ } >+ for (int i = 0; i < buildSpec.length; ++i) { >+ ICommand buildSpecCommand= buildSpec[i]; >+ if (ID.equals(buildSpecCommand.getBuilderName())) { >+ Map buildSpecArgs= buildSpecCommand.getArguments(); >+ if (buildSpecArgs != null) { >+ String buildSpecHandle= (String) buildSpecArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE); >+ if (handle.equals(buildSpecHandle)) { >+ return i; >+ } >+ } >+ } >+ } >+ return -1; >+ } >+ >+ /** >+ * Returns whether the given builder config is enabled or not. >+ * >+ * @param config the config to examine >+ * @return whether the config is enabled >+ */ >+ private boolean configEnabled(ILaunchConfiguration config) { >+ try { >+ return ExternalToolsCoreUtil.isBuilderEnabled(config); >+ } catch (CoreException e) { >+ ExternalToolsCore.log(e); >+ } >+ return true; >+ } >+ >+ private void doBuildBasedOnScope(IResource[] resources, int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException { >+ boolean buildForChange = true; >+ if (kind != FULL_BUILD) { //scope not applied for full builds >+ if (resources != null && resources.length > 0) { >+ buildForChange = buildScopeIndicatesBuild(resources); >+ } >+ } >+ >+ if (buildForChange) { >+ launchBuild(kind, config, monitor); >+ } >+ } >+ >+ private void launchBuild(int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException { >+ monitor.subTask(NLS.bind(ExternalToolsModelMessages.ExternalToolBuilder_Running__0_____1, new String[] { config.getName()})); >+ buildStarted(kind); >+ // The default value for "launch in background" is true in debug core. If >+ // the user doesn't go through the UI, the new attribute won't be set. This means >+ // that existing Ant builders will try to run in the background (and likely conflict with >+ // each other) without migration. >+ config= ExternalToolMigration.migrateRunInBackground(config); >+ config.launch(ILaunchManager.RUN_MODE, monitor); >+ buildEnded(); >+ } >+ >+ /** >+ * Returns the build type being performed if the >+ * external tool is being run as a project builder. >+ * >+ * @return one of the <code>IExternalToolConstants.BUILD_TYPE_*</code> constants. >+ */ >+ public static String getBuildType() { >+ return buildType; >+ } >+ >+ /** >+ * Returns the project that is being built and has triggered the current external >+ * tool builder. <code>null</code> is returned if no build is currently occurring. >+ * >+ * @return project being built or <code>null</code>. >+ */ >+ public static IProject getBuildProject() { >+ return buildProject; >+ } >+ >+ /** >+ * Returns the <code>IResourceDelta</code> that is being built and has triggered the current external >+ * tool builder. <code>null</code> is returned if no build is currently occurring. >+ * >+ * @return resource delta for the build or <code>null</code> >+ */ >+ public static IResourceDelta getBuildDelta() { >+ return buildDelta; >+ } >+ >+ /** >+ * Stores the currently active build kind and build project when a build begins >+ * @param buildKind >+ */ >+ private void buildStarted(int buildKind) { >+ switch (buildKind) { >+ case IncrementalProjectBuilder.INCREMENTAL_BUILD : >+ buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL; >+ buildDelta = getDelta(getProject()); >+ break; >+ case IncrementalProjectBuilder.FULL_BUILD : >+ buildType = IExternalToolConstants.BUILD_TYPE_FULL; >+ break; >+ case IncrementalProjectBuilder.AUTO_BUILD : >+ buildType = IExternalToolConstants.BUILD_TYPE_AUTO; >+ buildDelta = getDelta(getProject()); >+ break; >+ case IncrementalProjectBuilder.CLEAN_BUILD : >+ buildType = IExternalToolConstants.BUILD_TYPE_CLEAN; >+ break; >+ default : >+ buildType = IExternalToolConstants.BUILD_TYPE_NONE; >+ break; >+ } >+ buildProject= getProject(); >+ } >+ >+ /** >+ * Clears the current build kind, build project and build delta when a build finishes. >+ */ >+ private void buildEnded() { >+ buildType= IExternalToolConstants.BUILD_TYPE_NONE; >+ buildProject= null; >+ buildDelta= null; >+ } >+ >+ private boolean buildScopeIndicatesBuild(IResource[] resources) { >+ for (int i = 0; i < resources.length; i++) { >+ IResourceDelta delta = getDelta(resources[i].getProject()); >+ if (delta == null) { >+ //project just added to the workspace..no previous build tree >+ return true; >+ } >+ IPath path= resources[i].getProjectRelativePath(); >+ IResourceDelta change= delta.findMember(path); >+ if (change != null) { >+ final boolean[] trueChange= new boolean[1]; >+ trueChange[0]= false; >+ try { >+ change.accept(new IgnoreTeamPrivateChanges(trueChange)); >+ } catch (CoreException e) { >+ ExternalToolsCore.log("Internal error resolving changed resources during build", e); //$NON-NLS-1$ >+ } >+ >+ return trueChange[0]; //filtered out team private changes >+ } >+ } >+ return false; >+ } >+ >+ protected void clean(IProgressMonitor monitor) throws CoreException { >+ ICommand command= getCommand(); >+ ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), command.getArguments(), new String[1]); >+ if (!configEnabled(config)) { >+ return; >+ } >+ >+ if ((!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) { >+ //old behavior >+ super.clean(monitor); >+ return; >+ } >+ >+ launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, monitor); >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java >diff -N src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+/********************************************************************** >+ * 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.core.externaltools.internal.model; >+ >+import org.eclipse.osgi.util.NLS; >+ >+public class ExternalToolsModelMessages extends NLS { >+ private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.model.ExternalToolsModelMessages";//$NON-NLS-1$ >+ >+ public static String ExternalToolBuilder_Running__0_____1; >+ public static String ExternalToolBuilder_0; >+ >+ static { >+ // load message values from bundle file >+ NLS.initializeMessages(BUNDLE_NAME, ExternalToolsModelMessages.class); >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties >diff -N src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,13 @@ >+############################################################################### >+# 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 >+############################################################################### >+ >+ExternalToolBuilder_Running__0_____1=Running {0}... >+ExternalToolBuilder_0=The builder launch configuration could not be found. >Index: src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java >diff -N src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,410 @@ >+/******************************************************************************* >+ * 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.core.externaltools.internal.registry; >+ >+ >+import java.util.ArrayList; >+import java.util.Map; >+import java.util.StringTokenizer; >+ >+import org.eclipse.core.externaltools.internal.ExternalToolsCore; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.debug.core.ILaunchManager; >+import org.eclipse.debug.core.RefreshUtil; >+ >+ >+/** >+ * Responsible reading an old external tool format and creating >+ * and migrating it to create a new external tool. >+ */ >+public final class ExternalToolMigration { >+ /** >+ * Structure to represent a variable definition within a >+ * source string. >+ */ >+ public static final class VariableDefinition { >+ /** >+ * Index in the source text where the variable started >+ * or <code>-1</code> if no valid variable start tag >+ * identifier found. >+ */ >+ public int start = -1; >+ >+ /** >+ * Index in the source text of the character following >+ * the end of the variable or <code>-1</code> if no >+ * valid variable end tag found. >+ */ >+ public int end = -1; >+ >+ /** >+ * The variable's name found in the source text, or >+ * <code>null</code> if no valid variable found. >+ */ >+ public String name = null; >+ >+ /** >+ * The variable's argument found in the source text, or >+ * <code>null</code> if no valid variable found or if >+ * the variable did not specify an argument >+ */ >+ public String argument = null; >+ >+ /** >+ * Create an initialized variable definition. >+ */ >+ private VariableDefinition() { >+ super(); >+ } >+ } >+ >+ /** >+ * Variable tag indentifiers >+ */ >+ private static final String VAR_TAG_START = "${"; //$NON-NLS-1$ >+ private static final String VAR_TAG_END = "}"; //$NON-NLS-1$ >+ private static final String VAR_TAG_SEP = ":"; //$NON-NLS-1$ >+ >+ /** >+ * External tool type for Ant build files (value <code>antBuildType</code>). >+ */ >+ public static final String TOOL_TYPE_ANT_BUILD = "antBuildType"; //$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$ >+ >+ public static final String RUN_TARGETS_ATTRIBUTE = TOOL_TYPE_ANT_BUILD + ".runTargets"; //$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. >+ * NOTE: This value is copied here from org.eclipse.ant.ui.internal.IAntLaunchConfigurationConstants. >+ * Ant no longer resides in External Tools and this plug-in. This value is kept here only >+ * for migration. >+ */ >+ public static final String ATTR_ANT_TARGETS = IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_ANT_TARGETS"; //$NON-NLS-1$ >+ >+ /* >+ * 2.0 External Tool Tags >+ */ >+ public static final String TAG_TOOL_TYPE = "!{tool_type}"; //$NON-NLS-1$ >+ public static final String TAG_TOOL_NAME = "!{tool_name}"; //$NON-NLS-1$ >+ public static final String TAG_TOOL_LOCATION = "!{tool_loc}"; //$NON-NLS-1$ >+ public static final String TAG_TOOL_ARGUMENTS = "!{tool_args}"; //$NON-NLS-1$ >+ public static final String TAG_TOOL_DIRECTORY = "!{tool_dir}"; //$NON-NLS-1$ >+ public static final String TAG_TOOL_REFRESH = "!{tool_refresh}"; //$NON-NLS-1$ >+ public static final String TAG_TOOL_SHOW_LOG = "!{tool_show_log}"; //$NON-NLS-1$ >+ public static final String TAG_TOOL_BUILD_TYPES = "!{tool_build_types}"; //$NON-NLS-1$ >+ public static final String TAG_TOOL_BLOCK = "!{tool_block}"; //$NON-NLS-1$ >+ >+ // Known kind of tools >+ private static final String TOOL_TYPE_ANT = "org.eclipse.ui.externaltools.type.ant"; //$NON-NLS-1$ >+ private static final String TOOL_TYPE_PROGRAM = "org.eclipse.ui.externaltools.type.program"; //$NON-NLS-1$ >+ >+ /* >+ * 2.1 External Tool Keys >+ */ >+ public static final String TAG_TYPE = "type"; //$NON-NLS-1$ >+ public static final String TAG_NAME = "name"; //$NON-NLS-1$ >+ public static final String TAG_LOCATION = "location"; //$NON-NLS-1$ >+ public static final String TAG_WORK_DIR = "workDirectory"; //$NON-NLS-1$ >+ public static final String TAG_CAPTURE_OUTPUT = "captureOutput"; //$NON-NLS-1$ >+ public static final String TAG_SHOW_CONSOLE = "showConsole"; //$NON-NLS-1$ >+ public static final String TAG_RUN_BKGRND = "runInBackground"; //$NON-NLS-1$ >+ public static final String TAG_PROMPT_ARGS = "promptForArguments"; //$NON-NLS-1$ >+ public static final String TAG_ARGS = "arguments"; //$NON-NLS-1$ >+ public static final String TAG_REFRESH_SCOPE = "refreshScope"; //$NON-NLS-1$ >+ public static final String TAG_REFRESH_RECURSIVE = "refreshRecursive"; //$NON-NLS-1$ >+ public static final String TAG_RUN_BUILD_KINDS = "runForBuildKinds"; //$NON-NLS-1$ >+ public static final String TAG_EXTRA_ATTR = "extraAttribute"; //$NON-NLS-1$ >+ public static final String TAG_VERSION = "version"; //$NON-NLS-1$ >+ >+ private static final String EXTRA_ATTR_SEPARATOR = "="; //$NON-NLS-1$ >+ >+ private static final String VERSION_21 = "2.1"; //$NON-NLS-1$; >+ >+ private static final String TRUE = "true"; //$NON-NLS-1$ >+ private static final String FALSE = "false"; //$NON-NLS-1$ >+ >+ /** >+ * Allows no instances. >+ */ >+ private ExternalToolMigration() { >+ super(); >+ } >+ >+ /** >+ * Returns a launch configuration working copy from the argument map or >+ * <code>null</code> if the given map cannot be interpreted as a 2.0 or 2.1 >+ * branch external tool. The returned working copy will be unsaved and its >+ * location will be set to the metadata area. >+ */ >+ public static ILaunchConfigurationWorkingCopy configFromArgumentMap(Map args) { >+ String version = (String) args.get(TAG_VERSION); >+ if (VERSION_21.equals(version)) { >+ return configFrom21ArgumentMap(args); >+ } >+ return configFrom20ArgumentMap(args); >+ } >+ >+ public static ILaunchConfigurationWorkingCopy configFrom21ArgumentMap(Map commandArgs) { >+ String name = (String) commandArgs.get(TAG_NAME); >+ String type = (String) commandArgs.get(TAG_TYPE); >+ >+ ILaunchConfigurationWorkingCopy config = newConfig(type, name); >+ if (config == null) { >+ return null; >+ } >+ >+ config.setAttribute(IExternalToolConstants.ATTR_LOCATION, (String) commandArgs.get(TAG_LOCATION)); >+ config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) commandArgs.get(TAG_WORK_DIR)); >+ config.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, TRUE.equals(commandArgs.get(TAG_CAPTURE_OUTPUT))); >+ config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE.equals(commandArgs.get(TAG_SHOW_CONSOLE))); >+ config.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, TRUE.equals(commandArgs.get(TAG_RUN_BKGRND))); >+ config.setAttribute(IExternalToolConstants.ATTR_PROMPT_FOR_ARGUMENTS, TRUE.equals(commandArgs.get(TAG_PROMPT_ARGS))); >+ config.setAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, (String) commandArgs.get(TAG_REFRESH_SCOPE)); >+ config.setAttribute(RefreshUtil.ATTR_REFRESH_RECURSIVE, TRUE.equals(commandArgs.get(TAG_REFRESH_RECURSIVE))); >+ >+ config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) commandArgs.get(TAG_RUN_BUILD_KINDS)); >+ >+ String args = (String) commandArgs.get(TAG_ARGS); >+ if (args != null) { >+ config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, args); >+ } >+ >+ String extraAttributes = (String) commandArgs.get(TAG_EXTRA_ATTR); >+ if (extraAttributes != null) { >+ StringTokenizer tokenizer = new StringTokenizer(extraAttributes, EXTRA_ATTR_SEPARATOR); >+ while (tokenizer.hasMoreTokens()) { >+ String key = tokenizer.nextToken(); >+ if (!tokenizer.hasMoreTokens()) >+ break; >+ String value = tokenizer.nextToken(); >+ if (key.equals(RUN_TARGETS_ATTRIBUTE)) { >+ // 2.1 implementation only defined 1 "extra attribute" >+ config.setAttribute(ATTR_ANT_TARGETS, value); >+ } >+ } >+ } >+ return config; >+ } >+ >+ /** >+ * Creates an external tool from the map. >+ */ >+ public static ILaunchConfigurationWorkingCopy configFrom20ArgumentMap(Map args) { >+ // Update the type... >+ String type = (String) args.get(TAG_TOOL_TYPE); >+ if (TOOL_TYPE_ANT.equals(type)) { >+ type = TOOL_TYPE_ANT_BUILD; >+ } else if (TOOL_TYPE_PROGRAM.equals(type)){ >+ type = IExternalToolConstants.TOOL_TYPE_PROGRAM; >+ } else { >+ return null; >+ } >+ >+ String name = (String) args.get(TAG_TOOL_NAME); >+ >+ ILaunchConfigurationWorkingCopy config = newConfig(type, name); >+ if (config == null) { >+ return null; >+ } >+ >+ // Update the location... >+ String location = (String) args.get(TAG_TOOL_LOCATION); >+ config.setAttribute(IExternalToolConstants.ATTR_LOCATION, location); >+ >+ // Update the refresh scope... >+ String refresh = (String) args.get(TAG_TOOL_REFRESH); >+ if (refresh != null) { >+ VariableDefinition varDef = extractVariableDefinition(refresh, 0); >+ if ("none".equals(varDef.name)) { //$NON-NLS-1$ >+ refresh = null; >+ } >+ config.setAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, refresh); >+ } >+ >+ // Update the arguments >+ String arguments = (String) args.get(TAG_TOOL_ARGUMENTS); >+ if (type.equals(TOOL_TYPE_ANT_BUILD)) { >+ String targetNames = null; >+ if (arguments != null) { >+ int start = 0; >+ ArrayList targets = new ArrayList(); >+ StringBuffer buffer = new StringBuffer(); >+ VariableDefinition varDef = extractVariableDefinition(arguments, start); >+ while (varDef.end != -1) { >+ if ("ant_target".equals(varDef.name) && varDef.argument != null) { //$NON-NLS-1$ >+ targets.add(varDef.argument); >+ buffer.append(arguments.substring(start, varDef.start)); >+ } else { >+ buffer.append(arguments.substring(start, varDef.end)); >+ } >+ start = varDef.end; >+ varDef = extractVariableDefinition(arguments, start); >+ } >+ buffer.append(arguments.substring(start, arguments.length())); >+ arguments = buffer.toString(); >+ >+ buffer.setLength(0); >+ for (int i = 0; i < targets.size(); i++) { >+ String target = (String) targets.get(i); >+ if (target != null && target.length() > 0) { >+ buffer.append(target); >+ buffer.append(","); //$NON-NLS-1$ >+ } >+ } >+ targetNames = buffer.toString(); >+ } >+ if (targetNames != null && targetNames.length() > 0) { >+ config.setAttribute(ATTR_ANT_TARGETS, targetNames); >+ } >+ } >+ config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments); >+ >+ // Collect the rest of the information >+ config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE.equals(args.get(TAG_TOOL_SHOW_LOG))); >+ config.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, TRUE.equals(args.get(TAG_TOOL_SHOW_LOG))); >+ config.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, FALSE.equals(args.get(TAG_TOOL_BLOCK))); >+ String buildKinds= (String) args.get(TAG_TOOL_BUILD_TYPES); >+ if (buildKinds != null) { >+ buildKinds= buildKinds.replace(';', ','); // Replace the old separator with the new >+ } >+ config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buildKinds); >+ config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) args.get(TAG_TOOL_DIRECTORY)); >+ return config; >+ } >+ >+ /** >+ * Returns a new working copy with the given external tool name and external >+ * tool type or <code>null</code> if no config could be created. >+ */ >+ private static ILaunchConfigurationWorkingCopy newConfig(String type, String name) { >+ if (type == null || name == null) { >+ return null; >+ } >+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); >+ ILaunchConfigurationType configType; >+ if (TOOL_TYPE_ANT_BUILD.equals(type)) { >+ configType = manager.getLaunchConfigurationType(ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE); >+ } else if (IExternalToolConstants.TOOL_TYPE_PROGRAM.equals(type)) { >+ configType = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE); >+ } else { >+ return null; >+ } >+ try { >+ if (configType != null) { >+ return configType.newInstance(null, name); >+ } >+ } catch (CoreException e) { >+ ExternalToolsCore.log(e); >+ } >+ return null; >+ } >+ >+ /** >+ * Returns the tool name extracted from the given command argument map. >+ * Extraction is attempted using 2.0 and 2.1 external tool formats. >+ */ >+ public static String getNameFromCommandArgs(Map commandArgs) { >+ String name= (String) commandArgs.get(TAG_NAME); >+ if (name == null) { >+ name= (String) commandArgs.get(TAG_TOOL_NAME); >+ } >+ return name; >+ } >+ >+ /** >+ * Migrate the old RUN_IN_BACKGROUND launch config attribute to the new >+ * LAUNCH_IN_BACKGROUND attribute provided by the debug ui plugin. >+ * >+ * @param config the config to migrate >+ * @return the migrated config >+ */ >+ public static ILaunchConfiguration migrateRunInBackground(ILaunchConfiguration config) { >+ String noValueFlag= "NoValue"; //$NON-NLS-1$ >+ String attr= null; >+ try { >+ attr = config.getAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, noValueFlag); >+ } catch (CoreException e) { >+ // Exception will occur if the attribute is already set because the attribute is actually a boolean. >+ // No migration necessary. >+ return config; >+ } >+ if (noValueFlag.equals(attr)) { >+ //the old constant >+ String ATTR_RUN_IN_BACKGROUND= IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_RUN_IN_BACKGROUND"; //$NON-NLS-1$ >+ boolean runInBackground= false; >+ try { >+ runInBackground = config.getAttribute(ATTR_RUN_IN_BACKGROUND, runInBackground); >+ } catch (CoreException e) { >+ ExternalToolsCore.log(ExternalToolsMigrationMessages.ExternalToolMigration_37, e); >+ } >+ try { >+ ILaunchConfigurationWorkingCopy workingCopy= config.getWorkingCopy(); >+ workingCopy.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, runInBackground); >+ config= workingCopy.doSave(); >+ } catch (CoreException e) { >+ ExternalToolsCore.log(ExternalToolsMigrationMessages.ExternalToolMigration_38, e); >+ } >+ } >+ return config; >+ } >+ >+ /** >+ * Extracts a variable name and argument from the given string. >+ * >+ * @param text the source text to parse for a variable tag >+ * @param start the index in the string to start the search >+ * @return the variable definition >+ */ >+ public static VariableDefinition extractVariableDefinition(String text, int start) { >+ VariableDefinition varDef = new VariableDefinition(); >+ >+ varDef.start = text.indexOf(VAR_TAG_START, start); >+ if (varDef.start < 0){ >+ return varDef; >+ } >+ start = varDef.start + VAR_TAG_START.length(); >+ >+ int end = text.indexOf(VAR_TAG_END, start); >+ if (end < 0) { >+ return varDef; >+ } >+ varDef.end = end + VAR_TAG_END.length(); >+ if (end == start) { >+ return varDef; >+ } >+ >+ int mid = text.indexOf(VAR_TAG_SEP, start); >+ if (mid < 0 || mid > end) { >+ varDef.name = text.substring(start, end); >+ } else { >+ if (mid > start) { >+ varDef.name = text.substring(start, mid); >+ } >+ mid = mid + VAR_TAG_SEP.length(); >+ if (mid < end) { >+ varDef.argument = text.substring(mid, end); >+ } >+ } >+ >+ return varDef; >+ } >+} >Index: src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java >diff -N src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -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.core.externaltools.internal.registry; >+ >+import org.eclipse.osgi.util.NLS; >+ >+public class ExternalToolsMigrationMessages extends NLS { >+ private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.registry.launchConfigurations.ExternalToolsUIMessages";//$NON-NLS-1$ >+ >+ public static String ExternalToolMigration_37; >+ public static String ExternalToolMigration_38; >+ >+ static { >+ // load message values from bundle file >+ NLS.initializeMessages(BUNDLE_NAME, >+ ExternalToolsMigrationMessages.class); >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties >=================================================================== >RCS file: src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties >diff -N src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,13 @@ >+############################################################################### >+# 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 >+############################################################################### >+ >+ExternalToolMigration_37=An exception occurred accessing external tool\'s \"run in background\" attribute >+ExternalToolMigration_38=An exception occurred attempting to migrate external tool\'s \"run in background\" attribute >Index: src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java >diff -N src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java >--- src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java 16 Sep 2009 14:58:41 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,60 +0,0 @@ >-/******************************************************************************* >- * 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.core.internal.externaltools; >- >-import org.eclipse.core.runtime.Plugin; >-import org.osgi.framework.BundleContext; >- >-/** >- * Controls the plug-in life cycle >- */ >-public class ExternalToolsCore extends Plugin { >- >- // The plug-in ID >- public static final String PLUGIN_ID = "org.eclipse.core.externaltools"; //$NON-NLS-1$ >- >- // The shared instance >- private static ExternalToolsCore plugin; >- >- /** >- * The constructor >- */ >- public ExternalToolsCore() { >- } >- >- /* >- * (non-Javadoc) >- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) >- */ >- public void start(BundleContext context) throws Exception { >- super.start(context); >- plugin = this; >- } >- >- /* >- * (non-Javadoc) >- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) >- */ >- public void stop(BundleContext context) throws Exception { >- plugin = null; >- super.stop(context); >- } >- >- /** >- * Returns the shared instance >- * >- * @return the shared instance >- */ >- public static ExternalToolsCore getDefault() { >- return plugin; >- } >- >-} >#P org.eclipse.ui.externaltools >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java,v >retrieving revision 1.1 >diff -u -r1.1 ExternalToolsBuildTab.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java 30 Jul 2007 02:21:16 -0000 1.1 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java 7 Oct 2009 20:08:28 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * 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 >@@ -16,16 +16,15 @@ > import java.util.Iterator; > import java.util.List; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; > import org.eclipse.core.resources.IProject; >-import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IWorkspace; >-import org.eclipse.core.resources.IWorkspaceRoot; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; >-import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.jface.viewers.IStructuredContentProvider; > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.jface.window.Window; >@@ -41,7 +40,6 @@ > import org.eclipse.ui.dialogs.ListSelectionDialog; > import org.eclipse.ui.externaltools.internal.model.ExternalToolsImages; > import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > import org.eclipse.ui.model.WorkbenchLabelProvider; > > /** >@@ -330,37 +328,9 @@ > * @return collection of projects referred to by configuration > */ > public static IProject[] getBuildProjects(ILaunchConfiguration configuration, String buildScopeId) { >- String scope = null; >- String id = buildScopeId ; >- if (id == null) { >- id = IExternalToolConstants.ATTR_BUILD_SCOPE ; >- } >- try { >- scope = configuration.getAttribute(id, (String)null); >- } catch (CoreException e) { >- return null; >- } >- if (scope == null) { >- return null; >- } >- if (scope.startsWith("${projects:")) { //$NON-NLS-1$ >- String pathString = scope.substring(11, scope.length() - 1); >- if (pathString.length() > 1) { >- String[] names = pathString.split(","); //$NON-NLS-1$ >- IProject[] projects = new IProject[names.length]; >- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); >- for (int i = 0; i < names.length; i++) { >- projects[i] = root.getProject(names[i]); >- } >- return projects; >- } >- } else if (scope.equals("${project}")) { //$NON-NLS-1$ >- IResource resource = DebugUITools.getSelectedResource(); >- if (resource != null) { >- return new IProject[]{resource.getProject()}; >- } >- } >- return new IProject[0]; >+ return ExternalToolsCoreUtil.getBuildProjects(configuration, >+ buildScopeId); >+ > } > > /** >@@ -372,11 +342,8 @@ > * @throws CoreException if unable to access the associated attribute > */ > public static boolean isIncludeReferencedProjects(ILaunchConfiguration configuration, String includeReferencedProjectsId) throws CoreException { >- String id = includeReferencedProjectsId; >- if (id == null) { >- id = IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS ; >- } >- return configuration.getAttribute(id, true); >+ return ExternalToolsCoreUtil.isIncludeReferencedProjects(configuration, >+ includeReferencedProjectsId); > } > > /** >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java,v >retrieving revision 1.47 >diff -u -r1.47 ExternalToolsBuilderTab.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java 30 Jul 2007 02:21:16 -0000 1.47 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java 7 Oct 2009 20:08:28 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * 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 >@@ -12,6 +12,8 @@ > package org.eclipse.ui.externaltools.internal.launchConfigurations; > > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IncrementalProjectBuilder; > import org.eclipse.core.resources.ResourcesPlugin; >@@ -50,7 +52,6 @@ > import org.eclipse.ui.dialogs.IWorkingSetEditWizard; > import org.eclipse.ui.externaltools.internal.model.BuilderUtils; > import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds; > import org.eclipse.ui.ide.IDE; > import org.eclipse.ui.model.WorkbenchContentProvider; >@@ -358,7 +359,7 @@ > } > > protected void updateRunInBackground(ILaunchConfiguration configuration) { >- fLaunchInBackgroundButton.setSelection(isLaunchInBackground(configuration)); >+ fLaunchInBackgroundButton.setSelection(ExternalToolsCoreUtil.isAsynchronousBuild(configuration)); > } > > private void updateConsoleOutput(ILaunchConfiguration configuration) { >@@ -386,22 +387,6 @@ > fVariables.setEnabled(haveOutputFile); > fAppend.setEnabled(haveOutputFile); > } >- >- /** >- * Returns whether the given configuration should be run in the background. >- * >- * @param configuration the configuration >- * @return whether the configuration is configured to run in the background >- */ >- public static boolean isLaunchInBackground(ILaunchConfiguration configuration) { >- boolean launchInBackground= false; >- try { >- launchInBackground= configuration.getAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false); >- } catch (CoreException ce) { >- ExternalToolsPlugin.getDefault().log(ce); >- } >- return launchInBackground; >- } > > /* (non-Javadoc) > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java,v >retrieving revision 1.8 >diff -u -r1.8 ExternalToolsLaunchConfigurationMessages.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java 30 Jul 2007 02:21:16 -0000 1.8 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java 7 Oct 2009 20:08:28 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved. This >+ * 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 >@@ -48,11 +48,6 @@ > public static String ExternalToolsBuildTab_8; > public static String ExternalToolsBuildTab_9; > >- >- public static String ExternalToolsUtil_Location_not_specified_by__0__1; >- public static String ExternalToolsUtil_invalidLocation__0_; >- public static String ExternalToolsUtil_invalidDirectory__0_; >- > public static String ExternalToolsBuilderTab_Run_this_builder_for__1; > public static String ExternalToolsBuilderTab__Full_builds_2; > public static String ExternalToolsBuilderTab_Full; >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties,v >retrieving revision 1.37 >diff -u -r1.37 ExternalToolsLaunchConfigurationMessages.properties >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties 30 Jul 2007 02:21:16 -0000 1.37 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties 7 Oct 2009 20:08:28 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2007 IBM Corporation and others. >+# 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 >@@ -43,10 +43,6 @@ > ExternalToolsBuildTab_8=Build > ExternalToolsBuildTab_9=No projects specified > >-ExternalToolsUtil_Location_not_specified_by__0__1=Location not specified by {0} >-ExternalToolsUtil_invalidLocation__0_ = The file does not exist for the external tool named {0}. >-ExternalToolsUtil_invalidDirectory__0_ = The working directory {0} does not exist for the external tool named {1}. >- > ExternalToolsBuilderTab_Run_this_builder_for__1=Run the builder: > ExternalToolsBuilderTab__Full_builds_2=A&fter a \"Clean\" > ExternalToolsBuilderTab_Full=Runs on the first build that occurs after a clean. >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java,v >retrieving revision 1.60 >diff -u -r1.60 ExternalToolsMainTab.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java 23 Mar 2006 19:03:12 -0000 1.60 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * 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 >@@ -12,6 +12,8 @@ > > > import java.io.File; >+ >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; >@@ -46,7 +48,6 @@ > import org.eclipse.ui.dialogs.ResourceSelectionDialog; > import org.eclipse.ui.externaltools.internal.model.ExternalToolsImages; > import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > /** > * The external tools main tab allows the user to configure primary attributes >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java,v >retrieving revision 1.47 >diff -u -r1.47 ExternalToolsUtil.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java 30 Jul 2007 02:21:16 -0000 1.47 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * 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 >@@ -13,21 +13,14 @@ > package org.eclipse.ui.externaltools.internal.launchConfigurations; > > >-import java.io.File; >- >+import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.Status; >-import org.eclipse.core.variables.IStringVariableManager; >-import org.eclipse.core.variables.VariablesPlugin; >-import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.ui.RefreshTab; >-import org.eclipse.osgi.util.NLS; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >+import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; > > /** > * Utilities for external tool launch configurations. >@@ -47,7 +40,7 @@ > * @param code error code > */ > protected static void abort(String message, Throwable exception, int code) throws CoreException { >- throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, code, message, exception)); >+ throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, code, message, exception)); > } > > /** >@@ -63,26 +56,7 @@ > * system > */ > public static IPath getLocation(ILaunchConfiguration configuration) throws CoreException { >- String location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null); >- if (location == null) { >- abort(NLS.bind(ExternalToolsLaunchConfigurationMessages.ExternalToolsUtil_Location_not_specified_by__0__1, new String[] { configuration.getName()}), null, 0); >- } else { >- String expandedLocation = getStringVariableManager().performStringSubstitution(location); >- if (expandedLocation == null || expandedLocation.length() == 0) { >- String msg = NLS.bind(ExternalToolsLaunchConfigurationMessages.ExternalToolsUtil_invalidLocation__0_, new Object[] { configuration.getName()}); >- abort(msg, null, 0); >- } else { >- File file = new File(expandedLocation); >- if (file.isFile()) { >- return new Path(expandedLocation); >- } >- >- String msg = NLS.bind(ExternalToolsLaunchConfigurationMessages.ExternalToolsUtil_invalidLocation__0_, new Object[] { configuration.getName()}); >- abort(msg, null, 0); >- } >- } >- // execution will not reach here >- return null; >+ return ExternalToolsCoreUtil.getLocation(configuration); > } > > /** >@@ -95,7 +69,7 @@ > * @throws CoreException if unable to access the associated attribute > */ > public static boolean getCaptureOutput(ILaunchConfiguration configuration) throws CoreException { >- return configuration.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true); >+ return ExternalToolsCoreUtil.getCaptureOutput(configuration); > } > > /** >@@ -113,19 +87,7 @@ > * file system > */ > public static IPath getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException { >- String location = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) null); >- if (location != null) { >- String expandedLocation = getStringVariableManager().performStringSubstitution(location); >- if (expandedLocation.length() > 0) { >- File path = new File(expandedLocation); >- if (path.isDirectory()) { >- return new Path(expandedLocation); >- } >- String msg = NLS.bind(ExternalToolsLaunchConfigurationMessages.ExternalToolsUtil_invalidDirectory__0_, new Object[] { expandedLocation, configuration.getName()}); >- abort(msg, null, 0); >- } >- } >- return null; >+ return ExternalToolsCoreUtil.getWorkingDirectory(configuration); > } > > /** >@@ -139,16 +101,7 @@ > * configuration attribute, or if unable to resolve any variables > */ > public static String[] getArguments(ILaunchConfiguration configuration) throws CoreException { >- String args = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null); >- if (args != null) { >- String expanded = getStringVariableManager().performStringSubstitution(args); >- return parseStringIntoList(expanded); >- } >- return null; >- } >- >- private static IStringVariableManager getStringVariableManager() { >- return VariablesPlugin.getDefault().getStringVariableManager(); >+ return ExternalToolsCoreUtil.getArguments(configuration); > } > > /** >@@ -163,7 +116,7 @@ > * @throws CoreException if unable to access the associated attribute > */ > public static boolean isBuilderEnabled(ILaunchConfiguration configuration) throws CoreException { >- return configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_ENABLED, true); >+ return ExternalToolsCoreUtil.isBuilderEnabled(configuration); > } > > /** >@@ -173,12 +126,7 @@ > * @throws CoreException if an exception occurs while retrieving the resources > */ > public static IResource[] getResourcesForBuildScope(ILaunchConfiguration configuration) throws CoreException { >- String scope = configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, (String) null); >- if (scope == null) { >- return null; >- } >- >- return RefreshTab.getRefreshResources(scope); >+ return ExternalToolsCoreUtil.getResourcesForBuildScope(configuration); > } > > /** >@@ -193,11 +141,7 @@ > * @return the array of arguments > */ > public static String[] parseStringIntoList(String arguments) { >- if (arguments == null || arguments.length() == 0) { >- return new String[0]; >- } >- String[] res= DebugPlugin.parseArguments(arguments); >- return res; >+ return ExternalToolsCoreUtil.parseStringIntoList(arguments); > } > > } >Index: External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java,v >retrieving revision 1.17 >diff -u -r1.17 ExternalToolMenuDelegate.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java 23 Feb 2005 16:02:16 -0000 1.17 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * 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 >@@ -10,9 +10,9 @@ > *******************************************************************************/ > package org.eclipse.ui.externaltools.internal.menu; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.debug.ui.actions.AbstractLaunchToolbarAction; > import org.eclipse.jface.action.IAction; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > /** > * This action delegate is responsible for producing the >Index: External Tools Base/org/eclipse/ui/externaltools/internal/menu/OpenExternalToolsConfigurations.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/OpenExternalToolsConfigurations.java,v >retrieving revision 1.3 >diff -u -r1.3 OpenExternalToolsConfigurations.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/menu/OpenExternalToolsConfigurations.java 23 Feb 2005 16:02:16 -0000 1.3 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/menu/OpenExternalToolsConfigurations.java 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * 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 >@@ -10,8 +10,8 @@ > *******************************************************************************/ > package org.eclipse.ui.externaltools.internal.menu; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.debug.ui.actions.OpenLaunchDialogAction; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > /** > * Opens the launch config dialog on the external tools launch group. >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java,v >retrieving revision 1.17 >diff -u -r1.17 BuilderUtils.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java 23 Mar 2006 19:03:12 -0000 1.17 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * 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 >@@ -10,66 +10,33 @@ > *******************************************************************************/ > package org.eclipse.ui.externaltools.internal.model; > >-import java.util.HashMap; > import java.util.Map; >-import java.util.StringTokenizer; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.model.BuilderCoreUtils; > import org.eclipse.core.resources.ICommand; >-import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IFolder; > import org.eclipse.core.resources.IProject; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.IncrementalProjectBuilder; >-import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.IExtensionPoint; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.NullProgressMonitor; >-import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.Platform; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationType; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >-import org.eclipse.debug.core.ILaunchManager; > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.swt.widgets.Shell; >-import org.eclipse.ui.externaltools.internal.registry.ExternalToolMigration; > > /** > * Utility methods for working with external tool project builders. > */ > public class BuilderUtils { >- >- public static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$ >- >- /** >- * Constant used to find a builder using the 3.0-interim format >- */ >- public static final String BUILDER_FOLDER_NAME= ".externalToolBuilders"; //$NON-NLS-1$ >- /** >- * Constant used to represent the current project in the 3.0-final format. >- */ >- public static final String PROJECT_TAG= "<project>"; //$NON-NLS-1$ >- >- public static final String VERSION_1_0= "1.0"; //$NON-NLS-1$ >- public static final String VERSION_2_1= "2.1"; //$NON-NLS-1$ >- // The format shipped up to and including Eclipse 3.0 RC1 >- public static final String VERSION_3_0_interim= "3.0.interim"; //$NON-NLS-1$ >- // The format shipped in Eclipse 3.0 final >- public static final String VERSION_3_0_final= "3.0"; //$NON-NLS-1$ > > // Extension point constants. >- private static final String TAG_CONFIGURATION_MAP= "configurationMap"; //$NON-NLS-1$ >- private static final String TAG_SOURCE_TYPE= "sourceType"; //$NON-NLS-1$ >- private static final String TAG_BUILDER_TYPE= "builderType"; //$NON-NLS-1$ >- >- private static final String BUILD_TYPE_SEPARATOR = ","; //$NON-NLS-1$ >- private static final int[] DEFAULT_BUILD_TYPES= new int[] { >- IncrementalProjectBuilder.INCREMENTAL_BUILD, >- IncrementalProjectBuilder.FULL_BUILD}; >+ private static final String TAG_CONFIGURATION_MAP = "configurationMap"; //$NON-NLS-1$ >+ private static final String TAG_SOURCE_TYPE = "sourceType"; //$NON-NLS-1$ >+ private static final String TAG_BUILDER_TYPE = "builderType"; //$NON-NLS-1$ > > /** > * Returns a launch configuration from the given ICommand arguments. If the >@@ -81,42 +48,7 @@ > * <code>null</code> if not possible. > */ > public static ILaunchConfiguration configFromBuildCommandArgs(IProject project, Map commandArgs, String[] version) { >- String configHandle = (String) commandArgs.get(LAUNCH_CONFIG_HANDLE); >- if (configHandle == null) { >- // Probably an old-style (Eclipse 1.0 or 2.0) external tool. Try to migrate. >- version[0]= VERSION_1_0; >- return ExternalToolMigration.configFromArgumentMap(commandArgs); >- } >- ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager(); >- ILaunchConfiguration configuration= null; >- if (configHandle.startsWith(PROJECT_TAG)) { >- version[0]= VERSION_3_0_final; >- IPath path= new Path(configHandle); >- IFile file= project.getFile(path.removeFirstSegments(1)); >- if (file.exists()) { >- configuration= manager.getLaunchConfiguration(file); >- } >- } else { >- // Try treating the handle as a file name. >- // This is the format used in 3.0 RC1. >- IPath path= new Path(BUILDER_FOLDER_NAME).append(configHandle); >- IFile file= project.getFile(path); >- if (file.exists()) { >- version[0]= VERSION_3_0_interim; >- configuration= manager.getLaunchConfiguration(file); >- } else { >- try { >- // Treat the configHandle as a memento. This is the format >- // used in Eclipse 2.1. >- configuration = manager.getLaunchConfiguration(configHandle); >- } catch (CoreException e) { >- } >- if (configuration != null) { >- version[0]= VERSION_2_1; >- } >- } >- } >- return configuration; >+ return BuilderCoreUtils.configFromBuildCommandArgs(project, commandArgs, version); > } > > /** >@@ -144,33 +76,7 @@ > } > > public static void configureTriggers(ILaunchConfiguration config, ICommand newCommand) throws CoreException { >- newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, false); >- newCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, false); >- newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false); >- newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, false); >- String buildKinds= config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String)null); >- int[] triggers= BuilderUtils.buildTypesToArray(buildKinds); >- for (int i = 0; i < triggers.length; i++) { >- switch (triggers[i]) { >- case IncrementalProjectBuilder.FULL_BUILD: >- newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true); >- break; >- case IncrementalProjectBuilder.INCREMENTAL_BUILD: >- newCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, true); >- break; >- case IncrementalProjectBuilder.AUTO_BUILD: >- newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, true); >- break; >- case IncrementalProjectBuilder.CLEAN_BUILD: >- newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, true); >- break; >- } >- } >- if (!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false)) { >- ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); >- copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true); >- copy.doSave(); >- } >+ BuilderCoreUtils.configureTriggers(config, newCommand); > } > > /** >@@ -184,7 +90,7 @@ > * @return whether the given config represents an unmigrated builder > */ > public static boolean isUnmigratedConfig(ILaunchConfiguration config) { >- return config.isWorkingCopy() && ((ILaunchConfigurationWorkingCopy) config).getOriginal() == null; >+ return BuilderCoreUtils.isUnmigratedConfig(config); > } > > /** >@@ -194,37 +100,7 @@ > * @return the configured build command > */ > public static ICommand toBuildCommand(IProject project, ILaunchConfiguration config, ICommand command) throws CoreException { >- Map args= null; >- if (isUnmigratedConfig(config)) { >- // This config represents an old external tool builder that hasn't >- // been edited. Try to find the old ICommand and reuse the arguments. >- // The goal here is to not change the storage format of old, unedited builders. >- ICommand[] commands= project.getDescription().getBuildSpec(); >- for (int i = 0; i < commands.length; i++) { >- ICommand projectCommand = commands[i]; >- String name= ExternalToolMigration.getNameFromCommandArgs(projectCommand.getArguments()); >- if (name != null && name.equals(config.getName())) { >- args= projectCommand.getArguments(); >- break; >- } >- } >- } else { >- if (config instanceof ILaunchConfigurationWorkingCopy) { >- ILaunchConfigurationWorkingCopy workingCopy= (ILaunchConfigurationWorkingCopy) config; >- if (workingCopy.getOriginal() != null) { >- config= workingCopy.getOriginal(); >- } >- } >- args= new HashMap(); >- // Launch configuration builders are stored with a project-relative path >- StringBuffer buffer= new StringBuffer(PROJECT_TAG); >- // Append the project-relative path (workspace path minus first segment) >- buffer.append('/').append(config.getFile().getFullPath().removeFirstSegments(1)); >- args.put(LAUNCH_CONFIG_HANDLE, buffer.toString()); >- } >- command.setBuilderName(ExternalToolBuilder.ID); >- command.setArguments(args); >- return command; >+ return BuilderCoreUtils.toBuildCommand(project, config, command); > } > > /** >@@ -233,7 +109,7 @@ > * if an extension has been specified to explicitly declare the mapping. > */ > public static ILaunchConfigurationType getConfigurationDuplicationType(ILaunchConfiguration config) throws CoreException { >- IExtensionPoint ep= Platform.getExtensionRegistry().getExtensionPoint(IExternalToolConstants.PLUGIN_ID, IExternalToolConstants.EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS); >+ IExtensionPoint ep= Platform.getExtensionRegistry().getExtensionPoint(ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS); > IConfigurationElement[] elements = ep.getConfigurationElements(); > String sourceType= config.getType().getIdentifier(); > String builderType= null; >@@ -258,15 +134,7 @@ > * <code>null</code> if the folder could not be created > */ > public static IFolder getBuilderFolder(IProject project, boolean create) { >- IFolder folder = project.getFolder(BUILDER_FOLDER_NAME); >- if (!folder.exists() && create) { >- try { >- folder.create(true, true, new NullProgressMonitor()); >- } catch (CoreException e) { >- return null; >- } >- } >- return folder; >+ return BuilderCoreUtils.getBuilderFolder(project, create); > } > > /** >@@ -302,22 +170,9 @@ > * new launch configuration > */ > public static ILaunchConfiguration migrateBuilderConfiguration(IProject project, ILaunchConfigurationWorkingCopy workingCopy) throws CoreException { >- workingCopy.setContainer(getBuilderFolder(project, true)); >- // Before saving, make sure the name is valid >- String name= workingCopy.getName(); >- name= name.replace('/', '.'); >- if (name.charAt(0) == ('.')) { >- name = name.substring(1); >- } >- IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE); >- if (!status.isOK()) { >- name = "ExternalTool"; //$NON-NLS-1$ >- } >- name = DebugPlugin.getDefault().getLaunchManager().generateUniqueLaunchConfigurationNameFrom(name); >- workingCopy.rename(name); >- return workingCopy.doSave(); >+ return BuilderCoreUtils.migrateBuilderConfiguration(project, workingCopy); > } >- >+ > /** > * Converts the build types string into an array of > * build kinds. >@@ -326,61 +181,6 @@ > * @return the array of build kinds. > */ > public static int[] buildTypesToArray(String buildTypes) { >- if (buildTypes == null || buildTypes.length() == 0) { >- return DEFAULT_BUILD_TYPES; >- } >- >- int count = 0; >- boolean incremental = false; >- boolean full = false; >- boolean auto = false; >- boolean clean= false; >- >- StringTokenizer tokenizer = new StringTokenizer(buildTypes, BUILD_TYPE_SEPARATOR); >- while (tokenizer.hasMoreTokens()) { >- String token = tokenizer.nextToken(); >- if (IExternalToolConstants.BUILD_TYPE_INCREMENTAL.equals(token)) { >- if (!incremental) { >- incremental = true; >- count++; >- } >- } else if (IExternalToolConstants.BUILD_TYPE_FULL.equals(token)) { >- if (!full) { >- full = true; >- count++; >- } >- } else if (IExternalToolConstants.BUILD_TYPE_AUTO.equals(token)) { >- if (!auto) { >- auto = true; >- count++; >- } >- } else if (IExternalToolConstants.BUILD_TYPE_CLEAN.equals(token)) { >- if (!clean) { >- clean = true; >- count++; >- } >- } >- } >- >- int[] results = new int[count]; >- count = 0; >- if (incremental) { >- results[count] = IncrementalProjectBuilder.INCREMENTAL_BUILD; >- count++; >- } >- if (full) { >- results[count] = IncrementalProjectBuilder.FULL_BUILD; >- count++; >- } >- if (auto) { >- results[count] = IncrementalProjectBuilder.AUTO_BUILD; >- count++; >- } >- if (clean) { >- results[count] = IncrementalProjectBuilder.CLEAN_BUILD; >- count++; >- } >- >- return results; >- } >+ return BuilderCoreUtils.buildTypesToArray(buildTypes); >+ } > } >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java >=================================================================== >RCS file: External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java >diff -N External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java 16 Apr 2007 23:46:04 -0000 1.57 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,288 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2007 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 >- * Matthew Conway - Bug 175186 >- *******************************************************************************/ >-package org.eclipse.ui.externaltools.internal.model; >- >- >-import java.util.Map; >- >-import org.eclipse.core.resources.ICommand; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.resources.IProject; >-import org.eclipse.core.resources.IProjectDescription; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.IResourceDelta; >-import org.eclipse.core.resources.IResourceDeltaVisitor; >-import org.eclipse.core.resources.IncrementalProjectBuilder; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >-import org.eclipse.debug.core.ILaunchManager; >-import org.eclipse.osgi.util.NLS; >-import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; >-import org.eclipse.ui.externaltools.internal.registry.ExternalToolMigration; >-import org.osgi.framework.Bundle; >- >-/** >- * This project builder implementation will run an external tool during the >- * build process. >- */ >-public final class ExternalToolBuilder extends IncrementalProjectBuilder { >- private final class IgnoreTeamPrivateChanges implements IResourceDeltaVisitor { >- private boolean[] fTrueChange; >- private IgnoreTeamPrivateChanges(boolean[] trueChange) { >- super(); >- fTrueChange= trueChange; >- } >- public boolean visit(IResourceDelta visitDelta) throws CoreException { >- IResource resource= visitDelta.getResource(); >- if (resource instanceof IFile) { >- fTrueChange[0]= true; >- return false; >- } >- return true; >- } >- } >- >- public static final String ID = "org.eclipse.ui.externaltools.ExternalToolBuilder"; //$NON-NLS-1$; >- >- private static String buildType = IExternalToolConstants.BUILD_TYPE_NONE; >- >- private static IProject buildProject= null; >- private static IResourceDelta buildDelta= null; >- >- /* (non-Javadoc) >- * @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor) >- */ >- protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { >- if (ExternalToolsPlugin.getDefault().getBundle().getState() != Bundle.ACTIVE) { >- return null; >- } >- >- ILaunchConfiguration config= BuilderUtils.configFromBuildCommandArgs(getProject(), args, new String[1]); >- if (config == null) { >- throw ExternalToolsPlugin.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null); >- } >- IProject[] projectsWithinScope= null; >- IResource[] resources = ExternalToolsUtil.getResourcesForBuildScope(config); >- if (resources != null) { >- projectsWithinScope= new IProject[resources.length]; >- for (int i = 0; i < resources.length; i++) { >- projectsWithinScope[i]= resources[i].getProject(); >- } >- } >- boolean kindCompatible= commandConfiguredForKind(config, kind); >- if (kindCompatible && configEnabled(config)) { >- doBuildBasedOnScope(resources, kind, config, monitor); >- } >- >- return projectsWithinScope; >- } >- >- private boolean commandConfiguredForKind(ILaunchConfiguration config, int kind) { >- try { >- if (!(config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) { >- ICommand command= getCommand(); >- //adapt the builder command to make use of the 3.1 support for setting command build kinds >- //this will only happen once for builder/command defined before the support existed >- BuilderUtils.configureTriggers(config, command); >- IProjectDescription desc= getProject().getDescription(); >- ICommand[] commands= desc.getBuildSpec(); >- int index= getBuilderCommandIndex(commands, command); >- if (index != -1) { >- commands[index]= command; >- desc.setBuildSpec(commands); >- getProject().setDescription(desc, null); >- ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); >- copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true); >- copy.doSave(); >- } >- return command.isBuilding(kind); >- } >- } catch (CoreException e) { >- ExternalToolsPlugin.getDefault().log(e); >- return true; >- } >- return true; >- } >- >- private int getBuilderCommandIndex(ICommand[] buildSpec, ICommand command) { >- Map commandArgs= command.getArguments(); >- if (commandArgs == null) { >- return -1; >- } >- String handle= (String) commandArgs.get(BuilderUtils.LAUNCH_CONFIG_HANDLE); >- if (handle == null) { >- return -1; >- } >- for (int i = 0; i < buildSpec.length; ++i) { >- ICommand buildSpecCommand= buildSpec[i]; >- if (ID.equals(buildSpecCommand.getBuilderName())) { >- Map buildSpecArgs= buildSpecCommand.getArguments(); >- if (buildSpecArgs != null) { >- String buildSpecHandle= (String) buildSpecArgs.get(BuilderUtils.LAUNCH_CONFIG_HANDLE); >- if (handle.equals(buildSpecHandle)) { >- return i; >- } >- } >- } >- } >- return -1; >- } >- >- /** >- * Returns whether the given builder config is enabled or not. >- * >- * @param config the config to examine >- * @return whether the config is enabled >- */ >- private boolean configEnabled(ILaunchConfiguration config) { >- try { >- return ExternalToolsUtil.isBuilderEnabled(config); >- } catch (CoreException e) { >- ExternalToolsPlugin.getDefault().log(e); >- } >- return true; >- } >- >- private void doBuildBasedOnScope(IResource[] resources, int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException { >- boolean buildForChange = true; >- if (kind != FULL_BUILD) { //scope not applied for full builds >- if (resources != null && resources.length > 0) { >- buildForChange = buildScopeIndicatesBuild(resources); >- } >- } >- >- if (buildForChange) { >- launchBuild(kind, config, monitor); >- } >- } >- >- private void launchBuild(int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException { >- monitor.subTask(NLS.bind(ExternalToolsModelMessages.ExternalToolBuilder_Running__0_____1, new String[] { config.getName()})); >- buildStarted(kind); >- // The default value for "launch in background" is true in debug core. If >- // the user doesn't go through the UI, the new attribute won't be set. This means >- // that existing Ant builders will try to run in the background (and likely conflict with >- // each other) without migration. >- config= ExternalToolMigration.migrateRunInBackground(config); >- config.launch(ILaunchManager.RUN_MODE, monitor); >- buildEnded(); >- } >- >- /** >- * Returns the build type being performed if the >- * external tool is being run as a project builder. >- * >- * @return one of the <code>IExternalToolConstants.BUILD_TYPE_*</code> constants. >- */ >- public static String getBuildType() { >- return buildType; >- } >- >- /** >- * Returns the project that is being built and has triggered the current external >- * tool builder. <code>null</code> is returned if no build is currently occurring. >- * >- * @return project being built or <code>null</code>. >- */ >- public static IProject getBuildProject() { >- return buildProject; >- } >- >- /** >- * Returns the <code>IResourceDelta</code> that is being built and has triggered the current external >- * tool builder. <code>null</code> is returned if no build is currently occurring. >- * >- * @return resource delta for the build or <code>null</code> >- */ >- public static IResourceDelta getBuildDelta() { >- return buildDelta; >- } >- >- /** >- * Stores the currently active build kind and build project when a build begins >- * @param buildKind >- */ >- private void buildStarted(int buildKind) { >- switch (buildKind) { >- case IncrementalProjectBuilder.INCREMENTAL_BUILD : >- buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL; >- buildDelta = getDelta(getProject()); >- break; >- case IncrementalProjectBuilder.FULL_BUILD : >- buildType = IExternalToolConstants.BUILD_TYPE_FULL; >- break; >- case IncrementalProjectBuilder.AUTO_BUILD : >- buildType = IExternalToolConstants.BUILD_TYPE_AUTO; >- buildDelta = getDelta(getProject()); >- break; >- case IncrementalProjectBuilder.CLEAN_BUILD : >- buildType = IExternalToolConstants.BUILD_TYPE_CLEAN; >- break; >- default : >- buildType = IExternalToolConstants.BUILD_TYPE_NONE; >- break; >- } >- buildProject= getProject(); >- } >- >- /** >- * Clears the current build kind, build project and build delta when a build finishes. >- */ >- private void buildEnded() { >- buildType= IExternalToolConstants.BUILD_TYPE_NONE; >- buildProject= null; >- buildDelta= null; >- } >- >- private boolean buildScopeIndicatesBuild(IResource[] resources) { >- for (int i = 0; i < resources.length; i++) { >- IResourceDelta delta = getDelta(resources[i].getProject()); >- if (delta == null) { >- //project just added to the workspace..no previous build tree >- return true; >- } >- IPath path= resources[i].getProjectRelativePath(); >- IResourceDelta change= delta.findMember(path); >- if (change != null) { >- final boolean[] trueChange= new boolean[1]; >- trueChange[0]= false; >- try { >- change.accept(new IgnoreTeamPrivateChanges(trueChange)); >- } catch (CoreException e) { >- ExternalToolsPlugin.getDefault().log("Internal error resolving changed resources during build", e); //$NON-NLS-1$ >- } >- >- return trueChange[0]; //filtered out team private changes >- } >- } >- return false; >- } >- >- protected void clean(IProgressMonitor monitor) throws CoreException { >- ICommand command= getCommand(); >- ILaunchConfiguration config= BuilderUtils.configFromBuildCommandArgs(getProject(), command.getArguments(), new String[1]); >- if (!configEnabled(config)) { >- return; >- } >- >- if ((!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) { >- //old behavior >- super.clean(monitor); >- return; >- } >- >- launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, monitor); >- } >-} >\ No newline at end of file >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java,v >retrieving revision 1.36 >diff -u -r1.36 ExternalToolsImages.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java 30 Jul 2007 02:21:16 -0000 1.36 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * 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 >@@ -14,6 +14,7 @@ > import java.net.MalformedURLException; > import java.net.URL; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.resource.CompositeImageDescriptor; > import org.eclipse.jface.resource.ImageDescriptor; >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java,v >retrieving revision 1.6 >diff -u -r1.6 ExternalToolsModelMessages.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java 8 Apr 2005 18:56:41 -0000 1.6 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This >+ * 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 >@@ -15,8 +15,6 @@ > private static final String BUNDLE_NAME = "org.eclipse.ui.externaltools.internal.model.ExternalToolsModelMessages";//$NON-NLS-1$ > > public static String ImageDescriptorRegistry_Allocating_image_for_wrong_display_1; >- public static String ExternalToolBuilder_Running__0_____1; >- public static String ExternalToolBuilder_0; > public static String BuilderUtils_5; > public static String BuilderUtils_6; > public static String BuilderUtils_7; >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.properties,v >retrieving revision 1.14 >diff -u -r1.14 ExternalToolsModelMessages.properties >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.properties 9 Jun 2005 15:18:15 -0000 1.14 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.properties 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2005 IBM Corporation and others. >+# 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 >@@ -10,8 +10,6 @@ > ############################################################################### > > ImageDescriptorRegistry_Allocating_image_for_wrong_display_1=Allocating image for wrong display >-ExternalToolBuilder_Running__0_____1=Running {0}... >-ExternalToolBuilder_0=The builder launch configuration could not be found. > BuilderUtils_5=Command Error > BuilderUtils_6=An error occurred while saving the build commands of the project > BuilderUtils_7=\ [Builder] >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java,v >retrieving revision 1.43 >diff -u -r1.43 ExternalToolsPlugin.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java 23 Feb 2005 16:02:16 -0000 1.43 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * 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 >@@ -10,19 +10,29 @@ > *******************************************************************************/ > package org.eclipse.ui.externaltools.internal.model; > >- > import java.net.MalformedURLException; > import java.net.URL; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.core.ILaunchListener; >+import org.eclipse.debug.core.ILaunchManager; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.resource.ImageRegistry; > import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Shell; >+import org.eclipse.ui.IWindowListener; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.externaltools.internal.program.launchConfigurations.ExternalToolsProgramMessages; > import org.eclipse.ui.plugin.AbstractUIPlugin; > import org.osgi.framework.Bundle; > import org.osgi.framework.BundleContext; >@@ -30,15 +40,78 @@ > /** > * External tools plug-in class > */ >-public final class ExternalToolsPlugin extends AbstractUIPlugin { >+public final class ExternalToolsPlugin extends AbstractUIPlugin implements >+ ILaunchListener { >+ >+ public static final String PLUGIN_ID = "org.eclipse.ui.externaltools"; //$NON-NLS-1$ >+ > /** > * Status representing no problems encountered during operation. > */ >- public static final IStatus OK_STATUS = new Status(IStatus.OK, IExternalToolConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$ >- >+ public static final IStatus OK_STATUS = new Status(IStatus.OK, PLUGIN_ID, 0, "", null); //$NON-NLS-1$ >+ > private static ExternalToolsPlugin plugin; >- >- private static final String EMPTY_STRING= ""; //$NON-NLS-1$ >+ >+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$ >+ >+ private static IWindowListener fWindowListener; >+ >+ private static ILaunchManager launchManager; >+ >+ /** >+ * A window listener that warns the user about any running programs when the >+ * workbench closes. Programs are killed when the VM exits. >+ */ >+ private class ProgramLaunchWindowListener implements IWindowListener { >+ public void windowActivated(IWorkbenchWindow window) { >+ } >+ >+ public void windowDeactivated(IWorkbenchWindow window) { >+ } >+ >+ public void windowClosed(IWorkbenchWindow window) { >+ IWorkbenchWindow windows[] = PlatformUI.getWorkbench() >+ .getWorkbenchWindows(); >+ if (windows.length > 1) { >+ // There are more windows still open. >+ return; >+ } >+ ILaunchManager manager = DebugPlugin.getDefault() >+ .getLaunchManager(); >+ ILaunchConfigurationType programType = manager >+ .getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE); >+ if (programType == null) { >+ return; >+ } >+ ILaunch launches[] = manager.getLaunches(); >+ ILaunchConfigurationType configType; >+ ILaunchConfiguration config; >+ for (int i = 0; i < launches.length; i++) { >+ try { >+ config = launches[i].getLaunchConfiguration(); >+ if (config == null) { >+ continue; >+ } >+ configType = config.getType(); >+ } catch (CoreException e) { >+ continue; >+ } >+ if (configType.equals(programType)) { >+ if (!launches[i].isTerminated()) { >+ MessageDialog >+ .openWarning( >+ window.getShell(), >+ ExternalToolsProgramMessages.ProgramLaunchDelegate_Workbench_Closing_1, >+ ExternalToolsProgramMessages.ProgramLaunchDelegate_The_workbench_is_exiting); >+ break; >+ } >+ } >+ } >+ } >+ >+ public void windowOpened(IWorkbenchWindow window) { >+ } >+ } > > /** > * Create an instance of the External Tools plug-in. >@@ -63,14 +136,14 @@ > if (message == null) { > message= EMPTY_STRING; > } >- return new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, 0, message, exception); >+ return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, exception); > } > > /** > * Returns a new <code>CoreException</code> for this plug-in > */ > public static CoreException newError(String message, Throwable exception) { >- return new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, 0, message, exception)); >+ return new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, 0, message, exception)); > } > > /** >@@ -164,4 +237,49 @@ > super.stop(context); > } > } >+ >+ public void start(BundleContext context) throws Exception { >+ super.start(context); >+ // Listen to launches to lazily create "launch processors" >+ launchManager = DebugPlugin.getDefault().getLaunchManager(); >+ ILaunch[] launches = launchManager.getLaunches(); >+ if (launches.length > 0) { >+ if (fWindowListener == null) { >+ fWindowListener = new ProgramLaunchWindowListener(); >+ PlatformUI.getWorkbench().addWindowListener(fWindowListener); >+ } >+ } else { >+ // if no launches, wait for first launch to initialize processors >+ launchManager.addLaunchListener(this); >+ } >+ } >+ >+ public void launchAdded(ILaunch launch) { >+ ILaunchConfiguration launchConfiguration = launch >+ .getLaunchConfiguration(); >+ try { >+ ILaunchConfigurationType launchConfigurationType = launchConfiguration >+ .getType(); >+ if (launchConfigurationType >+ .getIdentifier() >+ .equals( >+ IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE)) { >+ if (fWindowListener == null) { >+ fWindowListener = new ProgramLaunchWindowListener(); >+ PlatformUI.getWorkbench() >+ .addWindowListener(fWindowListener); >+ } >+ } >+ } catch (CoreException e) { >+ log(e); >+ } >+ } >+ >+ public void launchChanged(ILaunch launch) { >+ >+ } >+ >+ public void launchRemoved(ILaunch launch) { >+ launchManager.removeLaunch(launch); >+ } > } >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java >=================================================================== >RCS file: External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java >diff -N External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java 30 Jul 2007 02:21:16 -0000 1.24 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,231 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2007 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 >- *******************************************************************************/ >-package org.eclipse.ui.externaltools.internal.model; >- >-/** >- * Defines the constants available for client use. >- * <p> >- * This interface is not intended to be extended or implemented by clients. >- * </p> >- */ >-public interface IExternalToolConstants { >- /** >- * Plugin identifier for external tools (value <code>org.eclipse.ui.externaltools</code>). >- */ >- public static final String PLUGIN_ID = "org.eclipse.ui.externaltools"; //$NON-NLS-1$; >- >- // ------- Extensions Points ------- >- /** >- * Extension point to declare the launch configuration type that should be >- * created when duplicating an existing configuration as a project builder. >- */ >- public static final String EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS = "configurationDuplicationMaps"; //$NON-NLS-1$ >- // ------- Refresh Variables ------- >- /** >- * Variable that expands to the workspace root object (value <code>workspace</code>). >- */ >- public static final String VAR_WORKSPACE = "workspace"; //$NON-NLS-1$ >- /** >- * Variable that expands to the project resource (value <code>project</code>). >- */ >- public static final String VAR_PROJECT = "project"; //$NON-NLS-1$ >- /** >- * Variable that expands to the container resource (value <code>container</code>). >- */ >- public static final String VAR_CONTAINER = "container"; //$NON-NLS-1$ >- /** >- * Variable that expands to a resource (value <code>resource</code>). >- */ >- public static final String VAR_RESOURCE = "resource"; //$NON-NLS-1$ >- /** >- * Variable that expands to the working set object (value <code>working_set</code>). >- */ >- public static final String VAR_WORKING_SET = "working_set"; //$NON-NLS-1$ >- // ------- Tool Types ------- >- /** >- * External tool type for programs such as executables, batch files, >- * shell scripts, etc (value <code>programType</code>). >- */ >- public static final String TOOL_TYPE_PROGRAM = "programType"; //$NON-NLS-1$; >- >- // ------- Build Types ------- >- /** >- * Build type indicating an incremental project build request for >- * the external tool running as a builder (value <code>incremental</code>). >- */ >- public static final String BUILD_TYPE_INCREMENTAL = "incremental"; //$NON-NLS-1$ >- >- /** >- * Build type indicating a full project build request for >- * the external tool running as a builder (value <code>full</code>). >- */ >- public static final String BUILD_TYPE_FULL = "full"; //$NON-NLS-1$ >- >- /** >- * Build type indicating an automatic project build request for >- * the external tool running as a builder (value <code>auto</code>). >- */ >- public static final String BUILD_TYPE_AUTO = "auto"; //$NON-NLS-1$ >- >- /** >- * Build type indicating a clean project build request for >- * the external tool running as a builder (value <code>clean</code>). >- */ >- public static final String BUILD_TYPE_CLEAN = "clean"; //$NON-NLS-1$ >- >- /** >- * Build type indicating no project build request for >- * the external tool running as a builder (value <code>none</code>). >- */ >- public static final String BUILD_TYPE_NONE = "none"; //$NON-NLS-1$ >- >- // ------- Images ------- >- >- /** >- * Main tab image. >- */ >- public static final String IMG_TAB_MAIN = PLUGIN_ID + ".IMG_TAB_MAIN"; //$NON-NLS-1$ >- >- /** >- * Build tab image >- */ >- public static final String IMG_TAB_BUILD = PLUGIN_ID + ".IMG_TAB_BUILD"; //$NON-NLS-1$ >- >- // ------- Launch configuration types -------- >- /** >- * Program launch configuration type identifier. >- */ >- public static final String ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"; //$NON-NLS-1$ >- >- /** >- * Program builder launch configuration type identifier. Program project >- * builders are of this type. >- */ >- public static final String ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"; //$NON-NLS-1$ >- >- // ------- Launch configuration category -------- >- /** >- * Identifier for external tools launch configuration category. Launch >- * configuration types for external tools that appear in the external tools >- * launch configuration dialog should belong to this category. >- */ >- public static final String ID_EXTERNAL_TOOLS_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools"; //$NON-NLS-1$ >- /** >- * Identifier for external tools launch configuration builders category. >- * Launch configuration types that can be added as project builders should >- * belong to this category. >- */ >- public static final String ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools.builder"; //$NON-NLS-1$ >- >- // ------- Launch configuration groups -------- >- /** >- * Identifier for external tools launch configuration group. The external >- * tools launch configuration group corresponds to the external tools >- * category in run mode. >- */ >- public static final String ID_EXTERNAL_TOOLS_LAUNCH_GROUP = "org.eclipse.ui.externaltools.launchGroup"; //$NON-NLS-1$ >- /** >- * Identifier for external tools launch configuration group >- */ >- public static final String ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_GROUP = "org.eclipse.ui.externaltools.launchGroup.builder"; //$NON-NLS-1$ >- >- // ------- Common External Tool Launch Configuration Attributes ------- >- >- /** >- * Boolean attribute indicating if external tool output should be captured. >- * Default value is <code>false</code>. >- * @deprecated since 3.1 Replaced by <code>org.eclipse.debug.core.DebugPlugin.ATTR_CAPTURE_OUTPUT</code> >- */ >- public static final String ATTR_CAPTURE_OUTPUT = PLUGIN_ID + ".ATTR_CAPTURE_OUTPUT"; //$NON-NLS-1$ >- /** >- * String attribute identifying the location of an external. Default value >- * is <code>null</code>. Encoding is tool specific. >- */ >- public static final String ATTR_LOCATION = PLUGIN_ID + ".ATTR_LOCATION"; //$NON-NLS-1$ >- >- /** >- * Boolean attribute indicating if the user should be prompted for >- * arguments before running a tool. Default value is <code>false</code>. >- * THIS ATTRIBUTE IS NOT USED. >- */ >- public static final String ATTR_PROMPT_FOR_ARGUMENTS = PLUGIN_ID + ".ATTR_PROMPT_FOR_ARGUMENTS"; //$NON-NLS-1$ >- >- /** >- * String attribute identifying the scope of resources that should trigger an >- * external tool to run. Default value is <code>null</code> >- * indicating that the builder will be triggered for all changes. >- */ >- public static final String ATTR_BUILDER_SCOPE = PLUGIN_ID + ".ATTR_BUILD_SCOPE"; //$NON-NLS-1$ >- >- /** >- * String attribute containing an array of build kinds for which an >- * external tool builder should be run. >- */ >- public static final String ATTR_RUN_BUILD_KINDS = PLUGIN_ID + ".ATTR_RUN_BUILD_KINDS"; //$NON-NLS-1$ >- >- /** >- * Boolean attribute indicating if the console should be shown on external >- * tool output. Default value is <code>false</code>. >- */ >- public static final String ATTR_SHOW_CONSOLE = PLUGIN_ID + ".ATTR_SHOW_CONSOLE"; //$NON-NLS-1$ >- >- /** >- * String attribute containing the arguments that should be passed to the >- * tool. Default value is <code>null</code>, and encoding is tool specific. >- */ >- public static final String ATTR_TOOL_ARGUMENTS = PLUGIN_ID + ".ATTR_TOOL_ARGUMENTS"; //$NON-NLS-1$ >- >- /** >- * String attribute identifying the working directory of an external tool. >- * Default value is <code>null</code>, which indicates a default working >- * directory, which is tool specific. >- */ >- public static final String ATTR_WORKING_DIRECTORY = PLUGIN_ID + ".ATTR_WORKING_DIRECTORY"; //$NON-NLS-1$ >- >- /** >- * String attribute identifying whether an external tool builder configuration >- * is enabled. The default value is <code>true</code>, which indicates >- * that the configuration will be executed as appropriate by the builder. >- */ >- public static final String ATTR_BUILDER_ENABLED = PLUGIN_ID + ".ATTR_BUILDER_ENABLED"; //$NON-NLS-1$ >- >- /** >- * Status code indicating an unexpected internal error. >- */ >- public static final int ERR_INTERNAL_ERROR = 150; >- >- /** >- * String attribute identifying a non-external tool builder launch configuration that is disabled >- * The value is the name of the disabled builder. >- */ >- public static final String ATTR_DISABLED_BUILDER = PLUGIN_ID + ".ATTR_DISABLED_BUILDER"; //$NON-NLS-1$ >- >- /** >- * boolean attribute identifying that an external tool builder has been configured for triggering >- * using the <code>ICommand.setBuilding(int)</code> mechanism >- * @since 3.1 >- */ >- public static final String ATTR_TRIGGERS_CONFIGURED = PLUGIN_ID + ".ATTR_TRIGGERS_CONFIGURED"; //$NON-NLS-1$ >- >- /** >- * String attribute identifying the build scope for a launch configuration. >- * <code>null</code> indicates the default workspace build. >- */ >- public static final String ATTR_BUILD_SCOPE = PLUGIN_ID + ".ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE"; //$NON-NLS-1$ >- >- /** >- * Attribute identifier specifying whether referenced projects should be >- * considered when computing the projects to build. Default value is >- * <code>true</code>. >- */ >- public static final String ATTR_INCLUDE_REFERENCED_PROJECTS = PLUGIN_ID + ".ATTR_INCLUDE_REFERENCED_PROJECTS"; //$NON-NLS-1$ >-} >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java,v >retrieving revision 1.11 >diff -u -r1.11 ImageDescriptorRegistry.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java 17 Apr 2007 03:34:14 -0000 1.11 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * 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 >Index: External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java >=================================================================== >RCS file: External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java >diff -N External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java 12 Aug 2005 20:39:30 -0000 1.46 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,411 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2005 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.ui.externaltools.internal.registry; >- >- >-import java.util.ArrayList; >-import java.util.Map; >-import java.util.StringTokenizer; >- >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.core.ILaunchConfigurationType; >-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >-import org.eclipse.debug.core.ILaunchManager; >-import org.eclipse.debug.ui.IDebugUIConstants; >-import org.eclipse.debug.ui.RefreshTab; >-import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >-import org.eclipse.ui.externaltools.internal.ui.ExternalToolsUIMessages; >- >-/** >- * Responsible reading an old external tool format and creating >- * and migrating it to create a new external tool. >- */ >-public final class ExternalToolMigration { >- /** >- * Structure to represent a variable definition within a >- * source string. >- */ >- public static final class VariableDefinition { >- /** >- * Index in the source text where the variable started >- * or <code>-1</code> if no valid variable start tag >- * identifier found. >- */ >- public int start = -1; >- >- /** >- * Index in the source text of the character following >- * the end of the variable or <code>-1</code> if no >- * valid variable end tag found. >- */ >- public int end = -1; >- >- /** >- * The variable's name found in the source text, or >- * <code>null</code> if no valid variable found. >- */ >- public String name = null; >- >- /** >- * The variable's argument found in the source text, or >- * <code>null</code> if no valid variable found or if >- * the variable did not specify an argument >- */ >- public String argument = null; >- >- /** >- * Create an initialized variable definition. >- */ >- private VariableDefinition() { >- super(); >- } >- } >- >- /** >- * Variable tag indentifiers >- */ >- private static final String VAR_TAG_START = "${"; //$NON-NLS-1$ >- private static final String VAR_TAG_END = "}"; //$NON-NLS-1$ >- private static final String VAR_TAG_SEP = ":"; //$NON-NLS-1$ >- >- /** >- * External tool type for Ant build files (value <code>antBuildType</code>). >- */ >- public static final String TOOL_TYPE_ANT_BUILD = "antBuildType"; //$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$ >- >- public static final String RUN_TARGETS_ATTRIBUTE = TOOL_TYPE_ANT_BUILD + ".runTargets"; //$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. >- * NOTE: This value is copied here from org.eclipse.ant.ui.internal.IAntLaunchConfigurationConstants. >- * Ant no longer resides in External Tools and this plug-in. This value is kept here only >- * for migration. >- */ >- public static final String ATTR_ANT_TARGETS = IExternalToolConstants.PLUGIN_ID + ".ATTR_ANT_TARGETS"; //$NON-NLS-1$ >- >- /* >- * 2.0 External Tool Tags >- */ >- public static final String TAG_TOOL_TYPE = "!{tool_type}"; //$NON-NLS-1$ >- public static final String TAG_TOOL_NAME = "!{tool_name}"; //$NON-NLS-1$ >- public static final String TAG_TOOL_LOCATION = "!{tool_loc}"; //$NON-NLS-1$ >- public static final String TAG_TOOL_ARGUMENTS = "!{tool_args}"; //$NON-NLS-1$ >- public static final String TAG_TOOL_DIRECTORY = "!{tool_dir}"; //$NON-NLS-1$ >- public static final String TAG_TOOL_REFRESH = "!{tool_refresh}"; //$NON-NLS-1$ >- public static final String TAG_TOOL_SHOW_LOG = "!{tool_show_log}"; //$NON-NLS-1$ >- public static final String TAG_TOOL_BUILD_TYPES = "!{tool_build_types}"; //$NON-NLS-1$ >- public static final String TAG_TOOL_BLOCK = "!{tool_block}"; //$NON-NLS-1$ >- >- // Known kind of tools >- private static final String TOOL_TYPE_ANT = "org.eclipse.ui.externaltools.type.ant"; //$NON-NLS-1$ >- private static final String TOOL_TYPE_PROGRAM = "org.eclipse.ui.externaltools.type.program"; //$NON-NLS-1$ >- >- /* >- * 2.1 External Tool Keys >- */ >- public static final String TAG_TYPE = "type"; //$NON-NLS-1$ >- public static final String TAG_NAME = "name"; //$NON-NLS-1$ >- public static final String TAG_LOCATION = "location"; //$NON-NLS-1$ >- public static final String TAG_WORK_DIR = "workDirectory"; //$NON-NLS-1$ >- public static final String TAG_CAPTURE_OUTPUT = "captureOutput"; //$NON-NLS-1$ >- public static final String TAG_SHOW_CONSOLE = "showConsole"; //$NON-NLS-1$ >- public static final String TAG_RUN_BKGRND = "runInBackground"; //$NON-NLS-1$ >- public static final String TAG_PROMPT_ARGS = "promptForArguments"; //$NON-NLS-1$ >- public static final String TAG_ARGS = "arguments"; //$NON-NLS-1$ >- public static final String TAG_REFRESH_SCOPE = "refreshScope"; //$NON-NLS-1$ >- public static final String TAG_REFRESH_RECURSIVE = "refreshRecursive"; //$NON-NLS-1$ >- public static final String TAG_RUN_BUILD_KINDS = "runForBuildKinds"; //$NON-NLS-1$ >- public static final String TAG_EXTRA_ATTR = "extraAttribute"; //$NON-NLS-1$ >- public static final String TAG_VERSION = "version"; //$NON-NLS-1$ >- >- private static final String EXTRA_ATTR_SEPARATOR = "="; //$NON-NLS-1$ >- >- private static final String VERSION_21 = "2.1"; //$NON-NLS-1$; >- >- private static final String TRUE = "true"; //$NON-NLS-1$ >- private static final String FALSE = "false"; //$NON-NLS-1$ >- >- /** >- * Allows no instances. >- */ >- private ExternalToolMigration() { >- super(); >- } >- >- /** >- * Returns a launch configuration working copy from the argument map or >- * <code>null</code> if the given map cannot be interpreted as a 2.0 or 2.1 >- * branch external tool. The returned working copy will be unsaved and its >- * location will be set to the metadata area. >- */ >- public static ILaunchConfigurationWorkingCopy configFromArgumentMap(Map args) { >- String version = (String) args.get(TAG_VERSION); >- if (VERSION_21.equals(version)) { >- return configFrom21ArgumentMap(args); >- } >- return configFrom20ArgumentMap(args); >- } >- >- public static ILaunchConfigurationWorkingCopy configFrom21ArgumentMap(Map commandArgs) { >- String name = (String) commandArgs.get(TAG_NAME); >- String type = (String) commandArgs.get(TAG_TYPE); >- >- ILaunchConfigurationWorkingCopy config = newConfig(type, name); >- if (config == null) { >- return null; >- } >- >- config.setAttribute(IExternalToolConstants.ATTR_LOCATION, (String) commandArgs.get(TAG_LOCATION)); >- config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) commandArgs.get(TAG_WORK_DIR)); >- config.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, TRUE.equals(commandArgs.get(TAG_CAPTURE_OUTPUT))); >- config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE.equals(commandArgs.get(TAG_SHOW_CONSOLE))); >- config.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, TRUE.equals(commandArgs.get(TAG_RUN_BKGRND))); >- config.setAttribute(IExternalToolConstants.ATTR_PROMPT_FOR_ARGUMENTS, TRUE.equals(commandArgs.get(TAG_PROMPT_ARGS))); >- config.setAttribute(RefreshTab.ATTR_REFRESH_SCOPE, (String) commandArgs.get(TAG_REFRESH_SCOPE)); >- config.setAttribute(RefreshTab.ATTR_REFRESH_RECURSIVE, TRUE.equals(commandArgs.get(TAG_REFRESH_RECURSIVE))); >- >- config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) commandArgs.get(TAG_RUN_BUILD_KINDS)); >- >- String args = (String) commandArgs.get(TAG_ARGS); >- if (args != null) { >- config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, args); >- } >- >- String extraAttributes = (String) commandArgs.get(TAG_EXTRA_ATTR); >- if (extraAttributes != null) { >- StringTokenizer tokenizer = new StringTokenizer(extraAttributes, EXTRA_ATTR_SEPARATOR); >- while (tokenizer.hasMoreTokens()) { >- String key = tokenizer.nextToken(); >- if (!tokenizer.hasMoreTokens()) >- break; >- String value = tokenizer.nextToken(); >- if (key.equals(RUN_TARGETS_ATTRIBUTE)) { >- // 2.1 implementation only defined 1 "extra attribute" >- config.setAttribute(ATTR_ANT_TARGETS, value); >- } >- } >- } >- return config; >- } >- >- /** >- * Creates an external tool from the map. >- */ >- public static ILaunchConfigurationWorkingCopy configFrom20ArgumentMap(Map args) { >- // Update the type... >- String type = (String) args.get(TAG_TOOL_TYPE); >- if (TOOL_TYPE_ANT.equals(type)) { >- type = TOOL_TYPE_ANT_BUILD; >- } else if (TOOL_TYPE_PROGRAM.equals(type)){ >- type = IExternalToolConstants.TOOL_TYPE_PROGRAM; >- } else { >- return null; >- } >- >- String name = (String) args.get(TAG_TOOL_NAME); >- >- ILaunchConfigurationWorkingCopy config = newConfig(type, name); >- if (config == null) { >- return null; >- } >- >- // Update the location... >- String location = (String) args.get(TAG_TOOL_LOCATION); >- config.setAttribute(IExternalToolConstants.ATTR_LOCATION, location); >- >- // Update the refresh scope... >- String refresh = (String) args.get(TAG_TOOL_REFRESH); >- if (refresh != null) { >- VariableDefinition varDef = extractVariableDefinition(refresh, 0); >- if ("none".equals(varDef.name)) { //$NON-NLS-1$ >- refresh = null; >- } >- config.setAttribute(RefreshTab.ATTR_REFRESH_SCOPE, refresh); >- } >- >- // Update the arguments >- String arguments = (String) args.get(TAG_TOOL_ARGUMENTS); >- if (type.equals(TOOL_TYPE_ANT_BUILD)) { >- String targetNames = null; >- if (arguments != null) { >- int start = 0; >- ArrayList targets = new ArrayList(); >- StringBuffer buffer = new StringBuffer(); >- VariableDefinition varDef = extractVariableDefinition(arguments, start); >- while (varDef.end != -1) { >- if ("ant_target".equals(varDef.name) && varDef.argument != null) { //$NON-NLS-1$ >- targets.add(varDef.argument); >- buffer.append(arguments.substring(start, varDef.start)); >- } else { >- buffer.append(arguments.substring(start, varDef.end)); >- } >- start = varDef.end; >- varDef = extractVariableDefinition(arguments, start); >- } >- buffer.append(arguments.substring(start, arguments.length())); >- arguments = buffer.toString(); >- >- buffer.setLength(0); >- for (int i = 0; i < targets.size(); i++) { >- String target = (String) targets.get(i); >- if (target != null && target.length() > 0) { >- buffer.append(target); >- buffer.append(","); //$NON-NLS-1$ >- } >- } >- targetNames = buffer.toString(); >- } >- if (targetNames != null && targetNames.length() > 0) { >- config.setAttribute(ATTR_ANT_TARGETS, targetNames); >- } >- } >- config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments); >- >- // Collect the rest of the information >- config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE.equals(args.get(TAG_TOOL_SHOW_LOG))); >- config.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, TRUE.equals(args.get(TAG_TOOL_SHOW_LOG))); >- config.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, FALSE.equals(args.get(TAG_TOOL_BLOCK))); >- String buildKinds= (String) args.get(TAG_TOOL_BUILD_TYPES); >- if (buildKinds != null) { >- buildKinds= buildKinds.replace(';', ','); // Replace the old separator with the new >- } >- config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buildKinds); >- config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) args.get(TAG_TOOL_DIRECTORY)); >- return config; >- } >- >- /** >- * Returns a new working copy with the given external tool name and external >- * tool type or <code>null</code> if no config could be created. >- */ >- private static ILaunchConfigurationWorkingCopy newConfig(String type, String name) { >- if (type == null || name == null) { >- return null; >- } >- ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); >- ILaunchConfigurationType configType; >- if (TOOL_TYPE_ANT_BUILD.equals(type)) { >- configType = manager.getLaunchConfigurationType(ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE); >- } else if (IExternalToolConstants.TOOL_TYPE_PROGRAM.equals(type)) { >- configType = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE); >- } else { >- return null; >- } >- try { >- if (configType != null) { >- return configType.newInstance(null, name); >- } >- } catch (CoreException e) { >- ExternalToolsPlugin.getDefault().log(e); >- } >- return null; >- } >- >- /** >- * Returns the tool name extracted from the given command argument map. >- * Extraction is attempted using 2.0 and 2.1 external tool formats. >- */ >- public static String getNameFromCommandArgs(Map commandArgs) { >- String name= (String) commandArgs.get(TAG_NAME); >- if (name == null) { >- name= (String) commandArgs.get(TAG_TOOL_NAME); >- } >- return name; >- } >- >- /** >- * Migrate the old RUN_IN_BACKGROUND launch config attribute to the new >- * LAUNCH_IN_BACKGROUND attribute provided by the debug ui plugin. >- * >- * @param config the config to migrate >- * @return the migrated config >- */ >- public static ILaunchConfiguration migrateRunInBackground(ILaunchConfiguration config) { >- String noValueFlag= "NoValue"; //$NON-NLS-1$ >- String attr= null; >- try { >- attr = config.getAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, noValueFlag); >- } catch (CoreException e) { >- // Exception will occur if the attribute is already set because the attribute is actually a boolean. >- // No migration necessary. >- return config; >- } >- if (noValueFlag.equals(attr)) { >- //the old constant >- String ATTR_RUN_IN_BACKGROUND= IExternalToolConstants.PLUGIN_ID + ".ATTR_RUN_IN_BACKGROUND"; //$NON-NLS-1$ >- boolean runInBackground= false; >- try { >- runInBackground = config.getAttribute(ATTR_RUN_IN_BACKGROUND, runInBackground); >- } catch (CoreException e) { >- ExternalToolsPlugin.getDefault().log(ExternalToolsUIMessages.ExternalToolMigration_37, e); >- } >- try { >- ILaunchConfigurationWorkingCopy workingCopy= config.getWorkingCopy(); >- workingCopy.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, runInBackground); >- config= workingCopy.doSave(); >- } catch (CoreException e) { >- ExternalToolsPlugin.getDefault().log(ExternalToolsUIMessages.ExternalToolMigration_38, e); >- } >- } >- return config; >- } >- >- /** >- * Extracts a variable name and argument from the given string. >- * >- * @param text the source text to parse for a variable tag >- * @param start the index in the string to start the search >- * @return the variable definition >- */ >- public static VariableDefinition extractVariableDefinition(String text, int start) { >- VariableDefinition varDef = new VariableDefinition(); >- >- varDef.start = text.indexOf(VAR_TAG_START, start); >- if (varDef.start < 0){ >- return varDef; >- } >- start = varDef.start + VAR_TAG_START.length(); >- >- int end = text.indexOf(VAR_TAG_END, start); >- if (end < 0) { >- return varDef; >- } >- varDef.end = end + VAR_TAG_END.length(); >- if (end == start) { >- return varDef; >- } >- >- int mid = text.indexOf(VAR_TAG_SEP, start); >- if (mid < 0 || mid > end) { >- varDef.name = text.substring(start, end); >- } else { >- if (mid > start) { >- varDef.name = text.substring(start, mid); >- } >- mid = mid + VAR_TAG_SEP.length(); >- if (mid < end) { >- varDef.argument = text.substring(mid, end); >- } >- } >- >- return varDef; >- } >-} >Index: External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java,v >retrieving revision 1.10 >diff -u -r1.10 BuilderLabelProvider.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java 18 Apr 2006 16:05:46 -0000 1.10 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java 7 Oct 2009 20:08:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * 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 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.ui.externaltools.internal.ui; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.resources.ICommand; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; >@@ -23,7 +24,6 @@ > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > import org.eclipse.ui.externaltools.internal.ui.BuilderPropertyPage.ErrorConfig; > > >Index: External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java,v >retrieving revision 1.102 >diff -u -r1.102 BuilderPropertyPage.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java 3 Feb 2009 14:36:22 -0000 1.102 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java 7 Oct 2009 20:08:30 -0000 >@@ -18,6 +18,9 @@ > import java.util.List; > import java.util.Map; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.model.BuilderCoreUtils; >+import org.eclipse.core.externaltools.internal.model.ExternalToolBuilder; > import org.eclipse.core.resources.ICommand; > import org.eclipse.core.resources.IFolder; > import org.eclipse.core.resources.IProject; >@@ -78,9 +81,7 @@ > import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; > import org.eclipse.ui.externaltools.internal.launchConfigurations.IgnoreWhiteSpaceComparator; > import org.eclipse.ui.externaltools.internal.model.BuilderUtils; >-import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder; > import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds; > import org.eclipse.ui.externaltools.internal.model.IPreferenceConstants; > import org.eclipse.ui.progress.IProgressService; >@@ -210,7 +211,7 @@ > for (int i = 0; i < commands.length; i++) { > String[] version= new String[] {""}; //$NON-NLS-1$ > ILaunchConfiguration config = BuilderUtils.configFromBuildCommandArgs(project, commands[i].getArguments(), version); >- if (BuilderUtils.VERSION_2_1.equals(version[0])) { >+ if (BuilderCoreUtils.VERSION_2_1.equals(version[0])) { > // Storing the .project file of a project with 2.1 configs, will > // edit the file in a way that isn't backwards compatible. > projectNeedsMigration= true; >@@ -222,7 +223,7 @@ > if (shell == null) { > return; > } >- IStatus status = new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, 0, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_Exists, new String[]{config.getName()}), null); >+ IStatus status = new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, 0, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_Exists, new String[]{config.getName()}), null); > ErrorDialog.openError(getShell(), ExternalToolsUIMessages.BuilderPropertyPage_errorTitle, > NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_External_Tool_Builder__0__Not_Added_2, new String[]{config.getName()}), > status); >@@ -232,7 +233,7 @@ > } > } else { > String builderID = commands[i].getBuilderName(); >- if (builderID.equals(ExternalToolBuilder.ID) && commands[i].getArguments().get(BuilderUtils.LAUNCH_CONFIG_HANDLE) != null) { >+ if (builderID.equals(ExternalToolBuilder.ID) && commands[i].getArguments().get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE) != null) { > // An invalid external tool entry. > element= new ErrorConfig(commands[i]); > } else { >@@ -767,7 +768,7 @@ > if (e instanceof CoreException) { > status[0] = ((CoreException) e).getStatus(); > } else { >- status[0] = new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsUIMessages.BuilderPropertyPage_statusMessage, e); >+ status[0] = new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, 0, ExternalToolsUIMessages.BuilderPropertyPage_statusMessage, e); > } > Display.getDefault().asyncExec(new Runnable() { > public void run() { >Index: External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.java,v >retrieving revision 1.6 >diff -u -r1.6 ExternalToolsUIMessages.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.java 8 Apr 2005 18:56:41 -0000 1.6 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.java 7 Oct 2009 20:08:30 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This >+ * 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 >@@ -55,8 +55,6 @@ > public static String ExternalToolsPreferencePage_Prompt_before_migrating_3; > public static String ExternalToolsPreferencePage_1; > >- public static String ExternalToolMigration_37; >- public static String ExternalToolMigration_38; > public static String EditCommandDialog_0; > public static String EditCommandDialog_1; > public static String EditCommandDialog_2; >Index: External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties,v >retrieving revision 1.33 >diff -u -r1.33 ExternalToolsUIMessages.properties >--- External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties 3 Feb 2006 04:01:43 -0000 1.33 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties 7 Oct 2009 20:08:30 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2006 IBM Corporation and others. >+# 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 >@@ -50,8 +50,6 @@ > ExternalToolsPreferencePage_Prompt_before_migrating_3=&Confirm before migrating external tool project builders for edit > ExternalToolsPreferencePage_1=C&onfirm before migrating projects to the new format > >-ExternalToolMigration_37=An exception occurred accessing external tool\'s \"run in background\" attribute >-ExternalToolMigration_38=An exception occurred attempting to migrate external tool\'s \"run in background\" attribute > EditCommandDialog_0=Configure Builder > EditCommandDialog_1=Run this builder: > EditCommandDialog_2=After a "&Clean" >Index: External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java,v >retrieving revision 1.1 >diff -u -r1.1 BuildFilesResolver.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java 19 Mar 2007 05:39:20 -0000 1.1 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java 7 Oct 2009 20:08:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007 Matthew Conway and others. >+ * Copyright (c) 2007, 2009 Matthew Conway 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 >@@ -13,13 +13,13 @@ > import java.util.LinkedHashSet; > import java.util.Set; > >+import org.eclipse.core.externaltools.internal.model.ExternalToolBuilder; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IResourceDelta; > import org.eclipse.core.resources.IResourceDeltaVisitor; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.variables.IDynamicVariable; > import org.eclipse.core.variables.IDynamicVariableResolver; >-import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder; > > public class BuildFilesResolver implements IDynamicVariableResolver > { >Index: External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java,v >retrieving revision 1.9 >diff -u -r1.9 BuildProjectResolver.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java 18 Apr 2006 16:08:29 -0000 1.9 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java 7 Oct 2009 20:08:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * 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 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.ui.externaltools.internal.variables; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.model.ExternalToolBuilder; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >@@ -19,8 +21,7 @@ > import org.eclipse.core.variables.IDynamicVariable; > import org.eclipse.core.variables.IDynamicVariableResolver; > import org.eclipse.osgi.util.NLS; >-import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >+import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; > > > public class BuildProjectResolver implements IDynamicVariableResolver { >@@ -48,7 +49,7 @@ > * @throws CoreException > */ > protected void abort(String message, Throwable exception) throws CoreException { >- throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, message, exception)); >+ throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, message, exception)); > } > > /** >Index: External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java,v >retrieving revision 1.7 >diff -u -r1.7 BuildTypeResolver.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java 23 Mar 2005 22:46:58 -0000 1.7 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java 7 Oct 2009 20:08:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * 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 >@@ -10,9 +10,9 @@ > *******************************************************************************/ > package org.eclipse.ui.externaltools.internal.variables; > >+import org.eclipse.core.externaltools.internal.model.ExternalToolBuilder; > import org.eclipse.core.variables.IDynamicVariable; > import org.eclipse.core.variables.IDynamicVariableResolver; >-import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder; > > > public class BuildTypeResolver implements IDynamicVariableResolver { >Index: External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java,v >retrieving revision 1.6 >diff -u -r1.6 SystemPathResolver.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java 23 Feb 2007 15:24:50 -0000 1.6 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java 7 Oct 2009 20:08:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * 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 >@@ -15,13 +15,14 @@ > import java.util.Map; > import java.util.StringTokenizer; > >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; > import org.eclipse.core.variables.IDynamicVariable; > import org.eclipse.core.variables.IDynamicVariableResolver; > import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >+import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; > > public class SystemPathResolver implements IDynamicVariableResolver { > >@@ -30,7 +31,7 @@ > */ > public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { > if (argument == null) { >- throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, VariableMessages.SystemPathResolver_0, null)); >+ throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, VariableMessages.SystemPathResolver_0, null)); > } > Map map= DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment(); > String path= (String) map.get("PATH"); //$NON-NLS-1$ >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF,v >retrieving revision 1.15 >diff -u -r1.15 MANIFEST.MF >--- META-INF/MANIFEST.MF 14 May 2008 16:04:30 -0000 1.15 >+++ META-INF/MANIFEST.MF 7 Oct 2009 20:08:30 -0000 >@@ -10,7 +10,6 @@ > org.eclipse.ui.externaltools.internal.menu;x-internal:=true, > org.eclipse.ui.externaltools.internal.model;x-friends:="org.eclipse.ant.ui", > org.eclipse.ui.externaltools.internal.program.launchConfigurations;x-friends:="org.eclipse.ant.ui", >- org.eclipse.ui.externaltools.internal.registry;x-internal:=true, > org.eclipse.ui.externaltools.internal.ui;x-friends:="org.eclipse.ant.ui", > org.eclipse.ui.externaltools.internal.variables;x-internal:=true > Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)";resolution:=optional, >@@ -19,6 +18,7 @@ > org.eclipse.ui;bundle-version="[3.2.0,4.0.0)", > org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)", > org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)", >- org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)" >+ org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)", >+ org.eclipse.core.externaltools;bundle-version="1.0.0" > Bundle-ActivationPolicy: lazy > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java >=================================================================== >RCS file: Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java >diff -N Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java >--- Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java 12 Aug 2005 20:39:29 -0000 1.15 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,87 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2005 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.ui.externaltools.internal.program.launchConfigurations; >- >- >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.Status; >-import org.eclipse.core.runtime.jobs.Job; >-import org.eclipse.debug.core.DebugEvent; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.IDebugEventSetListener; >-import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.core.model.IProcess; >-import org.eclipse.debug.ui.RefreshTab; >-import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; >- >-/** >- * Refreshes resources as specified by a launch configuration, when >- * an associated process terminates. >- */ >-public class BackgroundResourceRefresher implements IDebugEventSetListener { >- >- private ILaunchConfiguration fConfiguration; >- private IProcess fProcess; >- >- public BackgroundResourceRefresher(ILaunchConfiguration configuration, IProcess process) { >- fConfiguration = configuration; >- fProcess = process; >- } >- >- /** >- * If the process has already terminated, resource refreshing is done >- * immediately in the current thread. Otherwise, refreshing is done when the >- * process terminates. >- */ >- public void startBackgroundRefresh() { >- synchronized (fProcess) { >- if (fProcess.isTerminated()) { >- refresh(); >- } else { >- DebugPlugin.getDefault().addDebugEventListener(this); >- } >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) >- */ >- public void handleDebugEvents(DebugEvent[] events) { >- for (int i = 0; i < events.length; i++) { >- DebugEvent event = events[i]; >- if (event.getSource() == fProcess && event.getKind() == DebugEvent.TERMINATE) { >- DebugPlugin.getDefault().removeDebugEventListener(this); >- refresh(); >- break; >- } >- } >- } >- >- /** >- * Submits a job to do the refresh >- */ >- protected void refresh() { >- Job job= new Job(ExternalToolsProgramMessages.BackgroundResourceRefresher_0) { >- public IStatus run(IProgressMonitor monitor) { >- try { >- RefreshTab.refreshResources(fConfiguration, monitor); >- } catch (CoreException e) { >- ExternalToolsPlugin.getDefault().log(e); >- return e.getStatus(); >- } >- return Status.OK_STATUS; >- } >- }; >- job.schedule(); >- } >-} >Index: Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ExternalToolsProgramMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ExternalToolsProgramMessages.java,v >retrieving revision 1.6 >diff -u -r1.6 ExternalToolsProgramMessages.java >--- Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ExternalToolsProgramMessages.java 8 Apr 2005 18:56:41 -0000 1.6 >+++ Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ExternalToolsProgramMessages.java 7 Oct 2009 20:08:30 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This >+ * 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 >@@ -18,8 +18,6 @@ > > public static String ProgramLaunchDelegate_Workbench_Closing_1; > public static String ProgramLaunchDelegate_The_workbench_is_exiting; >- public static String ProgramLaunchDelegate_3; >- public static String ProgramLaunchDelegate_4; > > public static String ProgramMainTab_Select; > >Index: Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ExternalToolsProgramMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ExternalToolsProgramMessages.properties,v >retrieving revision 1.12 >diff -u -r1.12 ExternalToolsProgramMessages.properties >--- Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ExternalToolsProgramMessages.properties 9 Jun 2005 15:18:15 -0000 1.12 >+++ Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ExternalToolsProgramMessages.properties 7 Oct 2009 20:08:30 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2005 IBM Corporation and others. >+# 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 >@@ -13,7 +13,5 @@ > > ProgramLaunchDelegate_Workbench_Closing_1=Workbench Closing > ProgramLaunchDelegate_The_workbench_is_exiting=The workbench is exiting and a program launched from an external tool appears to still be running. These programs will be terminated when the workbench exits. It is recommended that you exit any external programs launched from the workbench before you proceed.\n\nClick OK to continue exiting the workbench. >-ProgramLaunchDelegate_3=Running {0}... >-ProgramLaunchDelegate_4=An IProcess could not be created for the launch > > ProgramMainTab_Select=&Select a program: >Index: Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java >=================================================================== >RCS file: Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java >diff -N Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java >--- Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java 30 Jul 2007 02:21:16 -0000 1.38 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,246 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2007 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 >- * Keith Seitz (keiths@redhat.com) - environment variables contribution (Bug 27243) >- * dakshinamurthy.karra@gmail.com - bug 165371 >- *******************************************************************************/ >-package org.eclipse.ui.externaltools.internal.program.launchConfigurations; >- >- >-import java.io.File; >-import java.util.HashMap; >-import java.util.Map; >- >-import org.eclipse.core.resources.IProject; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.Status; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.ILaunch; >-import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.core.ILaunchConfigurationType; >-import org.eclipse.debug.core.ILaunchManager; >-import org.eclipse.debug.core.model.IProcess; >-import org.eclipse.debug.core.model.LaunchConfigurationDelegate; >-import org.eclipse.debug.ui.CommonTab; >-import org.eclipse.debug.ui.RefreshTab; >-import org.eclipse.jface.dialogs.MessageDialog; >-import org.eclipse.osgi.util.NLS; >-import org.eclipse.ui.IWindowListener; >-import org.eclipse.ui.IWorkbenchWindow; >-import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab; >-import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; >-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >- >-/** >- * Launch delegate for a program. >- */ >-public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { >- >- private static IWindowListener fWindowListener; >- >- /** >- * A window listener that warns the user about any running programs when >- * the workbench closes. Programs are killed when the VM exits. >- */ >- private class ProgramLaunchWindowListener implements IWindowListener { >- public void windowActivated(IWorkbenchWindow window) { >- } >- public void windowDeactivated(IWorkbenchWindow window) { >- } >- public void windowClosed(IWorkbenchWindow window) { >- IWorkbenchWindow windows[]= PlatformUI.getWorkbench().getWorkbenchWindows(); >- if (windows.length > 1) { >- // There are more windows still open. >- return; >- } >- ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager(); >- ILaunchConfigurationType programType= manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE); >- if (programType == null) { >- return; >- } >- ILaunch launches[]= manager.getLaunches(); >- ILaunchConfigurationType configType; >- ILaunchConfiguration config; >- for (int i = 0; i < launches.length; i++) { >- try { >- config= launches[i].getLaunchConfiguration(); >- if (config == null) { >- continue; >- } >- configType= config.getType(); >- } catch (CoreException e) { >- continue; >- } >- if (configType.equals(programType)) { >- if (!launches[i].isTerminated()) { >- MessageDialog.openWarning(window.getShell(), ExternalToolsProgramMessages.ProgramLaunchDelegate_Workbench_Closing_1, ExternalToolsProgramMessages.ProgramLaunchDelegate_The_workbench_is_exiting); >- break; >- } >- } >- } >- } >- public void windowOpened(IWorkbenchWindow window) { >- } >- } >- >- /** >- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor) >- */ >- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { >- >- if (monitor.isCanceled()) { >- return; >- } >- >- // resolve location >- IPath location = ExternalToolsUtil.getLocation(configuration); >- >- if (monitor.isCanceled()) { >- return; >- } >- >- // resolve working directory >- IPath workingDirectory = ExternalToolsUtil.getWorkingDirectory(configuration); >- >- if (monitor.isCanceled()) { >- return; >- } >- >- // resolve arguments >- String[] arguments = ExternalToolsUtil.getArguments(configuration); >- >- if (monitor.isCanceled()) { >- return; >- } >- >- int cmdLineLength = 1; >- if (arguments != null) { >- cmdLineLength += arguments.length; >- } >- String[] cmdLine = new String[cmdLineLength]; >- cmdLine[0] = location.toOSString(); >- if (arguments != null) { >- System.arraycopy(arguments, 0, cmdLine, 1, arguments.length); >- } >- >- File workingDir = null; >- if (workingDirectory != null) { >- workingDir = workingDirectory.toFile(); >- } >- >- if (monitor.isCanceled()) { >- return; >- } >- >- String[] envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration); >- >- if (monitor.isCanceled()) { >- return; >- } >- >- if (fWindowListener == null) { >- fWindowListener= new ProgramLaunchWindowListener(); >- PlatformUI.getWorkbench().addWindowListener(fWindowListener); >- } >- Process p = DebugPlugin.exec(cmdLine, workingDir, envp); >- IProcess process = null; >- >- // add process type to process attributes >- Map processAttributes = new HashMap(); >- String programName = location.lastSegment(); >- String extension = location.getFileExtension(); >- if (extension != null) { >- programName = programName.substring(0, programName.length() - (extension.length() + 1)); >- } >- programName = programName.toLowerCase(); >- processAttributes.put(IProcess.ATTR_PROCESS_TYPE, programName); >- >- if (p != null) { >- monitor.beginTask(NLS.bind(ExternalToolsProgramMessages.ProgramLaunchDelegate_3, new String[] {configuration.getName()}), IProgressMonitor.UNKNOWN); >- process = DebugPlugin.newProcess(launch, p, location.toOSString(), processAttributes); >- } >- if (p == null || process == null) { >- if (p != null) >- p.destroy(); >- throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, ExternalToolsProgramMessages.ProgramLaunchDelegate_4, null)); >- } >- process.setAttribute(IProcess.ATTR_CMDLINE, generateCommandLine(cmdLine)); >- >- if (CommonTab.isLaunchInBackground(configuration)) { >- // refresh resources after process finishes >- if (RefreshTab.getRefreshScope(configuration) != null) { >- BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(configuration, process); >- refresher.startBackgroundRefresh(); >- } >- } else { >- // wait for process to exit >- while (!process.isTerminated()) { >- try { >- if (monitor.isCanceled()) { >- process.terminate(); >- break; >- } >- Thread.sleep(50); >- } catch (InterruptedException e) { >- } >- } >- >- // refresh resources >- RefreshTab.refreshResources(configuration, monitor); >- } >- } >- >- private String generateCommandLine(String[] commandLine) { >- if (commandLine.length < 1) >- return ""; //$NON-NLS-1$ >- StringBuffer buf= new StringBuffer(); >- for (int i= 0; i < commandLine.length; i++) { >- buf.append(' '); >- char[] characters= commandLine[i].toCharArray(); >- StringBuffer command= new StringBuffer(); >- boolean containsSpace= false; >- for (int j = 0; j < characters.length; j++) { >- char character= characters[j]; >- if (character == '\"') { >- command.append('\\'); >- } else if (character == ' ') { >- containsSpace = true; >- } >- command.append(character); >- } >- if (containsSpace) { >- buf.append('\"'); >- buf.append(command); >- buf.append('\"'); >- } else { >- buf.append(command); >- } >- } >- return buf.toString(); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String) >- */ >- protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException { >- IProject[] projects = ExternalToolsBuildTab.getBuildProjects(configuration, null); >- if (projects == null) { >- return null ; >- } >- boolean isRef = ExternalToolsBuildTab.isIncludeReferencedProjects(configuration, null); >- if (isRef) { >- return computeReferencedBuildOrder(projects); >- } >- return computeBuildOrder(projects); >- } >-} >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/plugin.properties,v >retrieving revision 1.52 >diff -u -r1.52 plugin.properties >--- plugin.properties 17 Apr 2007 03:34:14 -0000 1.52 >+++ plugin.properties 7 Oct 2009 20:08:28 -0000 >@@ -26,10 +26,8 @@ > Action.externalToolsTip = Run Last Tool > PropertyPage.externalToolsBuilders = Builders > >-Builder.externalTools = Integrated External Tool Builder > PreferencePage.externalToolsPreferences = External Tools > >-Program.externalTools = Program > programLaunchConfigurationTabGroup.description=Run a program > programBuilderLaunchConfigurationTabGroup.description=Create a configuration that will run a program during builds > >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/plugin.xml,v >retrieving revision 1.131 >diff -u -r1.131 plugin.xml >--- plugin.xml 4 May 2009 16:11:04 -0000 1.131 >+++ plugin.xml 7 Oct 2009 20:08:28 -0000 >@@ -99,36 +99,8 @@ > </enabledWhen> > </page> > </extension> >- <extension >- id="ExternalToolBuilder" >- name="%Builder.externalTools" >- point="org.eclipse.core.resources.builders"> >- <builder >- isConfigurable= "true"> >- <run >- class="org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder"> >- </run> >- </builder> >- </extension> > <!-- Launch Configuration Extensions --> > <extension >- point="org.eclipse.debug.core.launchConfigurationTypes"> >- <launchConfigurationType >- name="%Program.externalTools" >- delegate="org.eclipse.ui.externaltools.internal.program.launchConfigurations.ProgramLaunchDelegate" >- category="org.eclipse.ui.externaltools" >- modes="run" >- id="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"> >- </launchConfigurationType> >- <launchConfigurationType >- name="%Program.externalTools" >- delegate="org.eclipse.ui.externaltools.internal.program.launchConfigurations.ProgramLaunchDelegate" >- category="org.eclipse.ui.externaltools.builder" >- modes="run" >- id="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"> >- </launchConfigurationType> >- </extension> >- <extension > point="org.eclipse.ui.externaltools.configurationDuplicationMaps"> > <configurationMap > sourceType="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 264338
:
148142
|
148349
|
148353
|
148443
|
148455
|
148459
|
148730
|
148864
|
148946
| 149050