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 148443 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.
HeadlessPluginsMigration(inProgress)IV
HeadlessMigrationPatch(inProgress)IV.txt (text/plain), 1.09 MB, created by
Natalia Bartol
on 2009-09-30 12:23:54 EDT
(
hide
)
Description:
HeadlessPluginsMigration(inProgress)IV
Filename:
MIME Type:
Creator:
Natalia Bartol
Created:
2009-09-30 12:23:54 EDT
Size:
1.09 MB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ant.ui >Index: Ant Tools Support/org/eclipse/ant/internal/ui/model/AntProjectNodeProxy.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntProjectNodeProxy.java,v >retrieving revision 1.17 >diff -u -r1.17 AntProjectNodeProxy.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/model/AntProjectNodeProxy.java 11 Aug 2005 16:30:45 -0000 1.17 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/model/AntProjectNodeProxy.java 30 Sep 2009 16:24:37 -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,6 +14,7 @@ > import java.util.Collections; > import java.util.List; > >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > import org.eclipse.ant.internal.ui.AntUtil; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.IPath; >@@ -54,7 +55,7 @@ > fChildNodes= null; > fParsed= true; > AntTargetNode[] nodes = null; >- IPath buildFilePath= AntUtil.getFile(getBuildFileName()).getLocation(); >+ IPath buildFilePath= AntLaunchingUtil.getFile(getBuildFileName()).getLocation(); > if (buildFilePath == null) { > setProblemSeverity(AntModelProblem.SEVERITY_ERROR); > setProblemMessage(AntModelMessages.AntProjectNodeProxy_0); >@@ -256,7 +257,7 @@ > public IFile getBuildFileResource() { > if (fProject == null) { > if (fBuildFileName != null) { >- return AntUtil.getFile(fBuildFileName); >+ return AntLaunchingUtil.getFile(fBuildFileName); > } > } > return super.getBuildFileResource(); >Index: Ant Tools Support/org/eclipse/ant/internal/ui/model/AntElementNode.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntElementNode.java,v >retrieving revision 1.26 >diff -u -r1.26 AntElementNode.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/model/AntElementNode.java 19 Dec 2008 14:12:46 -0000 1.26 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/model/AntElementNode.java 30 Sep 2009 16:24:36 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2002, 2008 GEBIT Gesellschaft fuer EDV-Beratung >+ * Copyright (c) 2002, 2009 GEBIT Gesellschaft fuer EDV-Beratung > * und Informatik-Technologien mbH, > * Berlin, Duesseldorf, Frankfurt (Germany) and others. > * All rights reserved. This program and the accompanying materials >@@ -18,14 +18,13 @@ > import java.io.File; > import java.net.MalformedURLException; > import java.net.URL; >-import com.ibm.icu.text.MessageFormat; > import java.util.ArrayList; > import java.util.Iterator; > import java.util.List; > >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > import org.eclipse.ant.internal.ui.AntImageDescriptor; > import org.eclipse.ant.internal.ui.AntUIImages; >-import org.eclipse.ant.internal.ui.AntUtil; > import org.eclipse.ant.internal.ui.IAntUIConstants; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.IAdaptable; >@@ -35,6 +34,8 @@ > import org.eclipse.jface.text.IRegion; > import org.eclipse.swt.graphics.Image; > >+import com.ibm.icu.text.MessageFormat; >+ > /** > * General representation of an Ant buildfile element. > * >@@ -546,7 +547,7 @@ > */ > public IFile getIFile() { > if (isExternal()) { >- return AntUtil.getFileForLocation(fFilePath, null); >+ return AntLaunchingUtil.getFileForLocation(fFilePath, null); > } > return getBuildFileResource(); > } >Index: Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModel.java,v >retrieving revision 1.68 >diff -u -r1.68 AntModel.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModel.java 31 Aug 2009 17:56:26 -0000 1.68 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModel.java 30 Sep 2009 16:24:37 -0000 >@@ -50,8 +50,8 @@ > import org.eclipse.ant.internal.core.AntCoreUtil; > import org.eclipse.ant.internal.core.AntSecurityManager; > import org.eclipse.ant.internal.core.IAntCoreConstants; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.AntUtil; > import org.eclipse.ant.internal.ui.editor.DecayCodeCompletionDataStructuresThread; > import org.eclipse.ant.internal.ui.editor.outline.AntEditorMarkerUpdater; > import org.eclipse.ant.internal.ui.editor.utils.ProjectHelper; >@@ -584,7 +584,7 @@ > } > String buildFileNames= AntUIPlugin.getDefault().getCombinedPreferenceStore().getString(AntEditorPreferenceConstants.BUILDFILE_NAMES_TO_IGNORE); > if (buildFileNames.length() > 0) { >- String[] names= AntUtil.parseString(buildFileNames, ","); //$NON-NLS-1$ >+ String[] names= AntLaunchingUtil.parseString(buildFileNames, ","); //$NON-NLS-1$ > String editedFileName= getEditedFile().getName(); > for (int i = 0; i < names.length; i++) { > String string = names[i]; >Index: Ant Tools Support/org/eclipse/ant/internal/ui/model/AntImportNode.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntImportNode.java,v >retrieving revision 1.11 >diff -u -r1.11 AntImportNode.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/model/AntImportNode.java 11 Aug 2005 16:30:45 -0000 1.11 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/model/AntImportNode.java 30 Sep 2009 16:24:36 -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 org.apache.tools.ant.BuildException; > import org.apache.tools.ant.Task; > import org.eclipse.ant.core.AntSecurityException; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > import org.eclipse.ant.internal.ui.AntUIImages; >-import org.eclipse.ant.internal.ui.AntUtil; > import org.eclipse.ant.internal.ui.IAntUIConstants; > import org.eclipse.ant.internal.ui.editor.AntEditorCompletionProcessor; > import org.eclipse.ant.internal.ui.preferences.AntEditorPreferenceConstants; >@@ -82,10 +82,10 @@ > public IFile getIFile() { > IFile file; > if (isExternal()) { >- file= AntUtil.getFileForLocation(getFilePath(), null); >+ file= AntLaunchingUtil.getFileForLocation(getFilePath(), null); > } else { > String path= getFile(); >- file= AntUtil.getFileForLocation(path, getAntModel().getEditedFile().getParentFile()); >+ file= AntLaunchingUtil.getFileForLocation(path, getAntModel().getEditedFile().getParentFile()); > } > return file; > } >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 30 Sep 2009 16:24:37 -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/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/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/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/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/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/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/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/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 30 Sep 2009 16:24:36 -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,6 +18,8 @@ > import java.util.Iterator; > import java.util.List; > >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > import org.eclipse.ant.internal.ui.AntUIImages; > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.AntUtil; >@@ -28,7 +30,7 @@ > 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.core.internal.externaltools.model.IExternalToolConstants; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; >@@ -72,7 +74,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; > >@@ -532,7 +533,7 @@ > ISchedulingRule rule= null; > if (!ResourcesPlugin.getWorkspace().isTreeLocked()) { > //only set a scheduling rule if not in a resource change callback >- rule= AntUtil.getFileForLocation(expandedLocation, null); >+ rule= AntLaunchingUtil.getFileForLocation(expandedLocation, null); > } > PlatformUI.getWorkbench().getProgressService().runInUI(context, operation, rule); > } catch (InvocationTargetException e) { >@@ -649,7 +650,7 @@ > return; > } > >- String[] targetNames= AntUtil.parseRunTargets(configTargets); >+ String[] targetNames= AntLaunchingUtil.parseRunTargets(configTargets); > if (targetNames.length == 0) { > fTableViewer.setAllChecked(false); > setExecuteInput(allTargetNodes); >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/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/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 30 Sep 2009 16:24:35 -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.internal.externaltools.model.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/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/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 30 Sep 2009 16:24:35 -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/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/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 30 Sep 2009 16:24:36 -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 >@@ -16,7 +16,7 @@ > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.jdt.internal.debug.ui.launcher.JavaWorkingDirectoryBlock; > import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; >-import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; >+import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; > > import com.ibm.icu.text.MessageFormat; > >@@ -51,7 +51,7 @@ > setLaunchConfiguration(configuration); > try { > try { >- fDefaultWorkingDirPath= ExternalToolsUtil.getLocation(configuration).removeLastSegments(1).toOSString(); >+ fDefaultWorkingDirPath= ExternalToolsCoreUtil.getLocation(configuration).removeLastSegments(1).toOSString(); > } > catch(CoreException ce){} > String wd = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String)null); >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/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/AntEnvironmentTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntEnvironmentTab.java,v >retrieving revision 1.7 >diff -u -r1.7 AntEnvironmentTab.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntEnvironmentTab.java 11 Aug 2005 16:30:00 -0000 1.7 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntEnvironmentTab.java 30 Sep 2009 16:24:35 -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,7 +10,7 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.launchConfigurations; > >-import org.eclipse.ant.internal.ui.AntUtil; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.debug.ui.EnvironmentTab; > import org.eclipse.jface.dialogs.Dialog; >@@ -60,7 +60,7 @@ > if (wrappingComposite == null) { > return; > } >- boolean isSeparateJREBuild= AntUtil.isSeparateJREAntBuild(workingCopy); >+ boolean isSeparateJREBuild= AntLaunchingUtil.isSeparateJREAntBuild(workingCopy); > > Color tableColor= isSeparateJREBuild ? null : Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); > Color labelColor= isSeparateJREBuild ? null : Display.getDefault().getSystemColor(SWT.COLOR_RED); >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/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/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 30 Sep 2009 16:24:35 -0000 >@@ -17,14 +17,14 @@ > import org.eclipse.ant.core.AntCorePlugin; > import org.eclipse.ant.core.AntCorePreferences; > import org.eclipse.ant.core.Property; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > import org.eclipse.ant.internal.ui.AntUIImages; > 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.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.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >@@ -111,7 +111,7 @@ > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) > */ > public void initializeFrom(ILaunchConfiguration configuration) { >- fSeparateJRE= AntUtil.isSeparateJREAntBuild(configuration); >+ fSeparateJRE= AntLaunchingUtil.isSeparateJREAntBuild(configuration); > setErrorMessage(null); > setMessage(null); > Map properties= null; >@@ -134,7 +134,7 @@ > fUseDefaultButton.setSelection(false); > fAntPropertiesBlock.populatePropertyViewer(properties); > >- String[] files= AntUtil.parseString(propertyFiles, ","); //$NON-NLS-1$ >+ String[] files= AntLaunchingUtil.parseString(propertyFiles, ","); //$NON-NLS-1$ > fAntPropertiesBlock.setPropertyFilesInput(files); > } > >@@ -246,7 +246,7 @@ > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) > */ > public void activated(ILaunchConfigurationWorkingCopy workingCopy) { >- if (fSeparateJRE != AntUtil.isSeparateJREAntBuild(workingCopy)) { >+ if (fSeparateJRE != AntLaunchingUtil.isSeparateJREAntBuild(workingCopy)) { > //update the properties if changed whether build is in separate JRE > initializeFrom(workingCopy); > } >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 30 Sep 2009 16:24:35 -0000 >@@ -13,10 +13,11 @@ > > import java.util.regex.Pattern; > >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > 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.core.internal.externaltools.model.IExternalToolConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.variables.IStringVariableManager; > import org.eclipse.core.variables.VariablesPlugin; >@@ -34,8 +35,7 @@ > import org.eclipse.swt.layout.GridData; > 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; >+import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; > > public class AntJRETab extends JavaJRETab { > >@@ -159,7 +159,7 @@ > if (args != null) { > Pattern pattern = Pattern.compile("\\$\\{.*_prompt.*\\}"); //$NON-NLS-1$ > IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); >- String[] arguments = ExternalToolsUtil.parseStringIntoList(args); >+ String[] arguments = ExternalToolsCoreUtil.parseStringIntoList(args); > if (arguments != null) { > for (int i = 0; i < arguments.length; i++) { > String arg = arguments[i]; >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 30 Sep 2009 16:24:35 -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,10 +10,11 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.launchConfigurations; > >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > 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.IAntUIHelpContextIds; >+import org.eclipse.core.internal.externaltools.model.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 { >@@ -108,7 +108,7 @@ > if (location != null) { > String expandedLocation= manager.performStringSubstitution(location); > if (expandedLocation != null) { >- file= AntUtil.getFileForLocation(expandedLocation, null); >+ file= AntLaunchingUtil.getFileForLocation(expandedLocation, null); > } > } > } catch (CoreException e) { >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/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 30 Sep 2009 16:24:35 -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/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 30 Sep 2009 16:24:35 -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,7 +10,8 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.launchConfigurations; > >-import org.eclipse.ant.internal.ui.AntUtil; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+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; >@@ -81,7 +82,7 @@ > */ > public void initializeFrom(ILaunchConfiguration configuration) { > try { >- AntUtil.migrateToNewClasspathFormat(configuration); >+ AntLaunchingUtil.migrateToNewClasspathFormat(configuration); > } catch (CoreException e) { > } > super.initializeFrom(configuration); >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/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 30 Sep 2009 16:24:35 -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 >@@ -13,10 +13,13 @@ > import java.util.HashMap; > import java.util.Map; > >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > import org.eclipse.ant.internal.ui.AntUIImages; > 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.internal.externaltools.model.BuilderCoreUtils; >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; > 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= IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS; > text= fAfterCleanTargetText; > } else if (source == fManualBuildTarget) { >- attribute= org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS; >+ attribute= IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS; > text= fManualBuildTargetText; > } else if (source == fAutoBuildTarget) { >- attribute= org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS; >+ attribute= IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS; > text= fAutoBuildTargetText; > } else if (source == fDuringCleanTarget) { >- attribute= org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS; >+ attribute= IAntLaunchConfigurationConstants.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(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, (String)fAttributeToTargets.get(attribute)); > SetTargetsDialog dialog= new SetTargetsDialog(getShell(), copy); > if (dialog.open() != Window.OK) { > return; >@@ -182,7 +183,7 @@ > } > targetsSelected= configTargets; > } >- String[] targets= AntUtil.parseRunTargets(targetsSelected); >+ String[] targets= AntLaunchingUtil.parseRunTargets(targetsSelected); > StringBuffer result= new StringBuffer(targets[0]); > for (int i = 1; i < targets.length; i++) { > result.append(", "); //$NON-NLS-1$ >@@ -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(IAntLaunchConfigurationConstants.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(IAntLaunchConfigurationConstants.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(IAntLaunchConfigurationConstants.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(IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS, (String)null); >+ manualTargets= configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS, (String)null); >+ afterCleanTargets= configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, (String)null); >+ duringCleanTargets= configuration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS, (String)null); >+ initializeAttributeToTargets(fAutoBuildTargetText, autoTargets, configTargets, IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS); >+ initializeAttributeToTargets(fManualBuildTargetText, manualTargets, configTargets, IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS); >+ initializeAttributeToTargets(fDuringCleanTargetText, duringCleanTargets, configTargets, IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS); >+ initializeAttributeToTargets(fAfterCleanTargetText, afterCleanTargets, configTargets, IAntLaunchConfigurationConstants.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(IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS); >+ configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, targets); >+ targets= (String) fAttributeToTargets.get(IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS); >+ configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_AUTO_TARGETS, targets); >+ targets= (String) fAttributeToTargets.get(IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS); >+ configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_MANUAL_TARGETS, targets); >+ targets= (String) fAttributeToTargets.get(IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS); >+ configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_CLEAN_TARGETS, targets); >+ configuration.setAttribute(IAntLaunchConfigurationConstants.ATTR_TARGETS_UPDATED, true); > } > > /* (non-Javadoc) >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 30 Sep 2009 16:24:36 -0000 >@@ -10,8 +10,8 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.launchConfigurations; > >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.jface.dialogs.Dialog; >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 30 Sep 2009 16:24:36 -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,20 +10,25 @@ > *******************************************************************************/ > 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; > import org.eclipse.debug.ui.console.IConsole; > import org.eclipse.jface.text.BadLocationException; > import org.eclipse.jface.text.IRegion; >+import org.eclipse.jface.text.Region; > import org.eclipse.ui.console.IHyperlink; > > /** >@@ -33,65 +38,39 @@ > * each build event associated with a task. When the associated line is later > * appended to the console, the corresponding text region in the console > * document is determined (as the length of a console document can not be >- * determined beforehand), and the hyperlink is added to the document. >- * The new line is added to the console, information from that line >- * may be stored to process future incoming tasks hyperlinks. >+ * determined beforehand), and the hyperlink is added to the document. The new >+ * line is added to the console, information from that line 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 Map fFileNameToIFile = new HashMap(); >+ >+ private static File fBuildFileParent = null; > > 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; >+ 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; >- } >- } > > /** > * Not to be called. >@@ -99,50 +78,63 @@ > 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 HyperlinkEntry createHyperlink( >+ LinkDescriptor linkDescriptor) { >+ String line = linkDescriptor.getLine(); >+ String fileName = linkDescriptor.getFileName(); >+ int lineNumber = linkDescriptor.getLineNumber(); >+ int offset = linkDescriptor.getOffset(); >+ int length = linkDescriptor.getLength(); >+ >+ 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 = AntLaunchingUtil.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 (fgProcessToLinks == null) { >- fgProcessToLinks = new HashMap(); >- >+ if (taskLink != null) { >+ return new HyperlinkEntry(taskLink, new Region(offset, length), >+ line); > } >- List links = (List)fgProcessToLinks.get(process); >- if (links == null) { >- links = new ArrayList(10); >- fgProcessToLinks.put(process, links); >+ return null; >+ } >+ >+ private static Map createHyperlinksForLaunch(IProcess process) { >+ Map links = new HashMap(); >+ AntLaunch antLaunch = (AntLaunch) process.getLaunch(); >+ List linksDescriptors = antLaunch.getLinkDescriptors(); >+ for (int i = 0; i < linksDescriptors.size(); i++) { >+ links.put(linksDescriptors.get(i), createHyperlink( >+ (LinkDescriptor) linksDescriptors.get(i))); > } >- >- links.add(new HyperlinkEntry(link, region, message)); >+ return links; > } >- >- private static boolean addLink(IConsole console, IHyperlink link, IRegion lineRegion, IRegion region, String message) { >- >+ >+ private static boolean addLink(IConsole console, IHyperlink link, >+ IRegion lineRegion, IRegion region, String message) { > int length = region.getLength(); >- > String text; > try { >- text = console.getDocument().get(lineRegion.getOffset(), lineRegion.getLength()); >+ text = console.getDocument().get(lineRegion.getOffset(), >+ lineRegion.getLength()); > } catch (BadLocationException e) { > return false; > } >@@ -156,52 +148,38 @@ > > /** > * A new line has been added to the given console. Adds any task hyperlink >- * associated with the line, to the console. >- * The new line may be stored to process future incoming tasks hyperlinks. >+ * associated with the line, to the console. The new line may be stored to >+ * process future incoming tasks hyperlinks. > * > * @param console > * @param newLine > */ >- public static synchronized void processNewLine(IConsole console, IRegion 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); >+ >+ Map links = createHyperlinksForLaunch(process); >+ >+ if (linkBuildFileMessage(console, newLine)) { > return; > } >- >- List links = (List)fgProcessToLinks.get(process); >+ > if (links == null) { >- addNewLine(console, newLine, process); > 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.keySet().iterator(); i.hasNext();) { >+ LinkDescriptor keyLinkDescriptor = (LinkDescriptor) i.next(); >+ HyperlinkEntry link = (HyperlinkEntry) links.get(keyLinkDescriptor); >+ if (addLink(console, link.getLink(), newLine, link.getRegion(), >+ link.getMessage())) { >+ ((AntLaunch) process.getLaunch()) >+ .removeLinkDescriptor(keyLinkDescriptor); >+ links.remove(keyLinkDescriptor); > 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,56 +187,22 @@ > * @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); >- } >- } >- >- /** >- * 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$ >- int offset= region.getOffset(); >+ >+ String message = ""; //$NON-NLS-1$ >+ int offset = region.getOffset(); > try { > message = console.getDocument().get(offset, region.getLength()); > } catch (BadLocationException e) { > } > if (message.startsWith("Buildfile:")) { //$NON-NLS-1$ > String fileName = message.substring(10).trim(); >- IFile file = AntUtil.getFileForLocation(fileName, null); >+ IFile file = AntLaunchingUtil.getFileForLocation(fileName, null); > if (file != null) { >- FileLink link = new FileLink(file, null, -1, -1, -1); >+ FileLink link = new FileLink(file, null, -1, -1, -1); > console.addLink(link, offset + 11, fileName.length()); > return true; > } >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/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 30 Sep 2009 16:24:36 -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/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/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/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 30 Sep 2009 16:24:35 -0000 >@@ -14,14 +14,16 @@ > import java.util.ArrayList; > import java.util.List; > >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > 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.model.AntElementNode; > 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.core.internal.externaltools.model.IExternalToolConstants; > import org.eclipse.core.resources.IContainer; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IProject; >@@ -54,8 +56,7 @@ > import org.eclipse.ui.IWorkbenchPage; > 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 org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; > > import com.ibm.icu.text.MessageFormat; > >@@ -175,7 +176,7 @@ > for(int i = 0; i < configs.length; i++) { > if(configs[i].exists()) { > try { >- location = ExternalToolsUtil.getLocation(configs[i]); >+ location = ExternalToolsCoreUtil.getLocation(configs[i]); > if(location != null && location.equals(filepath)) { > list.add(configs[i]); > } >@@ -343,7 +344,7 @@ > //the user has not specified any names to look for > return null; > } >- return AntUtil.parseString(buildFileNames, ","); //$NON-NLS-1$ >+ return AntLaunchingUtil.parseString(buildFileNames, ","); //$NON-NLS-1$ > } > > /** >@@ -393,7 +394,7 @@ > jreTab.setDefaults(workingCopy); > jreTab.dispose(); > >- IFile file= AntUtil.getFileForLocation(filePath.toString(), null); >+ IFile file= AntLaunchingUtil.getFileForLocation(filePath.toString(), null); > workingCopy.setMappedResources(new IResource[] {file}); > > return workingCopy.doSave(); >@@ -421,7 +422,7 @@ > ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type); > for (int i = 0; i < configs.length; i++) { > try { >- if (filePath.equals(ExternalToolsUtil.getLocation(configs[i]))) { >+ if (filePath.equals(ExternalToolsCoreUtil.getLocation(configs[i]))) { > validConfigs.add(configs[i]); > } > } >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 30 Sep 2009 16:24:35 -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/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 30 Sep 2009 16:24:35 -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 30 Sep 2009 16:24:35 -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.launching.launchConfigurations.IAntLaunchConfigurationConstants; > 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.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.internal.externaltools.model.IExternalToolConstants; > 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; >@@ -78,9 +65,7 @@ > import org.eclipse.ui.browser.IWebBrowser; > 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.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; > import org.eclipse.ui.ide.IDE; > import org.eclipse.ui.part.FileEditorInput; > import org.eclipse.ui.texteditor.IDocumentProvider; >@@ -93,300 +78,235 @@ > */ > public final class AntUtil { > 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$ >- >+ 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$ >+ > private static String fgBrowserId; >- >+ > /** > * No instances allowed > */ > private AntUtil() { > 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 (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); >- } >- >- 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 >- * <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(IAntLaunchConfigurationConstants.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 >+ * >+ * @param configuration >+ * launch configuration > * @return array of property file names, or <code>null</code> >- * @throws CoreException if unable to access the associated attribute >+ * @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); >+ public static String[] getPropertyFiles(ILaunchConfiguration configuration) >+ throws CoreException { >+ String attribute = configuration.getAttribute( >+ IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTY_FILES, >+ (String) null); > if (attribute == null) { > return null; > } >- String[] propertyFiles= AntUtil.parseString(attribute, ","); //$NON-NLS-1$ >+ String[] propertyFiles = AntLaunchingUtil.parseString(attribute, ","); //$NON-NLS-1$ > for (int i = 0; i < propertyFiles.length; i++) { > String propertyFile = propertyFiles[i]; >- propertyFile= expandVariableString(propertyFile, AntUIModelMessages.AntUtil_6); >- propertyFiles[i]= propertyFile; >+ propertyFile = expandVariableString(propertyFile, >+ AntUIModelMessages.AntUtil_6); >+ propertyFiles[i] = propertyFile; > } > return propertyFiles; > } >- >- public static AntTargetNode[] getTargets(String path, ILaunchConfiguration config) throws CoreException { >- File buildfile= getBuildFile(path); >+ >+ public static AntTargetNode[] getTargets(String path, >+ ILaunchConfiguration config) throws CoreException { >+ File buildfile = getBuildFile(path); > if (buildfile == null) { >- return null; >+ return null; > } >- URL[] urls= getCustomClasspath(config); >- //no lexical, no position, no task >- IAntModel model= getAntModel(buildfile, urls, false, false, false); >+ URL[] urls = AntLaunchingUtil.getCustomClasspath(config); >+ // no lexical, no position, no task >+ IAntModel model = getAntModel(buildfile, urls, false, false, false); > try { > model.setProperties(getAllProperties(config)); >- } catch (CoreException ex){ >+ } catch (CoreException ex) { > } > model.setPropertyFiles(getPropertyFiles(config)); >- AntProjectNode project= model.getProjectNode(); //forces a reconcile >+ AntProjectNode project = model.getProjectNode(); // forces a reconcile > model.dispose(); > return getTargets(project); > } >- >- private static Map getAllProperties(ILaunchConfiguration config) throws CoreException { >- String allArgs = config.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null); >- Map properties= new HashMap(); >+ >+ private static Map getAllProperties(ILaunchConfiguration config) >+ throws CoreException { >+ String allArgs = config.getAttribute( >+ IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null); >+ Map properties = new HashMap(); > if (allArgs != null) { >- String[] arguments = ExternalToolsUtil.parseStringIntoList(allArgs); >- // filter arguments to avoid resolving variables that will prompt the user >+ String[] arguments = ExternalToolsCoreUtil >+ .parseStringIntoList(allArgs); >+ // filter arguments to avoid resolving variables that will prompt >+ // the user > List filtered = new ArrayList(); > Pattern pattern = Pattern.compile("\\$\\{.*_prompt.*\\}"); //$NON-NLS-1$ >- IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); >+ IStringVariableManager manager = VariablesPlugin.getDefault() >+ .getStringVariableManager(); > for (int i = 0; i < arguments.length; i++) { > String arg = arguments[i]; > if (arg.startsWith("-D")) { //$NON-NLS-1$ > if (!pattern.matcher(arg).find()) { >- filtered.add(manager.performStringSubstitution(arg, false)); >+ filtered.add(manager.performStringSubstitution(arg, >+ false)); > } > } > } >- AntCoreUtil.processMinusDProperties(filtered, properties); >+ AntCoreUtil.processMinusDProperties(filtered, properties); > } >- Map configProperties= getProperties(config); >+ Map configProperties = AntLaunchingUtil.getProperties(config); > if (configProperties != null) { >- Iterator keys= configProperties.keySet().iterator(); >- while (keys.hasNext()) { >- String name = (String) keys.next(); >- if (properties.get(name) == null) { >- properties.put(name, configProperties.get(name)); >- } >- } >+ Iterator keys = configProperties.keySet().iterator(); >+ while (keys.hasNext()) { >+ String name = (String) keys.next(); >+ if (properties.get(name) == null) { >+ properties.put(name, configProperties.get(name)); >+ } >+ } > } > return properties; >- } >+ } > >- private static AntTargetNode[] getTargets(AntProjectNode project) { >- if (project == null || !project.hasChildren()) { >- return null; >+ private static AntTargetNode[] getTargets(AntProjectNode project) { >+ if (project == null || !project.hasChildren()) { >+ return null; > } >- List targets= new ArrayList(); >- Iterator possibleTargets= project.getChildNodes().iterator(); >+ List targets = new ArrayList(); >+ Iterator possibleTargets = project.getChildNodes().iterator(); > while (possibleTargets.hasNext()) { >- AntElementNode node= (AntElementNode)possibleTargets.next(); >+ AntElementNode node = (AntElementNode) possibleTargets.next(); > if (node instanceof AntTargetNode) { > targets.add(node); > } > } > if (targets.size() == 0) { >- return null; >+ return null; > } >- return (AntTargetNode[])targets.toArray(new AntTargetNode[targets.size()]); >- } >+ return (AntTargetNode[]) targets.toArray(new AntTargetNode[targets >+ .size()]); >+ } > >- public static AntTargetNode[] getTargets(String path) { >- File buildfile= getBuildFile(path); >+ public static AntTargetNode[] getTargets(String path) { >+ File buildfile = getBuildFile(path); > if (buildfile == null) { >- return null; >+ return null; > } >- //tasks and position info but no lexical info >- IAntModel model= getAntModel(buildfile, null, false, true, true); >- AntProjectNode project= model.getProjectNode(); >+ // tasks and position info but no lexical info >+ IAntModel model = getAntModel(buildfile, null, false, true, true); >+ AntProjectNode project = model.getProjectNode(); > if (project == null) { > model.dispose(); > return null; > } >- AntTargetNode[] targets= getTargets(project); >- if (targets == null) { >- Hashtable antTargets= project.getProject().getTargets(); >- Target implicitTarget= (Target) antTargets.get(""); //$NON-NLS-1$ >- if (implicitTarget != null) { >- AntTargetNode implicitTargetNode= new AntTargetNode(implicitTarget); >- project.addChildNode(implicitTargetNode); >- return new AntTargetNode[] {implicitTargetNode}; >- } >- } >- return targets; >- } >- >- public static IAntModel getAntModel(String buildFilePath, boolean needsLexicalResolution, boolean needsPositionResolution, boolean needsTaskResolution) { >- IAntModel model= getAntModel(getBuildFile(buildFilePath), null, needsLexicalResolution, needsPositionResolution, needsTaskResolution); >- return model; >+ AntTargetNode[] targets = getTargets(project); >+ if (targets == null) { >+ Hashtable antTargets = project.getProject().getTargets(); >+ Target implicitTarget = (Target) antTargets.get(""); //$NON-NLS-1$ >+ if (implicitTarget != null) { >+ AntTargetNode implicitTargetNode = new AntTargetNode( >+ implicitTarget); >+ project.addChildNode(implicitTargetNode); >+ return new AntTargetNode[] { implicitTargetNode }; >+ } >+ } >+ return targets; >+ } >+ >+ public static IAntModel getAntModel(String buildFilePath, >+ boolean needsLexicalResolution, boolean needsPositionResolution, >+ boolean needsTaskResolution) { >+ IAntModel model = getAntModel(getBuildFile(buildFilePath), null, >+ needsLexicalResolution, needsPositionResolution, >+ needsTaskResolution); >+ return model; > } >- >+ > /** >- * Return a buildfile from the specified location. >- * If there isn't one return null. >+ * Return a buildfile from the specified location. If there isn't one return >+ * null. > */ > private static File getBuildFile(String path) { > File buildFile = new File(path); >- if (!buildFile.isFile() || !buildFile.exists()) { >+ if (!buildFile.isFile() || !buildFile.exists()) { > return null; > } > > return buildFile; > } >- >- private static IAntModel getAntModel(final File buildFile, URL[] urls, boolean needsLexical, boolean needsPosition, boolean needsTask) { >- if (buildFile == null || !buildFile.exists()) { >- return null; >- } >- IDocument doc= getDocument(buildFile); >+ >+ private static IAntModel getAntModel(final File buildFile, URL[] urls, >+ boolean needsLexical, boolean needsPosition, boolean needsTask) { >+ if (buildFile == null || !buildFile.exists()) { >+ return null; >+ } >+ IDocument doc = getDocument(buildFile); > if (doc == null) { > return null; > } >- final IFile file= getFileForLocation(buildFile.getAbsolutePath(), null); >- LocationProvider provider= new LocationProvider(null) { >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.model.LocationProvider#getFile() >- */ >- public IFile getFile() { >- return file; >- } >- /* (non-Javadoc) >- * @see org.eclipse.ant.internal.ui.model.LocationProvider#getLocation() >+ final IFile file = AntLaunchingUtil.getFileForLocation(buildFile >+ .getAbsolutePath(), null); >+ LocationProvider provider = new LocationProvider(null) { >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ant.internal.ui.model.LocationProvider#getFile() >+ */ >+ public IFile getFile() { >+ return file; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.ant.internal.ui.model.LocationProvider#getLocation() > */ > public IPath getLocation() { >- if (file == null) { >- return new Path(buildFile.getAbsolutePath()); >- } >- return file.getLocation(); >+ if (file == null) { >+ return new Path(buildFile.getAbsolutePath()); >+ } >+ return file.getLocation(); > } > }; >- IAntModel model= new AntModel(doc, null, provider, needsLexical, needsPosition, needsTask); >- >+ IAntModel model = new AntModel(doc, null, provider, needsLexical, >+ needsPosition, needsTask); >+ > if (urls != null) { >- model.setClassLoader(AntCorePlugin.getPlugin().getNewClassLoader(urls)); >+ model.setClassLoader(AntCorePlugin.getPlugin().getNewClassLoader( >+ urls)); > } > return model; > } >- >+ > private static IDocument getDocument(File buildFile) { >- ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); >- IPath location= new Path(buildFile.getAbsolutePath()); >- boolean connected= false; >+ ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager(); >+ IPath location = new Path(buildFile.getAbsolutePath()); >+ boolean connected = false; > try { >- ITextFileBuffer buffer= manager.getTextFileBuffer(location, LocationKind.NORMALIZE); >+ ITextFileBuffer buffer = manager.getTextFileBuffer(location, >+ LocationKind.NORMALIZE); > if (buffer == null) { >- //no existing file buffer..create one >- manager.connect(location, LocationKind.NORMALIZE, new NullProgressMonitor()); >- connected= true; >- buffer= manager.getTextFileBuffer(location, LocationKind.NORMALIZE); >+ // no existing file buffer..create one >+ manager.connect(location, LocationKind.NORMALIZE, >+ new NullProgressMonitor()); >+ connected = true; >+ buffer = manager.getTextFileBuffer(location, >+ LocationKind.NORMALIZE); > if (buffer == null) { > return null; > } > } >- >+ > return buffer.getDocument(); > } catch (CoreException ce) { > AntUIPlugin.log(ce.getStatus()); >@@ -394,100 +314,28 @@ > } finally { > if (connected) { > try { >- manager.disconnect(location, LocationKind.NORMALIZE, new NullProgressMonitor()); >+ manager.disconnect(location, LocationKind.NORMALIZE, >+ new NullProgressMonitor()); > } catch (CoreException e) { > AntUIPlugin.log(e.getStatus()); > } > } > } > } >- >- /** >- * 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, AntUIPlugin.getUniqueIdentifier(), AntUIPlugin.INTERNAL_ERROR, AntUIModelMessages.AntUtil_7, e)); >- } >- } >- return urls; >- } > >- private static String expandVariableString(String variableString, String invalidMessage) throws CoreException { >- String expandedString = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(variableString); >+ 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, IAntUIConstants.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(); >+ String msg = MessageFormat.format(invalidMessage, >+ new String[] { variableString }); >+ throw new CoreException(new Status(IStatus.ERROR, >+ IAntUIConstants.PLUGIN_ID, 0, msg, null)); > } >- >- 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)); >+ >+ return expandedString; > } > > public static IHyperlink getLocationLink(String path, File buildFileParent) { >@@ -497,12 +345,12 @@ > } > if (path.startsWith("file:")) { //$NON-NLS-1$ > // remove "file:" >- path= path.substring(5, path.length()); >+ path = path.substring(5, path.length()); > } > // format is file:F:L: where F is file path, and L is line number > int index = path.lastIndexOf(':'); > if (index == -1) { >- //incorrect format >+ // incorrect format > return null; > } > if (index == path.length() - 1) { >@@ -515,283 +363,155 @@ > try { > String lineNumber = path.substring(index + 1); > int line = Integer.parseInt(lineNumber); >- IFile file = getFileForLocation(fileName, buildFileParent); >+ IFile file = AntLaunchingUtil.getFileForLocation(fileName, >+ buildFileParent); > if (file != null) { > return new FileLink(file, null, -1, -1, line); > } > } catch (NumberFormatException e) { > } >- >+ > return null; > } > >- /** >- * 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; >+ private static int getOffset(int line, int column, ITextEditor editor) { >+ IDocumentProvider provider = editor.getDocumentProvider(); >+ IEditorInput input = editor.getEditorInput(); >+ try { >+ provider.connect(input); >+ } catch (CoreException e) { >+ return -1; > } >- 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; >+ try { >+ IDocument document = provider.getDocument(input); >+ if (document != null) { >+ if (column > -1) { >+ // column marks the length..adjust to 0 index and to be >+ // within the element's source range >+ return document.getLineOffset(line - 1) + column - 1 - 2; > } >- } catch (BuildException be) { >- return null; >+ return document.getLineOffset(line - 1); > } >+ } catch (BadLocationException e) { >+ } finally { >+ provider.disconnect(input); > } >- >- 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 -1; > } > > /** >- * 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. >+ * Opens the given editor on the buildfile of the provided node and selects >+ * that node in the editor. > * >- * @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(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; >+ * @param page >+ * the page to open the editor in >+ * @param editorDescriptor >+ * the editor descriptor, or <code>null</code> for the system >+ * editor >+ * @param node >+ * the node from the buildfile to open and then select in the >+ * editor >+ */ >+ public static void openInEditor(IWorkbenchPage page, >+ IEditorDescriptor editorDescriptor, AntElementNode node) { >+ IEditorPart editorPart = null; >+ IFile fileResource = node.getIFile(); >+ try { >+ if (editorDescriptor == null) { >+ editorPart = page.openEditor(new FileEditorInput(fileResource), >+ IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); > } else { >- workingCopy = configuration.getWorkingCopy(); >+ editorPart = page.openEditor(new FileEditorInput(fileResource), >+ editorDescriptor.getId()); > } >- 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()); >+ } catch (PartInitException e) { >+ AntUIPlugin.log(MessageFormat.format(AntUIModelMessages.AntUtil_0, >+ new String[] { fileResource.getLocation().toOSString() }), >+ e); >+ } >+ >+ if (editorPart instanceof AntEditor) { >+ AntEditor editor = (AntEditor) editorPart; >+ if (node.getImportNode() != null) { >+ AntModel model = editor.getAntModel(); >+ AntProjectNode project = model.getProjectNode(); >+ if (project == null) { >+ return; > } >- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false); >- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, mementos); >+ int[] info = node.getExternalInfo(); >+ int offset = getOffset(info[0], info[1], editor); >+ node = project.getNode(offset); > } >- workingCopy.doSave(); >+ editor.setSelection(node, true); > } > } > >- private static int getOffset(int line, int column, ITextEditor editor) { >- IDocumentProvider provider= editor.getDocumentProvider(); >- IEditorInput input= editor.getEditorInput(); >- try { >- provider.connect(input); >- } catch (CoreException e) { >- return -1; >- } >- try { >- IDocument document= provider.getDocument(input); >- if (document != null) { >- if (column > -1) { >- //column marks the length..adjust to 0 index and to be within the element's source range >- return document.getLineOffset(line - 1) + column - 1 - 2; >- } >- return document.getLineOffset(line - 1); >- } >- } catch (BadLocationException e) { >- } finally { >- provider.disconnect(input); >- } >- return -1; >- } >- >- /** >- * Opens the given editor on the buildfile of the provided node and selects that node in the editor. >- * >- * @param page the page to open the editor in >- * @param editorDescriptor the editor descriptor, or <code>null</code> for the system editor >- * @param node the node from the buildfile to open and then select in the editor >- */ >- public static void openInEditor(IWorkbenchPage page, IEditorDescriptor editorDescriptor, AntElementNode node) { >- IEditorPart editorPart= null; >- IFile fileResource = node.getIFile(); >- try { >- if (editorDescriptor == null) { >- editorPart= page.openEditor(new FileEditorInput(fileResource), IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); >- } else { >- editorPart= page.openEditor(new FileEditorInput(fileResource), editorDescriptor.getId()); >- } >- } catch (PartInitException e) { >- AntUIPlugin.log(MessageFormat.format(AntUIModelMessages.AntUtil_0, new String[]{fileResource.getLocation().toOSString()}), e); >- } >- >- if (editorPart instanceof AntEditor) { >- AntEditor editor= (AntEditor)editorPart; >- if (node.getImportNode() != null) { >- AntModel model= editor.getAntModel(); >- AntProjectNode project= model.getProjectNode(); >- if (project == null) { >- return; >- } >- int[] info= node.getExternalInfo(); >- int offset= getOffset(info[0], info[1], editor); >- node= project.getNode(offset); >- } >- editor.setSelection(node, true); >- } >- } >- >- /** >- * Opens an editor on the buildfile of the provided node and selects that node in the editor. >- * >- * @param page the page to open the editor in >- * @param node the node from the buildfile to open and then select in the editor >- */ >- public static void openInEditor(IWorkbenchPage page, AntElementNode node) { >- IFile file= node.getIFile(); >- IEditorDescriptor editorDesc; >- try { >- editorDesc = IDE.getEditorDescriptor(file); >- } catch (PartInitException e) { >- return; >- } >- openInEditor(page, editorDesc, node); >- } >- >- /** >- * Opens an external browser on the provided <code>urlString</code> >- * @param urlString The url to open >- * @param shell the shell >- * @param errorDialogTitle the title of any error dialog >- */ >- public static void openBrowser(final String urlString, final Shell shell, final String errorDialogTitle) { >- shell.getDisplay().syncExec(new Runnable() { >- public void run() { >- IWorkbenchBrowserSupport support= PlatformUI.getWorkbench().getBrowserSupport(); >- try { >- IWebBrowser browser= support.createBrowser(fgBrowserId); >- fgBrowserId= browser.getId(); >- browser.openURL(new URL(urlString)); >- return; >- } catch (PartInitException e) { >- AntUIPlugin.log(e.getStatus()); >- } catch (MalformedURLException e) { >- AntUIPlugin.log(e); >- } >- >- String platform= SWT.getPlatform(); >- boolean succeeded= true; >- if ("motif".equals(platform) || "gtk".equals(platform)) { //$NON-NLS-1$ //$NON-NLS-2$ >- Program program= Program.findProgram("html"); //$NON-NLS-1$ >- if (program == null) { >- program= Program.findProgram("htm"); //$NON-NLS-1$ >- } >- if (program != null) { >- succeeded= program.execute(urlString.toString()); >- } >- } else { >- succeeded= Program.launch(urlString.toString()); >- } >- if (!succeeded) { >- MessageDialog.openInformation(shell, errorDialogTitle, AntUIModelMessages.AntUtil_1); >- } >- } >- }); >- } >- >- public static boolean isSeparateJREAntBuild(ILaunchConfiguration configuration) { >- boolean separateJRE= true; >+ /** >+ * Opens an editor on the buildfile of the provided node and selects that >+ * node in the editor. >+ * >+ * @param page >+ * the page to open the editor in >+ * @param node >+ * the node from the buildfile to open and then select in the >+ * editor >+ */ >+ public static void openInEditor(IWorkbenchPage page, AntElementNode node) { >+ IFile file = node.getIFile(); >+ IEditorDescriptor editorDesc; > 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); >+ editorDesc = IDE.getEditorDescriptor(file); >+ } catch (PartInitException e) { >+ return; > } >- >- 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); >- } >- } >- } >+ openInEditor(page, editorDesc, node); >+ } >+ >+ /** >+ * Opens an external browser on the provided <code>urlString</code> >+ * >+ * @param urlString >+ * The url to open >+ * @param shell >+ * the shell >+ * @param errorDialogTitle >+ * the title of any error dialog >+ */ >+ public static void openBrowser(final String urlString, final Shell shell, >+ final String errorDialogTitle) { >+ shell.getDisplay().syncExec(new Runnable() { >+ public void run() { >+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench() >+ .getBrowserSupport(); >+ try { >+ IWebBrowser browser = support.createBrowser(fgBrowserId); >+ fgBrowserId = browser.getId(); >+ browser.openURL(new URL(urlString)); >+ return; >+ } catch (PartInitException e) { >+ AntUIPlugin.log(e.getStatus()); >+ } catch (MalformedURLException e) { >+ AntUIPlugin.log(e); >+ } >+ >+ String platform = SWT.getPlatform(); >+ boolean succeeded = true; >+ if ("motif".equals(platform) || "gtk".equals(platform)) { //$NON-NLS-1$ //$NON-NLS-2$ >+ Program program = Program.findProgram("html"); //$NON-NLS-1$ >+ if (program == null) { >+ program = Program.findProgram("htm"); //$NON-NLS-1$ >+ } >+ if (program != null) { >+ succeeded = program.execute(urlString.toString()); >+ } >+ } else { >+ succeeded = Program.launch(urlString.toString()); >+ } >+ if (!succeeded) { >+ MessageDialog.openInformation(shell, errorDialogTitle, >+ AntUIModelMessages.AntUtil_1); >+ } >+ } >+ }); >+ } > } >\ No newline at end of file >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/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/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/DebugModelMessages.java >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.java >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.java 12 May 2005 21:06:40 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,39 +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 - Initial API and implementation >- **********************************************************************/ >-package org.eclipse.ant.internal.ui.debug.model; >- >-import org.eclipse.osgi.util.NLS; >- >-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; >- public static String AntDebugModelPresentation_3; >- 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 >- NLS.initializeMessages(BUNDLE_NAME, DebugModelMessages.class); >- } >-} >\ No newline at end of file >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/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/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/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/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/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/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.properties >=================================================================== >RCS file: Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.properties >diff -N Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.properties >--- Ant Tools Support/org/eclipse/ant/internal/ui/debug/model/DebugModelMessages.properties 12 May 2005 21:06:24 -0000 1.7 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,28 +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 >-############################################################################### >- >-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/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 30 Sep 2009 16:24:35 -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,12 @@ > > 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.launching.debug.model.DebugModelMessages; > 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/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 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 30 Sep 2009 16:24:34 -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 30 Sep 2009 16:24:34 -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 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 30 Sep 2009 16:24:34 -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 30 Sep 2009 16:24:34 -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 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 30 Sep 2009 16:24:37 -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 >@@ -14,8 +14,9 @@ > import java.util.List; > > import org.eclipse.ant.core.AntCorePlugin; >-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.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; >+import org.eclipse.core.internal.externaltools.model.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; > >@@ -277,7 +277,7 @@ > try { > String expandedLocation= manager.performStringSubstitution(location); > if (expandedLocation != null) { >- file= AntUtil.getFileForLocation(expandedLocation, null); >+ file= AntLaunchingUtil.getFileForLocation(expandedLocation, null); > } > } catch (CoreException e) { > } >Index: Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPropertiesBlock.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPropertiesBlock.java,v >retrieving revision 1.26 >diff -u -r1.26 AntPropertiesBlock.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPropertiesBlock.java 24 Feb 2009 16:29:02 -0000 1.26 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPropertiesBlock.java 30 Sep 2009 16:24:37 -0000 >@@ -16,8 +16,8 @@ > import java.util.Map; > > import org.eclipse.ant.core.Property; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.AntUtil; > import org.eclipse.ant.internal.ui.ColumnSorter; > import org.eclipse.ant.internal.ui.IAntUIConstants; > import org.eclipse.core.resources.IFile; >@@ -174,7 +174,7 @@ > for (int j = 0; j < existingFiles.length; j++) { > String file = (String)existingFiles[j]; > try { >- propFiles.add(AntUtil.getFileForLocation(VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(file), null)); >+ propFiles.add(AntLaunchingUtil.getFileForLocation(VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(file), null)); > } catch (CoreException e) { > AntUIPlugin.log(e.getStatus()); > } >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 30 Sep 2009 16:24:37 -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,161 +42,212 @@ > import org.eclipse.ui.IWorkbenchPreferencePage; > import org.eclipse.ui.PlatformUI; > >-public class AntPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { >- >+import com.ibm.icu.text.MessageFormat; >+ >+public class AntPreferencePage extends FieldEditorPreferencePage implements >+ IWorkbenchPreferencePage { >+ > private List fConsoleColorList; > private ColorEditor fConsoleColorEditor; >- >- private BooleanFieldEditor fToolsWarningEditor= null; >- >- // Array containing the message to display, the preference key, and the >- // default value (initialized in storeInitialValues()) for each color preference >- private final String[][] fAppearanceColorListModel= new String[][] { >- {AntPreferencesMessages.AntPreferencePage__Error__2, IAntUIPreferenceConstants.CONSOLE_ERROR_COLOR, null}, >- {AntPreferencesMessages.AntPreferencePage__Warning__3, IAntUIPreferenceConstants.CONSOLE_WARNING_COLOR, null}, >- {AntPreferencesMessages.AntPreferencePage_I_nformation__4, IAntUIPreferenceConstants.CONSOLE_INFO_COLOR, null}, >- {AntPreferencesMessages.AntPreferencePage_Ve_rbose__5, IAntUIPreferenceConstants.CONSOLE_VERBOSE_COLOR, null}, >- {AntPreferencesMessages.AntPreferencePage_Deb_ug__6, IAntUIPreferenceConstants.CONSOLE_DEBUG_COLOR, null}, >- }; >+ private IntegerFieldEditor timeout; >+ >+ private BooleanFieldEditor fToolsWarningEditor = null; >+ >+ // Array containing the message to display, the preference key, and the >+ // default value (initialized in storeInitialValues()) for each color >+ // preference >+ private final String[][] fAppearanceColorListModel = new String[][] { >+ { AntPreferencesMessages.AntPreferencePage__Error__2, >+ IAntUIPreferenceConstants.CONSOLE_ERROR_COLOR, null }, >+ { AntPreferencesMessages.AntPreferencePage__Warning__3, >+ IAntUIPreferenceConstants.CONSOLE_WARNING_COLOR, null }, >+ { AntPreferencesMessages.AntPreferencePage_I_nformation__4, >+ IAntUIPreferenceConstants.CONSOLE_INFO_COLOR, null }, >+ { AntPreferencesMessages.AntPreferencePage_Ve_rbose__5, >+ IAntUIPreferenceConstants.CONSOLE_VERBOSE_COLOR, null }, >+ { AntPreferencesMessages.AntPreferencePage_Deb_ug__6, >+ IAntUIPreferenceConstants.CONSOLE_DEBUG_COLOR, null }, }; > > /** >- * Create the Ant page. >- */ >+ * Create the Ant page. >+ */ > public AntPreferencePage() { > super(GRID); > setDescription(AntPreferencesMessages.AntPreferencePage_General); > setPreferenceStore(AntUIPlugin.getDefault().getPreferenceStore()); > } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors >+ * () > */ > protected void createFieldEditors() { > storeAppliedValues(); > >- Font font= getFieldEditorParent().getFont(); >- Label label= new Label(getFieldEditorParent(), SWT.WRAP); >+ Font font = getFieldEditorParent().getFont(); >+ Label label = new Label(getFieldEditorParent(), SWT.WRAP); > label.setText(AntPreferencesMessages.AntPreferencePage_Enter); >- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); >- gd.horizontalSpan= 3; >- gd.widthHint= convertWidthInCharsToPixels(60); >+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); >+ gd.horizontalSpan = 3; >+ gd.widthHint = convertWidthInCharsToPixels(60); > label.setLayoutData(gd); > label.setLayoutData(gd); > label.setFont(font); >- >- StringFieldEditor editor = new StringFieldEditor(IAntUIPreferenceConstants.ANT_FIND_BUILD_FILE_NAMES, AntPreferencesMessages.AntPreferencePage__Names__3, getFieldEditorParent()); >+ >+ 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); >- int maxValue = 1200000; >- timeout.setValidRange(minValue, maxValue); >- timeout.setErrorMessage(MessageFormat.format(AntPreferencesMessages.AntPreferencePage_14, new Object[] {new Integer(minValue), new Integer(maxValue)})); >- addField(timeout); >- >- editor = new URLFieldEditor(IAntUIPreferenceConstants.DOCUMENTATION_URL, AntPreferencesMessages.AntPreferencePage_2, getFieldEditorParent()); >+ >+ 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) })); >+ addField(timeout); >+ >+ editor = new URLFieldEditor( >+ IAntUIPreferenceConstants.DOCUMENTATION_URL, >+ AntPreferencesMessages.AntPreferencePage_2, >+ getFieldEditorParent()); > addField(editor); >- >+ > createSpace(); >- >+ > if (!AntUIPlugin.isMacOS()) { >- //the mac does not have a tools.jar Bug 40778 >- label= new Label(getFieldEditorParent(), SWT.WRAP); >+ // the mac does not have a tools.jar Bug 40778 >+ label = new Label(getFieldEditorParent(), SWT.WRAP); > label.setText(AntPreferencesMessages.AntPreferencePage_0); >- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); >- gd.horizontalSpan= 3; >- gd.widthHint= convertWidthInCharsToPixels(60); >+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); >+ gd.horizontalSpan = 3; >+ gd.widthHint = convertWidthInCharsToPixels(60); > label.setLayoutData(gd); > label.setFont(font); >- fToolsWarningEditor= new BooleanFieldEditor(IAntUIPreferenceConstants.ANT_TOOLS_JAR_WARNING, AntPreferencesMessages.AntPreferencePage_1, getFieldEditorParent()); >+ fToolsWarningEditor = new BooleanFieldEditor( >+ IAntUIPreferenceConstants.ANT_TOOLS_JAR_WARNING, >+ AntPreferencesMessages.AntPreferencePage_1, >+ getFieldEditorParent()); > addField(fToolsWarningEditor); > createSpace(); > } >- >- addField(new BooleanFieldEditor(IAntUIPreferenceConstants.ANT_ERROR_DIALOG, AntPreferencesMessages.AntPreferencePage_12, getFieldEditorParent())); >+ >+ addField(new BooleanFieldEditor( >+ IAntUIPreferenceConstants.ANT_ERROR_DIALOG, >+ AntPreferencesMessages.AntPreferencePage_12, >+ getFieldEditorParent())); > createSpace(); >- >- >- addField(new BooleanFieldEditor(IAntUIPreferenceConstants.ANT_CREATE_MARKERS, AntPreferencesMessages.AntPreferencePage_15, getFieldEditorParent())); >- label= new Label(getFieldEditorParent(), SWT.WRAP); >+ >+ addField(new BooleanFieldEditor( >+ IAntUIPreferenceConstants.ANT_CREATE_MARKERS, >+ AntPreferencesMessages.AntPreferencePage_15, >+ getFieldEditorParent())); >+ label = new Label(getFieldEditorParent(), SWT.WRAP); > label.setText(AntPreferencesMessages.AntPreferencePage_16); >- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); >- gd.horizontalSpan= 3; >- gd.widthHint= convertWidthInCharsToPixels(60); >+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); >+ gd.horizontalSpan = 3; >+ gd.widthHint = convertWidthInCharsToPixels(60); > label.setLayoutData(gd); > label.setFont(font); >- >- createSpace(); >+ >+ createSpace(); > createColorComposite(); > getPreferenceStore().addPropertyChangeListener(this); > } >- >+ > private void createSpace() { >- Label label= new Label(getFieldEditorParent(), SWT.NONE); >- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); >- gd.horizontalSpan= 3; >+ Label label = new Label(getFieldEditorParent(), SWT.NONE); >+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); >+ gd.horizontalSpan = 3; > label.setLayoutData(gd); > } > > /** >- * Stores the initial values of the color preferences. The preference values are updated >- * on the fly as the user edits them (instead of only when they press "Apply"). We need >- * to store the old values so that we can reset them when the user chooses "Cancel". >+ * Stores the initial values of the color preferences. The preference values >+ * are updated on the fly as the user edits them (instead of only when they >+ * press "Apply"). We need to store the old values so that we can reset them >+ * when the user chooses "Cancel". > */ > private void storeAppliedValues() { >- IPreferenceStore store= getPreferenceStore(); >+ IPreferenceStore store = getPreferenceStore(); > for (int i = 0; i < fAppearanceColorListModel.length; i++) { > String preference = fAppearanceColorListModel[i][1]; >- fAppearanceColorListModel[i][2]= store.getString(preference); >+ fAppearanceColorListModel[i][2] = store.getString(preference); >+ } >+ >+ IEclipsePreferences node = new InstanceScope() >+ .getNode(AntLaunching.getUniqueIdentifier()); >+ String t = node.get( >+ IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, >+ "2000"); >+ if (timeout != null) { >+ t = new Integer(timeout.getIntValue()).toString(); > } >+ node.put(IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, t); //$NON-NLS-1$ > } >- >+ > private void createColorComposite() { >- Font font= getFieldEditorParent().getFont(); >- Label label= new Label(getFieldEditorParent(), SWT.LEFT); >- label.setText(AntPreferencesMessages.AntPreferencePage_Ant_Color_Options__6); >+ Font font = getFieldEditorParent().getFont(); >+ Label label = new Label(getFieldEditorParent(), SWT.LEFT); >+ label >+ .setText(AntPreferencesMessages.AntPreferencePage_Ant_Color_Options__6); > label.setFont(font); >- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); >- gd.horizontalSpan= 2; >+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); >+ gd.horizontalSpan = 2; > label.setLayoutData(gd); >- >- Composite editorComposite= new Composite(getFieldEditorParent(), SWT.NONE); >- GridLayout layout= new GridLayout(); >- layout.numColumns= 2; >- layout.marginHeight= 0; >- layout.marginWidth= 0; >+ >+ Composite editorComposite = new Composite(getFieldEditorParent(), >+ SWT.NONE); >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 2; >+ layout.marginHeight = 0; >+ layout.marginWidth = 0; > editorComposite.setLayout(layout); > editorComposite.setFont(font); >- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL); >- gd.horizontalSpan= 2; >- editorComposite.setLayoutData(gd); >- >- fConsoleColorList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); >- gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL); >- gd.heightHint= convertHeightInCharsToPixels(8); >+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL >+ | GridData.FILL_VERTICAL); >+ gd.horizontalSpan = 2; >+ editorComposite.setLayoutData(gd); >+ >+ fConsoleColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL >+ | SWT.H_SCROLL | SWT.BORDER); >+ gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING >+ | GridData.FILL_HORIZONTAL); >+ gd.heightHint = convertHeightInCharsToPixels(8); > fConsoleColorList.setLayoutData(gd); > fConsoleColorList.setFont(font); >- >- Composite stylesComposite= new Composite(editorComposite, SWT.NONE); >- layout= new GridLayout(); >- layout.marginHeight= 0; >- layout.marginWidth= 0; >- layout.numColumns= 2; >+ >+ Composite stylesComposite = new Composite(editorComposite, SWT.NONE); >+ layout = new GridLayout(); >+ layout.marginHeight = 0; >+ layout.marginWidth = 0; >+ layout.numColumns = 2; > stylesComposite.setLayout(layout); > stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); > stylesComposite.setFont(font); > >- label= new Label(stylesComposite, SWT.LEFT); >+ label = new Label(stylesComposite, SWT.LEFT); > label.setText(AntPreferencesMessages.AntPreferencePage_Color__7); > label.setFont(font); >- gd= new GridData(); >- gd.horizontalAlignment= GridData.BEGINNING; >+ gd = new GridData(); >+ gd.horizontalAlignment = GridData.BEGINNING; > label.setLayoutData(gd); > >- fConsoleColorEditor= new ColorEditor(stylesComposite); >- Button foregroundColorButton= fConsoleColorEditor.getButton(); >- gd= new GridData(GridData.FILL_HORIZONTAL); >- gd.horizontalAlignment= GridData.BEGINNING; >+ fConsoleColorEditor = new ColorEditor(stylesComposite); >+ Button foregroundColorButton = fConsoleColorEditor.getButton(); >+ gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalAlignment = GridData.BEGINNING; > foregroundColorButton.setLayoutData(gd); > foregroundColorButton.setFont(font); > >@@ -205,27 +258,29 @@ > }); > foregroundColorButton.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { >- int i= fConsoleColorList.getSelectionIndex(); >- if (i == -1) { //bug 85590 >+ int i = fConsoleColorList.getSelectionIndex(); >+ if (i == -1) { // bug 85590 > return; > } >- String key= fAppearanceColorListModel[i][1]; >- PreferenceConverter.setValue(getPreferenceStore(), key, fConsoleColorEditor.getColorValue()); >+ String key = fAppearanceColorListModel[i][1]; >+ PreferenceConverter.setValue(getPreferenceStore(), key, >+ fConsoleColorEditor.getColorValue()); > } > }); > } >- >+ > /** > * Restore all color preferences to their values when the page was opened. > */ > public boolean performCancel() { > for (int i = 0; i < fAppearanceColorListModel.length; i++) { > String preference = fAppearanceColorListModel[i][1]; >- PreferenceConverter.setValue(getPreferenceStore(), preference, StringConverter.asRGB(fAppearanceColorListModel[i][2])); >+ PreferenceConverter.setValue(getPreferenceStore(), preference, >+ StringConverter.asRGB(fAppearanceColorListModel[i][2])); > } > return super.performCancel(); > } >- >+ > /** > * When the user applies the preferences, update the set of stored > * preferences so that we will fall back to the applied values on Cancel. >@@ -234,22 +289,23 @@ > storeAppliedValues(); > return super.performOk(); > } >- >- private void handleAppearanceColorListSelection() { >- int i= fConsoleColorList.getSelectionIndex(); >- if (i == -1) { //bug 85590 >+ >+ private void handleAppearanceColorListSelection() { >+ int i = fConsoleColorList.getSelectionIndex(); >+ if (i == -1) { // bug 85590 > return; > } >- String key= fAppearanceColorListModel[i][1]; >- RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), key); >- fConsoleColorEditor.setColorValue(rgb); >+ String key = fAppearanceColorListModel[i][1]; >+ RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), key); >+ fConsoleColorEditor.setColorValue(rgb); > } >- >+ > /** > * @see FieldEditorPreferencePage#createContents(org.eclipse.swt.widgets.Composite) > */ > protected Control createContents(Composite parent) { >- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IAntUIHelpContextIds.ANT_PREFERENCE_PAGE); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, >+ IAntUIHelpContextIds.ANT_PREFERENCE_PAGE); > return super.createContents(parent); > } > >@@ -258,49 +314,60 @@ > */ > public void init(IWorkbench workbench) { > } >- >+ > /** > * @see org.eclipse.jface.preference.FieldEditorPreferencePage#initialize() > */ > protected void initialize() { > super.initialize(); >- for (int i= 0; i < fAppearanceColorListModel.length; i++) { >+ for (int i = 0; i < fAppearanceColorListModel.length; i++) { > fConsoleColorList.add(fAppearanceColorListModel[i][0]); > } > fConsoleColorList.getDisplay().asyncExec(new Runnable() { > public void run() { >- if (fConsoleColorList != null && !fConsoleColorList.isDisposed()) { >+ if (fConsoleColorList != null >+ && !fConsoleColorList.isDisposed()) { > fConsoleColorList.select(0); > handleAppearanceColorListSelection(); > } > } > }); > } >+ > /** > * @see org.eclipse.jface.preference.PreferencePage#performDefaults() > */ > protected void performDefaults() { > for (int i = 0; i < fAppearanceColorListModel.length; i++) { >- String key= fAppearanceColorListModel[i][1]; >- PreferenceConverter.setValue(getPreferenceStore(), key, PreferenceConverter.getDefaultColor(getPreferenceStore(), key)); >+ String key = fAppearanceColorListModel[i][1]; >+ PreferenceConverter.setValue(getPreferenceStore(), key, >+ PreferenceConverter.getDefaultColor(getPreferenceStore(), >+ key)); > } > handleAppearanceColorListSelection(); >- >+ > super.performDefaults(); > } >- >- /* (non-Javadoc) >+ >+ /* >+ * (non-Javadoc) >+ * > * @see org.eclipse.jface.dialogs.IDialogPage#dispose() > */ > public void dispose() { > getPreferenceStore().removePropertyChangeListener(this); > } > >- /* (non-Javadoc) >- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse >+ * .jface.util.PropertyChangeEvent) > */ > public void propertyChange(PropertyChangeEvent event) { >- if (event.getProperty().equals(IAntUIPreferenceConstants.ANT_TOOLS_JAR_WARNING)) { >+ if (event.getProperty().equals( >+ IAntUIPreferenceConstants.ANT_TOOLS_JAR_WARNING)) { > if (fToolsWarningEditor != null) { > fToolsWarningEditor.load(); > } >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 30 Sep 2009 16:24:35 -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: 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 30 Sep 2009 16:24:34 -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> >Index: Ant Tools Support/org/eclipse/ant/internal/ui/views/AntViewDropAdapter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/AntViewDropAdapter.java,v >retrieving revision 1.7 >diff -u -r1.7 AntViewDropAdapter.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/views/AntViewDropAdapter.java 23 Feb 2005 17:31:21 -0000 1.7 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/views/AntViewDropAdapter.java 30 Sep 2009 16:24:37 -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,7 +10,7 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.ui.views; > >-import org.eclipse.ant.internal.ui.AntUtil; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > import org.eclipse.ant.internal.ui.model.AntProjectNode; > import org.eclipse.ant.internal.ui.model.AntProjectNodeProxy; > import org.eclipse.core.resources.IFile; >@@ -60,7 +60,7 @@ > * @param buildFileName the string to process > */ > private void processString(String buildFileName) { >- IFile buildFile = AntUtil.getFileForLocation(buildFileName, null); >+ IFile buildFile = AntLaunchingUtil.getFileForLocation(buildFileName, null); > if (buildFile == null || !buildFileName.toLowerCase().endsWith(".xml")) { //$NON-NLS-1$ > return; > } >Index: Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AddBuildFilesAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AddBuildFilesAction.java,v >retrieving revision 1.10 >diff -u -r1.10 AddBuildFilesAction.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AddBuildFilesAction.java 11 Aug 2005 16:26:26 -0000 1.10 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AddBuildFilesAction.java 30 Sep 2009 16:24:37 -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,8 +13,9 @@ > import java.lang.reflect.InvocationTargetException; > import java.util.ArrayList; > import java.util.List; >+ >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > import org.eclipse.ant.internal.ui.AntUIImages; >-import org.eclipse.ant.internal.ui.AntUtil; > import org.eclipse.ant.internal.ui.IAntUIConstants; > import org.eclipse.ant.internal.ui.IAntUIHelpContextIds; > import org.eclipse.ant.internal.ui.model.AntProjectNode; >@@ -89,7 +90,7 @@ > List buildFiles= new ArrayList(existingProjects.length); > for (int j = 0; j < existingProjects.length; j++) { > AntProjectNode existingProject = existingProjects[j]; >- buildFiles.add(AntUtil.getFile(existingProject.getBuildFileName())); >+ buildFiles.add(AntLaunchingUtil.getFile(existingProject.getBuildFileName())); > } > return buildFiles; > } >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 30 Sep 2009 16:24:37 -0000 >@@ -13,7 +13,7 @@ > > 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.core.internal.externaltools.model.IExternalToolConstants; > > /** > * Constant definitions for Ant launch configurations. >Index: buildfiles/buildExtraJAR.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/buildfiles/buildExtraJAR.xml,v >retrieving revision 1.38 >diff -u -r1.38 buildExtraJAR.xml >--- buildfiles/buildExtraJAR.xml 4 May 2009 16:11:00 -0000 1.38 >+++ buildfiles/buildExtraJAR.xml 30 Sep 2009 16:24:37 -0000 >@@ -36,7 +36,7 @@ > <include name="org.eclipse.core.jobs/bin"/> > <include name="org.eclipse.equinox.common/bin"/> > <include name="org.eclipse.core.resources/bin"/> >- <include name="org.eclipse.ant.ui/bin"/> >+ <include name="org.eclipse.ant.ui/bin"/> <include name="org.eclipse.ant.launching/bin"/> > <include name="org.eclipse.swt*/bin"/> > <include name="org.eclipse.text/bin"/> > <include name="org.eclipse.ant.core/bin"/> >Index: Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java,v >retrieving revision 1.115 >diff -u -r1.115 AntEditor.java >--- Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java 24 Nov 2008 17:56:34 -0000 1.115 >+++ Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java 30 Sep 2009 16:24:34 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2002, 2008 GEBIT Gesellschaft fuer EDV-Beratung >+ * Copyright (c) 2002, 2009 GEBIT Gesellschaft fuer EDV-Beratung > * und Informatik-Technologien mbH, > * Berlin, Duesseldorf, Frankfurt (Germany) and others. > * All rights reserved. This program and the accompanying materials >@@ -23,8 +23,8 @@ > import java.util.Map; > import java.util.ResourceBundle; > >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; > 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.IAntUIHelpContextIds; > import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants; >@@ -45,35 +45,21 @@ > import org.eclipse.ant.internal.ui.model.AntProjectNode; > import org.eclipse.ant.internal.ui.model.IAntModelListener; > import org.eclipse.ant.internal.ui.preferences.AntEditorPreferenceConstants; >- >-import org.eclipse.swt.custom.StyledText; >-import org.eclipse.swt.events.ShellAdapter; >-import org.eclipse.swt.events.ShellEvent; >-import org.eclipse.swt.graphics.Image; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Shell; >- >+import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.jobs.Job; >- >-import org.eclipse.core.resources.IFile; >- >+import org.eclipse.debug.ui.actions.IRunToLineTarget; >+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; >+import org.eclipse.jdt.ui.JavaUI; >+import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.action.IMenuManager; > import org.eclipse.jface.action.Separator; > import org.eclipse.jface.preference.IPreferenceStore; >-import org.eclipse.jface.util.PropertyChangeEvent; >-import org.eclipse.jface.viewers.IPostSelectionProvider; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.jface.viewers.ISelectionChangedListener; >-import org.eclipse.jface.viewers.ISelectionProvider; >-import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.jface.viewers.SelectionChangedEvent; >- > import org.eclipse.jface.text.BadLocationException; > import org.eclipse.jface.text.DocumentEvent; > import org.eclipse.jface.text.IAutoEditStrategy; >@@ -99,7 +85,19 @@ > import org.eclipse.jface.text.source.projection.IProjectionListener; > import org.eclipse.jface.text.source.projection.ProjectionSupport; > import org.eclipse.jface.text.source.projection.ProjectionViewer; >- >+import org.eclipse.jface.util.PropertyChangeEvent; >+import org.eclipse.jface.viewers.IPostSelectionProvider; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.ISelectionChangedListener; >+import org.eclipse.jface.viewers.ISelectionProvider; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.SelectionChangedEvent; >+import org.eclipse.swt.custom.StyledText; >+import org.eclipse.swt.events.ShellAdapter; >+import org.eclipse.swt.events.ShellEvent; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IEditorInput; > import org.eclipse.ui.IPageLayout; > import org.eclipse.ui.IPartService; >@@ -107,24 +105,16 @@ > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PartInitException; >+import org.eclipse.ui.editors.text.TextEditor; > import org.eclipse.ui.ide.IDE; > import org.eclipse.ui.part.IShowInTargetList; >-import org.eclipse.ui.views.contentoutline.ContentOutline; >-import org.eclipse.ui.views.contentoutline.IContentOutlinePage; >- > import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; > import org.eclipse.ui.texteditor.IDocumentProvider; > import org.eclipse.ui.texteditor.IEditorStatusLine; > import org.eclipse.ui.texteditor.ITextEditorActionConstants; > import org.eclipse.ui.texteditor.TextOperationAction; >- >-import org.eclipse.ui.editors.text.TextEditor; >- >-import org.eclipse.debug.ui.actions.IRunToLineTarget; >-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; >- >-import org.eclipse.jdt.ui.JavaUI; >-import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds; >+import org.eclipse.ui.views.contentoutline.ContentOutline; >+import org.eclipse.ui.views.contentoutline.IContentOutlinePage; > > /** > * The actual editor implementation for Eclipse's Ant integration. >@@ -906,7 +896,7 @@ > if (buildFile != null) { > buildFileParent= buildFile.getParentFile(); > } >- IFile file= AntUtil.getFileForLocation(path, buildFileParent); >+ IFile file= AntLaunchingUtil.getFileForLocation(path, buildFileParent); > if (file != null && file.exists()) { > try { > IWorkbenchPage p= getEditorSite().getPage(); >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 30 Sep 2009 16:24:37 -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: Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessBuildLogger.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessBuildLogger.java,v >retrieving revision 1.31 >diff -u -r1.31 AntProcessBuildLogger.java >--- Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessBuildLogger.java 24 Apr 2007 03:42:29 -0000 1.31 >+++ Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessBuildLogger.java 30 Sep 2009 16:24:35 -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,53 +13,44 @@ > 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.launching.AntLaunch; >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+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.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; >+ >+ protected void logMessage(String message, BuildEvent event, >+ int overridePriority) { >+ int priority = overridePriority; > if (priority == -1) { >- priority= event.getPriority(); >- } >- >+ priority = event.getPriority(); >+ } >+ > if (priority > getMessageOutputLevel()) { > return; > } >@@ -67,18 +58,19 @@ > if (antProcess == null) { > return; > } >- >- StringBuffer fullMessage= new StringBuffer(); >- if (!loggingToLogFile()) { >+ >+ StringBuffer fullMessage = new StringBuffer(); >+ if (!loggingToLogFile()) { > fullMessage.append(System.getProperty("line.separator")); //$NON-NLS-1$ > } >- if (event.getException() == null && event.getTask() != null && !fEmacsMode) { >+ if (event.getException() == null && event.getTask() != null >+ && !fEmacsMode) { > adornMessage(event, fullMessage); > } else { > fullMessage.append(message); > } >- message= fullMessage.toString(); >- >+ message = fullMessage.toString(); >+ > if (loggingToLogFile()) { > logMessageToLogFile(message, priority); > } else { >@@ -88,11 +80,14 @@ > } > > /** >- * 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 >+ * 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(); >@@ -100,23 +95,24 @@ > name = "null"; //$NON-NLS-1$ > } > Location location = event.getTask().getLocation(); >- StringBuffer column= new StringBuffer(); >+ 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(); >+ 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(); >+ String label = labelBuff.toString(); > if (event.getMessage() == null) { > return; > } > try { >- BufferedReader r = new BufferedReader(new StringReader(event.getMessage())); >+ BufferedReader r = new BufferedReader(new StringReader(event >+ .getMessage())); > String line = r.readLine(); > fullMessage.append(column); > appendAndLink(fullMessage, location, label, offset, line); >@@ -133,39 +129,44 @@ > } > } > } >- >- private void appendAndLink(StringBuffer fullMessage, Location location, String label, int offset, String line) { >+ >+ 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); >- } >+ 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(); >+ 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; >+ 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; > } >@@ -177,52 +178,22 @@ > 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(); >+ 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; >+ if (process instanceof AntProcess >+ && processId >+ .equals(process >+ .getAttribute(AbstractEclipseBuildLogger.ANT_PROCESS_ID))) { >+ fProcess = (AntProcess) process; > break; > } > } >@@ -230,85 +201,101 @@ > return fProcess; > } > >- /* (non-Javadoc) >- * Set the start time. >+ /* >+ * (non-Javadoc) Set the start time. > * >- * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) >+ * @see >+ * org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant. >+ * BuildEvent) > */ > public void buildStarted(BuildEvent event) { >- fStartTime= System.currentTimeMillis(); >+ fStartTime = System.currentTimeMillis(); > } >- >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#buildFinished(org.apache.tools.ant.BuildEvent) >+ >+ /* >+ * (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; >+ 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); >+ logMessage(getTimeString(System.currentTimeMillis() - fStartTime), >+ event, fMessageOutputLevel); > } >- fProcess= null; >+ 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); >- } >+ 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) { >+ if (minutes > 0) { >+ result.append(' '); > } >- if (seconds == 0 && minutes == 0) { >- result.append(milliseconds); >- result.append(AntSupportMessages.AntProcessBuildLogger__milliseconds_6); >+ result.append(seconds); >+ >+ if (seconds > 1) { >+ result >+ .append(AntSupportMessages.AntProcessBuildLogger__seconds_4); >+ } else { >+ result >+ .append(AntSupportMessages.AntProcessBuildLogger__second_5); > } >- >- 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) >+ } >+ 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()) { >@@ -319,32 +306,37 @@ > } > } > >- /* (non-Javadoc) >- * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) >+ /* >+ * (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(); >+ 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); >+ 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()); >- } >+ 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; >+ // 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: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessDebugBuildLogger.java,v >retrieving revision 1.24 >diff -u -r1.24 AntProcessDebugBuildLogger.java >--- Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessDebugBuildLogger.java 4 Aug 2006 01:14:46 -0000 1.24 >+++ Ant Runner Support/org/eclipse/ant/internal/ui/antsupport/logger/AntProcessDebugBuildLogger.java 30 Sep 2009 16:24:35 -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 >@@ -16,13 +16,13 @@ > > import org.apache.tools.ant.BuildEvent; > import org.apache.tools.ant.Location; >+import org.eclipse.ant.internal.launching.debug.IAntDebugController; >+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.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; >#P org.eclipse.debug.core >Index: core/org/eclipse/debug/internal/core/DebugCoreMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java,v >retrieving revision 1.39 >diff -u -r1.39 DebugCoreMessages.java >--- core/org/eclipse/debug/internal/core/DebugCoreMessages.java 28 Sep 2009 15:55:03 -0000 1.39 >+++ core/org/eclipse/debug/internal/core/DebugCoreMessages.java 30 Sep 2009 16:24:42 -0000 >@@ -113,6 +113,9 @@ > public static String RuntimeProcess_Exit_value_not_available_until_process_terminates__1; > public static String WatchExpression_0; > public static String NullStreamsProxy_0; >+ >+ public static String RefreshingResources; >+ public static String RefreshingResourcesError; > > static { > // load message values from bundle file >Index: core/org/eclipse/debug/internal/core/LaunchManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java,v >retrieving revision 1.224 >diff -u -r1.224 LaunchManager.java >--- core/org/eclipse/debug/internal/core/LaunchManager.java 28 Sep 2009 15:55:03 -0000 1.224 >+++ core/org/eclipse/debug/internal/core/LaunchManager.java 30 Sep 2009 16:24:43 -0000 >@@ -13,7 +13,6 @@ > *******************************************************************************/ > package org.eclipse.debug.internal.core; > >- > import java.io.BufferedInputStream; > import java.io.BufferedReader; > import java.io.ByteArrayOutputStream; >@@ -25,6 +24,8 @@ > import java.io.IOException; > import java.io.InputStream; > import java.io.InputStreamReader; >+import java.io.StringReader; >+import java.io.StringWriter; > import java.util.ArrayList; > import java.util.Arrays; > import java.util.Collection; >@@ -64,6 +65,7 @@ > import org.eclipse.core.resources.IResourceProxyVisitor; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.IExtensionPoint; > import org.eclipse.core.runtime.IPath; >@@ -112,110 +114,131 @@ > import com.ibm.icu.text.MessageFormat; > > /** >- * Manages launch configurations, launch configuration types, and registered launches. >- * >+ * Manages launch configurations, launch configuration types, and registered >+ * launches. >+ * > * @see ILaunchManager > */ >-public class LaunchManager extends PlatformObject implements ILaunchManager, IResourceChangeListener { >- >- /** >- * Preferred launch delegate preference name. >- * <p> >- * Prior to 3.5 this preferred launch delegates for all launch >- * configuration types were serialized into a single XML string >- * and stored in this preference. >- * </p> >- * <p> >- * Since 3.5, the preferred launch delegates are stored in a separate >- * preference for each launch configuration type. The name of this >- * preference is composed of the prefix, followed by a slash, followed by >- * the launch configuration type id. The values contain a set of launch >- * delegates, delimited by a semicolon, and each delegate entry contains >- * the delegate ID, followed by a comma, followed by comma-delimited >- * launch modes. >- * >- * @since 3.3 >- */ >- protected static final String PREF_PREFERRED_DELEGATES = DebugPlugin.getUniqueIdentifier() + ".PREFERRED_DELEGATES"; //$NON-NLS-1$ >- >+public class LaunchManager extends PlatformObject implements ILaunchManager, >+ IResourceChangeListener { >+ >+ // indicates no working set has been selected >+ private static final String NO_WORKING_SET = "NONE"; //$NON-NLS-1$ >+ >+ /** >+ * Preferred launch delegate preference name. >+ * <p> >+ * Prior to 3.5 this preferred launch delegates for all launch configuration >+ * types were serialized into a single XML string and stored in this >+ * preference. >+ * </p> >+ * <p> >+ * Since 3.5, the preferred launch delegates are stored in a separate >+ * preference for each launch configuration type. The name of this >+ * preference is composed of the prefix, followed by a slash, followed by >+ * the launch configuration type id. The values contain a set of launch >+ * delegates, delimited by a semi-colon, and each delegate entry contains >+ * the delegate ID, followed by a comma, followed by comma-delimited launch >+ * modes. >+ * >+ * @since 3.3 >+ */ >+ protected static final String PREF_PREFERRED_DELEGATES = DebugPlugin >+ .getUniqueIdentifier() >+ + ".PREFERRED_DELEGATES"; //$NON-NLS-1$ >+ > /** >- * Boolean preference on whether to delete associated configurations when a project is deleted. >+ * Boolean preference on whether to delete associated configurations when a >+ * project is deleted. > * > * @since 3.3 > */ >- public static final String PREF_DELETE_CONFIGS_ON_PROJECT_DELETE = DebugPlugin.getUniqueIdentifier() + ".PREF_DELETE_CONFIGS_ON_PROJECT_DELETE"; //$NON-NLS-1$ >- >+ public static final String PREF_DELETE_CONFIGS_ON_PROJECT_DELETE = DebugPlugin >+ .getUniqueIdentifier() >+ + ".PREF_DELETE_CONFIGS_ON_PROJECT_DELETE"; //$NON-NLS-1$ >+ > /** > * Constant to define debug.ui for the status codes > * > * @since 3.2 > */ > private static final String DEBUG_UI = "org.eclipse.debug.ui"; //$NON-NLS-1$ >- >+ > /** > * Listing of unsupported launch configuration names for the Win 32 platform >+ * > * @since 3.5 > */ >- static final String[] UNSUPPORTED_WIN32_CONFIG_NAMES = new String[] {"aux", "clock$", "com1", "com2", "com3", "com4", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ >- "com5", "com6", "com7", "com8", "com9", "con", "lpt1", "lpt2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ >- "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "nul", "prn"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ >- >+ static final String[] UNSUPPORTED_WIN32_CONFIG_NAMES = new String[] { >+ "aux", "clock$", "com1", "com2", "com3", "com4", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ >+ "com5", "com6", "com7", "com8", "com9", "con", "lpt1", "lpt2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ >+ "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "nul", "prn" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ >+ > /** >- * Disallowed characters for launch configuration names >- * '@' and '&' are disallowed because they corrupt menu items. >+ * Disallowed characters for launch configuration names '@' and '&' are >+ * disallowed because they corrupt menu items. > * > * @since 3.5 > */ >- static final char[] DISALLOWED_CONFIG_NAME_CHARS = new char[] { '@', '&','\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0' }; >- >+ static final char[] DISALLOWED_CONFIG_NAME_CHARS = new char[] { '@', '&', >+ '\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0' }; >+ > /** > * Status code for which a UI prompter is registered. > * > * @since 3.2 > */ >- protected static final IStatus promptStatus = new Status(IStatus.INFO, DEBUG_UI, 200, IInternalDebugCoreConstants.EMPTY_STRING, null); >- >+ protected static final IStatus promptStatus = new Status(IStatus.INFO, >+ DEBUG_UI, 200, IInternalDebugCoreConstants.EMPTY_STRING, null); >+ > /** > * Step filter manager > */ > private StepFilterManager fStepFilterManager = null; >- >+ > /** > * Notifies a launch config listener in a safe runnable to handle > * exceptions. > */ > class ConfigurationNotifier implements ISafeRunnable { >- >+ > private ILaunchConfigurationListener fListener; > private int fType; > private ILaunchConfiguration fConfiguration; >- >+ > /** > * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) > */ > public void handleException(Throwable exception) { >- IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during launch configuration change notification.", exception); //$NON-NLS-1$ >+ IStatus status = new Status( >+ IStatus.ERROR, >+ DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.INTERNAL_ERROR, >+ "An exception occurred during launch configuration change notification.", exception); //$NON-NLS-1$ > DebugPlugin.log(status); > } > > /** > * Notifies the given listener of the add/change/remove > * >- * @param configuration the configuration that has changed >- * @param update the type of change >+ * @param configuration >+ * the configuration that has changed >+ * @param update >+ * the type of change > */ > public void notify(ILaunchConfiguration configuration, int update) { > fConfiguration = configuration; > fType = update; > if (fLaunchConfigurationListeners.size() > 0) { >- Object[] listeners = fLaunchConfigurationListeners.getListeners(); >+ Object[] listeners = fLaunchConfigurationListeners >+ .getListeners(); > for (int i = 0; i < listeners.length; i++) { >- fListener = (ILaunchConfigurationListener)listeners[i]; >- SafeRunner.run(this); >+ fListener = (ILaunchConfigurationListener) listeners[i]; >+ SafeRunner.run(this); > } > } > fConfiguration = null; >- fListener = null; >+ fListener = null; > } > > /** >@@ -223,56 +246,62 @@ > */ > public void run() throws Exception { > switch (fType) { >- case ADDED: >- fListener.launchConfigurationAdded(fConfiguration); >- break; >- case REMOVED: >- fListener.launchConfigurationRemoved(fConfiguration); >- break; >- case CHANGED: >- fListener.launchConfigurationChanged(fConfiguration); >- break; >- } >+ case ADDED: >+ fListener.launchConfigurationAdded(fConfiguration); >+ break; >+ case REMOVED: >+ fListener.launchConfigurationRemoved(fConfiguration); >+ break; >+ case CHANGED: >+ fListener.launchConfigurationChanged(fConfiguration); >+ break; >+ } > } > } >- >+ > /** > * Notifies a launch listener (multiple launches) in a safe runnable to > * handle exceptions. > */ > class LaunchesNotifier implements ISafeRunnable { >- >+ > private ILaunchesListener fListener; > private int fType; > private ILaunch[] fNotifierLaunches; > private ILaunch[] fRegistered; >- >+ > /** > * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) > */ > public void handleException(Throwable exception) { >- IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during launch change notification.", exception); //$NON-NLS-1$ >+ IStatus status = new Status( >+ IStatus.ERROR, >+ DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.INTERNAL_ERROR, >+ "An exception occurred during launch change notification.", exception); //$NON-NLS-1$ > DebugPlugin.log(status); > } > > /** > * Notifies the given listener of the adds/changes/removes > * >- * @param launches the launches that changed >- * @param update the type of change >+ * @param launches >+ * the launches that changed >+ * @param update >+ * the type of change > */ > public void notify(ILaunch[] launches, int update) { > fNotifierLaunches = launches; > fType = update; > fRegistered = null; >- Object[] copiedListeners= fLaunchesListeners.getListeners(); >- for (int i= 0; i < copiedListeners.length; i++) { >- fListener = (ILaunchesListener)copiedListeners[i]; >- SafeRunner.run(this); >- } >+ Object[] copiedListeners = fLaunchesListeners.getListeners(); >+ for (int i = 0; i < copiedListeners.length; i++) { >+ fListener = (ILaunchesListener) copiedListeners[i]; >+ SafeRunner.run(this); >+ } > fNotifierLaunches = null; > fRegistered = null; >- fListener = null; >+ fListener = null; > } > > /** >@@ -280,69 +309,80 @@ > */ > public void run() throws Exception { > switch (fType) { >- case ADDED: >- fListener.launchesAdded(fNotifierLaunches); >- break; >- case REMOVED: >- fListener.launchesRemoved(fNotifierLaunches); >- break; >- case CHANGED: >- case TERMINATE: >- if (fRegistered == null) { >- List registered = null; >- for (int j = 0; j < fNotifierLaunches.length; j++) { >- if (isRegistered(fNotifierLaunches[j])) { >- if (registered != null) { >- registered.add(fNotifierLaunches[j]); >- } >- } else { >- if (registered == null) { >- registered = new ArrayList(fNotifierLaunches.length); >- for (int k = 0; k < j; k++) { >- registered.add(fNotifierLaunches[k]); >- } >- } >+ case ADDED: >+ fListener.launchesAdded(fNotifierLaunches); >+ break; >+ case REMOVED: >+ fListener.launchesRemoved(fNotifierLaunches); >+ break; >+ case CHANGED: >+ case TERMINATE: >+ if (fRegistered == null) { >+ List registered = null; >+ for (int j = 0; j < fNotifierLaunches.length; j++) { >+ if (isRegistered(fNotifierLaunches[j])) { >+ if (registered != null) { >+ registered.add(fNotifierLaunches[j]); > } >- } >- if (registered == null) { >- fRegistered = fNotifierLaunches; > } else { >- fRegistered = (ILaunch[])registered.toArray(new ILaunch[registered.size()]); >+ if (registered == null) { >+ registered = new ArrayList( >+ fNotifierLaunches.length); >+ for (int k = 0; k < j; k++) { >+ registered.add(fNotifierLaunches[k]); >+ } >+ } > } > } >- if (fRegistered.length > 0) { >- if (fType == CHANGED) { >- fListener.launchesChanged(fRegistered); >- } >- if (fType == TERMINATE && fListener instanceof ILaunchesListener2) { >- ((ILaunchesListener2)fListener).launchesTerminated(fRegistered); >- } >+ if (registered == null) { >+ fRegistered = fNotifierLaunches; >+ } else { >+ fRegistered = (ILaunch[]) registered >+ .toArray(new ILaunch[registered.size()]); >+ } >+ } >+ if (fRegistered.length > 0) { >+ if (fType == CHANGED) { >+ fListener.launchesChanged(fRegistered); >+ } >+ if (fType == TERMINATE >+ && fListener instanceof ILaunchesListener2) { >+ ((ILaunchesListener2) fListener) >+ .launchesTerminated(fRegistered); > } >- break; >+ } >+ break; > } > } > } >- >+ > /** >- * Visitor for handling a resource begin deleted, and the need to check mapped configurations >- * for auto-deletion >+ * Visitor for handling a resource begin deleted, and the need to check >+ * mapped configurations for auto-deletion >+ * > * @since 3.4 > */ > class MappedResourceVisitor implements IResourceDeltaVisitor { >- >- /* (non-Javadoc) >- * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta) >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse >+ * .core.resources.IResourceDelta) > */ > public boolean visit(IResourceDelta delta) throws CoreException { > if (0 != (delta.getFlags() & IResourceDelta.OPEN)) { > return false; > } >- if(delta.getKind() == IResourceDelta.REMOVED && delta.getFlags() != IResourceDelta.MOVED_TO) { >- ArrayList configs = collectAssociatedLaunches(delta.getResource()); >- if(configs.size() > 0) { >- for(Iterator iter = configs.iterator(); iter.hasNext();) { >- try { >- ((ILaunchConfiguration)iter.next()).delete(); >+ if (delta.getKind() == IResourceDelta.REMOVED >+ && delta.getFlags() != IResourceDelta.MOVED_TO) { >+ ArrayList configs = collectAssociatedLaunches(delta >+ .getResource()); >+ if (configs.size() > 0) { >+ for (Iterator iter = configs.iterator(); iter.hasNext();) { >+ try { >+ ((ILaunchConfiguration) iter.next()).delete(); > } catch (CoreException e) { > DebugPlugin.log(e.getStatus()); > } >@@ -353,13 +393,13 @@ > return true; > } > } >- >+ > /** > * Visitor for handling resource deltas. > */ > class LaunchManagerVisitor implements IResourceDeltaVisitor { >- >- /** >+ >+ /** > * @see IResourceDeltaVisitor#visit(IResourceDelta) > */ > public boolean visit(IResourceDelta delta) { >@@ -368,30 +408,31 @@ > } > if (0 != (delta.getFlags() & IResourceDelta.OPEN)) { > if (delta.getResource() instanceof IProject) { >- IProject project = (IProject)delta.getResource(); >+ IProject project = (IProject) delta.getResource(); > if (project.isOpen()) { > LaunchManager.this.projectOpened(project); >- } else { >- LaunchManager.this.projectClosed(project); >+ } else { >+ LaunchManager.this.projectClosed(project); > } > } > return false; > } > IResource resource = delta.getResource(); > if (resource instanceof IFile) { >- IFile file = (IFile)resource; >- if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equals(file.getFileExtension())) { >+ IFile file = (IFile) resource; >+ if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION >+ .equals(file.getFileExtension())) { > ILaunchConfiguration handle = new LaunchConfiguration(file); >- switch (delta.getKind()) { >- case IResourceDelta.ADDED : >- LaunchManager.this.launchConfigurationAdded(handle); >- break; >- case IResourceDelta.REMOVED : >- LaunchManager.this.launchConfigurationDeleted(handle); >- break; >- case IResourceDelta.CHANGED : >- LaunchManager.this.launchConfigurationChanged(handle); >- break; >+ switch (delta.getKind()) { >+ case IResourceDelta.ADDED: >+ LaunchManager.this.launchConfigurationAdded(handle); >+ break; >+ case IResourceDelta.REMOVED: >+ LaunchManager.this.launchConfigurationDeleted(handle); >+ break; >+ case IResourceDelta.CHANGED: >+ LaunchManager.this.launchConfigurationChanged(handle); >+ break; > } > } > return false; >@@ -399,41 +440,47 @@ > return true; > } > } >- >+ > /** > * Notifies a launch listener (single launch) in a safe runnable to handle > * exceptions. > */ > class LaunchNotifier implements ISafeRunnable { >- >+ > private ILaunchListener fListener; > private int fType; > private ILaunch fLaunch; >- >+ > /** > * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) > */ > public void handleException(Throwable exception) { >- IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during launch change notification.", exception); //$NON-NLS-1$ >+ IStatus status = new Status( >+ IStatus.ERROR, >+ DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.INTERNAL_ERROR, >+ "An exception occurred during launch change notification.", exception); //$NON-NLS-1$ > DebugPlugin.log(status); > } > > /** > * Notifies listeners of the add/change/remove > * >- * @param launch the launch that has changed >- * @param update the type of change >+ * @param launch >+ * the launch that has changed >+ * @param update >+ * the type of change > */ > public void notify(ILaunch launch, int update) { > fLaunch = launch; > fType = update; >- Object[] copiedListeners= fListeners.getListeners(); >- for (int i= 0; i < copiedListeners.length; i++) { >- fListener = (ILaunchListener)copiedListeners[i]; >- SafeRunner.run(this); >- } >+ Object[] copiedListeners = fListeners.getListeners(); >+ for (int i = 0; i < copiedListeners.length; i++) { >+ fListener = (ILaunchListener) copiedListeners[i]; >+ SafeRunner.run(this); >+ } > fLaunch = null; >- fListener = null; >+ fListener = null; > } > > /** >@@ -441,38 +488,41 @@ > */ > public void run() throws Exception { > switch (fType) { >- case ADDED: >- fListener.launchAdded(fLaunch); >- break; >- case REMOVED: >- fListener.launchRemoved(fLaunch); >- break; >- case CHANGED: >- if (isRegistered(fLaunch)) { >- fListener.launchChanged(fLaunch); >- } >- break; >- } >+ case ADDED: >+ fListener.launchAdded(fLaunch); >+ break; >+ case REMOVED: >+ fListener.launchRemoved(fLaunch); >+ break; >+ case CHANGED: >+ if (isRegistered(fLaunch)) { >+ fListener.launchChanged(fLaunch); >+ } >+ break; >+ } > } > } >- >+ > /** > * Collects files whose extension matches the launch configuration file > * extension. > */ > class ResourceProxyVisitor implements IResourceProxyVisitor { >- >+ > private List fList; >- >+ > protected ResourceProxyVisitor(List list) { >- fList= list; >+ fList = list; > } >+ > /** > * @see org.eclipse.core.resources.IResourceProxyVisitor#visit(org.eclipse.core.resources.IResourceProxy) > */ > public boolean visit(IResourceProxy proxy) { > if (proxy.getType() == IResource.FILE) { >- if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equalsIgnoreCase(proxy.requestFullPath().getFileExtension())) { >+ if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION >+ .equalsIgnoreCase(proxy.requestFullPath() >+ .getFileExtension())) { > fList.add(proxy.requestResource()); > } > return false; >@@ -480,7 +530,7 @@ > return true; > } > } >- >+ > /** > * Internal class used to hold information about a preferred delegate > * >@@ -490,70 +540,78 @@ > private ILaunchDelegate fDelegate = null; > private String fTypeid = null; > private Set fModes = null; >- >- public PreferredDelegate(ILaunchDelegate delegate, String typeid, Set modes) { >+ >+ public PreferredDelegate(ILaunchDelegate delegate, String typeid, >+ Set modes) { > fDelegate = delegate; > fTypeid = typeid; > fModes = modes; > } >- >+ > public String getTypeId() { > return fTypeid; > } >- >+ > public Set getModes() { > return fModes; > } >- >+ > public ILaunchDelegate getDelegate() { > return fDelegate; > } > } >- >+ > /** > * Types of notifications > */ > public static final int ADDED = 0; >- public static final int REMOVED= 1; >- public static final int CHANGED= 2; >- public static final int TERMINATE= 3; >- >- /** >- * The collection of native environment variables on the user's system. Cached >- * after being computed once as the environment cannot change. >- */ >- private static HashMap fgNativeEnv= null; >- private static HashMap fgNativeEnvCasePreserved= null; >- >+ public static final int REMOVED = 1; >+ public static final int CHANGED = 2; >+ public static final int TERMINATE = 3; >+ >+ /** >+ * The collection of native environment variables on the user's system. >+ * Cached after being computed once as the environment cannot change. >+ */ >+ private static HashMap fgNativeEnv = null; >+ private static HashMap fgNativeEnvCasePreserved = null; >+ > /** >- * Path to the local directory where local launch configurations >- * are stored with the workspace. >+ * Path to the local directory where local launch configurations are stored >+ * with the workspace. > */ >- public static final IPath LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH = >- DebugPlugin.getDefault().getStateLocation().append(".launches"); //$NON-NLS-1$ >+ public static final IPath LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH = DebugPlugin >+ .getDefault().getStateLocation().append(".launches"); //$NON-NLS-1$ >+ > /** > * Returns a Document that can be used to build a DOM tree >+ * > * @return the Document >- * @throws ParserConfigurationException if an exception occurs creating the document builder >+ * @throws ParserConfigurationException >+ * if an exception occurs creating the document builder > * @since 3.0 > */ > public static Document getDocument() throws ParserConfigurationException { >- DocumentBuilderFactory dfactory= DocumentBuilderFactory.newInstance(); >- DocumentBuilder docBuilder= dfactory.newDocumentBuilder(); >- Document doc= docBuilder.newDocument(); >+ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); >+ DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); >+ Document doc = docBuilder.newDocument(); > return doc; > } > > /** >- * Serializes a XML document into a string - encoded in UTF8 format, >- * with platform line separators. >+ * Serializes a XML document into a string - encoded in UTF8 format, with >+ * platform line separators. > * >- * @param doc document to serialize >+ * @param doc >+ * document to serialize > * @return the document as a string >- * @throws TransformerException if an unrecoverable error occurs during the serialization >- * @throws IOException if the encoding attempted to be used is not supported >+ * @throws TransformerException >+ * if an unrecoverable error occurs during the serialization >+ * @throws IOException >+ * if the encoding attempted to be used is not supported > */ >- public static String serializeDocument(Document doc) throws TransformerException, IOException { >+ public static String serializeDocument(Document doc) >+ throws TransformerException, IOException { > ByteArrayOutputStream s = new ByteArrayOutputStream(); > TransformerFactory factory = TransformerFactory.newInstance(); > Transformer transformer = factory.newTransformer(); >@@ -564,103 +622,103 @@ > transformer.transform(source, outputTarget); > return s.toString("UTF8"); //$NON-NLS-1$ > } >- >+ > /** >- * Collection of defined launch configuration type >- * extensions. >+ * Collection of defined launch configuration type extensions. > */ >- private List fLaunchConfigurationTypes = null; >+ private List fLaunchConfigurationTypes = null; > > /** > * Launch configuration cache. Keys are <code>LaunchConfiguration</code>, > * values are <code>LaunchConfigurationInfo</code>. > */ > private Map fLaunchConfigurations = new HashMap(10); >- >+ > /** > * A cache of launch configuration names currently in the workspace. > */ > private String[] fSortedConfigNames = null; >- >+ > /** > * Collection of all launch configurations in the workspace. > * <code>List</code> of <code>ILaunchConfiguration</code>. > */ > private List fLaunchConfigurationIndex = null; >- >+ > /** >- * Launch configuration comparator extensions, >- * keyed by attribute name. >+ * Launch configuration comparator extensions, keyed by attribute name. > */ > private Map fComparators = null; >- >+ > /** >- * Registered launch modes, or <code>null</code> if not initialized. >- * Keys are mode identifiers, values are <code>ILaunchMode</code>s. >+ * Registered launch modes, or <code>null</code> if not initialized. Keys >+ * are mode identifiers, values are <code>ILaunchMode</code>s. > */ > private Map fLaunchModes = null; >- >+ > /** >- * A map of LaunchDelegate objects stored by id of delegate, or launch config type >+ * A map of LaunchDelegate objects stored by id of delegate, or launch >+ * config type > */ > private HashMap fLaunchDelegates = null; >- >+ > /** >- * Initial startup cache of preferred delegate so that the debug preferences are only parsed once >+ * Initial startup cache of preferred delegate so that the debug preferences >+ * are only parsed once > * > * @since 3.3 > */ > private Set fPreferredDelegates = null; >- >+ > /** > * Collection of launches > */ >- private List fLaunches= new ArrayList(10); >+ private List fLaunches = new ArrayList(10); > /** > * Set of launches for efficient 'isRegistered()' check > */ > private Set fLaunchSet = new HashSet(10); >- >+ > /** > * Collection of listeners > */ > private ListenerList fListeners = new ListenerList(); >- >+ > /** > * Collection of "plural" listeners. >+ * > * @since 2.1 > */ >- private ListenerList fLaunchesListeners = new ListenerList(); >- >+ private ListenerList fLaunchesListeners = new ListenerList(); >+ > /** >- * Visitor used to process resource deltas, >- * to update launch configuration index. >+ * Visitor used to process resource deltas, to update launch configuration >+ * index. > */ > private LaunchManagerVisitor fgVisitor; >- >+ > /** >- * Visitor used to process a deleted resource, >- * to remove mapped launch configurations in the event >- * auto-removal of launch configurations is enabled >+ * Visitor used to process a deleted resource, to remove mapped launch >+ * configurations in the event auto-removal of launch configurations is >+ * enabled > * > * @since 3.4 > */ > private MappedResourceVisitor fgMRVisitor; >- >+ > /** > * Whether this manager is listening for resource change events > */ > private boolean fListening = false; >- >+ > /** > * Launch configuration listeners > */ > private ListenerList fLaunchConfigurationListeners = new ListenerList(); >- >+ > /** >- * Table of source locator extensions. Keys >- * are identifiers, and values are associated >- * configuration elements. >+ * Table of source locator extensions. Keys are identifiers, and values are >+ * associated configuration elements. > */ > private Map fSourceLocators = null; > >@@ -668,21 +726,21 @@ > * The handles of launch configurations being moved, or <code>null</code> > */ > private ILaunchConfiguration fFrom; >- >+ > private ILaunchConfiguration fTo; > >- /** >- * Map of source container type extensions. Keys are extension ids >- * and values are associated configuration elements. >+ /** >+ * Map of source container type extensions. Keys are extension ids and >+ * values are associated configuration elements. > */ > private Map sourceContainerTypes; >- >+ > /** >- * Map of source path computer extensions. Keys are extension ids >- * and values are associated configuration elements. >+ * Map of source path computer extensions. Keys are extension ids and values >+ * are associated configuration elements. > */ > private Map sourcePathComputers; >- >+ > private Set fActiveModes; > > /** >@@ -691,17 +749,18 @@ > public void addLaunch(ILaunch launch) { > if (internalAddLaunch(launch)) { > fireUpdate(launch, ADDED); >- fireUpdate(new ILaunch[] {launch}, ADDED); >+ fireUpdate(new ILaunch[] { launch }, ADDED); > } > } >- >+ > /** > * @see ILaunchManager#addLaunchConfigurationListener(ILaunchConfigurationListener) > */ >- public void addLaunchConfigurationListener(ILaunchConfigurationListener listener) { >+ public void addLaunchConfigurationListener( >+ ILaunchConfigurationListener listener) { > fLaunchConfigurationListeners.add(listener); >- } >- >+ } >+ > /** > * @see org.eclipse.debug.core.ILaunchManager#addLaunches(org.eclipse.debug.core.ILaunch[]) > */ >@@ -713,88 +772,99 @@ > } > } > if (!added.isEmpty()) { >- ILaunch[] addedLaunches = (ILaunch[])added.toArray(new ILaunch[added.size()]); >+ ILaunch[] addedLaunches = (ILaunch[]) added >+ .toArray(new ILaunch[added.size()]); > fireUpdate(addedLaunches, ADDED); > for (int i = 0; i < addedLaunches.length; i++) { > fireUpdate(launches[i], ADDED); > } > } > } >- >+ > /** > * @see org.eclipse.debug.core.ILaunchManager#addLaunchListener(org.eclipse.debug.core.ILaunchesListener) > */ > public void addLaunchListener(ILaunchesListener listener) { > fLaunchesListeners.add(listener); >- } >- >+ } >+ > /** > * @see ILaunchManager#addLaunchListener(ILaunchListener) > */ > public void addLaunchListener(ILaunchListener listener) { > fListeners.add(listener); >- } >- >+ } >+ > /** > * Computes and caches the native system environment variables as a map of > * variable names and values (Strings) in the given map. > * <p> >- * Note that WIN32 system environment preserves >- * the case of variable names but is otherwise case insensitive. >- * Depending on what you intend to do with the environment, the >- * lack of normalization may or may not be create problems. This >- * method preserves mixed-case keys using the variable names >+ * Note that WIN32 system environment preserves the case of variable names >+ * but is otherwise case insensitive. Depending on what you intend to do >+ * with the environment, the lack of normalization may or may not be create >+ * problems. This method preserves mixed-case keys using the variable names > * recorded by the OS. > * </p> >+ * > * @since 3.1 >- */ >+ */ > private void cacheNativeEnvironment(Map cache) { > try { >- String nativeCommand= null; >- boolean isWin9xME= false; //see bug 50567 >- String fileName= null; >+ String nativeCommand = null; >+ boolean isWin9xME = false; // see bug 50567 >+ String fileName = null; > if (Platform.getOS().equals(Constants.OS_WIN32)) { >- String osName= System.getProperty("os.name"); //$NON-NLS-1$ >- isWin9xME= osName != null && (osName.startsWith("Windows 9") || osName.startsWith("Windows ME")); //$NON-NLS-1$ //$NON-NLS-2$ >+ String osName = System.getProperty("os.name"); //$NON-NLS-1$ >+ isWin9xME = osName != null >+ && (osName.startsWith("Windows 9") || osName.startsWith("Windows ME")); //$NON-NLS-1$ //$NON-NLS-2$ > if (isWin9xME) { > // Win 95, 98, and ME > // SET might not return therefore we pipe into a file >- IPath stateLocation= DebugPlugin.getDefault().getStateLocation(); >- fileName= stateLocation.toOSString() + File.separator + "env.txt"; //$NON-NLS-1$ >- nativeCommand= "command.com /C set > " + fileName; //$NON-NLS-1$ >+ IPath stateLocation = DebugPlugin.getDefault() >+ .getStateLocation(); >+ fileName = stateLocation.toOSString() + File.separator >+ + "env.txt"; //$NON-NLS-1$ >+ nativeCommand = "command.com /C set > " + fileName; //$NON-NLS-1$ > } else { > // Win NT, 2K, XP >- nativeCommand= "cmd.exe /C set"; //$NON-NLS-1$ >+ nativeCommand = "cmd.exe /C set"; //$NON-NLS-1$ > } >- } else if (!Platform.getOS().equals(Constants.OS_UNKNOWN)){ >- nativeCommand= "env"; //$NON-NLS-1$ >+ } else if (!Platform.getOS().equals(Constants.OS_UNKNOWN)) { >+ nativeCommand = "env"; //$NON-NLS-1$ > } > if (nativeCommand == null) { > return; > } >- Process process= Runtime.getRuntime().exec(nativeCommand); >+ Process process = Runtime.getRuntime().exec(nativeCommand); > if (isWin9xME) { >- //read piped data on Win 95, 98, and ME >- Properties p= new Properties(); >- File file= new File(fileName); >- InputStream stream = new BufferedInputStream(new FileInputStream(file)); >+ // read piped data on Win 95, 98, and ME >+ Properties p = new Properties(); >+ File file = new File(fileName); >+ InputStream stream = new BufferedInputStream( >+ new FileInputStream(file)); > p.load(stream); > stream.close(); > if (!file.delete()) { >- file.deleteOnExit(); // if delete() fails try again on VM close >+ file.deleteOnExit(); // if delete() fails try again on VM >+ // close > } >- for (Enumeration enumeration = p.keys(); enumeration.hasMoreElements();) { >- // Win32's environment variables are case insensitive. Put everything >- // to uppercase so that (for example) the "PATH" variable will match >+ for (Enumeration enumeration = p.keys(); enumeration >+ .hasMoreElements();) { >+ // Win32's environment variables are case insensitive. Put >+ // everything >+ // to uppercase so that (for example) the "PATH" variable >+ // will match > // "pAtH" correctly on Windows. >- String key= (String) enumeration.nextElement(); >- //no need to cast value >+ String key = (String) enumeration.nextElement(); >+ // no need to cast value > cache.put(key, p.get(key)); > } > } else { >- //read process directly on other platforms >- //we need to parse out matching '{' and '}' for function declarations in .bash environments >- // pattern is [func name]=() { and we must find the '}' on its own line with no trailing ';' >+ // read process directly on other platforms >+ // we need to parse out matching '{' and '}' for function >+ // declarations in .bash environments >+ // pattern is [func name]=() { and we must find the '}' on its >+ // own line with no trailing ';' > InputStream stream = process.getInputStream(); > InputStreamReader isreader = new InputStreamReader(stream); > BufferedReader reader = new BufferedReader(isreader); >@@ -803,32 +873,35 @@ > String value = null; > while (line != null) { > int func = line.indexOf("=()"); //$NON-NLS-1$ >- if(func > 0) { >+ if (func > 0) { > key = line.substring(0, func); >- //scan until we find the closing '}' with no following chars >- value = line.substring(func+1); >- while(line != null && !line.equals("}")) { //$NON-NLS-1$ >+ // scan until we find the closing '}' with no following >+ // chars >+ value = line.substring(func + 1); >+ while (line != null && !line.equals("}")) { //$NON-NLS-1$ > line = reader.readLine(); >- if(line != null) { >+ if (line != null) { > value += line; > } > } > line = reader.readLine(); >- } >- else { >+ } else { > int separator = line.indexOf('='); > if (separator > 0) { > key = line.substring(0, separator); > value = line.substring(separator + 1); > line = reader.readLine(); >- if(line != null) { >- //this line has a '=' read ahead to check next line for '=', might be broken on more than one line >+ if (line != null) { >+ // this line has a '=' read ahead to check next >+ // line for '=', might be broken on more than >+ // one line > separator = line.indexOf('='); >- while(separator < 0) { >+ while (separator < 0) { > value += line.trim(); > line = reader.readLine(); >- if(line == null) { >- //if next line read is the end of the file quit the loop >+ if (line == null) { >+ // if next line read is the end of the >+ // file quit the loop > break; > } > separator = line.indexOf('='); >@@ -836,12 +909,11 @@ > } > } > } >- if(key != null) { >+ if (key != null) { > cache.put(key, value); > key = null; > value = null; >- } >- else { >+ } else { > line = reader.readLine(); > } > } >@@ -864,103 +936,108 @@ > fLaunchConfigurationIndex.clear(); > } > } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchManager#getEncoding(org.eclipse.debug.core.ILaunchConfiguration) >- */ >- public String getEncoding(ILaunchConfiguration configuration) throws CoreException { >- String encoding = configuration.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null); >- if(encoding == null) { >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.ILaunchManager#getEncoding(org.eclipse.debug.core >+ * .ILaunchConfiguration) >+ */ >+ public String getEncoding(ILaunchConfiguration configuration) >+ throws CoreException { >+ String encoding = configuration.getAttribute( >+ DebugPlugin.ATTR_CONSOLE_ENCODING, (String) null); >+ if (encoding == null) { > IResource[] resources = configuration.getMappedResources(); >- if(resources != null && resources.length > 0) { >+ if (resources != null && resources.length > 0) { > IResource res = resources[0]; >- if(res instanceof IFile) { >- return ((IFile)res).getCharset(); >- } >- else if(res instanceof IContainer) { >- return ((IContainer)res).getDefaultCharset(); >+ if (res instanceof IFile) { >+ return ((IFile) res).getCharset(); >+ } else if (res instanceof IContainer) { >+ return ((IContainer) res).getDefaultCharset(); > } >- } >- else { >+ } else { > return ResourcesPlugin.getEncoding(); > } > } > return encoding; > } >- >+ > /** >- * The launch config name cache is cleared when a config is added, deleted or changed. >+ * The launch config name cache is cleared when a config is added, deleted >+ * or changed. > */ > protected void clearConfigNameCache() { > fSortedConfigNames = null; > } > > /** >- * Return an instance of DebugException containing the specified message and Throwable. >+ * Return an instance of DebugException containing the specified message and >+ * Throwable. > */ >- protected DebugException createDebugException(String message, Throwable throwable) { >- return new DebugException( >- new Status( >- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), >- DebugException.REQUEST_FAILED, message, throwable >- ) >- ); >+ protected DebugException createDebugException(String message, >+ Throwable throwable) { >+ return new DebugException(new Status(IStatus.ERROR, DebugPlugin >+ .getUniqueIdentifier(), DebugException.REQUEST_FAILED, message, >+ throwable)); > } >- >+ > /** > * Return a LaunchConfigurationInfo object initialized from XML contained in >- * the specified stream. Simply pass out any exceptions encountered so that >- * caller can deal with them. This is important since caller may need access to the >- * actual exception. >- */ >- protected LaunchConfigurationInfo createInfoFromXML(InputStream stream) throws CoreException, >- ParserConfigurationException, >- IOException, >- SAXException { >+ * the specified stream. Simply pass out any exceptions encountered so that >+ * caller can deal with them. This is important since caller may need access >+ * to the actual exception. >+ */ >+ protected LaunchConfigurationInfo createInfoFromXML(InputStream stream) >+ throws CoreException, ParserConfigurationException, IOException, >+ SAXException { > Element root = null; >- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); >+ DocumentBuilder parser = DocumentBuilderFactory.newInstance() >+ .newDocumentBuilder(); > parser.setErrorHandler(new DefaultHandler()); > root = parser.parse(new InputSource(stream)).getDocumentElement(); > LaunchConfigurationInfo info = new LaunchConfigurationInfo(); > info.initializeFromXML(root); > return info; >- } >- >+ } >+ > /** >- * Finds and returns all launch configurations in the given >- * container (and sub-containers) >+ * Finds and returns all launch configurations in the given container (and >+ * sub-containers) > * >- * @param container the container to search >- * @exception CoreException an exception occurs traversing >- * the container. >+ * @param container >+ * the container to search >+ * @exception CoreException >+ * an exception occurs traversing the container. > * @return all launch configurations in the given container > */ > protected List findLaunchConfigurations(IContainer container) { > List list = new ArrayList(10); >- if (container instanceof IProject && !((IProject)container).isOpen()) { >+ if (container instanceof IProject && !((IProject) container).isOpen()) { > return list; > } >- ResourceProxyVisitor visitor= new ResourceProxyVisitor(list); >+ ResourceProxyVisitor visitor = new ResourceProxyVisitor(list); > try { > container.accept(visitor, IResource.NONE); > } catch (CoreException ce) { >- //Closed project...should not be possible with previous check >+ // Closed project...should not be possible with previous check > } > Iterator iter = list.iterator(); > List configs = new ArrayList(list.size()); > ILaunchConfiguration config = null; > while (iter.hasNext()) { >- config = getLaunchConfiguration((IFile)iter.next()); >- if(config != null && config.exists()) { >+ config = getLaunchConfiguration((IFile) iter.next()); >+ if (config != null && config.exists()) { > configs.add(config); > } > } > return configs; > } >- >+ > /** > * Finds and returns all local launch configurations. >- * >+ * > * @return all local launch configurations > */ > protected List findLocalLaunchConfigurations() { >@@ -970,26 +1047,30 @@ > if (directory.isDirectory()) { > FilenameFilter filter = new FilenameFilter() { > public boolean accept(File dir, String name) { >- return dir.equals(directory) && >- name.endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION); >+ return dir.equals(directory) >+ && name >+ .endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION); > } > }; > File[] files = directory.listFiles(filter); > LaunchConfiguration config = null; > for (int i = 0; i < files.length; i++) { >- config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(files[i].getName()), null); >+ config = new LaunchConfiguration(LaunchConfiguration >+ .getSimpleName(files[i].getName()), null); > configs.add(config); > } > } > return configs; > } >- >+ > /** > * Fires notification to (single) listeners that a launch has been > * added/changed/removed. > * >- * @param launch launch that has changed >- * @param update type of change >+ * @param launch >+ * launch that has changed >+ * @param update >+ * type of change > */ > public void fireUpdate(ILaunch launch, int update) { > new LaunchNotifier().notify(launch, update); >@@ -999,112 +1080,131 @@ > * Fires notification to (plural) listeners that a launch has been > * added/changed/removed. > * >- * @param launches launches that have changed >- * @param update type of change >+ * @param launches >+ * launches that have changed >+ * @param update >+ * type of change > */ > public void fireUpdate(ILaunch[] launches, int update) { > new LaunchesNotifier().notify(launches, update); > } > >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchManager#generateUniqueLaunchConfigurationNameFrom(java.lang.String) >+ /* >+ * (non-Javadoc) >+ * >+ * @seeorg.eclipse.debug.core.ILaunchManager# >+ * generateUniqueLaunchConfigurationNameFrom(java.lang.String) > */ > public String generateUniqueLaunchConfigurationNameFrom(String baseName) { > int index = 1; >- int length= baseName.length(); >+ int length = baseName.length(); > int copyIndex = baseName.lastIndexOf(" ("); //$NON-NLS-1$ >- if (copyIndex > -1 && length > copyIndex + 2 && baseName.charAt(length - 1) == ')') { >- String trailer = baseName.substring(copyIndex + 2, length -1); >+ if (copyIndex > -1 && length > copyIndex + 2 >+ && baseName.charAt(length - 1) == ')') { >+ String trailer = baseName.substring(copyIndex + 2, length - 1); > if (isNumber(trailer)) { > try { > index = Integer.parseInt(trailer); > baseName = baseName.substring(0, copyIndex); >- } >- catch (NumberFormatException nfe) {} >+ } catch (NumberFormatException nfe) { >+ } > } >- } >+ } > String newName = baseName; > while (isExistingLaunchConfigurationName(newName)) { >- newName = MessageFormat.format(DebugCoreMessages.LaunchManager_31, new String[] {baseName, Integer.toString(index)}); >+ newName = MessageFormat.format(DebugCoreMessages.LaunchManager_31, >+ new String[] { baseName, Integer.toString(index) }); > index++; >- } >+ } >+ > return newName; > } >- >+ > /** >- * Return a String that can be used as the name of a launch configuration. The name >- * is guaranteed to be unique (no existing or temporary launch configurations will have this name). >- * The name that is returned uses the <code>basename</code> as a starting point. If >- * there is no existing launch configuration with this name, then <code>basename</code> >- * is returned. Otherwise, the value returned consists of the specified base plus >- * some suffix that guarantees uniqueness. Passing <code>null</code> as the set of reserved names will cause this >- * method to return <code>generateUniqueLaunchConfigurationNameFrom(String baseName)</code>. >- * >- * By specifying a set of reserved names, you can further constrain the name that will be generated >- * by this method. For example you can give a base name of 'test' and a reserved set of [test(1), test(2)], >- * which will result in a name of 'test(3)' being returned iff a configuration with the name 'test' already exists. >+ * Return a String that can be used as the name of a launch configuration. >+ * The name is guaranteed to be unique (no existing or temporary launch >+ * configurations will have this name). The name that is returned uses the >+ * <code>basename</code> as a starting point. If there is no existing launch >+ * configuration with this name, then <code>basename</code> is returned. >+ * Otherwise, the value returned consists of the specified base plus some >+ * suffix that guarantees uniqueness. Passing <code>null</code> as the set >+ * of reserved names will cause this method to return >+ * <code>generateUniqueLaunchConfigurationNameFrom(String baseName)</code>. >+ * >+ * By specifying a set of reserved names, you can further constrain the name >+ * that will be generated by this method. For example you can give a base >+ * name of 'test' and a reserved set of [test(1), test(2)], which will >+ * result in a name of 'test(3)' being returned iff a configuration with the >+ * name 'test' already exists. > * > * @return launch configuration name >- * @param basename the String that the returned name must begin with >- * @param reservednames a set of strings that is further used to constrain what names can be generated >+ * @param basename >+ * the String that the returned name must begin with >+ * @param reservednames >+ * a set of strings that is further used to constrain what names >+ * can be generated > * @since 3.3 > */ >- public String generateUniqueLaunchConfigurationNameFrom(String basename, Set reservednames) { >- if(reservednames == null) { >+ public String generateUniqueLaunchConfigurationNameFrom(String basename, >+ Set reservednames) { >+ if (reservednames == null) { > return generateUniqueLaunchConfigurationNameFrom(basename); > } >- int index = 1; >- int length= basename.length(); >+ int index = 1; >+ int length = basename.length(); > String base = basename; > int copyIndex = base.lastIndexOf(" ("); //$NON-NLS-1$ >- if (copyIndex > -1 && length > copyIndex + 2 && base.charAt(length - 1) == ')') { >- String trailer = base.substring(copyIndex + 2, length -1); >+ if (copyIndex > -1 && length > copyIndex + 2 >+ && base.charAt(length - 1) == ')') { >+ String trailer = base.substring(copyIndex + 2, length - 1); > if (isNumber(trailer)) { > try { > index = Integer.parseInt(trailer); > base = base.substring(0, copyIndex); >- } >- catch (NumberFormatException nfe) {} >+ } catch (NumberFormatException nfe) { >+ } > } >- } >+ } > String newname = base; > StringBuffer buffer = null; >- while (isExistingLaunchConfigurationName(newname) || reservednames.contains(newname)) { >+ while (isExistingLaunchConfigurationName(newname) >+ || reservednames.contains(newname)) { > buffer = new StringBuffer(base); > buffer.append(" ("); //$NON-NLS-1$ > buffer.append(String.valueOf(index)); >- index++; >+ index++; > buffer.append(')'); > newname = buffer.toString(); >- } >+ } > return newname; > } >- >+ > /** >- * Returns a collection of all launch configuration handles in >- * the workspace. This collection is initialized lazily. >+ * Returns a collection of all launch configuration handles in the >+ * workspace. This collection is initialized lazily. > * > * @return all launch configuration handles > */ > private synchronized List getAllLaunchConfigurations() { > if (fLaunchConfigurationIndex == null) { >- try { >+ try { > fLaunchConfigurationIndex = new ArrayList(20); > List configs = findLocalLaunchConfigurations(); > verifyConfigurations(configs, fLaunchConfigurationIndex); >- configs = findLaunchConfigurations(ResourcesPlugin.getWorkspace().getRoot()); >+ configs = findLaunchConfigurations(ResourcesPlugin >+ .getWorkspace().getRoot()); > verifyConfigurations(configs, fLaunchConfigurationIndex); > } finally { >- hookResourceChangeListener(); >+ hookResourceChangeListener(); > } > } > return fLaunchConfigurationIndex; > } >- >+ > /** >- * Return a sorted array of the names of all <code>ILaunchConfiguration</code>s in >- * the workspace. These are cached, and cache is cleared when a new config is added, >- * deleted or changed. >+ * Return a sorted array of the names of all >+ * <code>ILaunchConfiguration</code>s in the workspace. These are cached, >+ * and cache is cleared when a new config is added, deleted or changed. > */ > protected synchronized String[] getAllSortedConfigNames() { > if (fSortedConfigNames == null) { >@@ -1117,50 +1217,52 @@ > } > return fSortedConfigNames; > } >- >+ > /** > * Returns the comparator registered for the given attribute, or > * <code>null</code> if none. > * >- * @param attributeName attribute for which a comparator is required >+ * @param attributeName >+ * attribute for which a comparator is required > * @return comparator, or <code>null</code> if none > */ > protected Comparator getComparator(String attributeName) { >- Map map = getComparators(); >- return (Comparator)map.get(attributeName); >+ Map map = getComparators(); >+ return (Comparator) map.get(attributeName); > } >- >+ > /** > * Returns comparators, loading if required > */ > protected Map getComparators() { > initializeComparators(); > return fComparators; >- } >- >+ } >+ > /** >- * Returns the launch configurations specified by the given >- * XML document. >+ * Returns the launch configurations specified by the given XML document. > * >- * @param root XML document >+ * @param root >+ * XML document > * @return list of launch configurations >- * @exception IOException if an exception occurs reading the XML >- */ >+ * @exception IOException >+ * if an exception occurs reading the XML >+ */ > protected List getConfigsFromXML(Element root) throws CoreException { >- DebugException invalidFormat = >- new DebugException( >+ DebugException invalidFormat = new DebugException( > new Status( >- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), >- DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchManager_Invalid_launch_configuration_index__18, null >- ) >- ); >- >+ IStatus.ERROR, >+ DebugPlugin.getUniqueIdentifier(), >+ DebugException.REQUEST_FAILED, >+ DebugCoreMessages.LaunchManager_Invalid_launch_configuration_index__18, >+ null)); >+ > if (!root.getNodeName().equalsIgnoreCase("launchConfigurations")) { //$NON-NLS-1$ > throw invalidFormat; > } >- >- // read each launch configuration >- List configs = new ArrayList(4); >+ >+ // read each launch configuration >+ List configs = new ArrayList(4); > NodeList list = root.getChildNodes(); > int length = list.getLength(); > Node node = null; >@@ -1183,17 +1285,17 @@ > } > return configs; > } >- >+ > protected ConfigurationNotifier getConfigurationNotifier() { > return new ConfigurationNotifier(); >- } >- >+ } >+ > /** > * @see ILaunchManager#getDebugTargets() > */ > public IDebugTarget[] getDebugTargets() { > synchronized (fLaunches) { >- List allTargets= new ArrayList(fLaunches.size()); >+ List allTargets = new ArrayList(fLaunches.size()); > if (fLaunches.size() > 0) { > Iterator e = fLaunches.iterator(); > IDebugTarget[] targets = null; >@@ -1204,53 +1306,64 @@ > } > } > } >- return (IDebugTarget[])allTargets.toArray(new IDebugTarget[allTargets.size()]); >+ return (IDebugTarget[]) allTargets >+ .toArray(new IDebugTarget[allTargets.size()]); > } > } >- >+ > /** > * Returns the resource delta visitor for the launch manager. > * > * @return the resource delta visitor for the launch manager > */ > private LaunchManagerVisitor getDeltaVisitor() { >- if (fgVisitor == null) { >- fgVisitor= new LaunchManagerVisitor(); >+ if (fgVisitor == null) { >+ fgVisitor = new LaunchManagerVisitor(); > } >- return fgVisitor; >+ return fgVisitor; > } >- >+ > /** >- * Returns the resource delta visitor for auto-removal of mapped launch configurations >- * @return the resource delta visitor for auto-removal of mapped launch configurations >+ * Returns the resource delta visitor for auto-removal of mapped launch >+ * configurations >+ * >+ * @return the resource delta visitor for auto-removal of mapped launch >+ * configurations > * > * @since 3.4 > */ > private MappedResourceVisitor getMappedResourceVisitor() { >- if(fgMRVisitor == null) { >+ if (fgMRVisitor == null) { > fgMRVisitor = new MappedResourceVisitor(); > } > return fgMRVisitor; > } > >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchManager#getEnvironment(org.eclipse.debug.core.ILaunchConfiguration) >- */ >- public String[] getEnvironment(ILaunchConfiguration configuration) throws CoreException { >- Map configEnv = configuration.getAttribute(ATTR_ENVIRONMENT_VARIABLES, (Map) null); >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.ILaunchManager#getEnvironment(org.eclipse.debug >+ * .core.ILaunchConfiguration) >+ */ >+ public String[] getEnvironment(ILaunchConfiguration configuration) >+ throws CoreException { >+ Map configEnv = configuration.getAttribute(ATTR_ENVIRONMENT_VARIABLES, >+ (Map) null); > if (configEnv == null) { > return null; > } > Map env = new HashMap(); > // build base environment >- boolean append = configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true); >+ boolean append = configuration.getAttribute( >+ ATTR_APPEND_ENVIRONMENT_VARIABLES, true); > if (append) { > env.putAll(getNativeEnvironmentCasePreserved()); > } >- >+ > // Add variables from config >- Iterator iter= configEnv.entrySet().iterator(); >- boolean win32= Platform.getOS().equals(Constants.OS_WIN32); >+ Iterator iter = configEnv.entrySet().iterator(); >+ boolean win32 = Platform.getOS().equals(Constants.OS_WIN32); > Map.Entry entry = null; > String key = null; > String value = null; >@@ -1261,39 +1374,44 @@ > while (iter.hasNext()) { > entry = (Map.Entry) iter.next(); > key = (String) entry.getKey(); >- value = (String) entry.getValue(); >- // translate any string substitution variables >- if (value != null) { >- value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value); >- } >- boolean added= false; >+ value = (String) entry.getValue(); >+ // translate any string substitution variables >+ if (value != null) { >+ value = VariablesPlugin.getDefault().getStringVariableManager() >+ .performStringSubstitution(value); >+ } >+ boolean added = false; > if (win32) { >- // First, check if the key is an exact match for an existing key. >+ // First, check if the key is an exact match for an existing >+ // key. > nativeValue = env.get(key); >- if (nativeValue != null) { >- // If an exact match is found, just replace the value >- env.put(key, value); >- } else { >- // Win32 variables are case-insensitive. If an exact match isn't found, iterate to >- // check for a case-insensitive match. We maintain the key's case (see bug 86725), >- // but do a case-insensitive comparison (for example, "pAtH" will still override "PATH"). >- envIter = env.entrySet().iterator(); >- while (envIter.hasNext()) { >- nativeEntry = (Map.Entry) envIter.next(); >- nativeKey = (String) (nativeEntry).getKey(); >- if (nativeKey.equalsIgnoreCase(key)) { >- nativeEntry.setValue(value); >- added = true; >- break; >- } >- } >- } >- } >- if (!added) { >- env.put(key, value); >- } >- } >- >+ if (nativeValue != null) { >+ // If an exact match is found, just replace the value >+ env.put(key, value); >+ } else { >+ // Win32 variables are case-insensitive. If an exact match >+ // isn't found, iterate to >+ // check for a case-insensitive match. We maintain the key's >+ // case (see bug 86725), >+ // but do a case-insensitive comparison (for example, "pAtH" >+ // will still override "PATH"). >+ envIter = env.entrySet().iterator(); >+ while (envIter.hasNext()) { >+ nativeEntry = (Map.Entry) envIter.next(); >+ nativeKey = (String) (nativeEntry).getKey(); >+ if (nativeKey.equalsIgnoreCase(key)) { >+ nativeEntry.setValue(value); >+ added = true; >+ break; >+ } >+ } >+ } >+ } >+ if (!added) { >+ env.put(key, value); >+ } >+ } >+ > iter = env.entrySet().iterator(); > List strings = new ArrayList(env.size()); > StringBuffer buffer = null; >@@ -1305,58 +1423,70 @@ > } > return (String[]) strings.toArray(new String[strings.size()]); > } >- >+ > /** >- * Returns the info object for the specified launch configuration. >- * If the configuration exists, but is not yet in the cache, >- * an info object is built and added to the cache. >- * >- * @exception CoreException if an exception occurs building >- * the info object >- * @exception DebugException if the config does not exist >+ * Returns the info object for the specified launch configuration. If the >+ * configuration exists, but is not yet in the cache, an info object is >+ * built and added to the cache. >+ * >+ * @exception CoreException >+ * if an exception occurs building the info object >+ * @exception DebugException >+ * if the config does not exist > * @since 3.5 > */ >- protected LaunchConfigurationInfo getInfo(LaunchConfiguration config) throws CoreException { >- LaunchConfigurationInfo info = (LaunchConfigurationInfo)fLaunchConfigurations.get(config); >+ protected LaunchConfigurationInfo getInfo(LaunchConfiguration config) >+ throws CoreException { >+ LaunchConfigurationInfo info = (LaunchConfigurationInfo) fLaunchConfigurations >+ .get(config); > if (info == null) { > IFileStore store = config.getFileStore(); > if (config.exists()) { > BufferedInputStream stream = null; > try { >- stream = new BufferedInputStream(store.openInputStream(EFS.NONE, null)); >+ stream = new BufferedInputStream(store.openInputStream( >+ EFS.NONE, null)); > info = createInfoFromXML(stream); > synchronized (this) { > fLaunchConfigurations.put(config, info); > } > } catch (FileNotFoundException e) { >- throwException(config, e); >+ throwException(config, e); > } catch (SAXException e) { >- throwException(config, e); >+ throwException(config, e); > } catch (ParserConfigurationException e) { >- throwException(config, e); >+ throwException(config, e); > } catch (IOException e) { >- throwException(config, e); >+ throwException(config, e); > } finally { > if (stream != null) { > try { > stream.close(); > } catch (IOException e) { >- throwException(config, e); >+ throwException(config, e); > } > } > } >- >+ > } else { >- if (store != null){ >- throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist, new String[]{config.getName(), store.toURI().toString()}), null); >+ if (store != null) { >+ throw createDebugException(MessageFormat.format( >+ DebugCoreMessages.LaunchManager_does_not_exist, >+ new String[] { config.getName(), >+ store.toURI().toString() }), null); > } else { >- throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist_no_store_found, new String[]{config.getName()}), null); >+ throw createDebugException( >+ MessageFormat >+ .format( >+ DebugCoreMessages.LaunchManager_does_not_exist_no_store_found, >+ new String[] { config.getName() }), >+ null); > } > } > } > return info; > } >- >+ > /** > * @see ILaunchManager#getLaunchConfiguration(IFile) > */ >@@ -1364,46 +1494,51 @@ > hookResourceChangeListener(); > return new LaunchConfiguration(file); > } >- >+ > /** > * @see ILaunchManager#getLaunchConfiguration(String) > */ >- public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException { >+ public ILaunchConfiguration getLaunchConfiguration(String memento) >+ throws CoreException { > hookResourceChangeListener(); > return new LaunchConfiguration(memento); > } >- >+ > /** > * @see ILaunchManager#getLaunchConfigurations() > */ > public synchronized ILaunchConfiguration[] getLaunchConfigurations() { > List allConfigs = getAllLaunchConfigurations(); >- return (ILaunchConfiguration[])allConfigs.toArray(new ILaunchConfiguration[allConfigs.size()]); >- } >- >+ return (ILaunchConfiguration[]) allConfigs >+ .toArray(new ILaunchConfiguration[allConfigs.size()]); >+ } >+ > /** > * @see ILaunchManager#getLaunchConfigurations(ILaunchConfigurationType) > */ >- public synchronized ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException { >+ public synchronized ILaunchConfiguration[] getLaunchConfigurations( >+ ILaunchConfigurationType type) throws CoreException { > Iterator iter = getAllLaunchConfigurations().iterator(); > List configs = new ArrayList(); > ILaunchConfiguration config = null; > while (iter.hasNext()) { >- config = (ILaunchConfiguration)iter.next(); >+ config = (ILaunchConfiguration) iter.next(); > if (config.getType().equals(type)) { > configs.add(config); > } > } >- return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]); >+ return (ILaunchConfiguration[]) configs >+ .toArray(new ILaunchConfiguration[configs.size()]); > } >- >+ > /** >- * Returns all launch configurations that are stored as resources >- * in the given project. >+ * Returns all launch configurations that are stored as resources in the >+ * given project. > * >- * @param project a project >+ * @param project >+ * a project > * @return collection of launch configurations that are stored as resources >- * in the given project >+ * in the given project > */ > protected synchronized List getLaunchConfigurations(IProject project) { > Iterator iter = getAllLaunchConfigurations().iterator(); >@@ -1411,7 +1546,7 @@ > ILaunchConfiguration config = null; > IFile file = null; > while (iter.hasNext()) { >- config = (ILaunchConfiguration)iter.next(); >+ config = (ILaunchConfiguration) iter.next(); > file = config.getFile(); > if (file != null && file.getProject().equals(project)) { > configs.add(config); >@@ -1419,13 +1554,13 @@ > } > return configs; > } >- >+ > /** > * @see ILaunchManager#getLaunchConfigurationType(String) > */ > public ILaunchConfigurationType getLaunchConfigurationType(String id) { > ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); >- for(int i = 0; i < types.length; i++) { >+ for (int i = 0; i < types.length; i++) { > if (types[i].getIdentifier().equals(id)) { > return types[i]; > } >@@ -1438,39 +1573,47 @@ > */ > public ILaunchConfigurationType[] getLaunchConfigurationTypes() { > initializeLaunchConfigurationTypes(); >- return (ILaunchConfigurationType[])fLaunchConfigurationTypes.toArray(new ILaunchConfigurationType[fLaunchConfigurationTypes.size()]); >+ return (ILaunchConfigurationType[]) fLaunchConfigurationTypes >+ .toArray(new ILaunchConfigurationType[fLaunchConfigurationTypes >+ .size()]); > } >- >+ > /** > * @see ILaunchManager#getLaunches() > */ > public ILaunch[] getLaunches() { > synchronized (fLaunches) { >- return (ILaunch[])fLaunches.toArray(new ILaunch[fLaunches.size()]); >+ return (ILaunch[]) fLaunches.toArray(new ILaunch[fLaunches.size()]); > } > } >- >- /**) >+ >+ /** >+ * ) >+ * > * @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String) > */ > public ILaunchMode getLaunchMode(String mode) { > initializeLaunchModes(); > return (ILaunchMode) fLaunchModes.get(mode); > } >- >+ > /** > * @see org.eclipse.debug.core.ILaunchManager#getLaunchModes() > */ > public ILaunchMode[] getLaunchModes() { > initializeLaunchModes(); > Collection collection = fLaunchModes.values(); >- return (ILaunchMode[]) collection.toArray(new ILaunchMode[collection.size()]); >+ return (ILaunchMode[]) collection.toArray(new ILaunchMode[collection >+ .size()]); > } >- >+ > /** >- * Returns all of the launch delegates. The returned listing of delegates cannot be directly used to launch, >- * instead the method <code>IlaunchDelegate.getDelegate</code> must be used to acquire an executable form of >- * the delegate, allowing us to maintain lazy loading of the delegates themselves. >+ * Returns all of the launch delegates. The returned listing of delegates >+ * cannot be directly used to launch, instead the method >+ * <code>IlaunchDelegate.getDelegate</code> must be used to acquire an >+ * executable form of the delegate, allowing us to maintain lazy loading of >+ * the delegates themselves. >+ * > * @return all of the launch delegates > * > * @since 3.3 >@@ -1480,13 +1623,16 @@ > Collection col = fLaunchDelegates.values(); > return (ILaunchDelegate[]) col.toArray(new ILaunchDelegate[col.size()]); > } >- >+ > /** >- * Returns the listing of launch delegates that apply to the specified >+ * Returns the listing of launch delegates that apply to the specified > * <code>ILaunchConfigurationType</code> id >- * @param typeid the id of the launch configuration type to get delegates for >- * @return An array of <code>LaunchDelegate</code>s that apply to the specified launch configuration >- * type, or an empty array, never <code>null</code> >+ * >+ * @param typeid >+ * the id of the launch configuration type to get delegates for >+ * @return An array of <code>LaunchDelegate</code>s that apply to the >+ * specified launch configuration type, or an empty array, never >+ * <code>null</code> > * > * @since 3.3 > */ >@@ -1494,173 +1640,216 @@ > initializeLaunchDelegates(); > ArrayList list = new ArrayList(); > LaunchDelegate ld = null; >- for(Iterator iter = fLaunchDelegates.keySet().iterator(); iter.hasNext();) { >+ for (Iterator iter = fLaunchDelegates.keySet().iterator(); iter >+ .hasNext();) { > ld = (LaunchDelegate) fLaunchDelegates.get(iter.next()); >- if(ld.getLaunchConfigurationTypeId().equals(typeid)) { >+ if (ld.getLaunchConfigurationTypeId().equals(typeid)) { > list.add(ld); > } > } > return (LaunchDelegate[]) list.toArray(new LaunchDelegate[list.size()]); > } >- >+ > /** >- * This method returns the <code>ILaunchDelegate</code> instance corresponding to the id >- * of the launch delegate specified >- * @param id the id of the <code>ILaunchDelegate</code> to find >- * @return the <code>ILaunchDelegate</code> or <code>null</code> if not found >+ * This method returns the <code>ILaunchDelegate</code> instance >+ * corresponding to the id of the launch delegate specified >+ * >+ * @param id >+ * the id of the <code>ILaunchDelegate</code> to find >+ * @return the <code>ILaunchDelegate</code> or <code>null</code> if not >+ * found > * > * @since 3.3 > */ > public ILaunchDelegate getLaunchDelegate(String id) { >- if(id != null) { >+ if (id != null) { > ILaunchDelegate[] delegates = getLaunchDelegates(); >- for(int i = 0; i < delegates.length; i++) { >- if(id.equals(delegates[i].getId())) { >+ for (int i = 0; i < delegates.length; i++) { >+ if (id.equals(delegates[i].getId())) { > return delegates[i]; > } > } > } > return null; > } >- >+ > /** > * Initializes the listing of delegates available to the launching framework > * > * @since 3.3 > */ > private synchronized void initializeLaunchDelegates() { >- if(fLaunchDelegates == null) { >+ if (fLaunchDelegates == null) { > fLaunchDelegates = new HashMap(); >- //get all launch delegate contributions >- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES); >- IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); >+ // get all launch delegate contributions >+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry() >+ .getExtensionPoint(DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES); >+ IConfigurationElement[] infos = extensionPoint >+ .getConfigurationElements(); > LaunchDelegate delegate = null; >- for(int i = 0; i < infos.length; i++) { >+ for (int i = 0; i < infos.length; i++) { > delegate = new LaunchDelegate(infos[i]); > fLaunchDelegates.put(delegate.getId(), delegate); > } >- //get all delegates from launch configuration type contributions >- extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); >+ // get all delegates from launch configuration type contributions >+ extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( >+ DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); > infos = extensionPoint.getConfigurationElements(); >- for(int i = 0; i < infos.length; i++) { >- //must check to see if delegate is provided in contribution >- if(infos[i].getAttribute(IConfigurationElementConstants.DELEGATE) != null) { >+ for (int i = 0; i < infos.length; i++) { >+ // must check to see if delegate is provided in contribution >+ if (infos[i] >+ .getAttribute(IConfigurationElementConstants.DELEGATE) != null) { > delegate = new LaunchDelegate(infos[i]); > fLaunchDelegates.put(delegate.getId(), delegate); > } > } > } > } >- >+ > /** >- * This method is used to initialize a simple listing of all preferred delegates, which is then used by each >- * <code>ILaunchConfigurationType</code> to find if they have preferred delegates. Once an <code>ILaunchConfigurationType</code> >- * has used this listing to initialize its preferred delegates it will maintain changes to its preferred delegate, which are >- * then written back to the preference store only when the launch manager shuts down. >+ * This method is used to initialize a simple listing of all preferred >+ * delegates, which is then used by each >+ * <code>ILaunchConfigurationType</code> to find if they have preferred >+ * delegates. Once an <code>ILaunchConfigurationType</code> has used this >+ * listing to initialize its preferred delegates it will maintain changes to >+ * its preferred delegate, which are then written back to the preference >+ * store only when the launch manager shuts down. > * <p> >- * This cache is not synchronized with the runtime preferred delegates stored in launch configuration types. >+ * This cache is not synchronized with the runtime preferred delegates >+ * stored in launch configuration types. > * </p> >+ * > * @since 3.3 > */ > private synchronized void initializePreferredDelegates() { >- if(fPreferredDelegates == null) { >+ if (fPreferredDelegates == null) { > fPreferredDelegates = new HashSet(); >- String preferred = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), LaunchManager.PREF_PREFERRED_DELEGATES, IInternalDebugCoreConstants.EMPTY_STRING, null); >- if(!IInternalDebugCoreConstants.EMPTY_STRING.equals(preferred)) { >+ String preferred = Platform.getPreferencesService().getString( >+ DebugPlugin.getUniqueIdentifier(), >+ LaunchManager.PREF_PREFERRED_DELEGATES, >+ IInternalDebugCoreConstants.EMPTY_STRING, null); >+ if (!IInternalDebugCoreConstants.EMPTY_STRING.equals(preferred)) { > try { > Element root = DebugPlugin.parseDocument(preferred); >- NodeList nodes = root.getElementsByTagName(IConfigurationElementConstants.DELEGATE); >+ NodeList nodes = root >+ .getElementsByTagName(IConfigurationElementConstants.DELEGATE); > Element element = null; > String typeid = null; > Set modeset = null; >- for(int i = 0; i < nodes.getLength(); i++) { >+ for (int i = 0; i < nodes.getLength(); i++) { > element = (Element) nodes.item(i); >- String delegateid = element.getAttribute(IConfigurationElementConstants.ID); >- typeid = element.getAttribute(IConfigurationElementConstants.TYPE_ID); >- String[] modes = element.getAttribute(IConfigurationElementConstants.MODES).split(","); //$NON-NLS-1$ >- modeset = new HashSet(Arrays.asList(modes)); >- LaunchDelegate delegate = getLaunchDelegateExtension(typeid, delegateid, modeset); >+ String delegateid = element >+ .getAttribute(IConfigurationElementConstants.ID); >+ typeid = element >+ .getAttribute(IConfigurationElementConstants.TYPE_ID); >+ String[] modes = element.getAttribute( >+ IConfigurationElementConstants.MODES) >+ .split(","); //$NON-NLS-1$ >+ modeset = new HashSet(Arrays.asList(modes)); >+ LaunchDelegate delegate = getLaunchDelegateExtension( >+ typeid, delegateid, modeset); > if (delegate != null) { >- //take type id, modeset, delegate and create entry >- if(!IInternalDebugCoreConstants.EMPTY_STRING.equals(typeid) & modeset != null) { >- fPreferredDelegates.add(new PreferredDelegate(delegate, typeid, modeset)); >- } >+ // take type id, modeset, delegate and create entry >+ if (!IInternalDebugCoreConstants.EMPTY_STRING >+ .equals(typeid) >+ & modeset != null) { >+ fPreferredDelegates.add(new PreferredDelegate( >+ delegate, typeid, modeset)); >+ } > } > } >+ } catch (CoreException e) { >+ DebugPlugin.log(e); > } >- catch (CoreException e) {DebugPlugin.log(e);} > } > } > } >- >+ > /** >- * Allows internal access to a preferred delegate for a given type and mode set >- * @param typeid the id of the <code>ILaunchConfigurationType</code> to find a delegate for >- * @param modes the set of modes for the delegate >- * @return the preferred delegate for the specified type id and mode set, or <code>null</code> if none >+ * Allows internal access to a preferred delegate for a given type and mode >+ * set >+ * >+ * @param typeid >+ * the id of the <code>ILaunchConfigurationType</code> to find a >+ * delegate for >+ * @param modes >+ * the set of modes for the delegate >+ * @return the preferred delegate for the specified type id and mode set, or >+ * <code>null</code> if none > * > * @since 3.3 > */ > protected ILaunchDelegate getPreferredDelegate(String typeid, Set modes) { >- // Retrieve preferred delegates using legacy mechanism for backward >- // compatibility. >+ // Retrieve preferred delegates using legacy mechanism for backward >+ // compatibility. > initializePreferredDelegates(); > PreferredDelegate pd = null; >- for(Iterator iter = fPreferredDelegates.iterator(); iter.hasNext();) { >+ for (Iterator iter = fPreferredDelegates.iterator(); iter.hasNext();) { > pd = (PreferredDelegate) iter.next(); >- if(pd.getModes().equals(modes) & pd.getTypeId().equals(typeid)) { >+ if (pd.getModes().equals(modes) & pd.getTypeId().equals(typeid)) { > return pd.getDelegate(); > } > } > > // @since 3.5 >- // If the legacy mechanism didn't work, try the new preference name for >- // the given launch type. >- String preferred = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), LaunchManager.PREF_PREFERRED_DELEGATES + '/' + typeid, IInternalDebugCoreConstants.EMPTY_STRING, null); >- if (preferred != null && preferred.length() != 0) { >- StringTokenizer tokenizer = new StringTokenizer(preferred, ";"); //$NON-NLS-1$ >- while(tokenizer.hasMoreTokens()) { >- StringTokenizer tokenizer2 = new StringTokenizer(tokenizer.nextToken(), ","); //$NON-NLS-1$ >- String delegateId = tokenizer2.nextToken(); >- HashSet modeset = new HashSet(); >- while(tokenizer2.hasMoreTokens()) { >- modeset.add(tokenizer2.nextToken()); >- } >- LaunchDelegate delegate = getLaunchDelegateExtension(typeid, delegateId, modeset); >- if (delegate != null && modeset.equals(modes)) { >- return delegate; >- } >- } >- >- } >+ // If the legacy mechanism didn't work, try the new preference name for >+ // the given launch type. >+ String preferred = Platform.getPreferencesService().getString( >+ DebugPlugin.getUniqueIdentifier(), >+ LaunchManager.PREF_PREFERRED_DELEGATES + '/' + typeid, >+ IInternalDebugCoreConstants.EMPTY_STRING, null); >+ if (preferred != null && preferred.length() != 0) { >+ StringTokenizer tokenizer = new StringTokenizer(preferred, ";"); //$NON-NLS-1$ >+ while (tokenizer.hasMoreTokens()) { >+ StringTokenizer tokenizer2 = new StringTokenizer(tokenizer >+ .nextToken(), ","); //$NON-NLS-1$ >+ String delegateId = tokenizer2.nextToken(); >+ HashSet modeset = new HashSet(); >+ while (tokenizer2.hasMoreTokens()) { >+ modeset.add(tokenizer2.nextToken()); >+ } >+ LaunchDelegate delegate = getLaunchDelegateExtension(typeid, >+ delegateId, modeset); >+ if (delegate != null && modeset.equals(modes)) { >+ return delegate; >+ } >+ } >+ >+ } > return null; > } >- >+ > /** >- * Returns the launch delegate extension that matches the given type, delegate ID, and >- * set of modes. >+ * Returns the launch delegate extension that matches the given type, >+ * delegate ID, and set of modes. > * >- * @param typeId Launch configuration type. >- * @param id Launch delegate ID. >- * @param modeset Set of modes that the launch delegate applies to. >- * @return The launch delegate matching the specified parameters, or >- * <code>null</code> if not found. >+ * @param typeId >+ * Launch configuration type. >+ * @param id >+ * Launch delegate ID. >+ * @param modeset >+ * Set of modes that the launch delegate applies to. >+ * @return The launch delegate matching the specified parameters, or >+ * <code>null</code> if not found. > * > * @since 3.5 > */ >- private LaunchDelegate getLaunchDelegateExtension(String typeId, String id, Set modeset) { >- LaunchDelegate[] extensions = getLaunchDelegates(typeId); >- for(int j = 0; j < extensions.length; j++) { >- if(id.equals(extensions[j].getId())) { >- List modesets = extensions[j].getModes(); >- if(modesets.contains(modeset)) { >- return extensions[j]; >- } >- } >- } >- return null; >+ private LaunchDelegate getLaunchDelegateExtension(String typeId, String id, >+ Set modeset) { >+ LaunchDelegate[] extensions = getLaunchDelegates(typeId); >+ for (int j = 0; j < extensions.length; j++) { >+ if (id.equals(extensions[j].getId())) { >+ List modesets = extensions[j].getModes(); >+ if (modesets.contains(modeset)) { >+ return extensions[j]; >+ } >+ } >+ } >+ return null; > } >- >+ > /** > * Returns all launch configurations that are stored locally. > * >@@ -1671,18 +1860,21 @@ > List configs = new ArrayList(); > ILaunchConfiguration config = null; > while (iter.hasNext()) { >- config = (ILaunchConfiguration)iter.next(); >+ config = (ILaunchConfiguration) iter.next(); > if (config.isLocal()) { > configs.add(config); > } > } > return configs; > } >- >+ > /** > * Returns the launch configurations mapping to the specified resource >- * @param resource the resource to collect mapped launch configurations for >- * @return a list of launch configurations if found or an empty list, never null >+ * >+ * @param resource >+ * the resource to collect mapped launch configurations for >+ * @return a list of launch configurations if found or an empty list, never >+ * null > * @since 3.2 > */ > public ILaunchConfiguration[] getMappedConfigurations(IResource resource) { >@@ -1690,69 +1882,79 @@ > try { > ILaunchConfiguration[] configs = getLaunchConfigurations(); > IResource[] resources = null; >- for(int i = 0; i < configs.length; i++) { >+ for (int i = 0; i < configs.length; i++) { > resources = configs[i].getMappedResources(); >- if(resources != null) { >- for(int j = 0; j < resources.length; j++) { >- if(resources[j].equals(resource)) { >+ if (resources != null) { >+ for (int j = 0; j < resources.length; j++) { >+ if (resources[j].equals(resource)) { > configurations.add(configs[i]); > } > } > } > } >+ } catch (CoreException e) { >+ DebugPlugin.log(e); > } >- catch(CoreException e) {DebugPlugin.log(e);} >- return (ILaunchConfiguration[])configurations.toArray(new ILaunchConfiguration[configurations.size()]); >+ return (ILaunchConfiguration[]) configurations >+ .toArray(new ILaunchConfiguration[configurations.size()]); > } >- >- /* (non-Javadoc) >+ >+ /* >+ * (non-Javadoc) >+ * > * @see org.eclipse.debug.core.ILaunchManager#getMigrationCandidates() > */ > public ILaunchConfiguration[] getMigrationCandidates() throws CoreException { > List configs = new ArrayList(); > ILaunchConfiguration[] candidates = getLaunchConfigurations(); >- for(int i = 0; i < candidates.length; i++) { >- if(!candidates[i].isReadOnly() && candidates[i].isMigrationCandidate()) { >+ for (int i = 0; i < candidates.length; i++) { >+ if (!candidates[i].isReadOnly() >+ && candidates[i].isMigrationCandidate()) { > configs.add(candidates[i]); > } > } >- return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]); >+ return (ILaunchConfiguration[]) configs >+ .toArray(new ILaunchConfiguration[configs.size()]); > } >- >+ > /** > * @see org.eclipse.debug.core.ILaunchManager#getMovedFrom(org.eclipse.debug.core.ILaunchConfiguration) > */ >- public ILaunchConfiguration getMovedFrom(ILaunchConfiguration addedConfiguration) { >+ public ILaunchConfiguration getMovedFrom( >+ ILaunchConfiguration addedConfiguration) { > if (addedConfiguration.equals(fTo)) { > return fFrom; > } > return null; > } >- >+ > /** > * @see org.eclipse.debug.core.ILaunchManager#getMovedTo(org.eclipse.debug.core.ILaunchConfiguration) > */ >- public ILaunchConfiguration getMovedTo(ILaunchConfiguration removedConfiguration) { >+ public ILaunchConfiguration getMovedTo( >+ ILaunchConfiguration removedConfiguration) { > if (removedConfiguration.equals(fFrom)) { > return fTo; > } > return null; > } >- >- /* (non-Javadoc) >+ >+ /* >+ * (non-Javadoc) >+ * > * @see org.eclipse.debug.core.ILaunchManager#getNativeEnvironment() > */ > public synchronized Map getNativeEnvironment() { > if (fgNativeEnv == null) { > Map casePreserved = getNativeEnvironmentCasePreserved(); > if (Platform.getOS().equals(Constants.OS_WIN32)) { >- fgNativeEnv= new HashMap(); >+ fgNativeEnv = new HashMap(); > Iterator entries = casePreserved.entrySet().iterator(); > Map.Entry entry = null; > String key = null; > while (entries.hasNext()) { > entry = (Entry) entries.next(); >- key = ((String)entry.getKey()).toUpperCase(); >+ key = ((String) entry.getKey()).toUpperCase(); > fgNativeEnv.put(key, entry.getValue()); > } > } else { >@@ -1760,19 +1962,22 @@ > } > } > return new HashMap(fgNativeEnv); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchManager#getNativeEnvironmentCasePreserved() >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.ILaunchManager#getNativeEnvironmentCasePreserved() > */ > public synchronized Map getNativeEnvironmentCasePreserved() { > if (fgNativeEnvCasePreserved == null) { >- fgNativeEnvCasePreserved= new HashMap(); >+ fgNativeEnvCasePreserved = new HashMap(); > cacheNativeEnvironment(fgNativeEnvCasePreserved); > } > return new HashMap(fgNativeEnvCasePreserved); > } >- >+ > /** > * @see ILaunchManager#getProcesses() > */ >@@ -1783,47 +1988,66 @@ > IProcess[] processes = null; > while (e.hasNext()) { > processes = ((ILaunch) e.next()).getProcesses(); >- for (int i= 0; i < processes.length; i++) { >+ for (int i = 0; i < processes.length; i++) { > allProcesses.add(processes[i]); > } > } >- return (IProcess[])allProcesses.toArray(new IProcess[allProcesses.size()]); >+ return (IProcess[]) allProcesses.toArray(new IProcess[allProcesses >+ .size()]); > } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchManager#getSourceContainerType(java.lang.String) >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.ILaunchManager#getSourceContainerType(java.lang >+ * .String) > */ > public ISourceContainerType getSourceContainerType(String id) { > initializeSourceContainerTypes(); > return (ISourceContainerType) sourceContainerTypes.get(id); > } >- >- /* (non-Javadoc) >+ >+ /* >+ * (non-Javadoc) >+ * > * @see org.eclipse.debug.core.ILaunchManager#getSourceContainerTypes() > */ > public ISourceContainerType[] getSourceContainerTypes() { > initializeSourceContainerTypes(); > Collection containers = sourceContainerTypes.values(); >- return (ISourceContainerType[]) containers.toArray(new ISourceContainerType[containers.size()]); >+ return (ISourceContainerType[]) containers >+ .toArray(new ISourceContainerType[containers.size()]); > } > >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchManager#newSourcePathComputer(org.eclipse.debug.core.ILaunchConfiguration) >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.ILaunchManager#newSourcePathComputer(org.eclipse >+ * .debug.core.ILaunchConfiguration) > */ >- public ISourcePathComputer getSourcePathComputer(ILaunchConfiguration configuration) throws CoreException { >+ public ISourcePathComputer getSourcePathComputer( >+ ILaunchConfiguration configuration) throws CoreException { > String id = null; >- id = configuration.getAttribute(ISourcePathComputer.ATTR_SOURCE_PATH_COMPUTER_ID, (String)null); >- >+ id = configuration >+ .getAttribute(ISourcePathComputer.ATTR_SOURCE_PATH_COMPUTER_ID, >+ (String) null); >+ > if (id == null) { >- //use default computer for configuration type, if any >- return configuration.getType().getSourcePathComputer(); >+ // use default computer for configuration type, if any >+ return configuration.getType().getSourcePathComputer(); > } > return getSourcePathComputer(id); > } > >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchManager#getSourcePathComputer(java.lang.String) >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.ILaunchManager#getSourcePathComputer(java.lang >+ * .String) > */ > public ISourcePathComputer getSourcePathComputer(String id) { > initializeSourceContainerTypes(); >@@ -1831,34 +2055,48 @@ > } > > /** >- * Starts listening for resource change events >- */ >- private synchronized void hookResourceChangeListener() { >- if (!fListening) { >- ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE); >- fListening = true; >- } >- } >- >+ * Starts listening for resource change events >+ */ >+ private synchronized void hookResourceChangeListener() { >+ if (!fListening) { >+ ResourcesPlugin.getWorkspace().addResourceChangeListener( >+ this, >+ IResourceChangeEvent.POST_CHANGE >+ | IResourceChangeEvent.PRE_DELETE); >+ fListening = true; >+ } >+ } >+ > /** > * Load comparator extensions. > */ > private synchronized void initializeComparators() { > if (fComparators == null) { >- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS); >- IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); >+ IExtensionPoint extensionPoint = Platform >+ .getExtensionRegistry() >+ .getExtensionPoint( >+ DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS); >+ IConfigurationElement[] infos = extensionPoint >+ .getConfigurationElements(); > fComparators = new HashMap(infos.length); > IConfigurationElement configurationElement = null; > String attr = null; >- for (int i= 0; i < infos.length; i++) { >+ for (int i = 0; i < infos.length; i++) { > configurationElement = infos[i]; > attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$ > if (attr != null) { >- fComparators.put(attr, new LaunchConfigurationComparator(configurationElement)); >+ fComparators.put(attr, new LaunchConfigurationComparator( >+ configurationElement)); > } else { > // invalid status handler >- IStatus s = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR, >- MessageFormat.format("Invalid launch configuration comparator extension defined by plug-in {0} - attribute not specified.", new String[] {configurationElement.getContributor().getName()}), null); //$NON-NLS-1$ >+ IStatus s = new Status( >+ IStatus.ERROR, >+ DebugPlugin.getUniqueIdentifier(), >+ DebugException.INTERNAL_ERROR, >+ MessageFormat >+ .format( >+ "Invalid launch configuration comparator extension defined by plug-in {0} - attribute not specified.", new String[] { configurationElement.getContributor().getName() }), null); //$NON-NLS-1$ > DebugPlugin.log(s); > } > } >@@ -1871,57 +2109,73 @@ > private synchronized void initializeLaunchConfigurationTypes() { > if (fLaunchConfigurationTypes == null) { > hookResourceChangeListener(); >- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); >- IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); >+ IExtensionPoint extensionPoint = Platform >+ .getExtensionRegistry() >+ .getExtensionPoint( >+ DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); >+ IConfigurationElement[] infos = extensionPoint >+ .getConfigurationElements(); > fLaunchConfigurationTypes = new ArrayList(infos.length); >- for (int i= 0; i < infos.length; i++) { >- fLaunchConfigurationTypes.add(new LaunchConfigurationType(infos[i])); >+ for (int i = 0; i < infos.length; i++) { >+ fLaunchConfigurationTypes.add(new LaunchConfigurationType( >+ infos[i])); > } > } > } >- >+ > /** > * Load comparator extensions. > * >- * @exception CoreException if an exception occurs reading >- * the extensions >- * >+ * @exception CoreException >+ * if an exception occurs reading the extensions >+ * > */ > private synchronized void initializeLaunchModes() { > if (fLaunchModes == null) { > try { >- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_MODES); >- IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); >+ IExtensionPoint extensionPoint = Platform >+ .getExtensionRegistry().getExtensionPoint( >+ DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.EXTENSION_POINT_LAUNCH_MODES); >+ IConfigurationElement[] infos = extensionPoint >+ .getConfigurationElements(); > fLaunchModes = new HashMap(); > ILaunchMode mode = null; >- for (int i= 0; i < infos.length; i++) { >+ for (int i = 0; i < infos.length; i++) { > mode = new LaunchMode(infos[i]); > fLaunchModes.put(mode.getIdentifier(), mode); > } >- } >- catch (CoreException e) {DebugPlugin.log(e);} >+ } catch (CoreException e) { >+ DebugPlugin.log(e); >+ } > } > } >- >+ > /** > * Initializes source container type and source path computer extensions. > */ > private synchronized void initializeSourceContainerTypes() { > if (sourceContainerTypes == null) { >- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_CONTAINER_TYPES); >- IConfigurationElement[] extensions = extensionPoint.getConfigurationElements(); >+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry() >+ .getExtensionPoint(DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.EXTENSION_POINT_SOURCE_CONTAINER_TYPES); >+ IConfigurationElement[] extensions = extensionPoint >+ .getConfigurationElements(); > sourceContainerTypes = new HashMap(); > for (int i = 0; i < extensions.length; i++) { >- sourceContainerTypes.put( >- extensions[i].getAttribute(IConfigurationElementConstants.ID), >+ sourceContainerTypes.put(extensions[i] >+ .getAttribute(IConfigurationElementConstants.ID), > new SourceContainerType(extensions[i])); > } >- extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_PATH_COMPUTERS); >+ extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( >+ DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.EXTENSION_POINT_SOURCE_PATH_COMPUTERS); > extensions = extensionPoint.getConfigurationElements(); > sourcePathComputers = new HashMap(); > for (int i = 0; i < extensions.length; i++) { >- sourcePathComputers.put( >- extensions[i].getAttribute(IConfigurationElementConstants.ID), >+ sourcePathComputers.put(extensions[i] >+ .getAttribute(IConfigurationElementConstants.ID), > new SourcePathComputer(extensions[i])); > } > } >@@ -1930,25 +2184,34 @@ > /** > * Register source locators. > * >- * @exception CoreException if an exception occurs reading >- * the extensions >+ * @exception CoreException >+ * if an exception occurs reading the extensions > */ > private synchronized void initializeSourceLocators() { > if (fSourceLocators == null) { >- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS); >- IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); >- fSourceLocators= new HashMap(infos.length); >+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry() >+ .getExtensionPoint(DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS); >+ IConfigurationElement[] infos = extensionPoint >+ .getConfigurationElements(); >+ fSourceLocators = new HashMap(infos.length); > IConfigurationElement configurationElement = null; > String id = null; >- for (int i= 0; i < infos.length; i++) { >+ for (int i = 0; i < infos.length; i++) { > configurationElement = infos[i]; >- id = configurationElement.getAttribute(IConfigurationElementConstants.ID); >+ id = configurationElement >+ .getAttribute(IConfigurationElementConstants.ID); > if (id != null) { >- fSourceLocators.put(id,configurationElement); >+ fSourceLocators.put(id, configurationElement); > } else { > // invalid status handler >- IStatus s = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR, >- MessageFormat.format("Invalid source locator extension defined by plug-in \"{0}\": \"id\" not specified.", new String[] {configurationElement.getContributor().getName()} ), null); //$NON-NLS-1$ >+ IStatus s = new Status( >+ IStatus.ERROR, >+ DebugPlugin.getUniqueIdentifier(), >+ DebugException.INTERNAL_ERROR, >+ MessageFormat >+ .format( >+ "Invalid source locator extension defined by plug-in \"{0}\": \"id\" not specified.", new String[] { configurationElement.getContributor().getName() }), null); //$NON-NLS-1$ > DebugPlugin.log(s); > } > } >@@ -1956,10 +2219,11 @@ > } > > /** >- * Adds the given launch object to the list of registered launches, >- * and returns whether the launch was added. >+ * Adds the given launch object to the list of registered launches, and >+ * returns whether the launch was added. > * >- * @param launch launch to register >+ * @param launch >+ * launch to register > * @return whether the launch was added > */ > protected boolean internalAddLaunch(ILaunch launch) { >@@ -1979,7 +2243,8 @@ > * Removes the given launch object from the collection of registered > * launches. Returns whether the launch was removed. > * >- * @param launch the launch to remove >+ * @param launch >+ * the launch to remove > * @return whether the launch was removed > */ > protected boolean internalRemoveLaunch(ILaunch launch) { >@@ -1991,6 +2256,7 @@ > return fLaunches.remove(launch); > } > } >+ > /** > * @see ILaunchManager#isExistingLaunchConfigurationName(String) > */ >@@ -1999,38 +2265,44 @@ > int index = Arrays.binarySearch(sortedConfigNames, name); > if (index < 0) { > return false; >- } >+ } > return true; > } >- >+ > /** > * Returns whether the given String is composed solely of digits > */ > private boolean isNumber(String string) { >- int numChars= string.length(); >+ int numChars = string.length(); > if (numChars == 0) { > return false; > } >- for (int i= 0; i < numChars; i++) { >+ for (int i = 0; i < numChars; i++) { > if (!Character.isDigit(string.charAt(i))) { > return false; > } > } > return true; > } >- >+ > /** >- * Returns whether the user has selected to delete associated configurations when a >- * project is deleted. >+ * Returns whether the user has selected to delete associated configurations >+ * when a project is deleted. > * > * @return whether to auto-delete configurations > */ > private boolean isDeleteConfigurations() { >- return Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(), PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true, null); >+ return Platform.getPreferencesService().getBoolean( >+ DebugPlugin.getUniqueIdentifier(), >+ PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true, null); > } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchManager#isRegistered(org.eclipse.debug.core.ILaunch) >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.core.ILaunchManager#isRegistered(org.eclipse.debug. >+ * core.ILaunch) > */ > public boolean isRegistered(ILaunch launch) { > synchronized (fLaunches) { >@@ -2039,10 +2311,11 @@ > } > > /** >- * Returns whether the given launch configuration passes a basic >- * integrity test by retrieving its type. >+ * Returns whether the given launch configuration passes a basic integrity >+ * test by retrieving its type. > * >- * @param config the configuration to verify >+ * @param config >+ * the configuration to verify > * @return whether the config meets basic integrity constraints > */ > protected boolean isValid(ILaunchConfiguration config) { >@@ -2058,26 +2331,27 @@ > } > return true; > } >- >+ > /** >- * Notifies the launch manager that a launch configuration >- * has been added. The configuration is added to the index of >- * configurations by project, and listeners are notified. >+ * Notifies the launch manager that a launch configuration has been added. >+ * The configuration is added to the index of configurations by project, and >+ * listeners are notified. > * >- * @param config the launch configuration that was added >+ * @param config >+ * the launch configuration that was added > */ > protected void launchConfigurationAdded(ILaunchConfiguration config) { > if (config.isWorkingCopy()) { > return; > } >- if (isValid(config)) { >+ if (isValid(config)) { > boolean added = false; > synchronized (this) { > List allConfigs = getAllLaunchConfigurations(); > if (!allConfigs.contains(config)) { > allConfigs.add(config); > added = true; >- } >+ } > } > if (added) { > getConfigurationNotifier().notify(config, ADDED); >@@ -2087,91 +2361,107 @@ > launchConfigurationDeleted(config); > } > } >- >+ > /** >- * Notifies the launch manager that a launch configuration >- * has been changed. The configuration is removed from the >- * cache of info objects such that the new attributes will >- * be updated on the next access. Listeners are notified of >- * the change. >+ * Notifies the launch manager that a launch configuration has been changed. >+ * The configuration is removed from the cache of info objects such that the >+ * new attributes will be updated on the next access. Listeners are notified >+ * of the change. > * >- * @param config the launch configuration that was changed >+ * @param config >+ * the launch configuration that was changed > */ > protected void launchConfigurationChanged(ILaunchConfiguration config) { >- synchronized(this) { >+ synchronized (this) { > fLaunchConfigurations.remove(config); > } > clearConfigNameCache(); > if (isValid(config)) { > // in case the config has been refreshed and it was removed from the >- // index due to 'out of synch with local file system' (see bug 36147), >+ // index due to 'out of synch with local file system' (see bug >+ // 36147), > // add it back (will only add if required) > launchConfigurationAdded(config); > getConfigurationNotifier().notify(config, CHANGED); > } else { > launchConfigurationDeleted(config); >- } >+ } > } >- >+ > /** >- * Notifies the launch manager that a launch configuration >- * has been deleted. The configuration is removed from the >- * cache of info and from the index of configurations by >- * project, and listeners are notified. >+ * Notifies the launch manager that a launch configuration has been deleted. >+ * The configuration is removed from the cache of info and from the index of >+ * configurations by project, and listeners are notified. > * >- * @param config the launch configuration that was deleted >+ * @param config >+ * the launch configuration that was deleted > */ > protected void launchConfigurationDeleted(ILaunchConfiguration config) { > synchronized (this) { > fLaunchConfigurations.remove(config); >- getAllLaunchConfigurations().remove(config); >+ getAllLaunchConfigurations().remove(config); > } > getConfigurationNotifier().notify(config, REMOVED); >- clearConfigNameCache(); >+ clearConfigNameCache(); > } >- >+ > /** > * @see ILaunchManager#newSourceLocator(String) > */ >- public IPersistableSourceLocator newSourceLocator(String identifier) throws CoreException { >+ public IPersistableSourceLocator newSourceLocator(String identifier) >+ throws CoreException { > initializeSourceLocators(); >- IConfigurationElement config = (IConfigurationElement)fSourceLocators.get(identifier); >+ IConfigurationElement config = (IConfigurationElement) fSourceLocators >+ .get(identifier); > if (config == null) { >- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR, >- MessageFormat.format(DebugCoreMessages.LaunchManager_Source_locator_does_not_exist___0__13, new String[] {identifier} ), null)); >- } >- IPersistableSourceLocator sourceLocator = (IPersistableSourceLocator)config.createExecutableExtension("class"); //$NON-NLS-1$ >+ throw new CoreException( >+ new Status( >+ IStatus.ERROR, >+ DebugPlugin.getUniqueIdentifier(), >+ DebugException.INTERNAL_ERROR, >+ MessageFormat >+ .format( >+ DebugCoreMessages.LaunchManager_Source_locator_does_not_exist___0__13, >+ new String[] { identifier }), null)); >+ } >+ IPersistableSourceLocator sourceLocator = (IPersistableSourceLocator) config >+ .createExecutableExtension("class"); //$NON-NLS-1$ > if (sourceLocator instanceof AbstractSourceLookupDirector) { >- ((AbstractSourceLookupDirector)sourceLocator).setId(identifier); >+ ((AbstractSourceLookupDirector) sourceLocator).setId(identifier); > } > return sourceLocator; > } >- >+ > /** >- * The specified project has just closed - remove its >- * launch configurations from the cached index. >+ * The specified project has just closed - remove its launch configurations >+ * from the cached index. > * >- * @param project the project that has been closed >- * @exception CoreException if writing the index fails >+ * @param project >+ * the project that has been closed >+ * @exception CoreException >+ * if writing the index fails > */ > protected void projectClosed(IProject project) { > List configs = getLaunchConfigurations(project); > if (!configs.isEmpty()) { > Iterator iterator = configs.iterator(); > while (iterator.hasNext()) { >- launchConfigurationDeleted((ILaunchConfiguration)iterator.next()); >+ launchConfigurationDeleted((ILaunchConfiguration) iterator >+ .next()); > } > } >- //bug 12134 >+ // bug 12134 > terminateMappedConfigurations(project); > } >- >+ > /** >- * The specified project has just opened - add all launch >- * configs in the project to the index of all configs. >+ * The specified project has just opened - add all launch configs in the >+ * project to the index of all configs. > * >- * @param project the project that has been opened >- * @exception CoreException if reading the index fails >+ * @param project >+ * the project that has been opened >+ * @exception CoreException >+ * if reading the index fails > */ > protected void projectOpened(IProject project) { > List configs = findLaunchConfigurations(project); >@@ -2179,28 +2469,29 @@ > Iterator iterator = configs.iterator(); > while (iterator.hasNext()) { > launchConfigurationAdded((ILaunchConfiguration) iterator.next()); >- } >+ } > } > } >- >+ > /** > * @see ILaunchManager#removeLaunch(ILaunch) > */ > public void removeLaunch(final ILaunch launch) { > if (internalRemoveLaunch(launch)) { > fireUpdate(launch, REMOVED); >- fireUpdate(new ILaunch[] {launch}, REMOVED); >+ fireUpdate(new ILaunch[] { launch }, REMOVED); > } > } >- >+ > /** > * @see ILaunchManager#removeLaunchConfigurationListener(ILaunchConfigurationListener) > */ >- public void removeLaunchConfigurationListener(ILaunchConfigurationListener listener) { >+ public void removeLaunchConfigurationListener( >+ ILaunchConfigurationListener listener) { > fLaunchConfigurationListeners.remove(listener); > } >- >- /** >+ >+ /** > * @see org.eclipse.debug.core.ILaunchManager#removeLaunches(org.eclipse.debug.core.ILaunch[]) > */ > public void removeLaunches(ILaunch[] launches) { >@@ -2211,27 +2502,29 @@ > } > } > if (!removed.isEmpty()) { >- ILaunch[] removedLaunches = (ILaunch[])removed.toArray(new ILaunch[removed.size()]); >+ ILaunch[] removedLaunches = (ILaunch[]) removed >+ .toArray(new ILaunch[removed.size()]); > fireUpdate(removedLaunches, REMOVED); > for (int i = 0; i < removedLaunches.length; i++) { > fireUpdate(removedLaunches[i], REMOVED); > } > } >- } >+ } >+ > /** > * @see org.eclipse.debug.core.ILaunchManager#removeLaunchListener(org.eclipse.debug.core.ILaunchesListener) > */ > public void removeLaunchListener(ILaunchesListener listener) { > fLaunchesListeners.remove(listener); > } >- >+ > /** > * @see ILaunchManager#removeLaunchListener(ILaunchListener) > */ > public void removeLaunchListener(ILaunchListener listener) { > fListeners.remove(listener); > } >- >+ > /** > * Traverses the delta looking for added/removed/changed launch > * configuration files. >@@ -2241,42 +2534,45 @@ > public void resourceChanged(IResourceChangeEvent event) { > IResourceDelta delta = event.getDelta(); > if (delta != null) { >- LaunchManagerVisitor visitor = getDeltaVisitor(); >- MappedResourceVisitor v = null; >- if (isDeleteConfigurations()) { >- v = getMappedResourceVisitor(); >- } >- try { >- delta.accept(visitor); >- if (v != null) { >- delta.accept(v); >- } >- } catch (CoreException e) { >- DebugPlugin.log(e.getStatus()); >- } >- } >- } >- >- /** >- * Gets the launch configuration associated with the specified <code>IResource</code>. >- * This method relies on the resource mapping existing, if no such mapping >- * exists the launch configuration is ignored. >+ LaunchManagerVisitor visitor = getDeltaVisitor(); >+ MappedResourceVisitor v = null; >+ if (isDeleteConfigurations()) { >+ v = getMappedResourceVisitor(); >+ } >+ try { >+ delta.accept(visitor); >+ if (v != null) { >+ delta.accept(v); >+ } >+ } catch (CoreException e) { >+ DebugPlugin.log(e.getStatus()); >+ } >+ } >+ } >+ >+ /** >+ * Gets the launch configuration associated with the specified >+ * <code>IResource</code>. This method relies on the resource mapping >+ * existing, if no such mapping exists the launch configuration is ignored. > * >- * @param resource the resource to collect launch configurations for >+ * @param resource >+ * the resource to collect launch configurations for > * @return the list of associated launch configurations > */ > private ArrayList collectAssociatedLaunches(IResource resource) { > ArrayList list = new ArrayList(); >- try { >- ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(); >+ try { >+ ILaunchConfiguration[] configs = DebugPlugin.getDefault() >+ .getLaunchManager().getLaunchConfigurations(); > IResource[] resources = null; >- for(int i = 0; i < configs.length; i++) { >- if(configs[i].isLocal()) { >+ for (int i = 0; i < configs.length; i++) { >+ if (configs[i].isLocal()) { > resources = configs[i].getMappedResources(); >- if(resources != null) { >- for(int j = 0; j < resources.length; j++){ >- if(resource.equals(resources[j]) || >- resource.getFullPath().isPrefixOf(resources[j].getFullPath())) { >+ if (resources != null) { >+ for (int j = 0; j < resources.length; j++) { >+ if (resource.equals(resources[j]) >+ || resource.getFullPath().isPrefixOf( >+ resources[j].getFullPath())) { > list.add(configs[i]); > break; > } >@@ -2285,51 +2581,55 @@ > } > } > } catch (CoreException e) { >- DebugPlugin.log(e); >- } >+ DebugPlugin.log(e); >+ } > return list; > } >- >+ > /** > * Indicates the given launch configuration is being moved from the given > * location to the new location. > * >- * @param from the location a launch configuration is being moved from, or >- * <code>null</code> >- * @param to the location a launch configuration is being moved to, >- * or <code>null</code> >+ * @param from >+ * the location a launch configuration is being moved from, or >+ * <code>null</code> >+ * @param to >+ * the location a launch configuration is being moved to, or >+ * <code>null</code> > */ >- protected void setMovedFromTo(ILaunchConfiguration from, ILaunchConfiguration to) { >+ protected void setMovedFromTo(ILaunchConfiguration from, >+ ILaunchConfiguration to) { > fFrom = from; > fTo = to; > } >+ > /** >- * Terminates/Disconnects any active debug targets/processes. >- * Clears launch configuration types. >+ * Terminates/Disconnects any active debug targets/processes. Clears launch >+ * configuration types. > */ > public void shutdown() { > fListeners = new ListenerList(); >- fLaunchesListeners = new ListenerList(); >- fLaunchConfigurationListeners = new ListenerList(); >+ fLaunchesListeners = new ListenerList(); >+ fLaunchConfigurationListeners = new ListenerList(); > ILaunch[] launches = getLaunches(); > ILaunch launch = null; >- for (int i= 0; i < launches.length; i++) { >+ for (int i = 0; i < launches.length; i++) { > launch = launches[i]; > try { >- if (launch instanceof IDisconnect) { >- IDisconnect disconnect = (IDisconnect)launch; >- if (disconnect.canDisconnect()) { >- disconnect.disconnect(); >- } >- } >- if (launch.canTerminate()) { >- launch.terminate(); >- } >+ if (launch instanceof IDisconnect) { >+ IDisconnect disconnect = (IDisconnect) launch; >+ if (disconnect.canDisconnect()) { >+ disconnect.disconnect(); >+ } >+ } >+ if (launch.canTerminate()) { >+ launch.terminate(); >+ } > } catch (DebugException e) { > DebugPlugin.log(e); > } > } >- >+ > persistPreferredLaunchDelegates(); > clearAllLaunchConfigurations(); > fStepFilterManager = null; >@@ -2337,73 +2637,88 @@ > } > > /** >- * Saves the listings of preferred launch delegates from all of the launch configuration types >+ * Saves the listings of preferred launch delegates from all of the launch >+ * configuration types > * > * @since 3.3 > */ > private void persistPreferredLaunchDelegates() { >- ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); >- Map preferred = null; >- ILaunchDelegate delegate = null; >- Set modes = null; >- for(int i = 0; i < types.length; i++) { >- String preferenceName = PREF_PREFERRED_DELEGATES + '/' + types[i].getIdentifier(); >- preferred = ((LaunchConfigurationType)types[i]).getPreferredDelegates(); >- if(preferred != null && preferred.size() > 0) { >- StringBuffer str = new StringBuffer(); >- for(Iterator iter = preferred.keySet().iterator(); iter.hasNext();) { >- modes = (Set) iter.next(); >- delegate = (ILaunchDelegate) preferred.get(modes); >- if(delegate != null) { >- str.append(delegate.getId()); >- str.append(','); >- for(Iterator iter2 = modes.iterator(); iter2.hasNext();) { >- str.append(iter2.next()); >- if(iter2.hasNext()) { >- str.append(','); >- } >- } >- if (iter.hasNext()) { >- str.append(';'); >- } >- } >- } >- Preferences.setString(DebugPlugin.getUniqueIdentifier(), preferenceName, str.toString(), null); >- } else { >- Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), preferenceName); >- } >- } >+ ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); >+ Map preferred = null; >+ ILaunchDelegate delegate = null; >+ Set modes = null; >+ for (int i = 0; i < types.length; i++) { >+ String preferenceName = PREF_PREFERRED_DELEGATES + '/' >+ + types[i].getIdentifier(); >+ preferred = ((LaunchConfigurationType) types[i]) >+ .getPreferredDelegates(); >+ if (preferred != null && preferred.size() > 0) { >+ StringBuffer str = new StringBuffer(); >+ for (Iterator iter = preferred.keySet().iterator(); iter >+ .hasNext();) { >+ modes = (Set) iter.next(); >+ delegate = (ILaunchDelegate) preferred.get(modes); >+ if (delegate != null) { >+ str.append(delegate.getId()); >+ str.append(','); >+ for (Iterator iter2 = modes.iterator(); iter2.hasNext();) { >+ str.append(iter2.next()); >+ if (iter2.hasNext()) { >+ str.append(','); >+ } >+ } >+ if (iter.hasNext()) { >+ str.append(';'); >+ } >+ } >+ } >+ Preferences.setString(DebugPlugin.getUniqueIdentifier(), >+ preferenceName, str.toString(), null); >+ } else { >+ Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), >+ preferenceName); >+ } >+ } > >- // Reset the legacy preference string. >- Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), PREF_PREFERRED_DELEGATES); >+ // Reset the legacy preference string. >+ Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), >+ PREF_PREFERRED_DELEGATES); > } >- >+ > /** >- * finds and terminates any running launch configurations associated with the given resource >- * @param resource the resource to search for launch configurations and hence launches for >+ * finds and terminates any running launch configurations associated with >+ * the given resource >+ * >+ * @param resource >+ * the resource to search for launch configurations and hence >+ * launches for > * @since 3.2 > */ > protected void terminateMappedConfigurations(IResource resource) { > ILaunch[] launches = getLaunches(); > ILaunchConfiguration[] configs = getMappedConfigurations(resource); > try { >- for(int i = 0; i < launches.length; i++) { >- for(int j = 0; j < configs.length; j++) { >- if(configs[j].equals(launches[i].getLaunchConfiguration()) & launches[i].canTerminate()) { >+ for (int i = 0; i < launches.length; i++) { >+ for (int j = 0; j < configs.length; j++) { >+ if (configs[j].equals(launches[i].getLaunchConfiguration()) >+ & launches[i].canTerminate()) { > launches[i].terminate(); > } > } > } >+ } catch (CoreException e) { >+ DebugPlugin.log(e); > } >- catch(CoreException e) {DebugPlugin.log(e);} > } >- >+ > /** >- * Throws a debug exception with the given throwable that occurred >- * while processing the given configuration. >+ * Throws a debug exception with the given throwable that occurred while >+ * processing the given configuration. >+ * > * @since 3.5 > */ >- private void throwException(LaunchConfiguration config, Throwable e) throws DebugException { >+ private void throwException(LaunchConfiguration config, Throwable e) >+ throws DebugException { > String uri = config.getName(); > try { > IFileStore store = config.getFileStore(); >@@ -2412,33 +2727,40 @@ > } > } catch (CoreException ce) { > } >- throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager__0__occurred_while_reading_launch_configuration_file__1___1, new String[]{e.toString(), uri}), e); >+ throw createDebugException( >+ MessageFormat >+ .format( >+ DebugCoreMessages.LaunchManager__0__occurred_while_reading_launch_configuration_file__1___1, >+ new String[] { e.toString(), uri }), e); > } > > /** >- * Verify basic integrity of launch configurations in the given list, >- * adding valid configurations to the collection of all launch configurations. >+ * Verify basic integrity of launch configurations in the given list, adding >+ * valid configurations to the collection of all launch configurations. > * Exceptions are logged for invalid configurations. > * >- * @param verify the list of configurations to verify >- * @param valid the list to place valid configurations in >+ * @param verify >+ * the list of configurations to verify >+ * @param valid >+ * the list to place valid configurations in > */ > protected void verifyConfigurations(List verify, List valid) { > Iterator configs = verify.iterator(); > ILaunchConfiguration config = null; > while (configs.hasNext()) { >- config = (ILaunchConfiguration)configs.next(); >+ config = (ILaunchConfiguration) configs.next(); > if (!valid.contains(config) && isValid(config)) { > valid.add(config); > } >- } >+ } > } >- >+ > /** >- * Returns the name of the given launch mode with accelerators removed, >- * or <code>null</code> if none. >+ * Returns the name of the given launch mode with accelerators removed, or >+ * <code>null</code> if none. > * >- * @param id launch mode identifier >+ * @param id >+ * launch mode identifier > * @return launch mode name with accelerators removed or <code>null</code> > */ > public String getLaunchModeName(String id) { >@@ -2448,35 +2770,39 @@ > } > return null; > } >+ > /** > * Returns the label with any accelerators removed. > * >- * @param label label to process >+ * @param label >+ * label to process > * @return label without accelerators > */ >- public static String removeAccelerators(String label) { >- String title = label; >- if (title != null) { >- // strip out any '&' (accelerators) >- int index = title.indexOf('&'); >- if (index == 0) { >- title = title.substring(1); >- } else if (index > 0) { >- //DBCS languages use "(&X)" format >- if (title.charAt(index - 1) == '(' && title.length() >= index + 3 && title.charAt(index + 2) == ')') { >- String first = title.substring(0, index - 1); >- String last = title.substring(index + 3); >- title = first + last; >- } else if (index < (title.length() - 1)) { >- String first = title.substring(0, index); >- String last = title.substring(index + 1); >- title = first + last; >- } >- } >- } >- return title; >- } >- >+ public static String removeAccelerators(String label) { >+ String title = label; >+ if (title != null) { >+ // strip out any '&' (accelerators) >+ int index = title.indexOf('&'); >+ if (index == 0) { >+ title = title.substring(1); >+ } else if (index > 0) { >+ // DBCS languages use "(&X)" format >+ if (title.charAt(index - 1) == '(' >+ && title.length() >= index + 3 >+ && title.charAt(index + 2) == ')') { >+ String first = title.substring(0, index - 1); >+ String last = title.substring(index + 3); >+ title = first + last; >+ } else if (index < (title.length() - 1)) { >+ String first = title.substring(0, index); >+ String last = title.substring(index + 1); >+ title = first + last; >+ } >+ } >+ } >+ return title; >+ } >+ > /** > * Returns the singleton step filter manager. > * >@@ -2487,22 +2813,28 @@ > fStepFilterManager = new StepFilterManager(); > } > return fStepFilterManager; >- } >- >+ } >+ > /** >- * Imports launch configurations represented by the given local files, overwriting >- * any existing configurations. Sends launch configuration change notification >- * as required (i.e. added or changed). >+ * Imports launch configurations represented by the given local files, >+ * overwriting any existing configurations. Sends launch configuration >+ * change notification as required (i.e. added or changed). > * <p> >- * If a file is imported that has the same name as a configuration in the workspace >- * (i.e. a shared configuration), the shared configuration is deleted (becomes local). >+ * If a file is imported that has the same name as a configuration in the >+ * workspace (i.e. a shared configuration), the shared configuration is >+ * deleted (becomes local). > * </p> >- * @param files files to import >- * @param monitor progress monitor or <code>null</code> >- * @throws CoreException if an exception occurs while importing configurations >+ * >+ * @param files >+ * files to import >+ * @param monitor >+ * progress monitor or <code>null</code> >+ * @throws CoreException >+ * if an exception occurs while importing configurations > * @since 3.4.0 > */ >- public void importConfigurations(File[] files, IProgressMonitor monitor) throws CoreException { >+ public void importConfigurations(File[] files, IProgressMonitor monitor) >+ throws CoreException { > if (monitor == null) { > monitor = new NullProgressMonitor(); > } >@@ -2510,11 +2842,13 @@ > List stati = null; > Iterator iterator = getAllLaunchConfigurations().iterator(); > while (iterator.hasNext()) { >- ILaunchConfiguration config = (ILaunchConfiguration) iterator.next(); >+ ILaunchConfiguration config = (ILaunchConfiguration) iterator >+ .next(); > if (!config.isLocal()) { > StringBuffer buf = new StringBuffer(config.getName()); > buf.append('.'); >- buf.append(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION); >+ buf >+ .append(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION); > sharedConfigs.put(buf.toString(), config); > } > } >@@ -2524,18 +2858,24 @@ > break; > } > File source = files[i]; >- monitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchManager_28, new String[]{source.getName()})); >- IPath location = new Path(LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.toOSString()).append(source.getName()); >+ monitor.subTask(MessageFormat.format( >+ DebugCoreMessages.LaunchManager_28, new String[] { source >+ .getName() })); >+ IPath location = new Path(LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH >+ .toOSString()).append(source.getName()); > File target = location.toFile(); > IPath locationdir = location.removeLastSegments(1); >- if(!locationdir.toFile().exists()) { >+ if (!locationdir.toFile().exists()) { > locationdir.toFile().mkdirs(); > } > boolean added = !target.exists(); > try { > copyFile(source, target); >- ILaunchConfiguration configuration = new LaunchConfiguration(LaunchConfiguration.getSimpleName(source.getName()), null); >- ILaunchConfiguration shared = (ILaunchConfiguration) sharedConfigs.get(target.getName()); >+ ILaunchConfiguration configuration = new LaunchConfiguration( >+ LaunchConfiguration.getSimpleName(source.getName()), >+ null); >+ ILaunchConfiguration shared = (ILaunchConfiguration) sharedConfigs >+ .get(target.getName()); > if (shared != null) { > setMovedFromTo(shared, configuration); > shared.delete(); >@@ -2549,8 +2889,11 @@ > if (stati == null) { > stati = new ArrayList(); > } >- stati.add(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, >- MessageFormat.format(DebugCoreMessages.LaunchManager_27, new String[]{source.getPath()}), e)); >+ stati.add(new Status(IStatus.ERROR, DebugPlugin >+ .getUniqueIdentifier(), DebugPlugin.ERROR, >+ MessageFormat.format( >+ DebugCoreMessages.LaunchManager_27, >+ new String[] { source.getPath() }), e)); > } > monitor.worked(1); > } >@@ -2559,7 +2902,9 @@ > } > if (stati != null) { > if (stati.size() > 1) { >- MultiStatus multi = new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchManager_26, null); >+ MultiStatus multi = new MultiStatus(DebugPlugin >+ .getUniqueIdentifier(), DebugPlugin.ERROR, >+ DebugCoreMessages.LaunchManager_26, null); > Iterator it = stati.iterator(); > while (it.hasNext()) { > multi.add((IStatus) it.next()); >@@ -2570,31 +2915,34 @@ > } > } > } >- >+ > /** > * Copies a file from one location to another, replacing any existing file. > * >- * @param in the file to copy >- * @param out the file to be copied out to >- * @throws IOException >+ * @param in >+ * the file to copy >+ * @param out >+ * the file to be copied out to >+ * @throws IOException > * @since 3.4.0 > */ > private void copyFile(File in, File out) throws IOException { >- FileInputStream fis = new FileInputStream(in); >- FileOutputStream fos = new FileOutputStream(out); >- byte[] buf = new byte[1024]; >- int i = 0; >- while((i = fis.read(buf)) != -1) { >- fos.write(buf, 0, i); >- } >- fis.close(); >- fos.close(); >- } >- >+ FileInputStream fis = new FileInputStream(in); >+ FileOutputStream fos = new FileOutputStream(out); >+ byte[] buf = new byte[1024]; >+ int i = 0; >+ while ((i = fis.read(buf)) != -1) { >+ fos.write(buf, 0, i); >+ } >+ fis.close(); >+ fos.close(); >+ } >+ > /** > * Returns whether any launch config supports the given mode. > * >- * @param mode launch mode >+ * @param mode >+ * launch mode > * @return whether any launch config supports the given mode > */ > public synchronized boolean launchModeAvailable(String mode) { >@@ -2620,41 +2968,251 @@ > String name = generateUniqueLaunchConfigurationNameFrom(namePrefix); > try { > isValidLaunchConfigurationName(name); >- } >- catch(IllegalArgumentException iae) { >- //blanket change all reserved names >- if(Platform.OS_WIN32.equals(Platform.getOS())) { >- for(int i = 0; i < UNSUPPORTED_WIN32_CONFIG_NAMES.length; i++) { >- if(UNSUPPORTED_WIN32_CONFIG_NAMES[i].equals(name)) { >+ } catch (IllegalArgumentException iae) { >+ // blanket change all reserved names >+ if (Platform.OS_WIN32.equals(Platform.getOS())) { >+ for (int i = 0; i < UNSUPPORTED_WIN32_CONFIG_NAMES.length; i++) { >+ if (UNSUPPORTED_WIN32_CONFIG_NAMES[i].equals(name)) { > name = "launch_configuration"; //$NON-NLS-1$ > } > } > } >- //blanket replace all invalid chars >+ // blanket replace all invalid chars > for (int i = 0; i < DISALLOWED_CONFIG_NAME_CHARS.length; i++) { > name = name.replace(DISALLOWED_CONFIG_NAME_CHARS[i], '_'); > } > } >- //run it through the generator once more in case a replaced name has already been done >+ // run it through the generator once more in case a replaced name has >+ // already been done > return generateUniqueLaunchConfigurationNameFrom(name); > } > > /** > * @see org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(java.lang.String) > */ >- public boolean isValidLaunchConfigurationName(String configname) throws IllegalArgumentException { >- if(Platform.OS_WIN32.equals(Platform.getOS())) { >- for(int i = 0; i < UNSUPPORTED_WIN32_CONFIG_NAMES.length; i++) { >- if(configname.equals(UNSUPPORTED_WIN32_CONFIG_NAMES[i])) { >- throw new IllegalArgumentException(MessageFormat.format(DebugCoreMessages.LaunchManager_invalid_config_name, new String[] {configname})); >+ public boolean isValidLaunchConfigurationName(String configname) >+ throws IllegalArgumentException { >+ if (Platform.OS_WIN32.equals(Platform.getOS())) { >+ for (int i = 0; i < UNSUPPORTED_WIN32_CONFIG_NAMES.length; i++) { >+ if (configname.equals(UNSUPPORTED_WIN32_CONFIG_NAMES[i])) { >+ throw new IllegalArgumentException( >+ MessageFormat >+ .format( >+ DebugCoreMessages.LaunchManager_invalid_config_name, >+ new String[] { configname })); > } > } > } > for (int i = 0; i < DISALLOWED_CONFIG_NAME_CHARS.length; i++) { > if (configname.indexOf(DISALLOWED_CONFIG_NAME_CHARS[i]) > -1) { >- throw new IllegalArgumentException(MessageFormat.format(DebugCoreMessages.LaunchManager_invalid_config_name_char, new String[] {String.valueOf(DISALLOWED_CONFIG_NAME_CHARS[i])})); >+ throw new IllegalArgumentException( >+ MessageFormat >+ .format( >+ DebugCoreMessages.LaunchManager_invalid_config_name_char, >+ new String[] { String >+ .valueOf(DISALLOWED_CONFIG_NAME_CHARS[i]) })); > } > } > return true; >- } >+ } >+ >+ /** >+ * Returns whether the given configuration should be launched in the >+ * background. >+ * >+ * @param configuration >+ * the configuration >+ * @return whether the configuration is configured to launch in the >+ * background >+ */ >+ public boolean isLaunchInBackground(ILaunchConfiguration configuration) { >+ boolean launchInBackground = true; >+ try { >+ launchInBackground = configuration.getAttribute( >+ ILaunchManager.ATTR_LAUNCH_IN_BACKGROUND, true); >+ } catch (CoreException ce) { >+ DebugPlugin.log(ce); >+ } >+ return launchInBackground; >+ } >+ >+ public String getRefreshScope(ILaunchConfiguration configuration) >+ throws CoreException { >+ return configuration.getAttribute(ATTR_REFRESH_SCOPE, (String) null); >+ } >+ >+ public void refreshResources(ILaunchConfiguration configuration, >+ IProgressMonitor monitor) throws CoreException { >+ if (monitor == null) { >+ monitor = new NullProgressMonitor(); >+ } >+ String scope = getRefreshScope(configuration); >+ IResource[] resources = null; >+ if (scope != null) { >+ resources = getRefreshResources(configuration, scope); >+ } >+ if (resources == null || resources.length == 0) { >+ return; >+ } >+ int depth = IResource.DEPTH_ONE; >+ if (isRefreshRecursive(configuration)) >+ depth = IResource.DEPTH_INFINITE; >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ monitor.beginTask(DebugCoreMessages.RefreshingResources, >+ resources.length); >+ >+ MultiStatus status = new MultiStatus(DebugPlugin.getUniqueIdentifier(), >+ 0, DebugCoreMessages.RefreshingResourcesError, null); >+ for (int i = 0; i < resources.length; i++) { >+ if (monitor.isCanceled()) >+ break; >+ if (resources[i] != null && resources[i].isAccessible()) { >+ try { >+ resources[i].refreshLocal(depth, null); >+ } catch (CoreException e) { >+ status.merge(e.getStatus()); >+ } >+ } >+ monitor.worked(1); >+ } >+ >+ monitor.done(); >+ if (!status.isOK()) { >+ throw new CoreException(status); >+ } >+ } >+ >+ public IResource[] getRefreshResources(ILaunchConfiguration configuration, >+ String scope) throws CoreException { >+ >+ if (scope.startsWith("${resource:")) { //$NON-NLS-1$ >+ // This is an old format that is replaced with 'working_set' >+ String pathString = scope.substring(11, scope.length() - 1); >+ Path path = new Path(pathString); >+ IResource resource = ResourcesPlugin.getWorkspace().getRoot() >+ .findMember(path); >+ if (resource == null) { >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin >+ .getUniqueIdentifier(), IStatus.ERROR, MessageFormat >+ .format(StringSubstitutionMessages.RefreshTab_43, >+ new String[] { pathString }), null)); >+ } >+ return new IResource[] { resource }; >+ } else if (scope.startsWith("${working_set:")) { //$NON-NLS-1$ >+ String memento = scope.substring(14, scope.length() - 1); >+ return getResources(memento); >+ } else if (scope.equals("${workspace}")) { //$NON-NLS-1$ >+ return new IResource[] { ResourcesPlugin.getWorkspace().getRoot() }; >+ } else { >+ if (configuration.getFile() != null) { >+ IResource resource = configuration.getFile(); >+ if (resource == null) { >+ // empty selection >+ return new IResource[] {}; >+ } >+ if (scope.equals("${resource}")) { //$NON-NLS-1$ >+ // resource = resource >+ } else if (scope.equals("${container}")) { //$NON-NLS-1$ >+ resource = resource.getParent(); >+ } else if (scope.equals("${project}")) { //$NON-NLS-1$ >+ resource = resource.getProject(); >+ } >+ return new IResource[] { resource }; >+ } >+ } >+ return null; >+ } >+ >+ public static IResource[] getResources(String mementoString) { >+ >+ if (NO_WORKING_SET.equals(mementoString)) { >+ return null; >+ } >+ >+ List resourcesList = new ArrayList(); >+ StringReader reader = new StringReader(mementoString); >+ ResourceFactory resourceFactory = new ResourceFactory(); >+ >+ XMLMemento memento = null; >+ try { >+ memento = XMLMemento.createReadRoot(reader); >+ } catch (Exception e) { >+ DebugPlugin.log(e); >+ return null; >+ } >+ >+ IMemento[] mementos = memento >+ .getChildren(IMementoConstants.MEMENTO_ITEM); >+ for (int i = 0; i < mementos.length; i++) { >+ resourcesList.add(resourceFactory.createElement(mementos[i])); >+ } >+ >+ return (IResource[]) resourcesList.toArray(new IResource[resourcesList >+ .size()]); >+ >+ } >+ >+ public static String getResourcesMemento(IAdaptable[] resources, >+ String workingSetFactory, String editPageId, String workingSetName) { >+ XMLMemento workingSetMemento = XMLMemento >+ .createWriteRoot(IMementoConstants.TAG_LAUNCH_CONFIGURATION_WORKING_SET); >+ workingSetMemento.putString(IMementoConstants.TAG_FACTORY_ID, >+ workingSetFactory); >+ workingSetMemento >+ .putString( >+ IMementoConstants.TAG_EDIT_PAGE_ID, >+ editPageId == null ? "org.eclipse.ui.resourceWorkingSetPage" : editPageId); //$NON-NLS-1$ >+ workingSetMemento.putString(IMementoConstants.TAG_NAME, workingSetName); >+ for (int i = 0; i < resources.length; i++) { >+ IResource res = (IResource) resources[i]; >+ final IMemento itemMemento = workingSetMemento >+ .createChild(IMementoConstants.MEMENTO_ITEM); >+ // Since workingSet elements are set using >+ // LaunchManager.getResources(String mementoString) this field is no >+ // longer used. It stays for backward compatibility, to allow >+ // correct work of WorkingSet.restoreWorkingSet() >+ itemMemento.putString(IMementoConstants.TAG_FACTORY_ID, >+ "org.eclipse.ui.internal.model.ResourceFactory"); //$NON-NLS-1$ >+ itemMemento.putString(ResourceFactory.TAG_PATH, (res.getFullPath() >+ .toString())); >+ itemMemento.putString(ResourceFactory.TAG_TYPE, Integer >+ .toString(res.getType())); >+ >+ } >+ StringWriter writer = new StringWriter(); >+ try { >+ workingSetMemento.save(writer); >+ } catch (IOException e) { >+ DebugPlugin.log(e); >+ } >+ String set = writer.toString(); >+ >+ if (set != null) { >+ StringBuffer memento = new StringBuffer(); >+ memento.append("${working_set:"); //$NON-NLS-1$ >+ memento.append(set); >+ memento.append("}"); //$NON-NLS-1$ >+ return memento.toString(); >+ } >+ return null; >+ } >+ >+ /** >+ * Returns whether the refresh scope specified by the given launch >+ * configuration is recursive. >+ * >+ * @param configuration >+ * @return whether the refresh scope is recursive >+ * @throws CoreException >+ * if unable to access the associated attribute >+ */ >+ private boolean isRefreshRecursive(ILaunchConfiguration configuration) >+ throws CoreException { >+ return configuration.getAttribute(ATTR_REFRESH_RECURSIVE, true); >+ } >+ > } >Index: core/org/eclipse/debug/internal/core/DebugCoreMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties,v >retrieving revision 1.91 >diff -u -r1.91 DebugCoreMessages.properties >--- core/org/eclipse/debug/internal/core/DebugCoreMessages.properties 28 Sep 2009 15:55:03 -0000 1.91 >+++ core/org/eclipse/debug/internal/core/DebugCoreMessages.properties 30 Sep 2009 16:24:42 -0000 >@@ -100,3 +100,21 @@ > LaunchConfigurationType_7=Launch mode not supported: {0} > WatchExpression_0=(Watch expressions not supported) > NullStreamsProxy_0=Null Stream Monitor >+RefreshingResources=Refresh resources... >+RefreshingResourcesError=Exception(s) occurred during refresh. >+RefreshingResources=Refresh resources... >+RefreshingResourcesError=Exception(s) occurred during refresh. >+RefreshingResources=Refresh resources... >+RefreshingResourcesError=Exception(s) occurred during refresh. >+RefreshingResources=Refresh resources... >+RefreshingResourcesError=Exception(s) occurred during refresh. >+RefreshingResources=Refresh resources... >+RefreshingResourcesError=Exception(s) occurred during refresh. >+RefreshingResources=Refresh resources... >+RefreshingResourcesError=Exception(s) occurred during refresh. >+RefreshingResources=Refresh resources... >+RefreshingResourcesError=Exception(s) occurred during refresh. >+RefreshingResources=Refresh resources... >+RefreshingResourcesError=Exception(s) occurred during refresh. >+RefreshingResources=Refresh resources... >+RefreshingResourcesError=Exception(s) occurred during refresh. >Index: core/org/eclipse/debug/core/ILaunchManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java,v >retrieving revision 1.76 >diff -u -r1.76 ILaunchManager.java >--- core/org/eclipse/debug/core/ILaunchManager.java 28 Sep 2009 15:55:03 -0000 1.76 >+++ core/org/eclipse/debug/core/ILaunchManager.java 30 Sep 2009 16:24:42 -0000 >@@ -10,11 +10,12 @@ > *******************************************************************************/ > package org.eclipse.debug.core; > >- > import java.util.Map; > > import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.debug.core.model.IDebugTarget; > import org.eclipse.debug.core.model.IPersistableSourceLocator; > import org.eclipse.debug.core.model.IProcess; >@@ -22,9 +23,10 @@ > import org.eclipse.debug.core.sourcelookup.ISourcePathComputer; > > /** >- * The launch manager manages the set of registered launches, maintaining >- * a collection of active processes and debug targets. Clients interested >- * in launch notification may register with the launch manager. >+ * The launch manager manages the set of registered launches, maintaining a >+ * collection of active processes and debug targets. Clients interested in >+ * launch notification may register with the launch manager. >+ * > * @see ILaunch > * @see ILaunchListener > * @noimplement This interface is not intended to be implemented by clients. >@@ -34,113 +36,175 @@ > /** > * A launch in a normal, non-debug mode(value <code>"run"</code>). > */ >- public static final String RUN_MODE= "run"; //$NON-NLS-1$ >+ public static final String RUN_MODE = "run"; //$NON-NLS-1$ > /** > * A launch in a special debug mode (value <code>"debug"</code>). > */ >- public static final String DEBUG_MODE= "debug"; //$NON-NLS-1$ >+ public static final String DEBUG_MODE = "debug"; //$NON-NLS-1$ > /** > * A launch in a special profile mode (value <code>"profile"</code>). >+ * > * @since 3.0 > */ >- public static final String PROFILE_MODE= "profile"; //$NON-NLS-1$ >- >+ public static final String PROFILE_MODE = "profile"; //$NON-NLS-1$ >+ >+ /** >+ * Launch configuration attribute - a boolean value indicating whether a >+ * configuration should be launched in the background. Default value is >+ * <code>true</code>. >+ * >+ * @since 3.6 >+ */ >+ public static final String ATTR_LAUNCH_IN_BACKGROUND = "org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND"; //$NON-NLS-1$ >+ >+ /** >+ * Launch configuration attribute - a boolean value that indicates if the >+ * launch configuration is 'private'. A private configuration is one that >+ * does not appear to the user in the launch history or the launch >+ * configuration dialog. >+ * >+ * @since 3.6 >+ */ >+ public static final String ATTR_PRIVATE = "org.eclipse.debug.ui.private"; //$NON-NLS-1$ >+ >+ /** >+ * String attribute identifying the scope of resources that should be >+ * refreshed after an external tool is run. The value is either a refresh >+ * variable or the default value, <code>null</code>, indicating no refresh. >+ * >+ * @since 3.6 >+ */ >+ public static final String ATTR_REFRESH_SCOPE = DebugPlugin >+ .getUniqueIdentifier() >+ + ".ATTR_REFRESH_SCOPE"; //$NON-NLS-1$ >+ >+ /** >+ * Boolean attribute indicating if a refresh scope is recursive. Default >+ * value is <code>false</code>. >+ * >+ * @since 3.6 >+ */ >+ public static final String ATTR_REFRESH_RECURSIVE = DebugPlugin >+ .getUniqueIdentifier() >+ + ".ATTR_REFRESH_RECURSIVE"; //$NON-NLS-1$ >+ > /** > * Launch configuration attribute name. The value is a map of environment >- * variables passed into Runtime.exec(...) when a launch configuration is launched. >- * Default value is <code>null</code> which indicates the default environment >- * should be used. >+ * variables passed into Runtime.exec(...) when a launch configuration is >+ * launched. Default value is <code>null</code> which indicates the default >+ * environment should be used. > * > * @since 3.0 > */ >- public static final String ATTR_ENVIRONMENT_VARIABLES = DebugPlugin.getUniqueIdentifier() + ".environmentVariables"; //$NON-NLS-1$ >- >+ public static final String ATTR_ENVIRONMENT_VARIABLES = DebugPlugin >+ .getUniqueIdentifier() >+ + "org.eclipse.debug.ui.environmentVariables"; //$NON-NLS-1$ >+ > /** >- * Launch configuration attribute name. The value is a boolean value specifying >- * whether the environment variables in a launch configuration >- * should be appended to the native environment (i.e. when <code>true</code>), >- * or if they should replace the environment (i.e. <code>false</code>). The >- * default value is <code>true</code>. >+ * Launch configuration attribute name. The value is a boolean value >+ * specifying whether the environment variables in a launch configuration >+ * should be appended to the native environment (i.e. when <code>true</code> >+ * ), or if they should replace the environment (i.e. <code>false</code>). >+ * The default value is <code>true</code>. > * >- * @since 3.0 >+ * @since 3.0 > */ >- public static final String ATTR_APPEND_ENVIRONMENT_VARIABLES = DebugPlugin.getUniqueIdentifier() + ".appendEnvironmentVariables"; //$NON-NLS-1$ >- >+ public static final String ATTR_APPEND_ENVIRONMENT_VARIABLES = DebugPlugin >+ .getUniqueIdentifier() >+ + ".appendEnvironmentVariables"; //$NON-NLS-1$ >+ > /** >- * Adds the specified launch and notifies listeners. Has no >- * effect if an identical launch is already registered. >+ * Adds the specified launch and notifies listeners. Has no effect if an >+ * identical launch is already registered. > * >- * @param launch the launch to add >+ * @param launch >+ * the launch to add > * @since 2.0 > */ > public void addLaunch(ILaunch launch); >+ > /** >- * Adds the given launch configuration listener to the list >- * of listeners notified when a launch configuration is >- * added, removed, or changed. Has no effect if the given listener >- * is already registered. >+ * Adds the given launch configuration listener to the list of listeners >+ * notified when a launch configuration is added, removed, or changed. Has >+ * no effect if the given listener is already registered. > * >- * @param listener launch configuration listener >+ * @param listener >+ * launch configuration listener > * @since 2.0 > */ >- public void addLaunchConfigurationListener(ILaunchConfigurationListener listener); >+ public void addLaunchConfigurationListener( >+ ILaunchConfigurationListener listener); >+ > /** >- * Adds the specified launch objects and notifies listeners. Has no >- * effect on identical launch objects already registered. >+ * Adds the specified launch objects and notifies listeners. Has no effect >+ * on identical launch objects already registered. > * >- * @param launches the launch objects to add >+ * @param launches >+ * the launch objects to add > * @since 2.1 > */ >- public void addLaunches(ILaunch[] launches); >+ public void addLaunches(ILaunch[] launches); >+ > /** > * Adds the given listener to the collection of registered launch listeners. > * Has no effect if an identical listener is already registered. >- * >- * @param listener the listener to register >+ * >+ * @param listener >+ * the listener to register > * @since 2.1 > */ >- public void addLaunchListener(ILaunchesListener listener); >+ public void addLaunchListener(ILaunchesListener listener); >+ > /** > * Adds the given listener to the collection of registered launch listeners. > * Has no effect if an identical listener is already registered. >- * >- * @param listener the listener to register >+ * >+ * @param listener >+ * the listener to register > */ > public void addLaunchListener(ILaunchListener listener); >+ > /** >- * Return a String that can be used as the name of a launch configuration. The name >- * is guaranteed to be unique (no existing launch configurations will have this name). >- * The name that is returned uses the <code>namePrefix</code> as a starting point. If >- * there is no existing launch configuration with this name, then <code>namePrefix</code> >- * is returned. Otherwise, the value returned consists of the specified prefix plus >- * some suffix that guarantees uniqueness. >- * >- * @param namePrefix the String that the returned name must begin with >+ * Return a String that can be used as the name of a launch configuration. >+ * The name is guaranteed to be unique (no existing launch configurations >+ * will have this name). The name that is returned uses the >+ * <code>namePrefix</code> as a starting point. If there is no existing >+ * launch configuration with this name, then <code>namePrefix</code> is >+ * returned. Otherwise, the value returned consists of the specified prefix >+ * plus some suffix that guarantees uniqueness. >+ * >+ * @param namePrefix >+ * the String that the returned name must begin with > * @return launch configuration name > * @since 2.0 >- * @deprecated since 3.5 clients should use the {@link #generateLaunchConfigurationName(String)} method which >- * will perform validation of the name and correct unsupported name parts. >+ * @deprecated since 3.5 clients should use the >+ * {@link #generateLaunchConfigurationName(String)} method which >+ * will perform validation of the name and correct unsupported >+ * name parts. > */ > public String generateUniqueLaunchConfigurationNameFrom(String namePrefix); >- >+ > /** >- * Returns a string that can be used as the name of a launch configuration. The name >- * is guaranteed to be unique (no existing launch configurations will have this name). >- * The name that is returned uses the <code>namePrefix</code> as a starting point. If >- * there is no existing launch configuration with this name, then <code>namePrefix</code> >- * is returned. Otherwise, the value returned consists of the specified prefix plus >- * some suffix that guarantees uniqueness. >+ * Returns a string that can be used as the name of a launch configuration. >+ * The name is guaranteed to be unique (no existing launch configurations >+ * will have this name). The name that is returned uses the >+ * <code>namePrefix</code> as a starting point. If there is no existing >+ * launch configuration with this name, then <code>namePrefix</code> is >+ * returned. Otherwise, the value returned consists of the specified prefix >+ * plus some suffix that guarantees uniqueness. > * <p> >- * If the name prefix does not pass name validation any illegal parts of the name will be removed >- * during the name generation. Illegal characters will be replaced with '_' and illegal names wil be >- * replaced with "_reserved_". >+ * If the name prefix does not pass name validation any illegal parts of the >+ * name will be removed during the name generation. Illegal characters will >+ * be replaced with '_' and illegal names wil be replaced with "_reserved_". > * </p> >- * @param namePrefix the string that the returned name should begin with >+ * >+ * @param namePrefix >+ * the string that the returned name should begin with > * @return launch configuration name > * @since 3.6 > */ > public String generateLaunchConfigurationName(String namePrefix); >- >+ > /** > * Returns if the given name is valid or not. If an invalid name part is located > * an {@link IllegalArgumentException} is thrown. >@@ -157,96 +221,124 @@ > /** > * Returns the collection of debug targets currently registered with this > * launch manager. >- * >+ * > * @return an array of debug targets > */ > public IDebugTarget[] getDebugTargets(); >- /** >- * Returns an array of environment variables to be used when >- * launching the given configuration or <code>null</code> if unspecified. >- * Each entry is of the form "<code>var_name=value</code>". >+ >+ /** >+ * Returns an array of environment variables to be used when launching the >+ * given configuration or <code>null</code> if unspecified. Each entry is of >+ * the form "<code>var_name=value</code>". > * > * @return an array of environment variables to use when launching the given >- * configuration or <code>null</code> if unspecified >- * @param configuration launch configuration >- * @throws CoreException if unable to access associated attribute or if >- * unable to resolve a variable in an environment variable's value >- * @since 3.0 >- */ >- public String[] getEnvironment(ILaunchConfiguration configuration) throws CoreException; >- /** >- * This method returns the character encoding to use when launching the specified <code>ILaunchConfiguration</code>. >- * The returned encoding can be derived from one of three places in the following order: >- * <ol> >- * <li>An attribute saved on the configuration itself (where no attribute means use the default encoding).</li> >- * <li>The mapped resources for the configuration, in the event one of them has a specific encoding that >- * is not the workspace default. If there are more than one mapped resource we optimistically ask only the first resource >- * for its encoding.</li> >- * <li>We ask the <code>ResourcesPlugin</code> for the workspace preference (which resolves back to the system >- * property <code>file.encoding</code> if the user has made no changes to the workspace encoding preference).</li> >+ * configuration or <code>null</code> if unspecified >+ * @param configuration >+ * launch configuration >+ * @throws CoreException >+ * if unable to access associated attribute or if unable to >+ * resolve a variable in an environment variable's value >+ * @since 3.0 >+ */ >+ public String[] getEnvironment(ILaunchConfiguration configuration) >+ throws CoreException; >+ >+ /** >+ * This method returns the character encoding to use when launching the >+ * specified <code>ILaunchConfiguration</code>. The returned encoding can be >+ * derived from one of three places in the following order: >+ * <ol> >+ * <li>An attribute saved on the configuration itself (where no attribute >+ * means use the default encoding).</li> >+ * <li>The mapped resources for the configuration, in the event one of them >+ * has a specific encoding that is not the workspace default. If there are >+ * more than one mapped resource we optimistically ask only the first >+ * resource for its encoding.</li> >+ * <li>We ask the <code>ResourcesPlugin</code> for the workspace preference >+ * (which resolves back to the system property <code>file.encoding</code> if >+ * the user has made no changes to the workspace encoding preference).</li> > * </ol> >- * @param configuration the <code>ILaunchConfiguration</code> to get the encoding for >- * @return the encoding to use when launching the specified <code>ILaunchConfiguration</code> >+ * >+ * @param configuration >+ * the <code>ILaunchConfiguration</code> to get the encoding for >+ * @return the encoding to use when launching the specified >+ * <code>ILaunchConfiguration</code> > * @throws CoreException > * > * @since 3.4 > */ >- public String getEncoding(ILaunchConfiguration configuration) throws CoreException; >+ public String getEncoding(ILaunchConfiguration configuration) >+ throws CoreException; >+ > /** >- * Returns a handle to the launch configuration contained >- * in the specified file. This method does not check if the specified <code>IFile</code> is >- * a launch configuration file or that it exists in the local or >- * remote file system. >- * >- * @param file launch configuration file >- * @return a handle to the launch configuration contained >- * in the specified file >+ * Returns a handle to the launch configuration contained in the specified >+ * file. This method does not check if the specified <code>IFile</code> is a >+ * launch configuration file or that it exists in the local or remote file >+ * system. >+ * >+ * @param file >+ * launch configuration file >+ * @return a handle to the launch configuration contained in the specified >+ * file > * @since 2.0 > */ >- public ILaunchConfiguration getLaunchConfiguration(IFile file); >+ public ILaunchConfiguration getLaunchConfiguration(IFile file); >+ > /** >- * Returns a handle to the launch configuration specified by >- * the given memento. The configuration may not exist. >+ * Returns a handle to the launch configuration specified by the given >+ * memento. The configuration may not exist. > * >- * @param memento launch configuration memento >- * @return a handle to the launch configuration specified by >- * the given memento >- * @exception CoreException if the given memento is invalid or >- * an exception occurs parsing the memento >+ * @param memento >+ * launch configuration memento >+ * @return a handle to the launch configuration specified by the given >+ * memento >+ * @exception CoreException >+ * if the given memento is invalid or an exception occurs >+ * parsing the memento > * @see ILaunchConfiguration#getMemento() > * @since 2.0 > */ >- public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException; >+ public ILaunchConfiguration getLaunchConfiguration(String memento) >+ throws CoreException; >+ > /** > * Returns all launch configurations defined in the workspace. > * > * @return all launch configurations defined in the workspace >- * @exception CoreException if an exception occurs retrieving configurations >+ * @exception CoreException >+ * if an exception occurs retrieving configurations > * @since 2.0 > */ >- public ILaunchConfiguration[] getLaunchConfigurations() throws CoreException; >+ public ILaunchConfiguration[] getLaunchConfigurations() >+ throws CoreException; >+ > /** >- * Returns all launch configurations of the specified type defined in the workspace >+ * Returns all launch configurations of the specified type defined in the >+ * workspace > * >- * @param type a launch configuration type >- * @return all launch configurations of the specified type defined in the workspace >- * @exception CoreException if an error occurs while retrieving >- * a launch configuration >+ * @param type >+ * a launch configuration type >+ * @return all launch configurations of the specified type defined in the >+ * workspace >+ * @exception CoreException >+ * if an error occurs while retrieving a launch configuration > * @since 2.0 > */ >- public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException; >- >+ public ILaunchConfiguration[] getLaunchConfigurations( >+ ILaunchConfigurationType type) throws CoreException; >+ > /** >- * Returns the launch configuration type extension with the specified >- * id, or <code>null</code> if it does not exist. >+ * Returns the launch configuration type extension with the specified id, or >+ * <code>null</code> if it does not exist. > * >- * @param id unique identifier for a launch configuration type extension >- * @return the launch configuration type extension with the specified >- * id, or <code>null</code> if it does not exist >+ * @param id >+ * unique identifier for a launch configuration type extension >+ * @return the launch configuration type extension with the specified id, or >+ * <code>null</code> if it does not exist > * @since 2.0 > */ > public ILaunchConfigurationType getLaunchConfigurationType(String id); >- >+ > /** > * Returns all defined launch configuration type extensions > * >@@ -254,25 +346,26 @@ > * @since 2.0 > */ > public ILaunchConfigurationType[] getLaunchConfigurationTypes(); >- >+ > /** >- * Returns the collection of launches currently registered >- * with this launch manager. >+ * Returns the collection of launches currently registered with this launch >+ * manager. > * > * @return an array of launches > */ > public ILaunch[] getLaunches(); >- >+ > /** >- * Returns the launch mode registered with the given mode identifier, >- * or <code>null</code> if none. >+ * Returns the launch mode registered with the given mode identifier, or >+ * <code>null</code> if none. > * >- * @param mode mode identifier >+ * @param mode >+ * mode identifier > * @return launch mode or <code>null</code> > * @since 3.0 > */ > public ILaunchMode getLaunchMode(String mode); >- >+ > /** > * Returns all registered launch modes. > * >@@ -280,18 +373,18 @@ > * @since 3.0 > */ > public ILaunchMode[] getLaunchModes(); >- >+ > /** >- * Returns a collection of launch configurations that required migration to be >- * compatible with current tooling. >+ * Returns a collection of launch configurations that required migration to >+ * be compatible with current tooling. > * > * @return a collection of launch configurations that required migration >- * @exception org.eclipse.core.runtime.CoreException if an exception occurs determining >- * migration candidates >+ * @exception org.eclipse.core.runtime.CoreException >+ * if an exception occurs determining migration candidates > * @since 3.2 > */ > public ILaunchConfiguration[] getMigrationCandidates() throws CoreException; >- >+ > /** > * When a launch configuration is created or moved, registered launch > * configuration listeners (see <code>ILaunchConfigurationListener</code>) >@@ -307,15 +400,17 @@ > * configuration. > * </p> > * >- * @param addedConfiguration a launch configuration for which an add >- * notification is being broadcast >+ * @param addedConfiguration >+ * a launch configuration for which an add notification is being >+ * broadcast > * @return the launch configuration that the added launch configuration was >- * moved from, or <code>null</code> if the add notification is not the >- * result of a move >+ * moved from, or <code>null</code> if the add notification is not >+ * the result of a move > * @since 2.1 > */ >- public ILaunchConfiguration getMovedFrom(ILaunchConfiguration addedConfiguration); >- >+ public ILaunchConfiguration getMovedFrom( >+ ILaunchConfiguration addedConfiguration); >+ > /** > * When a launch configuration is deleted or moved, registered launch > * configuration listeners (see <code>ILaunchConfigurationListener</code>) >@@ -330,77 +425,78 @@ > * Renaming a configuration is considered the same as moving a > * configuration. > * </p> >- * >- * @param removedConfiguration a launch configuration for which a >- * remove notification is being broadcast >+ * >+ * @param removedConfiguration >+ * a launch configuration for which a remove notification is >+ * being broadcast > * @return the launch configuration that the removed launch configuration >- * was moved to, or <code>null</code> if the add notification is not the >- * result of a move >+ * was moved to, or <code>null</code> if the add notification is not >+ * the result of a move > * @since 2.1 > */ >- public ILaunchConfiguration getMovedTo(ILaunchConfiguration removedConfiguration); >- >+ public ILaunchConfiguration getMovedTo( >+ ILaunchConfiguration removedConfiguration); >+ > /** >- * Returns the native system environment variables as a map of >- * variable names and values (Strings). >+ * Returns the native system environment variables as a map of variable >+ * names and values (Strings). > * <p> >- * Note that WIN32 system environment preserves >- * the case of variable names but is otherwise case insensitive. >- * Depending on what you intend to do with the environment, the >- * lack of normalization may or may not be create problems. On >- * WIN32, this method normalizes mixed-case keys variable names >- * to upper case. Use {@link #getNativeEnvironmentCasePreserved()} >- * instead to get a WIN32 system environment where the keys are >- * the mixed-case variable names recorded by the OS. >+ * Note that WIN32 system environment preserves the case of variable names >+ * but is otherwise case insensitive. Depending on what you intend to do >+ * with the environment, the lack of normalization may or may not be create >+ * problems. On WIN32, this method normalizes mixed-case keys variable names >+ * to upper case. Use {@link #getNativeEnvironmentCasePreserved()} instead >+ * to get a WIN32 system environment where the keys are the mixed-case >+ * variable names recorded by the OS. > * </p> > * > * @return the native system environment variables; on WIN32, mixed-case >- * variable names (keys) have been normalized to upper case >- * (key type: <code>String</code>; value type: <code>String</code>) >+ * variable names (keys) have been normalized to upper case (key >+ * type: <code>String</code>; value type: <code>String</code>) > * @since 3.0 >- */ >+ */ > public Map getNativeEnvironment(); > > /** >- * Returns the native system environment variables as a map of >- * variable names and values (Strings). >+ * Returns the native system environment variables as a map of variable >+ * names and values (Strings). > * <p> >- * Note that WIN32 system environment preserves >- * the case of variable names but is otherwise case insensitive. >- * Depending on what you intend to do with the environment, the >- * lack of normalization may or may not be create problems. This >- * method returns mixed-case keys using the variable names >- * recorded by the OS. >- * Use {@link #getNativeEnvironment()} instead to get a WIN32 system >- * environment where all keys have been normalized to upper case. >+ * Note that WIN32 system environment preserves the case of variable names >+ * but is otherwise case insensitive. Depending on what you intend to do >+ * with the environment, the lack of normalization may or may not be create >+ * problems. This method returns mixed-case keys using the variable names >+ * recorded by the OS. Use {@link #getNativeEnvironment()} instead to get a >+ * WIN32 system environment where all keys have been normalized to upper >+ * case. > * </p> > * > * @return the native system environment variables; on WIN32, mixed-case >- * variable names (keys) are returned without normalization >- * (key type: <code>String</code>; value type: <code>String</code>) >+ * variable names (keys) are returned without normalization (key >+ * type: <code>String</code>; value type: <code>String</code>) > * @since 3.1 >- */ >+ */ > public Map getNativeEnvironmentCasePreserved(); > > /** >- * Returns the collection of processes currently registered with this >- * launch manager. >- * >+ * Returns the collection of processes currently registered with this launch >+ * manager. >+ * > * @return an array of processes > */ > public IProcess[] getProcesses(); >- >+ > /** >- * Returns the source container type extension registered with the >- * given unique identifier, or <code>null</code> if none. >+ * Returns the source container type extension registered with the given >+ * unique identifier, or <code>null</code> if none. > * >- * @param id unique identifier of a source container type extension >- * @return the source container type extension registered with the >- * given unique identifier, or <code>null</code> if none >+ * @param id >+ * unique identifier of a source container type extension >+ * @return the source container type extension registered with the given >+ * unique identifier, or <code>null</code> if none > * @since 3.0 > */ > public ISourceContainerType getSourceContainerType(String id); >- >+ > /** > * Returns all registered source container type extensions. > * >@@ -410,112 +506,180 @@ > public ISourceContainerType[] getSourceContainerTypes(); > > /** >- * Returns a source path computer to compute a default source lookup path for >- * the given launch configuration, or <code>null</code> if a source path >+ * Returns a source path computer to compute a default source lookup path >+ * for the given launch configuration, or <code>null</code> if a source path > * computer has not been registered for the associated launch configuration > * type. >- * >- * @param configuration a launch configuration >+ * >+ * @param configuration >+ * a launch configuration > * @return a source path computer registered for the associated launch >- * configurations type, or <code>null</code> if unspecified >- * @throws CoreException if an exception occurs while instantiating a source >- * path computer >+ * configurations type, or <code>null</code> if unspecified >+ * @throws CoreException >+ * if an exception occurs while instantiating a source path >+ * computer > * @since 3.0 > */ >- public ISourcePathComputer getSourcePathComputer(ILaunchConfiguration configuration) throws CoreException; >- >+ public ISourcePathComputer getSourcePathComputer( >+ ILaunchConfiguration configuration) throws CoreException; >+ > /** > * Returns the source path computer extension registered with the given > * unique identifier, or <code>null</code> if none. > * >- * @param id source path computer identifier >+ * @param id >+ * source path computer identifier > * @return the source path computer extension registered with the given >- * unique identifier, or <code>null</code> if none >+ * unique identifier, or <code>null</code> if none > * @since 3.0 > */ >- public ISourcePathComputer getSourcePathComputer(String id); >- >+ public ISourcePathComputer getSourcePathComputer(String id); >+ > /** >- * Return <code>true</code> if there is a launch configuration with the specified name, >- * <code>false</code> otherwise. >+ * Return <code>true</code> if there is a launch configuration with the >+ * specified name, <code>false</code> otherwise. > * > * @return whether a launch configuration already exists with the given name >- * @param name the name of the launch configuration whose existence is being checked >- * @exception CoreException if unable to retrieve existing launch configuration names >+ * @param name >+ * the name of the launch configuration whose existence is being >+ * checked >+ * @exception CoreException >+ * if unable to retrieve existing launch configuration names > * @since 2.0 > */ >- public boolean isExistingLaunchConfigurationName(String name) throws CoreException; >- >+ public boolean isExistingLaunchConfigurationName(String name) >+ throws CoreException; >+ > /** > * Returns whether the given launch is currently registered. > * >- * @param launch a launch >+ * @param launch >+ * a launch > * @return whether the launch is currently registered > * @since 3.1 > */ > public boolean isRegistered(ILaunch launch); >- >+ > /** >- * Creates and returns a new source locator of the specified >- * type. >+ * Creates and returns a new source locator of the specified type. > * >- * @param identifier the identifier associated with a >- * persistable source locator extension >+ * @param identifier >+ * the identifier associated with a persistable source locator >+ * extension > * @return a source locator >- * @exception CoreException if an exception occurs creating >- * the source locator >+ * @exception CoreException >+ * if an exception occurs creating the source locator > * @since 2.0 > */ >- public IPersistableSourceLocator newSourceLocator(String identifier) throws CoreException; >+ public IPersistableSourceLocator newSourceLocator(String identifier) >+ throws CoreException; > > /** >- * Removes the specified launch and notifies listeners. >- * Has no effect if an identical launch is not already >- * registered. >- * >- * @param launch the launch to remove >+ * Removes the specified launch and notifies listeners. Has no effect if an >+ * identical launch is not already registered. >+ * >+ * @param launch >+ * the launch to remove > * @since 2.0 > */ > public void removeLaunch(ILaunch launch); > > /** >- * Removes the given launch configuration listener from the list >- * of listeners notified when a launch configuration is >- * added, removed, or changed. Has no effect if the given listener >- * is not already registered. >+ * Removes the given launch configuration listener from the list of >+ * listeners notified when a launch configuration is added, removed, or >+ * changed. Has no effect if the given listener is not already registered. > * >- * @param listener launch configuration listener >+ * @param listener >+ * launch configuration listener > * @since 2.0 > */ >- public void removeLaunchConfigurationListener(ILaunchConfigurationListener listener); >+ public void removeLaunchConfigurationListener( >+ ILaunchConfigurationListener listener); > > /** >- * Removes the specified launch objects and notifies listeners. >- * Has no effect on identical launch objects that are not already >- * registered. >- * >- * @param launches the launch objects to remove >+ * Removes the specified launch objects and notifies listeners. Has no >+ * effect on identical launch objects that are not already registered. >+ * >+ * @param launches >+ * the launch objects to remove > * @since 2.1 > */ > public void removeLaunches(ILaunch[] launches); >- >+ > /** >- * Removes the given listener from the collection of registered launch listeners. >- * Has no effect if an identical listener is not already registered. >- * >- * @param listener the listener to unregister >+ * Removes the given listener from the collection of registered launch >+ * listeners. Has no effect if an identical listener is not already >+ * registered. >+ * >+ * @param listener >+ * the listener to unregister > * @since 2.1 > */ > public void removeLaunchListener(ILaunchesListener listener); >- >+ > /** >- * Removes the given listener from the collection of registered launch listeners. >- * Has no effect if an identical listener is not already registered. >- * >- * @param listener the listener to unregister >+ * Removes the given listener from the collection of registered launch >+ * listeners. Has no effect if an identical listener is not already >+ * registered. >+ * >+ * @param listener >+ * the listener to unregister > */ > public void removeLaunchListener(ILaunchListener listener); >- >-} > >+ /** >+ * Returns whether the given configuration should be launched in the >+ * background. >+ * >+ * @param configuration >+ * the configuration >+ * @return whether the configuration is configured to launch in the >+ * background >+ * @since 3.6 >+ */ >+ public boolean isLaunchInBackground(ILaunchConfiguration configuration); >+ >+ /** >+ * Returns the refresh scope attribute specified by the given launch >+ * configuration or <code>null</code> if none. >+ * >+ * @param configuration >+ * launch configuration >+ * @return refresh scope attribute (<code>ATTR_REFRESH_SCOPE</code>) >+ * @throws CoreException >+ * if unable to access the associated attribute >+ * @since 3.6 >+ */ >+ public String getRefreshScope(ILaunchConfiguration configuration) >+ throws CoreException; >+ >+ /** >+ * Refreshes the resources as specified by the given launch configuration. >+ * >+ * @param configuration >+ * launch configuration >+ * @param monitor >+ * progress monitor which may be <code>null</code> >+ * @throws CoreException >+ * if an exception occurs while refreshing resources >+ * @since 3.6 >+ */ >+ public void refreshResources(ILaunchConfiguration configuration, >+ IProgressMonitor monitor) throws CoreException; >+ >+ /** >+ * Returns a collection of resources referred to by a refresh scope >+ * attribute. >+ * >+ * @param scope >+ * refresh scope attribute (<code>ATTR_REFRESH_SCOPE</code>) >+ * @return collection of resources referred to by the refresh scope >+ * attribute >+ * @throws CoreException >+ * if unable to resolve a set of resources >+ * @since 3.6 >+ */ >+ public IResource[] getRefreshResources(ILaunchConfiguration configuration, >+ String scope) throws CoreException; > >+} >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/META-INF/MANIFEST.MF,v >retrieving revision 1.22 >diff -u -r1.22 MANIFEST.MF >--- META-INF/MANIFEST.MF 10 Sep 2009 04:29:54 -0000 1.22 >+++ META-INF/MANIFEST.MF 30 Sep 2009 16:24:42 -0000 >@@ -23,5 +23,6 @@ > org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)", > org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)" > Bundle-ActivationPolicy: lazy >-Import-Package: com.ibm.icu.text >+Import-Package: com.ibm.icu.text, >+ org.eclipse.jface.util > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: core/org/eclipse/debug/internal/core/IMementoConstants.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/IMementoConstants.java >diff -N core/org/eclipse/debug/internal/core/IMementoConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/IMementoConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,32 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.debug.internal.core; >+ >+public interface IMementoConstants { >+ // These persistence constant is stored in XML. Do not >+ // change it. >+ public static final String TAG_FACTORY_ID = "factoryID"; //$NON-NLS-1$ >+ >+ public static final String TAG_EDITOR_STATE = "editorState"; //$NON-NLS-1$ >+ >+ public static final String MEMENTO_ITEM = "item"; //$NON-NLS-1$ >+ >+ public static final String TAG_EDIT_PAGE_ID = "editPageId"; //$NON-NLS-1$ >+ >+ public static final String TAG_NAME = "name"; //$NON-NLS-1$ >+ >+ public static final String TAG_LABEL = "label"; //$NON-NLS-1$ >+ >+ public static final String TAG_ID = "id"; //$NON-NLS-1$ >+ >+ public static final String TAG_LAUNCH_CONFIGURATION_WORKING_SET = "launchConfigurationWorkingSet"; //$NON-NLS-1$ >+ >+} >Index: core/org/eclipse/debug/internal/core/XMLMemento.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/XMLMemento.java >diff -N core/org/eclipse/debug/internal/core/XMLMemento.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/XMLMemento.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,612 @@ >+/******************************************************************************* >+ * 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.debug.internal.core; >+ >+ >+import java.io.IOException; >+import java.io.PrintWriter; >+import java.io.Reader; >+import java.io.Writer; >+import java.util.ArrayList; >+ >+import javax.xml.parsers.DocumentBuilder; >+import javax.xml.parsers.DocumentBuilderFactory; >+import javax.xml.parsers.ParserConfigurationException; >+ >+import org.eclipse.debug.core.DebugPlugin; >+import org.w3c.dom.Attr; >+import org.w3c.dom.Document; >+import org.w3c.dom.Element; >+import org.w3c.dom.NamedNodeMap; >+import org.w3c.dom.Node; >+import org.w3c.dom.NodeList; >+import org.w3c.dom.Text; >+import org.xml.sax.InputSource; >+import org.xml.sax.SAXException; >+ >+/** >+ * This class represents the default implementation of the >+ * <code>IMemento</code> interface. >+ * <p> >+ * This class is not intended to be extended by clients. >+ * </p> >+ * >+ * @see IMemento >+ */ >+public final class XMLMemento implements IMemento { >+ private Document factory; >+ >+ private Element element; >+ >+ /** >+ * Creates a <code>Document</code> from the <code>Reader</code> >+ * and returns a memento on the first <code>Element</code> for reading >+ * the document. >+ * <p> >+ * Same as calling createReadRoot(reader, null) >+ * </p> >+ * >+ * @param reader the <code>Reader</code> used to create the memento's document >+ * @return a memento on the first <code>Element</code> for reading the document >+ * @throws Exception if IO problems, invalid format, or no element. >+ */ >+ public static XMLMemento createReadRoot(Reader reader) >+ throws Exception { >+ return createReadRoot(reader, null); >+ } >+ >+ /** >+ * Creates a <code>Document</code> from the <code>Reader</code> >+ * and returns a memento on the first <code>Element</code> for reading >+ * the document. >+ * >+ * @param reader the <code>Reader</code> used to create the memento's document >+ * @param baseDir the directory used to resolve relative file names >+ * in the XML document. This directory must exist and include the >+ * trailing separator. The directory format, including the separators, >+ * must be valid for the platform. Can be <code>null</code> if not >+ * needed. >+ * @return a memento on the first <code>Element</code> for reading the document >+ * @throws Exception if IO problems, invalid format, or no element. >+ */ >+ public static XMLMemento createReadRoot(Reader reader, String baseDir) >+ throws Exception { >+ String errorMessage = null; >+ Exception exception = null; >+ >+ try { >+ DocumentBuilderFactory factory = DocumentBuilderFactory >+ .newInstance(); >+ DocumentBuilder parser = factory.newDocumentBuilder(); >+ InputSource source = new InputSource(reader); >+ if (baseDir != null) { >+ source.setSystemId(baseDir); >+ } >+ Document document = parser.parse(source); >+ NodeList list = document.getChildNodes(); >+ for (int i = 0; i < list.getLength(); i++) { >+ Node node = list.item(i); >+ if (node instanceof Element) { >+ return new XMLMemento(document, (Element) node); >+ } >+ } >+ } catch (ParserConfigurationException e) { >+ exception = e; >+ // errorMessage = WorkbenchMessages.XMLMemento_parserConfigError; >+ } catch (IOException e) { >+ exception = e; >+ // errorMessage = WorkbenchMessages.XMLMemento_ioError; >+ } catch (SAXException e) { >+ exception = e; >+ // errorMessage = WorkbenchMessages.XMLMemento_formatError; >+ } >+ >+ String problemText = null; >+ if (exception != null) { >+ problemText = exception.getMessage(); >+ } >+ if (problemText == null || problemText.length() == 0) { >+ problemText = errorMessage != null ? errorMessage >+ :"ERROR"; //;WorkbenchMessages.XMLMemento_noElement; //$NON-NLS-1$ >+ } >+ throw new Exception(problemText, exception); >+ } >+ >+ /** >+ * Returns a root memento for writing a document. >+ * >+ * @param type the element node type to create on the document >+ * @return the root memento for writing a document >+ */ >+ public static XMLMemento createWriteRoot(String type) { >+ Document document; >+ try { >+ document = DocumentBuilderFactory.newInstance() >+ .newDocumentBuilder().newDocument(); >+ Element element = document.createElement(type); >+ document.appendChild(element); >+ return new XMLMemento(document, element); >+ } catch (ParserConfigurationException e) { >+// throw new Error(e); >+ throw new Error(e.getMessage()); >+ } >+ } >+ >+ /** >+ * Creates a memento for the specified document and element. >+ * <p> >+ * Clients should use <code>createReadRoot</code> and >+ * <code>createWriteRoot</code> to create the initial >+ * memento on a document. >+ * </p> >+ * >+ * @param document the document for the memento >+ * @param element the element node for the memento >+ */ >+ public XMLMemento(Document document, Element element) { >+ super(); >+ this.factory = document; >+ this.element = element; >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public IMemento createChild(String type) { >+ Element child = factory.createElement(type); >+ element.appendChild(child); >+ return new XMLMemento(factory, child); >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public IMemento createChild(String type, String id) { >+ Element child = factory.createElement(type); >+ child.setAttribute(TAG_ID, id == null ? "" : id); //$NON-NLS-1$ >+ element.appendChild(child); >+ return new XMLMemento(factory, child); >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public IMemento copyChild(IMemento child) { >+ Element childElement = ((XMLMemento) child).element; >+ Element newElement = (Element) factory.importNode(childElement, true); >+ element.appendChild(newElement); >+ return new XMLMemento(factory, newElement); >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public IMemento getChild(String type) { >+ >+ // Get the nodes. >+ NodeList nodes = element.getChildNodes(); >+ int size = nodes.getLength(); >+ if (size == 0) { >+ return null; >+ } >+ >+ // Find the first node which is a child of this node. >+ for (int nX = 0; nX < size; nX++) { >+ Node node = nodes.item(nX); >+ if (node instanceof Element) { >+ Element element = (Element) node; >+ if (element.getNodeName().equals(type)) { >+ return new XMLMemento(factory, element); >+ } >+ } >+ } >+ >+ // A child was not found. >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public IMemento[] getChildren(String type) { >+ >+ // Get the nodes. >+ NodeList nodes = element.getChildNodes(); >+ int size = nodes.getLength(); >+ if (size == 0) { >+ return new IMemento[0]; >+ } >+ >+ // Extract each node with given type. >+ ArrayList list = new ArrayList(size); >+ for (int nX = 0; nX < size; nX++) { >+ Node node = nodes.item(nX); >+ if (node instanceof Element) { >+ Element element = (Element) node; >+ if (element.getNodeName().equals(type)) { >+ list.add(element); >+ } >+ } >+ } >+ >+ // Create a memento for each node. >+ size = list.size(); >+ IMemento[] results = new IMemento[size]; >+ for (int x = 0; x < size; x++) { >+ results[x] = new XMLMemento(factory, (Element) list.get(x)); >+ } >+ return results; >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public Float getFloat(String key) { >+ Attr attr = element.getAttributeNode(key); >+ if (attr == null) { >+ return null; >+ } >+ String strValue = attr.getValue(); >+ try { >+ return new Float(strValue); >+ } catch (NumberFormatException e) { >+ DebugPlugin.logMessage("Memento problem - Invalid float for key: " //$NON-NLS-1$ >+ + key + " value: " + strValue, e); //$NON-NLS-1$ >+ return null; >+ } >+ } >+ >+ /** >+ * @since 3.4 >+ */ >+ public String getType() { >+ return element.getNodeName(); >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public String getID() { >+ return element.getAttribute(TAG_ID); >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public Integer getInteger(String key) { >+ Attr attr = element.getAttributeNode(key); >+ if (attr == null) { >+ return null; >+ } >+ String strValue = attr.getValue(); >+ try { >+ return new Integer(strValue); >+ } catch (NumberFormatException e) { >+ DebugPlugin >+ .logMessage("Memento problem - invalid integer for key: " + key //$NON-NLS-1$ >+ + " value: " + strValue, e); //$NON-NLS-1$ >+ return null; >+ } >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public String getString(String key) { >+ Attr attr = element.getAttributeNode(key); >+ if (attr == null) { >+ return null; >+ } >+ return attr.getValue(); >+ } >+ >+ /** >+ * @since 3.4 >+ */ >+ public Boolean getBoolean(String key) { >+ Attr attr = element.getAttributeNode(key); >+ if (attr == null) { >+ return null; >+ } >+ return Boolean.valueOf(attr.getValue()); >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public String getTextData() { >+ Text textNode = getTextNode(); >+ if (textNode != null) { >+ return textNode.getData(); >+ } >+ return null; >+ } >+ >+ /** >+ * @since 3.4 >+ */ >+ public String[] getAttributeKeys() { >+ NamedNodeMap map = element.getAttributes(); >+ int size = map.getLength(); >+ String[] attributes = new String[size]; >+ for (int i = 0; i < size; i++) { >+ Node node = map.item(i); >+ attributes[i] = node.getNodeName(); >+ } >+ return attributes; >+ } >+ >+ /** >+ * Returns the Text node of the memento. Each memento is allowed only >+ * one Text node. >+ * >+ * @return the Text node of the memento, or <code>null</code> if >+ * the memento has no Text node. >+ */ >+ private Text getTextNode() { >+ // Get the nodes. >+ NodeList nodes = element.getChildNodes(); >+ int size = nodes.getLength(); >+ if (size == 0) { >+ return null; >+ } >+ for (int nX = 0; nX < size; nX++) { >+ Node node = nodes.item(nX); >+ if (node instanceof Text) { >+ return (Text) node; >+ } >+ } >+ // a Text node was not found >+ return null; >+ } >+ >+ /** >+ * Places the element's attributes into the document. >+ * @param copyText true if the first text node should be copied >+ */ >+ private void putElement(Element element, boolean copyText) { >+ NamedNodeMap nodeMap = element.getAttributes(); >+ int size = nodeMap.getLength(); >+ for (int i = 0; i < size; i++) { >+ Attr attr = (Attr) nodeMap.item(i); >+ putString(attr.getName(), attr.getValue()); >+ } >+ >+ NodeList nodes = element.getChildNodes(); >+ size = nodes.getLength(); >+ // Copy first text node (fixes bug 113659). >+ // Note that text data will be added as the first child (see putTextData) >+ boolean needToCopyText = copyText; >+ for (int i = 0; i < size; i++) { >+ Node node = nodes.item(i); >+ if (node instanceof Element) { >+ XMLMemento child = (XMLMemento) createChild(node.getNodeName()); >+ child.putElement((Element) node, true); >+ } else if (node instanceof Text && needToCopyText) { >+ putTextData(((Text) node).getData()); >+ needToCopyText = false; >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public void putFloat(String key, float f) { >+ element.setAttribute(key, String.valueOf(f)); >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public void putInteger(String key, int n) { >+ element.setAttribute(key, String.valueOf(n)); >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public void putMemento(IMemento memento) { >+ // Do not copy the element's top level text node (this would overwrite the existing text). >+ // Text nodes of children are copied. >+ putElement(((XMLMemento) memento).element, false); >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public void putString(String key, String value) { >+ if (value == null) { >+ return; >+ } >+ element.setAttribute(key, value); >+ } >+ >+ /** >+ * @since 3.4 >+ */ >+ public void putBoolean(String key, boolean value) { >+ element.setAttribute(key, value ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ /* (non-Javadoc) >+ * Method declared in IMemento. >+ */ >+ public void putTextData(String data) { >+ Text textNode = getTextNode(); >+ if (textNode == null) { >+ textNode = factory.createTextNode(data); >+ // Always add the text node as the first child (fixes bug 93718) >+ element.insertBefore(textNode, element.getFirstChild()); >+ } else { >+ textNode.setData(data); >+ } >+ } >+ >+ /** >+ * Saves this memento's document current values to the >+ * specified writer. >+ * >+ * @param writer the writer used to save the memento's document >+ * @throws IOException if there is a problem serializing the document to the stream. >+ */ >+ public void save(Writer writer) throws IOException { >+ DOMWriter out = new DOMWriter(writer); >+ try { >+ out.print(element); >+ } finally { >+ out.close(); >+ } >+ } >+ >+ /** >+ * A simple XML writer. Using this instead of the javax.xml.transform classes allows >+ * compilation against JCL Foundation (bug 80053). >+ */ >+ private static final class DOMWriter extends PrintWriter { >+ >+ private int tab; >+ >+ /* constants */ >+ private static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$ >+ >+ /** >+ * Creates a new DOM writer on the given output writer. >+ * >+ * @param output the output writer >+ */ >+ public DOMWriter(Writer output) { >+ super(output); >+ tab = 0; >+ println(XML_VERSION); >+ } >+ >+ /** >+ * Prints the given element. >+ * >+ * @param element the element to print >+ */ >+ public void print(Element element) { >+ // Ensure extra whitespace is not emitted next to a Text node, >+ // as that will result in a situation where the restored text data is not the >+ // same as the saved text data. >+ boolean hasChildren = element.hasChildNodes(); >+ startTag(element, hasChildren); >+ if (hasChildren) { >+ tab++; >+ boolean prevWasText = false; >+ NodeList children = element.getChildNodes(); >+ for (int i = 0; i < children.getLength(); i++) { >+ Node node = children.item(i); >+ if (node instanceof Element) { >+ if (!prevWasText) { >+ println(); >+ printTabulation(); >+ } >+ print((Element) children.item(i)); >+ prevWasText = false; >+ } >+ else if (node instanceof Text) { >+ print(getEscaped(node.getNodeValue())); >+ prevWasText = true; >+ } >+ } >+ tab--; >+ if (!prevWasText) { >+ println(); >+ printTabulation(); >+ } >+ endTag(element); >+ } >+ } >+ >+ private void printTabulation() { >+ // Indenting is disabled, as it can affect the result of getTextData(). >+ // In 3.0, elements were separated by a newline but not indented. >+ // This causes getTextData() to return "\n" even if no text data had explicitly been set. >+ // The code here emulates that behaviour. >+ >+// for (int i = 0; i < tab; i++) >+// super.print("\t"); //$NON-NLS-1$ >+ } >+ >+ private void startTag(Element element, boolean hasChildren) { >+ StringBuffer sb = new StringBuffer(); >+ sb.append("<"); //$NON-NLS-1$ >+ sb.append(element.getTagName()); >+ NamedNodeMap attributes = element.getAttributes(); >+ for (int i = 0; i < attributes.getLength(); i++) { >+ Attr attribute = (Attr)attributes.item(i); >+ sb.append(" "); //$NON-NLS-1$ >+ sb.append(attribute.getName()); >+ sb.append("=\""); //$NON-NLS-1$ >+ sb.append(getEscaped(String.valueOf(attribute.getValue()))); >+ sb.append("\""); //$NON-NLS-1$ >+ } >+ sb.append(hasChildren ? ">" : "/>"); //$NON-NLS-1$ //$NON-NLS-2$ >+ print(sb.toString()); >+ } >+ >+ private void endTag(Element element) { >+ StringBuffer sb = new StringBuffer(); >+ sb.append("</"); //$NON-NLS-1$ >+ sb.append(element.getNodeName()); >+ sb.append(">"); //$NON-NLS-1$ >+ print(sb.toString()); >+ } >+ >+ private static void appendEscapedChar(StringBuffer buffer, char c) { >+ String replacement = getReplacement(c); >+ if (replacement != null) { >+ buffer.append('&'); >+ buffer.append(replacement); >+ buffer.append(';'); >+ } else if (c==9 || c==10 || c==13 || c>=32){ >+ buffer.append(c); >+ } >+ } >+ >+ private static String getEscaped(String s) { >+ StringBuffer result = new StringBuffer(s.length() + 10); >+ for (int i = 0; i < s.length(); ++i) { >+ appendEscapedChar(result, s.charAt(i)); >+ } >+ return result.toString(); >+ } >+ >+ private static String getReplacement(char c) { >+ // Encode special XML characters into the equivalent character references. >+ // The first five are defined by default for all XML documents. >+ // The next three (#xD, #xA, #x9) are encoded to avoid them >+ // being converted to spaces on deserialization >+ // (fixes bug 93720) >+ switch (c) { >+ case '<' : >+ return "lt"; //$NON-NLS-1$ >+ case '>' : >+ return "gt"; //$NON-NLS-1$ >+ case '"' : >+ return "quot"; //$NON-NLS-1$ >+ case '\'' : >+ return "apos"; //$NON-NLS-1$ >+ case '&' : >+ return "amp"; //$NON-NLS-1$ >+ case '\r': >+ return "#x0D"; //$NON-NLS-1$ >+ case '\n': >+ return "#x0A"; //$NON-NLS-1$ >+ case '\u0009': >+ return "#x09"; //$NON-NLS-1$ >+ } >+ return null; >+ } >+ } >+} >Index: core/org/eclipse/debug/internal/core/IMemento.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/IMemento.java >diff -N core/org/eclipse/debug/internal/core/IMemento.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/IMemento.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,195 @@ >+/******************************************************************************* >+ * 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.debug.internal.core; >+ >+/** >+ * This class is a copy of org.eclipse.ui.IMemento, copied into >+ * org.eclipse.debug.core to allow usage of XMLMemento class. >+ */ >+public interface IMemento { >+ /** >+ * Special reserved key used to store the memento id >+ * (value <code>"IMemento.internal.id"</code>). >+ * >+ * @see #getID() >+ */ >+ public static final String TAG_ID = "IMemento.internal.id"; //$NON-NLS-1$ >+ >+ /** >+ * Creates a new child of this memento with the given type. >+ * <p> >+ * The <code>getChild</code> and <code>getChildren</code> methods >+ * are used to retrieve children of a given type. >+ * </p> >+ * >+ * @param type the type >+ * @return a new child memento >+ * @see #getChild >+ * @see #getChildren >+ */ >+ public IMemento createChild(String type); >+ >+ /** >+ * Creates a new child of this memento with the given type and id. >+ * The id is stored in the child memento (using a special reserved >+ * key, <code>TAG_ID</code>) and can be retrieved using <code>getId</code>. >+ * <p> >+ * The <code>getChild</code> and <code>getChildren</code> methods >+ * are used to retrieve children of a given type. >+ * </p> >+ * >+ * @param type the type >+ * @param id the child id >+ * @return a new child memento with the given type and id >+ * @see #getID >+ */ >+ public IMemento createChild(String type, String id); >+ >+ /** >+ * Returns the first child with the given type id. >+ * >+ * @param type the type id >+ * @return the first child with the given type >+ */ >+ public IMemento getChild(String type); >+ >+ /** >+ * Returns all children with the given type id. >+ * >+ * @param type the type id >+ * @return an array of children with the given type >+ */ >+ public IMemento[] getChildren(String type); >+ >+ /** >+ * Returns the floating point value of the given key. >+ * >+ * @param key the key >+ * @return the value, or <code>null</code> if the key was not found or was found >+ * but was not a floating point number >+ */ >+ public Float getFloat(String key); >+ >+ /** >+ * Returns the type for this memento. >+ * >+ * @return the memento type >+ * @see #createChild(java.lang.String) >+ * @see #createChild(java.lang.String,java.lang.String) >+ * @since 3.4 >+ */ >+ public String getType(); >+ >+ /** >+ * Returns the id for this memento. >+ * >+ * @return the memento id, or <code>null</code> if none >+ * @see #createChild(java.lang.String,java.lang.String) >+ */ >+ public String getID(); >+ >+ /** >+ * Returns the integer value of the given key. >+ * >+ * @param key the key >+ * @return the value, or <code>null</code> if the key was not found or was found >+ * but was not an integer >+ */ >+ public Integer getInteger(String key); >+ >+ /** >+ * Returns the string value of the given key. >+ * >+ * @param key the key >+ * @return the value, or <code>null</code> if the key was not found >+ */ >+ public String getString(String key); >+ >+ /** >+ * Returns the boolean value of the given key. >+ * >+ * @param key the key >+ * @return the value, or <code>null</code> if the key was not found >+ * @since 3.4 >+ */ >+ public Boolean getBoolean(String key); >+ >+ /** >+ * Returns the data of the Text node of the memento. Each memento is allowed >+ * only one Text node. >+ * >+ * @return the data of the Text node of the memento, or <code>null</code> >+ * if the memento has no Text node. >+ * @since 2.0 >+ */ >+ public String getTextData(); >+ >+ /** >+ * Returns an array of all the attribute keys of the memento. This will not >+ * be <code>null</code>. If there are no keys, an array of length zero will >+ * be returned. >+ * @return an array with all the attribute keys of the memento >+ * @since 3.4 >+ */ >+ public String[] getAttributeKeys(); >+ >+ /** >+ * Sets the value of the given key to the given floating point number. >+ * >+ * @param key the key >+ * @param value the value >+ */ >+ public void putFloat(String key, float value); >+ >+ /** >+ * Sets the value of the given key to the given integer. >+ * >+ * @param key the key >+ * @param value the value >+ */ >+ public void putInteger(String key, int value); >+ >+ /** >+ * Copy the attributes and children from <code>memento</code> >+ * to the receiver. >+ * >+ * @param memento the IMemento to be copied. >+ */ >+ public void putMemento(IMemento memento); >+ >+ /** >+ * Sets the value of the given key to the given string. >+ * >+ * @param key the key >+ * @param value the value >+ */ >+ public void putString(String key, String value); >+ >+ /** >+ * Sets the value of the given key to the given boolean value. >+ * >+ * @param key the key >+ * @param value the value >+ * @since 3.4 >+ */ >+ public void putBoolean(String key, boolean value); >+ >+ /** >+ * Sets the memento's Text node to contain the given data. Creates the Text node if >+ * none exists. If a Text node does exist, it's current contents are replaced. >+ * Each memento is allowed only one text node. >+ * >+ * @param data the data to be placed on the Text node >+ * @since 2.0 >+ */ >+ public void putTextData(String data); >+} >+ >Index: core/org/eclipse/debug/internal/core/StringSubstitutionMessages.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/StringSubstitutionMessages.java >diff -N core/org/eclipse/debug/internal/core/StringSubstitutionMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/StringSubstitutionMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+/********************************************************************** >+ * 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.debug.internal.core; >+ >+import org.eclipse.osgi.util.NLS; >+ >+public class StringSubstitutionMessages extends NLS { >+ private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.stringsubstitution.StringSubstitutionMessages";//$NON-NLS-1$ >+ >+ public static String PromptExpanderBase_0; >+ public static String PromptExpanderBase_1; >+ public static String PromptingResolver_0; >+ >+ public static String RefreshTab_0; >+ >+ public static String RefreshTab_43; >+ >+ public static String RefreshTab_44; >+ public static String RefreshTab_6; >+ public static String RefreshTab_7; >+ public static String RefreshTab_8; >+ public static String RefreshTab_31; >+ public static String RefreshTab_32; >+ public static String RefreshTab_33; >+ public static String RefreshTab_34; >+ public static String RefreshTab_35; >+ public static String RefreshTab_36; >+ public static String RefreshTab_37; >+ public static String RefreshTab_40; >+ public static String RefreshTab_42; >+ >+ public static String ResourceSelector_0; >+ >+ public static String SelectedResourceResolver_0; >+ >+ public static String StringPromptExpander_0; >+ >+ public static String StringVariableSelectionDialog_2; >+ public static String StringVariableSelectionDialog_3; >+ public static String StringVariableSelectionDialog_6; >+ public static String StringVariableSelectionDialog_7; >+ public static String StringVariableSelectionDialog_8; >+ public static String StringVariableSelectionDialog_0; >+ >+ static { >+ // load message values from bundle file >+ NLS.initializeMessages(BUNDLE_NAME, StringSubstitutionMessages.class); >+ } >+ >+ public static String SystemPropertyArgumentSelector_0; >+ >+ public static String SystemPropertyArgumentSelector_1; >+} >\ No newline at end of file >Index: core/org/eclipse/debug/internal/core/ResourceFactory.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/ResourceFactory.java >diff -N core/org/eclipse/debug/internal/core/ResourceFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/ResourceFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,99 @@ >+/******************************************************************************* >+ * 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.debug.internal.core; >+ >+ >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IWorkspaceRoot; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.core.runtime.Path; >+ >+/** >+ * The ResourceFactory is used to save and recreate an IResource object. >+ * As such, it implements the IPersistableElement interface for storage >+ * and the IElementFactory interface for recreation. >+ * >+ * @see IMemento >+ * @see IElementFactory >+ */ >+public class ResourceFactory implements IElementFactory { >+ >+ // These persistence constants are stored in XML. Do not >+ // change them. >+ public static final String TAG_PATH = "path";//$NON-NLS-1$ >+ >+ public static final String TAG_TYPE = "type";//$NON-NLS-1$ >+ >+ public static final String FACTORY_ID = "org.eclipse.debug.internal.core.ResourceFactory";//$NON-NLS-1$ >+ >+ // IPersistable data. >+ private IResource res; >+ >+ /** >+ * Create a ResourceFactory. This constructor is typically used >+ * for our IElementFactory side. >+ */ >+ public ResourceFactory() { >+ } >+ >+ /** >+ * Create a ResourceFactory. This constructor is typically used >+ * for our IPersistableElement side. >+ * >+ * @param input the resource of this factory >+ */ >+ public ResourceFactory(IResource input) { >+ res = input; >+ } >+ >+ /** >+ * @see IElementFactory >+ */ >+ public IAdaptable createElement(IMemento memento) { >+ // Get the file name. >+ String fileName = memento.getString(TAG_PATH); >+ if (fileName == null) { >+ return null; >+ } >+ >+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); >+ String type = memento.getString(TAG_TYPE); >+ if (type == null) { >+ // Old format memento. Create an IResource using findMember. >+ // Will return null for resources in closed projects. >+ res = root.findMember(new Path(fileName)); >+ } else { >+ int resourceType = Integer.parseInt(type); >+ >+ if (resourceType == IResource.ROOT) { >+ res = root; >+ } else if (resourceType == IResource.PROJECT) { >+ res = root.getProject(fileName); >+ } else if (resourceType == IResource.FOLDER) { >+ res = root.getFolder(new Path(fileName)); >+ } else if (resourceType == IResource.FILE) { >+ res = root.getFile(new Path(fileName)); >+ } >+ } >+ return res; >+ } >+ >+ >+ public String getFactoryId() { >+ return FACTORY_ID; >+ } >+ >+ public void saveState(IMemento memento) { >+ memento.putString(TAG_PATH, res.getFullPath().toString()); >+ memento.putString(TAG_TYPE, Integer.toString(res.getType())); >+ } >+} >Index: core/org/eclipse/debug/internal/core/IElementFactory.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/IElementFactory.java >diff -N core/org/eclipse/debug/internal/core/IElementFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/IElementFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,56 @@ >+/******************************************************************************* >+ * 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.debug.internal.core; >+ >+import org.eclipse.core.runtime.IAdaptable; >+ >+/** >+ * This class is a copy of org.eclipse.ui.IElementFactory, copied into >+ * org.eclipse.debug.core to allow usage of XMLMemento class. >+ * A factory for >+ * re-creating objects from a previously saved memento. >+ * <p> >+ * Clients should implement this interface and include the name of their class >+ * in an extension to the platform extension point named >+ * <code>"org.eclipse.ui.elementFactories"</code>. For example, the plug-in's >+ * XML markup might contain: >+ * >+ * <pre> >+ * &LTextension point="org.eclipse.ui.elementFactories"&GT >+ * &LTfactory id="com.example.myplugin.MyFactory" class="com.example.myplugin.MyFactory" /&GT >+ * &LT/extension&GT >+ * </pre> >+ * >+ * </p> >+ * >+ * @see IMemento >+ */ >+public interface IElementFactory { >+ /** >+ * Re-creates and returns an object from the state captured within the given >+ * memento. >+ * <p> >+ * If the result is not null, it should be persistable; that is, >+ * >+ * <pre> >+ * result.getAdapter(org.eclipse.ui.IPersistableElement.class) >+ * </pre> >+ * >+ * should not return <code>null</code>. >+ * </p> >+ * >+ * @param memento >+ * a memento containing the state for the object >+ * @return an object, or <code>null</code> if the element could not be >+ * created >+ */ >+ public IAdaptable createElement(IMemento memento); >+} >Index: core/org/eclipse/debug/internal/core/StringSubstitutionMessages.properties >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/StringSubstitutionMessages.properties >diff -N core/org/eclipse/debug/internal/core/StringSubstitutionMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/StringSubstitutionMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,44 @@ >+############################################################################### >+# Copyright (c) 2000, 2009 IBM Corporation and others. >+# All rights reserved. This program and the accompanying materials >+# are made available under the terms of the Eclipse Public License v1.0 >+# which accompanies this distribution, and is available at >+# http://www.eclipse.org/legal/epl-v10.html >+# >+# Contributors: >+# IBM Corporation - initial API and implementation >+############################################################################### >+ >+PromptExpanderBase_0=Please input a value for {0} >+PromptExpanderBase_1=Please input a value >+PromptingResolver_0=Failed to expand {0}. Input was cancelled. >+ >+RefreshTab_0=Recursively &include sub-folders >+RefreshTab_6=Refresh >+RefreshTab_7=Refresh resources... >+RefreshTab_8=Exception(s) occurred during refresh. >+RefreshTab_31=Refresh resources &upon completion. >+RefreshTab_32=The &entire workspace >+RefreshTab_33=The se&lected resource >+RefreshTab_34=The &project containing the selected resource >+RefreshTab_35=The f&older containing the selected resource >+RefreshTab_36=&Specific resources >+RefreshTab_37=Specify &Resources... >+RefreshTab_40=working set >+RefreshTab_42=Must select resources to refresh. >+RefreshTab_43=Refresh scope refers to non-existent resource {0} >+RefreshTab_44=Refresh scope invalid >+ >+ResourceSelector_0=Select Resource >+ >+SelectedResourceResolver_0=Unable to resource a selected resource: {0} >+StringPromptExpander_0=Variable input >+ >+StringVariableSelectionDialog_2=Select Variable >+StringVariableSelectionDialog_3=&Choose a variable (? = any character, * = any string): >+StringVariableSelectionDialog_6=&Argument: >+StringVariableSelectionDialog_7=C&onfigure... >+StringVariableSelectionDialog_8=&Variable Description: >+StringVariableSelectionDialog_0=&Edit Variables... >+SystemPropertyArgumentSelector_0=Select System Property >+SystemPropertyArgumentSelector_1=Select a system property (? = any character, * = any String): >#P org.eclipse.ui.externaltools >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: 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 30 Sep 2009 16:24:46 -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/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 30 Sep 2009 16:24:46 -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/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: 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 30 Sep 2009 16:24:45 -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.internal.externaltools.model.BuilderCoreUtils; >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IncrementalProjectBuilder; > import org.eclipse.core.resources.ResourcesPlugin; >@@ -48,9 +50,7 @@ > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; > 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; >@@ -328,7 +328,7 @@ > } > > if (fCreateBuildScheduleComponent) { >- 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: >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 30 Sep 2009 16:24:45 -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/ExternalToolsUtil.java >=================================================================== >RCS file: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java >diff -N External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java 30 Jul 2007 02:21:16 -0000 1.47 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,203 +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) - Bug 27243 (environment variables contribution) >- * dakshinamurthy.karra@gmail.com - bug 165371 >- *******************************************************************************/ >-package org.eclipse.ui.externaltools.internal.launchConfigurations; >- >- >-import java.io.File; >- >-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; >- >-/** >- * Utilities for external tool launch configurations. >- * <p> >- * This class it not intended to be instantiated. >- * </p> >- */ >-public class ExternalToolsUtil { >- >- /** >- * 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(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; >- } >- >- /** >- * 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(ExternalToolsLaunchConfigurationMessages.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 RefreshTab.getRefreshResources(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; >- } >- >-} >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 30 Sep 2009 16:24:45 -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.internal.externaltools.model.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/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 30 Sep 2009 16:24:45 -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/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 30 Sep 2009 16:24:45 -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,21 +11,19 @@ > *******************************************************************************/ > package org.eclipse.ui.externaltools.internal.launchConfigurations; > >- > import java.util.ArrayList; > import java.util.Iterator; > import java.util.List; > >+import org.eclipse.core.internal.externaltools.launchConfigurations.ExternalToolsCoreUtil; >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; > 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,83 +39,96 @@ > 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; > > /** >- * A launch configuration tab which allows the user to specify >- * which resources should be built before a build (a build scope) >+ * A launch configuration tab which allows the user to specify which resources >+ * should be built before a build (a build scope) > * <p> >- * This class may be instantiated; this class is not intended >- * to be subclassed. >+ * This class may be instantiated; this class is not intended to be subclassed. > * </p> >- * A generalized version of AntBuildTab which was removed after the work of bug 165371 >+ * A generalized version of AntBuildTab which was removed after the work of bug >+ * 165371 >+ * > * @since 3.4 > */ > public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { > // Check Buttons > private Button fBuildButton; >- >+ > // Group box > private Group fGroup; >- >+ > // Radio Buttons > private Button fProjectButton; > private Button fSpecificProjectsButton; > private Button fWorkspaceButton; >- >+ > // Push Button > private Button fSelectButton; >- >+ > // whether to include referenced projects > private Button fReferencedProjects; >- >+ > // projects to build (empty if none) > private List fProjects = new ArrayList(); >- >+ > class ProjectsContentProvider implements IStructuredContentProvider { > >- /* (non-Javadoc) >- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.jface.viewers.IStructuredContentProvider#getElements( >+ * java.lang.Object) > */ > public Object[] getElements(Object inputElement) { >- return ((IWorkspace)inputElement).getRoot().getProjects(); >+ return ((IWorkspace) inputElement).getRoot().getProjects(); > } > >- /* (non-Javadoc) >+ /* >+ * (non-Javadoc) >+ * > * @see org.eclipse.jface.viewers.IContentProvider#dispose() > */ > public void dispose() { > } > >- /* (non-Javadoc) >- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse >+ * .jface.viewers.Viewer, java.lang.Object, java.lang.Object) > */ > public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { > } >- >+ > } >+ > /** > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) > */ > public void createControl(Composite parent) { > Composite mainComposite = new Composite(parent, SWT.NONE); > setControl(mainComposite); >- >+ > GridLayout layout = new GridLayout(); > GridData gd = new GridData(GridData.FILL_HORIZONTAL); > mainComposite.setLayout(layout); > mainComposite.setLayoutData(gd); > mainComposite.setFont(parent.getFont()); >- >- fBuildButton = createCheckButton(mainComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_1); >+ >+ fBuildButton = createCheckButton( >+ mainComposite, >+ ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_1); > fBuildButton.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > updateEnabledState(); > updateLaunchConfigurationDialog(); > } > }); >- >+ > fGroup = new Group(mainComposite, SWT.NONE); > fGroup.setFont(mainComposite.getFont()); > layout = new GridLayout(); >@@ -130,49 +141,65 @@ > > SelectionAdapter adapter = new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { >- if (((Button)e.getSource()).getSelection()) { >+ if (((Button) e.getSource()).getSelection()) { > updateEnabledState(); > updateLaunchConfigurationDialog(); > } > } > }; >- >- fWorkspaceButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_2); >+ >+ fWorkspaceButton = createRadioButton( >+ fGroup, >+ ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_2); > gd = new GridData(GridData.FILL_HORIZONTAL); > gd.horizontalSpan = 2; > fWorkspaceButton.setLayoutData(gd); > fWorkspaceButton.addSelectionListener(adapter); >- >- fProjectButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_3); >+ >+ fProjectButton = createRadioButton( >+ fGroup, >+ ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_3); > gd = new GridData(GridData.FILL_HORIZONTAL); > gd.horizontalSpan = 2; >- fProjectButton.setLayoutData(gd); >+ fProjectButton.setLayoutData(gd); > fProjectButton.addSelectionListener(adapter); >- >- fSpecificProjectsButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_4); >+ >+ fSpecificProjectsButton = createRadioButton( >+ fGroup, >+ ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_4); > gd = new GridData(GridData.FILL_HORIZONTAL); > gd.horizontalSpan = 1; > fSpecificProjectsButton.setLayoutData(gd); >- fSpecificProjectsButton.addSelectionListener(adapter); >- >- fSelectButton = createPushButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_5, null); >- gd = (GridData)fSelectButton.getLayoutData(); >+ fSpecificProjectsButton.addSelectionListener(adapter); >+ >+ fSelectButton = createPushButton( >+ fGroup, >+ ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_5, >+ null); >+ gd = (GridData) fSelectButton.getLayoutData(); > gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; > fSelectButton.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > selectResources(); > } > }); >- >+ > createVerticalSpacer(mainComposite, 1); >- fReferencedProjects = createCheckButton(mainComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_6); >+ fReferencedProjects = createCheckButton( >+ mainComposite, >+ ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_6); > } > > /** > * Prompts the user to select the projects to build. > */ > private void selectResources() { >- ListSelectionDialog dialog = new ListSelectionDialog(getShell(), ResourcesPlugin.getWorkspace(), new ProjectsContentProvider(), new WorkbenchLabelProvider(), ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_7); >+ ListSelectionDialog dialog = new ListSelectionDialog( >+ getShell(), >+ ResourcesPlugin.getWorkspace(), >+ new ProjectsContentProvider(), >+ new WorkbenchLabelProvider(), >+ ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_7); > dialog.setInitialElementSelections(fProjects); > if (dialog.open() == Window.CANCEL) { > return; >@@ -184,7 +211,7 @@ > } > updateLaunchConfigurationDialog(); > } >- >+ > /** > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) > */ >@@ -197,15 +224,18 @@ > public void initializeFrom(ILaunchConfiguration configuration) { > updateScope(configuration); > updateReferencedProjects(configuration); >- updateEnabledState(); >+ updateEnabledState(); > } >- >+ > private void updateReferencedProjects(ILaunchConfiguration configuration) { > boolean ref = false; > try { >- ref = configuration.getAttribute(IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS, true); >+ ref = configuration.getAttribute( >+ IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS, >+ true); > } catch (CoreException e) { >- ExternalToolsPlugin.getDefault().log("Exception reading launch configuration", e); //$NON-NLS-1$ >+ ExternalToolsPlugin.getDefault().log( >+ "Exception reading launch configuration", e); //$NON-NLS-1$ > } > fReferencedProjects.setSelection(ref); > } >@@ -216,9 +246,11 @@ > private void updateScope(ILaunchConfiguration configuration) { > String scope = null; > try { >- scope= configuration.getAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, (String)null); >+ scope = configuration.getAttribute( >+ IExternalToolConstants.ATTR_BUILD_SCOPE, (String) null); > } catch (CoreException ce) { >- ExternalToolsPlugin.getDefault().log("Exception reading launch configuration", ce); //$NON-NLS-1$ >+ ExternalToolsPlugin.getDefault().log( >+ "Exception reading launch configuration", ce); //$NON-NLS-1$ > } > fBuildButton.setSelection(scope != null); > fWorkspaceButton.setSelection(false); >@@ -236,7 +268,8 @@ > fProjectButton.setSelection(true); > } else if (scope.startsWith("${projects:")) { //$NON-NLS-1$ > fSpecificProjectsButton.setSelection(true); >- IProject[] projects = getBuildProjects(configuration, IExternalToolConstants.ATTR_BUILD_SCOPE); >+ IProject[] projects = getBuildProjects(configuration, >+ IExternalToolConstants.ATTR_BUILD_SCOPE); > fProjects = new ArrayList(projects.length); > for (int i = 0; i < projects.length; i++) { > fProjects.add(projects[i]); >@@ -244,17 +277,23 @@ > } > } > } >+ > /** > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) > */ > public void performApply(ILaunchConfigurationWorkingCopy configuration) { > String scope = generateScopeMemento(); >- configuration.setAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, scope); >+ configuration.setAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, >+ scope); > if (fReferencedProjects.getSelection()) { > // default is true >- configuration.setAttribute(IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS, (String)null); >+ configuration.setAttribute( >+ IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS, >+ (String) null); > } else { >- configuration.setAttribute(IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS, false); >+ configuration.setAttribute( >+ IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS, >+ false); > } > } > >@@ -273,7 +312,7 @@ > return getBuildScopeAttribute(fProjects); > } > return null; >- >+ > } > return "${none}"; //$NON-NLS-1$ > } >@@ -284,106 +323,87 @@ > public String getName() { > return ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_8; > } >- >+ > /** > * Updates the enablement state of the fields. > */ > private void updateEnabledState() { >- boolean enabled= fBuildButton.getSelection(); >+ boolean enabled = fBuildButton.getSelection(); > fGroup.setEnabled(enabled); > fWorkspaceButton.setEnabled(enabled); > fProjectButton.setEnabled(enabled); > fSpecificProjectsButton.setEnabled(enabled); >- fSelectButton.setEnabled(enabled && fSpecificProjectsButton.getSelection()); >+ fSelectButton.setEnabled(enabled >+ && fSpecificProjectsButton.getSelection()); > if (!enabled) { > super.setErrorMessage(null); > } > if (enabled) { >- if (!fWorkspaceButton.getSelection() && !fProjectButton.getSelection() && >- !fSpecificProjectsButton.getSelection()) { >+ if (!fWorkspaceButton.getSelection() >+ && !fProjectButton.getSelection() >+ && !fSpecificProjectsButton.getSelection()) { > fWorkspaceButton.setSelection(true); > } > } >- fReferencedProjects.setEnabled(fBuildButton.getSelection() && (fProjectButton.getSelection() || fSpecificProjectsButton.getSelection())); >+ fReferencedProjects.setEnabled(fBuildButton.getSelection() >+ && (fProjectButton.getSelection() || fSpecificProjectsButton >+ .getSelection())); > } >- >+ > /** > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() > */ > public Image getImage() { >- return ExternalToolsImages.getImage(IExternalToolConstants.IMG_TAB_BUILD); >+ return ExternalToolsImages >+ .getImage(IExternalToolConstants.IMG_TAB_BUILD); > } > > public boolean isValid(ILaunchConfiguration launchConfig) { > setErrorMessage(null); > setMessage(null); >- if (fBuildButton.getSelection() && fSpecificProjectsButton.getSelection() && fProjects.isEmpty()) { >+ if (fBuildButton.getSelection() >+ && fSpecificProjectsButton.getSelection() >+ && fProjects.isEmpty()) { > setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_9); > return false; > } > return true; > } >- >+ > /** > * 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$ >- IResource resource = DebugUITools.getSelectedResource(); >- if (resource != null) { >- return new IProject[]{resource.getProject()}; >- } >- } >- return new IProject[0]; >+ public static IProject[] getBuildProjects( >+ ILaunchConfiguration configuration, String buildScopeId) { >+ return ExternalToolsCoreUtil.getBuildProjects(configuration, >+ buildScopeId); >+ > } >- >+ > /** >- * Whether referenced projects should be considered when building. Only valid >- * when a set of projects is to be built. >+ * 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 >+ * @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); >+ public static boolean isIncludeReferencedProjects( >+ ILaunchConfiguration configuration, >+ String includeReferencedProjectsId) throws CoreException { >+ return ExternalToolsCoreUtil.isIncludeReferencedProjects(configuration, >+ includeReferencedProjectsId); > } >- >+ > /** > * Creates and returns a memento for the given project set, to be used as a > * build scope attribute. > * >- * @param projects list of projects >+ * @param projects >+ * list of projects > * @return an equivalent refresh attribute > */ > public static String getBuildScopeAttribute(List projects) { >@@ -400,16 +420,24 @@ > buf.append("}"); //$NON-NLS-1$ > return buf.toString(); > } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug >+ * .core.ILaunchConfigurationWorkingCopy) > */ > public void activated(ILaunchConfigurationWorkingCopy workingCopy) { > // do nothing on activation > } > >- /* (non-Javadoc) >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse. >+ * debug.core.ILaunchConfigurationWorkingCopy) > */ > public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { > // do nothing on deactivation >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 30 Sep 2009 16:24:45 -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.internal.externaltools.model.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 30 Sep 2009 16:24:45 -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.internal.externaltools.model.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 30 Sep 2009 16:24:45 -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,377 +10,46 @@ > *******************************************************************************/ > package org.eclipse.ui.externaltools.internal.model; > >-import java.util.HashMap; >-import java.util.Map; >-import java.util.StringTokenizer; >- >+import org.eclipse.core.internal.externaltools.model.BuilderCoreUtils; >+import org.eclipse.core.internal.externaltools.model.ExternalToolsModelMessages; > 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}; >- >- /** >- * 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; >- } >- > /** > * Returns an <code>ICommand</code> from the given launch configuration. > * >- * @param project the project the ICommand is relevant to >- * @param config the launch configuration to create the command from >- * @return the new command. <code>null</code> can be returned if problems occur during >- * the translation. >+ * @param project >+ * the project the ICommand is relevant to >+ * @param config >+ * the launch configuration to create the command from >+ * @return the new command. <code>null</code> can be returned if problems >+ * occur during the translation. > */ >- public static ICommand commandFromLaunchConfig(IProject project, ILaunchConfiguration config) { >+ public static ICommand commandFromLaunchConfig(IProject project, >+ ILaunchConfiguration config) { > ICommand newCommand = null; > try { > newCommand = project.getDescription().newCommand(); >- newCommand = toBuildCommand(project, config, newCommand); >- configureTriggers(config, newCommand); >+ newCommand = BuilderCoreUtils.toBuildCommand(project, config, newCommand); >+ BuilderCoreUtils.configureTriggers(config, newCommand); > } catch (CoreException exception) { >- Shell shell= ExternalToolsPlugin.getActiveWorkbenchShell(); >+ Shell shell = ExternalToolsPlugin.getActiveWorkbenchShell(); > if (shell != null) { >- MessageDialog.openError(shell, ExternalToolsModelMessages.BuilderUtils_5, ExternalToolsModelMessages.BuilderUtils_6); >+ MessageDialog.openError(shell, >+ ExternalToolsModelMessages.BuilderUtils_5, >+ ExternalToolsModelMessages.BuilderUtils_6); > } > return null; > } > return newCommand; > } >- >- 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(); >- } >- } >- >- /** >- * 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 type of launch configuration that should be created when >- * duplicating the given configuration as a project builder. Queries to see >- * 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); >- IConfigurationElement[] elements = ep.getConfigurationElements(); >- String sourceType= config.getType().getIdentifier(); >- String builderType= null; >- for (int i= 0; i < elements.length; i++) { >- IConfigurationElement element= elements[i]; >- if (element.getName().equals(TAG_CONFIGURATION_MAP) && sourceType.equals(element.getAttribute(TAG_SOURCE_TYPE))) { >- builderType= element.getAttribute(TAG_BUILDER_TYPE); >- break; >- } >- } >- if (builderType != null) { >- ILaunchConfigurationType type= DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(builderType); >- if (type != null) { >- return type; >- } >- } >- return config.getType(); >- } >- >- /** >- * 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; >- } >- >- /** >- * Returns a duplicate of the given configuration. The new configuration >- * will be of the same type as the given configuration or of the duplication >- * type registered for the given configuration via the extension point >- * IExternalToolConstants.EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS. >- */ >- public static ILaunchConfiguration duplicateConfiguration(IProject project, ILaunchConfiguration config) throws CoreException { >- Map attributes= config.getAttributes(); >- String newName= new StringBuffer(config.getName()).append(ExternalToolsModelMessages.BuilderUtils_7).toString(); >- newName= DebugPlugin.getDefault().getLaunchManager().generateUniqueLaunchConfigurationNameFrom(newName); >- ILaunchConfigurationType newType= getConfigurationDuplicationType(config); >- ILaunchConfigurationWorkingCopy newWorkingCopy= newType.newInstance(getBuilderFolder(project, true), newName); >- newWorkingCopy.setAttributes(attributes); >- return newWorkingCopy.doSave(); >- } >- >- /** >- * 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: External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java >=================================================================== >RCS file: External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java >diff -N External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java 8 Apr 2005 18:56:41 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,28 +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 - Initial API and implementation >- **********************************************************************/ >-package org.eclipse.ui.externaltools.internal.model; >- >-import org.eclipse.osgi.util.NLS; >- >-public class ExternalToolsModelMessages extends NLS { >- 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; >- >- static { >- // load message values from bundle file >- NLS.initializeMessages(BUNDLE_NAME, ExternalToolsModelMessages.class); >- } >-} >\ 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 30 Sep 2009 16:24:45 -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.internal.externaltools.model.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/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/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 30 Sep 2009 16:24:45 -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,30 @@ > *******************************************************************************/ > package org.eclipse.ui.externaltools.internal.model; > >- > import java.net.MalformedURLException; > import java.net.URL; > >+import org.eclipse.core.internal.externaltools.model.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.debug.internal.ui.views.console.ProcessConsoleManager; >+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 +41,81 @@ > /** > * External tools plug-in class > */ >-public final class ExternalToolsPlugin extends AbstractUIPlugin { >+public final class ExternalToolsPlugin extends AbstractUIPlugin implements >+ ILaunchListener { > /** > * 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, >+ IExternalToolConstants.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; >+ >+ /** >+ * Singleton console document manager >+ */ >+ private ProcessConsoleManager fProcessConsoleManager = null; >+ >+ /** >+ * 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. >@@ -49,8 +126,8 @@ > } > > /** >- * Returns the default instance of the receiver. >- * This represents the runtime plugin. >+ * Returns the default instance of the receiver. This represents the runtime >+ * plugin. > */ > public static ExternalToolsPlugin getDefault() { > return plugin; >@@ -61,32 +138,39 @@ > */ > public static IStatus newErrorStatus(String message, Throwable exception) { > if (message == null) { >- message= EMPTY_STRING; >- } >- return new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, 0, message, exception); >+ message = EMPTY_STRING; >+ } >+ return new Status(IStatus.ERROR, IExternalToolConstants.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, >+ IExternalToolConstants.PLUGIN_ID, 0, message, exception)); > } > > /** > * Writes the message to the plug-in's log > * >- * @param message the text to write to the log >+ * @param message >+ * the text to write to the log > */ > public void log(String message, Throwable exception) { > IStatus status = newErrorStatus(message, exception); > getLog().log(status); > } >- >+ > public void log(Throwable exception) { >- //this message is intentionally not internationalized, as an exception may >+ // this message is intentionally not internationalized, as an exception >+ // may > // be due to the resource bundle itself >- getLog().log(newErrorStatus("Internal error logged from External Tools UI: ", exception)); //$NON-NLS-1$ >+ getLog() >+ .log( >+ newErrorStatus( >+ "Internal error logged from External Tools UI: ", exception)); //$NON-NLS-1$ > } > > /** >@@ -96,7 +180,7 @@ > */ > public ImageDescriptor getImageDescriptor(String path) { > try { >- Bundle bundle= getDefault().getBundle(); >+ Bundle bundle = getDefault().getBundle(); > URL installURL = bundle.getEntry("/"); //$NON-NLS-1$ > URL url = new URL(installURL, path); > return ImageDescriptor.createFromURL(url); >@@ -111,18 +195,18 @@ > public static IWorkbenchWindow getActiveWorkbenchWindow() { > return getDefault().getWorkbench().getActiveWorkbenchWindow(); > } >- >+ > /** > * Returns the active workbench page or <code>null</code> if none. > */ > public static IWorkbenchPage getActivePage() { >- IWorkbenchWindow window= getActiveWorkbenchWindow(); >+ IWorkbenchWindow window = getActiveWorkbenchWindow(); > if (window != null) { > return window.getActivePage(); > } > return null; > } >- >+ > /** > * Returns the active workbench shell or <code>null</code> if none. > */ >@@ -135,9 +219,9 @@ > } > > /** >- * Returns the standard display to be used. The method first checks, if >- * the thread calling this method has an associated display. If so, this >- * display is returned. Otherwise the method returns the default display. >+ * Returns the standard display to be used. The method first checks, if the >+ * thread calling this method has an associated display. If so, this display >+ * is returned. Otherwise the method returns the default display. > */ > public static Display getStandardDisplay() { > Display display = Display.getCurrent(); >@@ -147,15 +231,20 @@ > return display; > } > >- /* (non-Javadoc) >+ /* >+ * (non-Javadoc) >+ * > * @see org.eclipse.ui.plugin.AbstractUIPlugin#createImageRegistry() > */ > protected ImageRegistry createImageRegistry() { > return ExternalToolsImages.initializeImageRegistry(); > } > >- /* (non-Javadoc) >- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) > */ > public void stop(BundleContext context) throws Exception { > try { >@@ -164,4 +253,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/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/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 30 Sep 2009 16:24:45 -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.util.HashMap; > import java.util.Iterator; > >+import org.eclipse.core.internal.externaltools.model.ExternalToolsModelMessages; > import org.eclipse.core.runtime.Assert; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.swt.graphics.Image; >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 30 Sep 2009 16:24:46 -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.internal.externaltools.model.ExternalToolBuilder; >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >@@ -19,8 +21,6 @@ > 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; > > > public class BuildProjectResolver implements IDynamicVariableResolver { >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 30 Sep 2009 16:24:46 -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.internal.externaltools.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 30 Sep 2009 16:24:46 -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,13 @@ > import java.util.Map; > import java.util.StringTokenizer; > >+import org.eclipse.core.internal.externaltools.model.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; > > public class SystemPathResolver implements IDynamicVariableResolver { > >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 30 Sep 2009 16:24:46 -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.internal.externaltools.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: 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 30 Sep 2009 16:24:45 -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" >Index: External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java,v >retrieving revision 1.46 >diff -u -r1.46 ExternalToolMigration.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java 12 Aug 2005 20:39:30 -0000 1.46 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java 30 Sep 2009 16:24:45 -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 >@@ -15,6 +15,8 @@ > import java.util.Map; > import java.util.StringTokenizer; > >+import org.eclipse.core.internal.externaltools.launchConfigurations.ExternalToolsMigrationMessages; >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; >@@ -24,8 +26,6 @@ > 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 >@@ -355,14 +355,14 @@ > try { > runInBackground = config.getAttribute(ATTR_RUN_IN_BACKGROUND, runInBackground); > } catch (CoreException e) { >- ExternalToolsPlugin.getDefault().log(ExternalToolsUIMessages.ExternalToolMigration_37, e); >+ ExternalToolsPlugin.getDefault().log(ExternalToolsMigrationMessages.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); >+ ExternalToolsPlugin.getDefault().log(ExternalToolsMigrationMessages.ExternalToolMigration_38, e); > } > } > return config; >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 30 Sep 2009 16:24:46 -0000 >@@ -19,6 +19,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: 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 30 Sep 2009 16:24:45 -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.internal.externaltools.model.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/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 30 Sep 2009 16:24:46 -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/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 30 Sep 2009 16:24:46 -0000 >@@ -18,6 +18,9 @@ > import java.util.List; > import java.util.Map; > >+import org.eclipse.core.internal.externaltools.model.BuilderCoreUtils; >+import org.eclipse.core.internal.externaltools.model.ExternalToolBuilder; >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; > import org.eclipse.core.resources.ICommand; > import org.eclipse.core.resources.IFolder; > import org.eclipse.core.resources.IProject; >@@ -74,13 +77,11 @@ > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.dialogs.ElementListSelectionDialog; > import org.eclipse.ui.dialogs.PropertyPage; >+import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; > import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsMainTab; >-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; >@@ -209,8 +210,8 @@ > boolean projectNeedsMigration= false; > 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])) { >+ ILaunchConfiguration config = BuilderCoreUtils.configFromBuildCommandArgs(project, commands[i].getArguments(), version); >+ 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; >@@ -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 { >@@ -521,7 +522,7 @@ > boolean wasAutobuilding= ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding(); > try { > setAutobuild(false); >- newConfig= BuilderUtils.duplicateConfiguration(getInputProject(), config); >+ newConfig= BuilderCoreUtils.duplicateConfiguration(getInputProject(), config); > } catch (CoreException e) { > handleException(e); > } finally { >@@ -579,7 +580,7 @@ > try { > ILaunchConfigurationWorkingCopy workingCopy = null; > String name= DebugPlugin.getDefault().getLaunchManager().generateUniqueLaunchConfigurationNameFrom(ExternalToolsUIMessages.BuilderPropertyPage_New_Builder_7); >- workingCopy = type.newInstance(BuilderUtils.getBuilderFolder(getInputProject(), true), name); >+ workingCopy = type.newInstance(BuilderCoreUtils.getBuilderFolder(getInputProject(), true), name); > > StringBuffer buffer= new StringBuffer(IExternalToolConstants.BUILD_TYPE_FULL); > buffer.append(','); >@@ -689,12 +690,12 @@ > Object data = selection.getData(); > if (data instanceof ILaunchConfiguration) { > ILaunchConfiguration config= (ILaunchConfiguration) data; >- if (BuilderUtils.isUnmigratedConfig(config)) { >+ if (BuilderCoreUtils.isUnmigratedConfig(config)) { > if (!shouldProceedWithMigration()) { > return; > } > try { >- config= BuilderUtils.migrateBuilderConfiguration(getInputProject(), (ILaunchConfigurationWorkingCopy) config); >+ config= BuilderCoreUtils.migrateBuilderConfiguration(getInputProject(), (ILaunchConfigurationWorkingCopy) config); > } catch (CoreException e) { > handleException(e); > return; >@@ -858,7 +859,7 @@ > } > } else if (element instanceof ILaunchConfiguration) { > try { >- return ExternalToolsUtil.isBuilderEnabled((ILaunchConfiguration) element); >+ return ExternalToolsCoreUtil.isBuilderEnabled((ILaunchConfiguration) element); > } catch (CoreException e) { > } > } else if (element instanceof ErrorConfig) { >@@ -985,14 +986,14 @@ > String disabledBuilderName; > try { > disabledBuilderName = config.getAttribute(IExternalToolConstants.ATTR_DISABLED_BUILDER, (String)null); >- if (disabledBuilderName != null && ExternalToolsUtil.isBuilderEnabled(config)) { >+ if (disabledBuilderName != null && ExternalToolsCoreUtil.isBuilderEnabled(config)) { > possibleCommands.add(translateBackToCommand(config, project)); > continue; > } > } catch (CoreException e1) { > } > >- if (!BuilderUtils.isUnmigratedConfig(config) && (config instanceof ILaunchConfigurationWorkingCopy)) { >+ if (!BuilderCoreUtils.isUnmigratedConfig(config) && (config instanceof ILaunchConfigurationWorkingCopy)) { > ILaunchConfigurationWorkingCopy workingCopy= ((ILaunchConfigurationWorkingCopy) config); > // Save any changes to the config (such as enable/disable) > if (workingCopy.isDirty()) { >@@ -1037,7 +1038,7 @@ > > private void checkBuilderFolder() { > try { >- IFolder builderFolder= BuilderUtils.getBuilderFolder(getInputProject(), false); >+ IFolder builderFolder= BuilderCoreUtils.getBuilderFolder(getInputProject(), false); > if (builderFolder != null && builderFolder.exists() && builderFolder.members().length == 0) { > // All files in the builder folder have been deleted. Clean up > builderFolder.delete(true, false, null); >@@ -1096,7 +1097,7 @@ > ILaunchConfigurationWorkingCopy workingCopy = null; > String builderName = command.getBuilderName(); > String name= DebugPlugin.getDefault().getLaunchManager().generateUniqueLaunchConfigurationNameFrom(builderName); >- workingCopy = type.newInstance(BuilderUtils.getBuilderFolder(getInputProject(), true), name); >+ workingCopy = type.newInstance(BuilderCoreUtils.getBuilderFolder(getInputProject(), true), name); > > workingCopy.setAttribute(IExternalToolConstants.ATTR_DISABLED_BUILDER, builderName); > if (arguments != null) { >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 30 Sep 2009 16:24:46 -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/launchConfigurations/ExternalToolsCoreUtil.java >=================================================================== >RCS file: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java >diff -N External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,204 @@ >+/******************************************************************************* >+ * 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.ui.externaltools.internal.launchConfigurations; >+ >+ >+import java.io.File; >+ >+import org.eclipse.core.internal.externaltools.launchConfigurations.ExternalToolsCoreLaunchConfigurationMessages; >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; >+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; >+ >+/** >+ * 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(ExternalToolsCoreLaunchConfigurationMessages.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(ExternalToolsCoreLaunchConfigurationMessages.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(ExternalToolsCoreLaunchConfigurationMessages.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(ExternalToolsCoreLaunchConfigurationMessages.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 RefreshTab.getRefreshResources(configuration, 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; >+ } >+ >+} >#P org.eclipse.core.externaltools >Index: src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.externaltools/src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java,v >retrieving revision 1.1 >diff -u -r1.1 ExternalToolsCore.java >--- src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java 16 Sep 2009 14:58:41 -0000 1.1 >+++ src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java 30 Sep 2009 16:24:48 -0000 >@@ -10,7 +10,11 @@ > *******************************************************************************/ > package org.eclipse.core.internal.externaltools; > >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; >+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; > > /** >@@ -20,6 +24,14 @@ > > // 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; >@@ -56,5 +68,52 @@ > 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: 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 30 Sep 2009 16:24:48 -0000 >@@ -10,4 +10,17 @@ > ############################################################################### > > pluginName=External Tools Headless Support >-providerName=Eclipse.org >\ No newline at end of file >+providerName=Eclipse.org >+ >+Program.externalTools = Program >+Program.externalTools = Program >+Program.externalTools = Program >+Program.externalTools = Program >+Program.externalTools = Program >+Program.externalTools = Program >+Program.externalTools = Program >+Program.externalTools = Program >+Program.externalTools = Program >+Program.externalTools = Program >+Program.externalTools = Program >+Program.externalTools = Program >\ No newline at end of file >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 30 Sep 2009 16:24:48 -0000 >@@ -1,4 +1,6 @@ > source.. = src/ > output.. = bin/ > bin.includes = META-INF/,\ >- . >+ .,\ >+ plugin.xml,\ >+ plugin.properties >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 30 Sep 2009 16:24:48 -0000 >@@ -1,7 +1,7 @@ > Manifest-Version: 1.0 > Bundle-ManifestVersion: 2 > Bundle-Name: %pluginName >-Bundle-SymbolicName: org.eclipse.core.externaltools >+Bundle-SymbolicName: org.eclipse.core.externaltools;singleton:=true > Bundle-Version: 1.0.0.qualifier > Bundle-Activator: org.eclipse.core.internal.externaltools.ExternalToolsCore > Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", >@@ -10,4 +10,6 @@ > 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.internal.externaltools;x-friends:="org.eclipse.ant.tests.ui,org.eclipse.ui.externaltools,org.eclipse.ant.launching", >+ org.eclipse.core.internal.externaltools.launchConfigurations;x-friends:="org.eclipse.ant.launching", >+ org.eclipse.core.internal.externaltools.model;x-friends:="org.eclipse.ant.launching,org.eclipse.ant.ui" >Index: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreUtil.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreUtil.java >diff -N src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreUtil.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreUtil.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,258 @@ >+/******************************************************************************* >+ * 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.internal.externaltools.launchConfigurations; >+ >+ >+import java.io.File; >+ >+import org.eclipse.core.internal.externaltools.model.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.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(ExternalToolsCoreLaunchConfigurationMessages.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(ExternalToolsCoreLaunchConfigurationMessages.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(ExternalToolsCoreLaunchConfigurationMessages.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(ExternalToolsCoreLaunchConfigurationMessages.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 DebugPlugin.getDefault().getLaunchManager().getRefreshResources(configuration, 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); >+ } >+ >+} >Index: src/org/eclipse/core/internal/externaltools/model/BuilderCoreUtils.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/model/BuilderCoreUtils.java >diff -N src/org/eclipse/core/internal/externaltools/model/BuilderCoreUtils.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/model/BuilderCoreUtils.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,402 @@ >+/******************************************************************************* >+ * 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.internal.externaltools.model; >+ >+import java.util.HashMap; >+import java.util.Map; >+import java.util.StringTokenizer; >+ >+import org.eclipse.core.internal.externaltools.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.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; >+ >+/** >+ * 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$ >+ >+ // 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 }; >+ >+ /** >+ * 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 type of launch configuration that should be created when >+ * duplicating the given configuration as a project builder. Queries to see >+ * 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); >+ IConfigurationElement[] elements = ep.getConfigurationElements(); >+ String sourceType = config.getType().getIdentifier(); >+ String builderType = null; >+ for (int i = 0; i < elements.length; i++) { >+ IConfigurationElement element = elements[i]; >+ if (element.getName().equals(TAG_CONFIGURATION_MAP) >+ && sourceType.equals(element.getAttribute(TAG_SOURCE_TYPE))) { >+ builderType = element.getAttribute(TAG_BUILDER_TYPE); >+ break; >+ } >+ } >+ if (builderType != null) { >+ ILaunchConfigurationType type = DebugPlugin.getDefault() >+ .getLaunchManager().getLaunchConfigurationType(builderType); >+ if (type != null) { >+ return type; >+ } >+ } >+ return config.getType(); >+ } >+ >+ /** >+ * 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; >+ } >+ >+ /** >+ * Returns a duplicate of the given configuration. The new configuration >+ * will be of the same type as the given configuration or of the duplication >+ * type registered for the given configuration via the extension point >+ * IExternalToolConstants.EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS. >+ */ >+ public static ILaunchConfiguration duplicateConfiguration(IProject project, >+ ILaunchConfiguration config) throws CoreException { >+ Map attributes = config.getAttributes(); >+ String newName = new StringBuffer(config.getName()).append( >+ ExternalToolsModelMessages.BuilderUtils_7).toString(); >+ newName = DebugPlugin.getDefault().getLaunchManager() >+ .generateUniqueLaunchConfigurationNameFrom(newName); >+ ILaunchConfigurationType newType = getConfigurationDuplicationType(config); >+ ILaunchConfigurationWorkingCopy newWorkingCopy = newType.newInstance( >+ getBuilderFolder(project, true), newName); >+ newWorkingCopy.setAttributes(attributes); >+ return newWorkingCopy.doSave(); >+ } >+ >+ /** >+ * 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/internal/externaltools/launchConfigurations/ExternalToolsCoreLaunchConfigurationMessages.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreLaunchConfigurationMessages.java >diff -N src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreLaunchConfigurationMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreLaunchConfigurationMessages.java 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 - Initial API and implementation >+ * dakshinamurthy.karra@gmail.com - bug 165371 >+ **********************************************************************/ >+package org.eclipse.core.internal.externaltools.launchConfigurations; >+ >+import org.eclipse.osgi.util.NLS; >+ >+public class ExternalToolsCoreLaunchConfigurationMessages extends NLS { >+ private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsLaunchConfigurationMessages";//$NON-NLS-1$ >+ >+ 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, ExternalToolsCoreLaunchConfigurationMessages.class); >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/core/internal/externaltools/model/ExternalToolBuilder.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/model/ExternalToolBuilder.java >diff -N src/org/eclipse/core/internal/externaltools/model/ExternalToolBuilder.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/model/ExternalToolBuilder.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,289 @@ >+/******************************************************************************* >+ * 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.internal.externaltools.model; >+ >+ >+import java.util.Map; >+ >+import org.eclipse.core.internal.externaltools.ExternalToolsCore; >+import org.eclipse.core.internal.externaltools.launchConfigurations.ExternalToolsCoreUtil; >+import org.eclipse.core.internal.externaltools.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.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(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.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) { >+ ExternalToolsCore.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= 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/internal/externaltools/registry/ExternalToolMigration.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/registry/ExternalToolMigration.java >diff -N src/org/eclipse/core/internal/externaltools/registry/ExternalToolMigration.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/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.internal.externaltools.registry; >+ >+ >+import java.util.ArrayList; >+import java.util.Map; >+import java.util.StringTokenizer; >+ >+import org.eclipse.core.internal.externaltools.ExternalToolsCore; >+import org.eclipse.core.internal.externaltools.launchConfigurations.ExternalToolsMigrationMessages; >+import org.eclipse.core.internal.externaltools.model.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; >+ >+ >+/** >+ * 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(ILaunchManager.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(ILaunchManager.ATTR_REFRESH_SCOPE, (String) commandArgs.get(TAG_REFRESH_SCOPE)); >+ config.setAttribute(ILaunchManager.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(ILaunchManager.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(ILaunchManager.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.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(ILaunchManager.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) { >+ ExternalToolsCore.getDefault().log(ExternalToolsMigrationMessages.ExternalToolMigration_37, e); >+ } >+ try { >+ ILaunchConfigurationWorkingCopy workingCopy= config.getWorkingCopy(); >+ workingCopy.setAttribute(ILaunchManager.ATTR_LAUNCH_IN_BACKGROUND, runInBackground); >+ config= workingCopy.doSave(); >+ } catch (CoreException e) { >+ ExternalToolsCore.getDefault().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/internal/externaltools/model/ExternalToolsModelMessages.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/model/ExternalToolsModelMessages.java >diff -N src/org/eclipse/core/internal/externaltools/model/ExternalToolsModelMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/model/ExternalToolsModelMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/********************************************************************** >+ * 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.internal.externaltools.model; >+ >+import org.eclipse.osgi.util.NLS; >+ >+public class ExternalToolsModelMessages extends NLS { >+ 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; >+ >+ static { >+ // load message values from bundle file >+ NLS.initializeMessages(BUNDLE_NAME, ExternalToolsModelMessages.class); >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/core/internal/externaltools/model/ExternalToolsModelMessages.properties >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/model/ExternalToolsModelMessages.properties >diff -N src/org/eclipse/core/internal/externaltools/model/ExternalToolsModelMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/model/ExternalToolsModelMessages.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 >+############################################################################### >+ >+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: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreLaunchConfigurationMessages.properties >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreLaunchConfigurationMessages.properties >diff -N src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreLaunchConfigurationMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsCoreLaunchConfigurationMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,15 @@ >+############################################################################### >+# 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 >+############################################################################### >+ >+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/internal/externaltools/launchConfigurations/ExternalToolsProgramMessages.properties >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsProgramMessages.properties >diff -N src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsProgramMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsProgramMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+############################################################################### >+# 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: >Index: src/org/eclipse/core/internal/externaltools/model/IExternalToolConstants.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/model/IExternalToolConstants.java >diff -N src/org/eclipse/core/internal/externaltools/model/IExternalToolConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/model/IExternalToolConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,231 @@ >+/******************************************************************************* >+ * 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.internal.externaltools.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: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsMigrationMessages.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsMigrationMessages.java >diff -N src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsMigrationMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/launchConfigurations/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.internal.externaltools.launchConfigurations; >+ >+import org.eclipse.osgi.util.NLS; >+ >+public class ExternalToolsMigrationMessages extends NLS { >+ private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.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: 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.internal.externaltools.launchConfigurations.ProgramLaunchDelegate" >+ category="org.eclipse.ui.externaltools" >+ modes="run" >+ id="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"> >+ </launchConfigurationType> >+ <launchConfigurationType >+ name="%Program.externalTools" >+ delegate="org.eclipse.core.internal.externaltools.launchConfigurations.ProgramLaunchDelegate" >+ category="org.eclipse.ui.externaltools.builder" >+ modes="run" >+ id="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"> >+ </launchConfigurationType> >+ </extension> >+ <extension >+ id="ExternalToolBuilder" >+ name="%Builder.externalTools" >+ point="org.eclipse.core.resources.builders"> >+ <builder >+ isConfigurable= "true"> >+ <run >+ class="org.eclipse.core.internal.externaltools.model.ExternalToolBuilder"> >+ </run> >+ </builder> >+ </extension> >+</plugin> >Index: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsProgramMessages.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsProgramMessages.java >diff -N src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsProgramMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsProgramMessages.java 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 - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.core.internal.externaltools.launchConfigurations; >+ >+import org.eclipse.osgi.util.NLS; >+ >+public class ExternalToolsProgramMessages extends NLS { >+ private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.program.launchConfigurations.ExternalToolsProgramMessages";//$NON-NLS-1$ >+ >+ public static String BackgroundResourceRefresher_0; >+ >+ public static String ProgramLaunchDelegate_3; >+ public static String ProgramLaunchDelegate_4; >+ >+ static { >+ // load message values from bundle file >+ NLS.initializeMessages(BUNDLE_NAME, ExternalToolsProgramMessages.class); >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/core/internal/externaltools/launchConfigurations/ProgramLaunchDelegate.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/launchConfigurations/ProgramLaunchDelegate.java >diff -N src/org/eclipse/core/internal/externaltools/launchConfigurations/ProgramLaunchDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/launchConfigurations/ProgramLaunchDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,212 @@ >+/******************************************************************************* >+ * 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.internal.externaltools.launchConfigurations; >+ >+import java.io.File; >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.internal.externaltools.model.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.ILaunchManager; >+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) >+ */ >+ >+ private ILaunchManager launchManager; >+ >+ public void launch(ILaunchConfiguration configuration, String mode, >+ ILaunch launch, IProgressMonitor monitor) throws CoreException { >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ launchManager = DebugPlugin.getDefault().getLaunchManager(); >+ >+ // 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 >+ launchManager.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/internal/externaltools/launchConfigurations/ExternalToolsMigrationMessages.properties >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsMigrationMessages.properties >diff -N src/org/eclipse/core/internal/externaltools/launchConfigurations/ExternalToolsMigrationMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/launchConfigurations/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/launchConfigurations/BackgroundResourceRefresher.java >=================================================================== >RCS file: src/org/eclipse/core/internal/externaltools/launchConfigurations/BackgroundResourceRefresher.java >diff -N src/org/eclipse/core/internal/externaltools/launchConfigurations/BackgroundResourceRefresher.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/externaltools/launchConfigurations/BackgroundResourceRefresher.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,88 @@ >+/******************************************************************************* >+ * 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.internal.externaltools.launchConfigurations; >+ >+ >+import org.eclipse.core.internal.externaltools.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.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 { >+ DebugPlugin.getDefault().getLaunchManager().refreshResources(fConfiguration, monitor); >+ } catch (CoreException e) { >+ ExternalToolsCore.log(e); >+ return e.getStatus(); >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ job.schedule(); >+ } >+} >#P org.eclipse.debug.ui >Index: ui/org/eclipse/debug/ui/RefreshTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/RefreshTab.java,v >retrieving revision 1.26 >diff -u -r1.26 RefreshTab.java >--- ui/org/eclipse/debug/ui/RefreshTab.java 31 Mar 2009 20:46:31 -0000 1.26 >+++ ui/org/eclipse/debug/ui/RefreshTab.java 30 Sep 2009 16:24:53 -0000 >@@ -10,30 +10,21 @@ > *******************************************************************************/ > package org.eclipse.debug.ui; > >- >-import java.io.IOException; > import java.io.StringReader; >-import java.io.StringWriter; >-import com.ibm.icu.text.MessageFormat; >+ > import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.MultiStatus; >-import org.eclipse.core.runtime.NullProgressMonitor; >-import org.eclipse.core.runtime.Path; >-import org.eclipse.core.runtime.Status; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.debug.internal.core.LaunchManager; > import org.eclipse.debug.internal.ui.DebugPluginImages; > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.internal.ui.IDebugHelpContextIds; > import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog; >-import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager; > import org.eclipse.debug.internal.ui.stringsubstitution.StringSubstitutionMessages; > import org.eclipse.jface.window.Window; > import org.eclipse.jface.wizard.WizardDialog; >@@ -54,12 +45,12 @@ > import org.eclipse.ui.dialogs.IWorkingSetEditWizard; > > /** >- * A launch configuration tab which allows the user to specify >- * which resources should be refreshed when the launch >- * terminates. >+ * A launch configuration tab which allows the user to specify which resources >+ * should be refreshed when the launch terminates. > * <p> > * This class may be instantiate. > * </p> >+ * > * @since 3.0 > * @noextend This class is not intended to be subclassed by clients. > */ >@@ -69,71 +60,82 @@ > * Boolean attribute indicating if a refresh scope is recursive. Default > * value is <code>false</code>. > */ >- public static final String ATTR_REFRESH_RECURSIVE = DebugPlugin.getUniqueIdentifier() + ".ATTR_REFRESH_RECURSIVE"; //$NON-NLS-1$ >+ public static final String ATTR_REFRESH_RECURSIVE = DebugPlugin >+ .getUniqueIdentifier() >+ + ".ATTR_REFRESH_RECURSIVE"; //$NON-NLS-1$ > > /** >+ * @since 3.6 >+ */ >+ private static String TAG_NAME = "name"; //$NON-NLS-1$ >+ /** > * String attribute identifying the scope of resources that should be > * refreshed after an external tool is run. The value is either a refresh > * variable or the default value, <code>null</code>, indicating no refresh. > */ >- public static final String ATTR_REFRESH_SCOPE = DebugPlugin.getUniqueIdentifier() + ".ATTR_REFRESH_SCOPE"; //$NON-NLS-1$ >- >+ public static final String ATTR_REFRESH_SCOPE = DebugPlugin >+ .getUniqueIdentifier() >+ + ".ATTR_REFRESH_SCOPE"; //$NON-NLS-1$ >+ > // indicates no working set has been selected > private static final String NO_WORKING_SET = "NONE"; //$NON-NLS-1$ >- >+ > // Check Buttons > private Button fRefreshButton; > private Button fRecursiveButton; >- >+ > // Group box > private Group fGroup; >- >+ > // Radio Buttons > private Button fContainerButton; > private Button fProjectButton; > private Button fResourceButton; > private Button fWorkingSetButton; > private Button fWorkspaceButton; >- >+ > // Push Button > private Button fSelectButton; >- >+ > // Working set > private IWorkingSet fWorkingSet; > >- /** >- * XML tag used to designate the root of the persisted IWorkingSet >- */ >- private static final String TAG_LAUNCH_CONFIGURATION_WORKING_SET= "launchConfigurationWorkingSet"; //$NON-NLS-1$ >+ // /** >+ // * XML tag used to designate the root of the persisted IWorkingSet >+ // */ >+ // private static final String TAG_LAUNCH_CONFIGURATION_WORKING_SET= "launchConfigurationWorkingSet"; //$NON-NLS-1$ >+ // >+ // /** >+ // * XML tag used for setting / getting the factory ID of the persisted >+ // IWorkingSet >+ // * Bug 37143 >+ // */ >+ // private static final String TAG_FACTORY_ID = "factoryID"; //$NON-NLS-1$ > > /** >- * XML tag used for setting / getting the factory ID of the persisted IWorkingSet >- * Bug 37143 >- */ >- private static final String TAG_FACTORY_ID = "factoryID"; //$NON-NLS-1$ >- >- /** > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) > */ > public void createControl(Composite parent) { > Composite mainComposite = new Composite(parent, SWT.NONE); > setControl(mainComposite); >- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_REFRESH_TAB); >- >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), >+ IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_REFRESH_TAB); >+ > GridLayout layout = new GridLayout(); > GridData gd = new GridData(GridData.FILL_HORIZONTAL); > mainComposite.setLayout(layout); > mainComposite.setLayoutData(gd); > mainComposite.setFont(parent.getFont()); >- >- fRefreshButton = createCheckButton(mainComposite, StringSubstitutionMessages.RefreshTab_31); >+ >+ fRefreshButton = createCheckButton(mainComposite, >+ StringSubstitutionMessages.RefreshTab_31); > fRefreshButton.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > updateEnabledState(); > updateLaunchConfigurationDialog(); > } > }); >- >+ > fGroup = new Group(mainComposite, SWT.NONE); > fGroup.setFont(mainComposite.getFont()); > layout = new GridLayout(); >@@ -146,52 +148,58 @@ > > SelectionAdapter adapter = new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { >- if (((Button)e.getSource()).getSelection()) { >+ if (((Button) e.getSource()).getSelection()) { > updateEnabledState(); > updateLaunchConfigurationDialog(); > } > } > }; >- >- fWorkspaceButton = createRadioButton(fGroup, StringSubstitutionMessages.RefreshTab_32); >+ >+ fWorkspaceButton = createRadioButton(fGroup, >+ StringSubstitutionMessages.RefreshTab_32); > gd = new GridData(GridData.FILL_HORIZONTAL); > gd.horizontalSpan = 2; > fWorkspaceButton.setLayoutData(gd); > fWorkspaceButton.addSelectionListener(adapter); > >- fResourceButton = createRadioButton(fGroup, StringSubstitutionMessages.RefreshTab_33); >+ fResourceButton = createRadioButton(fGroup, >+ StringSubstitutionMessages.RefreshTab_33); > gd = new GridData(GridData.FILL_HORIZONTAL); > gd.horizontalSpan = 2; > fResourceButton.setLayoutData(gd); > fResourceButton.addSelectionListener(adapter); > >- fProjectButton = createRadioButton(fGroup, StringSubstitutionMessages.RefreshTab_34); >+ fProjectButton = createRadioButton(fGroup, >+ StringSubstitutionMessages.RefreshTab_34); > gd = new GridData(GridData.FILL_HORIZONTAL); > gd.horizontalSpan = 2; >- fProjectButton.setLayoutData(gd); >+ fProjectButton.setLayoutData(gd); > fProjectButton.addSelectionListener(adapter); > >- fContainerButton = createRadioButton(fGroup, StringSubstitutionMessages.RefreshTab_35); >+ fContainerButton = createRadioButton(fGroup, >+ StringSubstitutionMessages.RefreshTab_35); > gd = new GridData(GridData.FILL_HORIZONTAL); > gd.horizontalSpan = 2; > fContainerButton.setLayoutData(gd); > fContainerButton.addSelectionListener(adapter); >- >- fWorkingSetButton = createRadioButton(fGroup, StringSubstitutionMessages.RefreshTab_36); >+ >+ fWorkingSetButton = createRadioButton(fGroup, >+ StringSubstitutionMessages.RefreshTab_36); > gd = new GridData(GridData.FILL_HORIZONTAL); > gd.horizontalSpan = 1; > fWorkingSetButton.setLayoutData(gd); >- fWorkingSetButton.addSelectionListener(adapter); >- >- fSelectButton = createPushButton(fGroup, StringSubstitutionMessages.RefreshTab_37, null); >- gd = (GridData)fSelectButton.getLayoutData(); >+ fWorkingSetButton.addSelectionListener(adapter); >+ >+ fSelectButton = createPushButton(fGroup, >+ StringSubstitutionMessages.RefreshTab_37, null); >+ gd = (GridData) fSelectButton.getLayoutData(); > gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; > fSelectButton.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > selectResources(); > } > }); >- >+ > createVerticalSpacer(fGroup, 2); > createRecursiveComponent(fGroup); > } >@@ -200,30 +208,39 @@ > * Prompts the user to select the resources to refresh. > */ > private void selectResources() { >- IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); >- >- if (fWorkingSet == null){ >- fWorkingSet = workingSetManager.createWorkingSet(StringSubstitutionMessages.RefreshTab_40, new IAdaptable[0]); >- } >- IWorkingSetEditWizard wizard = workingSetManager.createWorkingSetEditWizard(fWorkingSet); >- WizardDialog dialog = new WizardDialog(((LaunchConfigurationsDialog)LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog()).getShell(), wizard); >- dialog.create(); >- >+ IWorkingSetManager workingSetManager = PlatformUI.getWorkbench() >+ .getWorkingSetManager(); >+ >+ if (fWorkingSet == null) { >+ fWorkingSet = workingSetManager >+ .createWorkingSet(StringSubstitutionMessages.RefreshTab_40, >+ new IAdaptable[0]); >+ } >+ IWorkingSetEditWizard wizard = workingSetManager >+ .createWorkingSetEditWizard(fWorkingSet); >+ WizardDialog dialog = new WizardDialog( >+ ((LaunchConfigurationsDialog) LaunchConfigurationsDialog >+ .getCurrentlyVisibleLaunchConfigurationDialog()) >+ .getShell(), wizard); >+ dialog.create(); >+ > if (dialog.open() == Window.CANCEL) { > return; > } > fWorkingSet = wizard.getSelection(); > updateLaunchConfigurationDialog(); > } >- >+ > /** >- * Creates the controls needed to edit the refresh recursive >- * attribute of a launch configuration >+ * Creates the controls needed to edit the refresh recursive attribute of a >+ * launch configuration > * >- * @param parent the composite to create the controls in >+ * @param parent >+ * the composite to create the controls in > */ > private void createRecursiveComponent(Composite parent) { >- fRecursiveButton = createCheckButton(parent, StringSubstitutionMessages.RefreshTab_0); >+ fRecursiveButton = createCheckButton(parent, >+ StringSubstitutionMessages.RefreshTab_0); > GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); > data.horizontalSpan = 2; > fRecursiveButton.setLayoutData(data); >@@ -247,18 +264,21 @@ > updateRefresh(configuration); > updateRecursive(configuration); > updateScope(configuration); >- updateEnabledState(); >+ updateEnabledState(); > } >- >+ > /** >- * Updates the tab to display the refresh scope specified by the launch config >+ * Updates the tab to display the refresh scope specified by the launch >+ * config > */ > private void updateScope(ILaunchConfiguration configuration) { > String scope = null; > try { >- scope= configuration.getAttribute(ATTR_REFRESH_SCOPE, (String)null); >+ scope = configuration.getAttribute(ATTR_REFRESH_SCOPE, >+ (String) null); > } catch (CoreException ce) { >- DebugUIPlugin.log(DebugUIPlugin.newErrorStatus("Exception reading launch configuration", ce)); //$NON-NLS-1$ >+ DebugUIPlugin.log(DebugUIPlugin.newErrorStatus( >+ "Exception reading launch configuration", ce)); //$NON-NLS-1$ > } > fWorkspaceButton.setSelection(false); > fResourceButton.setSelection(false); >@@ -280,9 +300,14 @@ > } else if (scope.startsWith("${resource:")) { //$NON-NLS-1$ > fWorkingSetButton.setSelection(true); > try { >- IResource[] resources = getRefreshResources(scope); >- IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager(); >- fWorkingSet = workingSetManager.createWorkingSet(StringSubstitutionMessages.RefreshTab_40, resources); >+ IResource[] resources = getRefreshResources(configuration, >+ scope); >+ IWorkingSetManager workingSetManager = PlatformUI >+ .getWorkbench().getWorkingSetManager(); >+ fWorkingSet = workingSetManager >+ .createWorkingSet( >+ StringSubstitutionMessages.RefreshTab_40, >+ resources); > } catch (CoreException e) { > fWorkingSet = null; > } >@@ -293,29 +318,37 @@ > } > } > } >+ > /** > * Method updateRecursive. >+ * > * @param configuration > */ > private void updateRecursive(ILaunchConfiguration configuration) { >- boolean recursive= true; >+ boolean recursive = true; > try { >- recursive= configuration.getAttribute(ATTR_REFRESH_RECURSIVE, true); >+ recursive = configuration >+ .getAttribute(ATTR_REFRESH_RECURSIVE, true); > } catch (CoreException ce) { >- DebugUIPlugin.log(DebugUIPlugin.newErrorStatus("Exception reading launch configuration", ce)); //$NON-NLS-1$ >+ DebugUIPlugin.log(DebugUIPlugin.newErrorStatus( >+ "Exception reading launch configuration", ce)); //$NON-NLS-1$ > } > fRecursiveButton.setSelection(recursive); > } >+ > /** > * Method updateRefresh. >+ * > * @param configuration > */ > private void updateRefresh(ILaunchConfiguration configuration) { >- String scope= null; >+ String scope = null; > try { >- scope= configuration.getAttribute(ATTR_REFRESH_SCOPE, (String)null); >+ scope = configuration.getAttribute(ATTR_REFRESH_SCOPE, >+ (String) null); > } catch (CoreException ce) { >- DebugUIPlugin.log(DebugUIPlugin.newErrorStatus("Exception reading launch configuration", ce)); //$NON-NLS-1$ >+ DebugUIPlugin.log(DebugUIPlugin.newErrorStatus( >+ "Exception reading launch configuration", ce)); //$NON-NLS-1$ > } > fRefreshButton.setSelection(scope != null); > } >@@ -327,10 +360,11 @@ > if (fRefreshButton.getSelection()) { > String scope = generateScopeMemento(); > configuration.setAttribute(ATTR_REFRESH_SCOPE, scope); >- setAttribute(ATTR_REFRESH_RECURSIVE, configuration, fRecursiveButton.getSelection(), true); >+ setAttribute(ATTR_REFRESH_RECURSIVE, configuration, >+ fRecursiveButton.getSelection(), true); > } else { >- //clear the refresh attributes >- configuration.setAttribute(ATTR_REFRESH_SCOPE, (String)null); >+ // clear the refresh attributes >+ configuration.setAttribute(ATTR_REFRESH_SCOPE, (String) null); > setAttribute(ATTR_REFRESH_RECURSIVE, configuration, true, true); > } > } >@@ -364,14 +398,14 @@ > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() > */ > public String getName() { >- return StringSubstitutionMessages.RefreshTab_6; >+ return StringSubstitutionMessages.RefreshTab_6; > } >- >+ > /** > * Updates the enablement state of the fields. > */ > private void updateEnabledState() { >- boolean enabled= fRefreshButton.getSelection(); >+ boolean enabled = fRefreshButton.getSelection(); > fRecursiveButton.setEnabled(enabled); > fGroup.setEnabled(enabled); > fWorkspaceButton.setEnabled(enabled); >@@ -384,140 +418,94 @@ > super.setErrorMessage(null); > } > } >- >+ > /** > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() > */ > public Image getImage() { >- return DebugPluginImages.getImage(IInternalDebugUIConstants.IMG_OBJS_REFRESH_TAB); >+ return DebugPluginImages >+ .getImage(IInternalDebugUIConstants.IMG_OBJS_REFRESH_TAB); > } > > public boolean isValid(ILaunchConfiguration launchConfig) { > setErrorMessage(null); > setMessage(null); >- if (fRefreshButton.getSelection() && (fWorkingSetButton.getSelection() && (fWorkingSet == null || fWorkingSet.getElements().length == 0))) { >- setErrorMessage(StringSubstitutionMessages.RefreshTab_42); >+ if (fRefreshButton.getSelection() >+ && (fWorkingSetButton.getSelection() && (fWorkingSet == null || fWorkingSet >+ .getElements().length == 0))) { >+ setErrorMessage(StringSubstitutionMessages.RefreshTab_42); > return false; > } > return true; > } >- >+ > /** > * Refreshes the resources as specified by the given launch configuration. > * >- * @param configuration launch configuration >- * @param monitor progress monitor which may be <code>null</code> >- * @throws CoreException if an exception occurs while refreshing resources >- */ >- public static void refreshResources(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { >- if (monitor == null) { >- monitor = new NullProgressMonitor(); >- } >- String scope = getRefreshScope(configuration); >- IResource[] resources= null; >- if (scope != null) { >- resources = getRefreshResources(scope); >- } >- if (resources == null || resources.length == 0){ >- return; >- } >- int depth = IResource.DEPTH_ONE; >- if (isRefreshRecursive(configuration)) >- depth = IResource.DEPTH_INFINITE; >- >- if (monitor.isCanceled()) { >- return; >- } >- >- monitor.beginTask(StringSubstitutionMessages.RefreshTab_7, >- resources.length); >- >- MultiStatus status = new MultiStatus(DebugUIPlugin.getUniqueIdentifier(), 0, StringSubstitutionMessages.RefreshTab_8, null); >- for (int i = 0; i < resources.length; i++) { >- if (monitor.isCanceled()) >- break; >- if (resources[i] != null && resources[i].isAccessible()) { >- try { >- resources[i].refreshLocal(depth, null); >- } catch (CoreException e) { >- status.merge(e.getStatus()); >- } >- } >- monitor.worked(1); >- } >- >- monitor.done(); >- if (!status.isOK()) { >- throw new CoreException(status); >- } >+ * @param configuration >+ * launch configuration >+ * @param monitor >+ * progress monitor which may be <code>null</code> >+ * @throws CoreException >+ * if an exception occurs while refreshing resources >+ */ >+ public static void refreshResources(ILaunchConfiguration configuration, >+ IProgressMonitor monitor) throws CoreException { >+ DebugPlugin.getDefault().getLaunchManager().refreshResources( >+ configuration, monitor); > } > > /** >- * Returns a collection of resources referred to by a refresh scope attribute. >- * >- * @param scope refresh scope attribute (<code>ATTR_REFRESH_SCOPE</code>) >- * @return collection of resources referred to by the refresh scope attribute >- * @throws CoreException if unable to resolve a set of resources >- */ >- public static IResource[] getRefreshResources(String scope) throws CoreException { >- if (scope.startsWith("${resource:")) { //$NON-NLS-1$ >- // This is an old format that is replaced with 'working_set' >- String pathString = scope.substring(11, scope.length() - 1); >- Path path = new Path(pathString); >- IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path); >- if (resource == null) { >- throw new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, MessageFormat.format(StringSubstitutionMessages.RefreshTab_43, new String[]{pathString}), null)); >- } >- return new IResource[]{resource}; >- } else if (scope.startsWith("${working_set:")) { //$NON-NLS-1$ >- IWorkingSet workingSet = getWorkingSet(scope); >- if (workingSet == null) { >- throw new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, StringSubstitutionMessages.RefreshTab_44, null)); >- } >- IAdaptable[] elements = workingSet.getElements(); >- IResource[] resources = new IResource[elements.length]; >- for (int i = 0; i < elements.length; i++) { >- IAdaptable adaptable = elements[i]; >- if (adaptable instanceof IResource) { >- resources[i] = (IResource) adaptable; >- } else { >- resources[i] = (IResource) adaptable.getAdapter(IResource.class); >- } >- } >- return resources; >- } else if(scope.equals("${workspace}")) { //$NON-NLS-1$ >- return new IResource[]{ResourcesPlugin.getWorkspace().getRoot()}; >- } else { >- IResource resource = SelectedResourceManager.getDefault().getSelectedResource(); >- if (resource == null) { >- // empty selection >- return new IResource[]{}; >- } >- if (scope.equals("${resource}")) { //$NON-NLS-1$ >- // resource = resource >- } else if (scope.equals("${container}")) { //$NON-NLS-1$ >- resource = resource.getParent(); >- } else if (scope.equals("${project}")) { //$NON-NLS-1$ >- resource = resource.getProject(); >- } >- return new IResource[]{resource}; >- } >+ * Returns a collection of resources referred to by a refresh scope >+ * attribute. >+ * >+ * @param scope >+ * refresh scope attribute (<code>ATTR_REFRESH_SCOPE</code>) >+ * @return collection of resources referred to by the refresh scope >+ * attribute >+ * @throws CoreException >+ * if unable to resolve a set of resources >+ * @since 3.6 >+ */ >+ public static IResource[] getRefreshResources( >+ ILaunchConfiguration configuration, String scope) >+ throws CoreException { >+ return DebugPlugin.getDefault().getLaunchManager().getRefreshResources( >+ configuration, scope); >+ } >+ >+ /** >+ * Returns a collection of resources referred to by a refresh scope >+ * attribute. >+ * >+ * @param scope >+ * refresh scope attribute (<code>ATTR_REFRESH_SCOPE</code>) >+ * @return collection of resources referred to by the refresh scope >+ * attribute >+ * @throws CoreException >+ * if unable to resolve a set of resources >+ */ >+ public static IResource[] getRefreshResources(String scope) >+ throws CoreException { >+ return getRefreshResources(DebugPlugin.getDefault().getLaunchManager() >+ .getLaunchConfiguration(scope), scope); > } >- >+ > /** >- * Restores a working set based on the XMLMemento represented within >- * the mementoString. >+ * Restores a working set based on the XMLMemento represented within the >+ * mementoString. > * >- * @param mementoString The string memento of the working set >- * @return the restored working set or <code>null</code> if problems occurred restoring the >- * working set. >+ * @param mementoString >+ * The string memento of the working set >+ * @return the restored working set or <code>null</code> if problems >+ * occurred restoring the working set. > */ > private static IWorkingSet restoreWorkingSet(String mementoString) { > if (NO_WORKING_SET.equals(mementoString)) { > return null; > } >- StringReader reader= new StringReader(mementoString); >- XMLMemento memento= null; >+ StringReader reader = new StringReader(mementoString); >+ XMLMemento memento = null; > try { > memento = XMLMemento.createReadRoot(reader); > } catch (WorkbenchException e) { >@@ -525,20 +513,29 @@ > return null; > } > >- IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager(); >- return workingSetManager.createWorkingSet(memento); >- } >- >+ IWorkingSetManager workingSetManager = PlatformUI.getWorkbench() >+ .getWorkingSetManager(); >+ >+ IWorkingSet workingSet = workingSetManager >+ .createWorkingSet(memento.getString(TAG_NAME), LaunchManager >+ .getResources(mementoString)); >+ return workingSet; >+ } >+ > /** >- * Returns the refresh scope attribute specified by the given launch configuration >- * or <code>null</code> if none. >+ * Returns the refresh scope attribute specified by the given launch >+ * configuration or <code>null</code> if none. > * >- * @param configuration launch configuration >+ * @param configuration >+ * launch configuration > * @return refresh scope attribute (<code>ATTR_REFRESH_SCOPE</code>) >- * @throws CoreException if unable to access the associated attribute >+ * @throws CoreException >+ * if unable to access the associated attribute > */ >- public static String getRefreshScope(ILaunchConfiguration configuration) throws CoreException { >- return configuration.getAttribute(ATTR_REFRESH_SCOPE, (String) null); >+ public static String getRefreshScope(ILaunchConfiguration configuration) >+ throws CoreException { >+ return DebugPlugin.getDefault().getLaunchManager().getRefreshScope( >+ configuration); > } > > /** >@@ -547,17 +544,20 @@ > * > * @param configuration > * @return whether the refresh scope is recursive >- * @throws CoreException if unable to access the associated attribute >+ * @throws CoreException >+ * if unable to access the associated attribute > */ >- public static boolean isRefreshRecursive(ILaunchConfiguration configuration) throws CoreException { >+ public static boolean isRefreshRecursive(ILaunchConfiguration configuration) >+ throws CoreException { > return configuration.getAttribute(ATTR_REFRESH_RECURSIVE, true); >- } >- >+ } >+ > /** > * Creates and returns a memento for the given working set, to be used as a > * refresh attribute. > * >- * @param workingSet a working set, or <code>null</code> >+ * @param workingSet >+ * a working set, or <code>null</code> > * @return an equivalent refresh attribute > */ > public static String getRefreshAttribute(IWorkingSet workingSet) { >@@ -565,57 +565,53 @@ > if (workingSet == null || workingSet.getElements().length == 0) { > set = NO_WORKING_SET; > } else { >- XMLMemento workingSetMemento = XMLMemento.createWriteRoot(TAG_LAUNCH_CONFIGURATION_WORKING_SET); >- workingSetMemento.putString(RefreshTab.TAG_FACTORY_ID, workingSet.getFactoryId()); >- workingSet.saveState(workingSetMemento); >- StringWriter writer= new StringWriter(); >- try { >- workingSetMemento.save(writer); >- } catch (IOException e) { >- DebugUIPlugin.log(e); >- } >- set = writer.toString(); >- } >- if (set != null) { >- StringBuffer memento = new StringBuffer(); >- memento.append("${working_set:"); //$NON-NLS-1$ >- memento.append(set); >- memento.append("}"); //$NON-NLS-1$ >- return memento.toString(); >+ set = LaunchManager.getResourcesMemento(workingSet.getElements(), >+ workingSet.getFactoryId(), workingSet.getId(), workingSet >+ .getName()); > } >- return null; >+ return set; > } >- >+ > /** >- * Creates and returns a working set from the given refresh attribute created by >- * the method <code>getRefreshAttribute(IWorkingSet)</code>, or <code>null</code> >- * if none. >+ * Creates and returns a working set from the given refresh attribute >+ * created by the method <code>getRefreshAttribute(IWorkingSet)</code>, or >+ * <code>null</code> if none. > * >- * @param refreshAttribute a refresh attribute that represents a working set >+ * @param refreshAttribute >+ * a refresh attribute that represents a working set > * @return equivalent working set, or <code>null</code> > */ > public static IWorkingSet getWorkingSet(String refreshAttribute) { > if (refreshAttribute.startsWith("${working_set:")) { //$NON-NLS-1$ >- String memento = refreshAttribute.substring(14, refreshAttribute.length() - 1); >- return restoreWorkingSet(memento); >+ String memento = refreshAttribute.substring(14, refreshAttribute >+ .length() - 1); >+ return restoreWorkingSet(memento); > } > return null; > } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug >+ * .core.ILaunchConfigurationWorkingCopy) > */ > public void activated(ILaunchConfigurationWorkingCopy workingCopy) { > // do nothing on activation > } > >- /* (non-Javadoc) >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse. >+ * debug.core.ILaunchConfigurationWorkingCopy) > */ > public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { > // do nothing on deactivation > } >- >+ > /** > * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getId() > * >Index: ui/org/eclipse/debug/ui/IDebugUIConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java,v >retrieving revision 1.189 >diff -u -r1.189 IDebugUIConstants.java >--- ui/org/eclipse/debug/ui/IDebugUIConstants.java 31 Mar 2009 20:46:31 -0000 1.189 >+++ ui/org/eclipse/debug/ui/IDebugUIConstants.java 30 Sep 2009 16:24:53 -0000 >@@ -14,6 +14,7 @@ > > > import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchManager; > > /** > * Constant definitions for debug UI plug-in. >@@ -861,7 +862,7 @@ > * > * @since 2.0 > */ >- public static final String ATTR_PRIVATE = PLUGIN_ID + ".private"; //$NON-NLS-1$ >+ public static final String ATTR_PRIVATE = ILaunchManager.ATTR_PRIVATE; > > /** > * Launch configuration attribute - a boolean value that indicates if the launch configuration >Index: ui/org/eclipse/debug/ui/CommonTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java,v >retrieving revision 1.98 >diff -u -r1.98 CommonTab.java >--- ui/org/eclipse/debug/ui/CommonTab.java 21 Jul 2009 14:27:29 -0000 1.98 >+++ ui/org/eclipse/debug/ui/CommonTab.java 30 Sep 2009 16:24:52 -0000 >@@ -590,13 +590,7 @@ > * @return whether the configuration is configured to launch in the background > */ > public static boolean isLaunchInBackground(ILaunchConfiguration configuration) { >- boolean launchInBackground= true; >- try { >- launchInBackground= configuration.getAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true); >- } catch (CoreException ce) { >- DebugUIPlugin.log(ce); >- } >- return launchInBackground; >+ return false;//DebugPlugin.getDefault().getLaunchManager().isLaunchInBackground(configuration); > } > > /** >#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 30 Sep 2009 16:24:57 -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: 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 30 Sep 2009 16:24:58 -0000 >@@ -10,7 +10,9 @@ > *******************************************************************************/ > package org.eclipse.ant.internal.launching; > >+import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Plugin; >+import org.eclipse.core.runtime.Status; > import org.osgi.framework.BundleContext; > > /** >@@ -20,6 +22,14 @@ > > // 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$ >+ >+ /** >+ * 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 +66,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: .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 30 Sep 2009 16:24:58 -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: 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 30 Sep 2009 16:24:58 -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.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 30 Sep 2009 16:24:58 -0000 >@@ -10,4 +10,172 @@ > ############################################################################### > > pluginName=Ant Launching Support >-providerName=Eclipse.org >\ No newline at end of file >+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 >+ >+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 >+ >+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 >+ >+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 >+ >+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 >+ >+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 >+ >+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 >+ >+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 >+ >+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 >+ >+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 >+ >+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 >+ >+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 >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 30 Sep 2009 16:24:58 -0000 >@@ -1,16 +1,27 @@ > Manifest-Version: 1.0 > Bundle-ManifestVersion: 2 > 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.core", >+ 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" >+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: 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/launchConfigurations/IAntLaunchConfigurationConstants.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/IAntLaunchConfigurationConstants.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/IAntLaunchConfigurationConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/IAntLaunchConfigurationConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,177 @@ >+/******************************************************************************* >+ * 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.internal.launching.launchConfigurations; >+ >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; >+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; >+ >+/** >+ * Constant definitions for Ant launch configurations. >+ * >+ * @since 3.4 >+ * @noimplement This interface is not intended to be implemented by clients. >+ */ >+public interface IAntLaunchConfigurationConstants { >+ >+ public static final String PLUGIN_ID = "org.eclipse.ant.launching"; //$NON-NLS-1$ >+ >+ /** >+ * 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$ >+ >+ /** >+ * Ant launch configuration type identifier. >+ */ >+ public static final String ID_ANT_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ant.AntLaunchConfigurationType"; //$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.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.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.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.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.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$ >+ >+ /** >+ * 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; >+} >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/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(IAntLaunchConfigurationConstants.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/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/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.internal.externaltools.model.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/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/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/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/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/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/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/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.internal.externaltools.model.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/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/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,891 @@ >+/******************************************************************************* >+ * 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.core.internal.externaltools.launchConfigurations.BackgroundResourceRefresher; >+import org.eclipse.core.internal.externaltools.launchConfigurations.ExternalToolsCoreUtil; >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; >+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.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.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 = 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 (launchManager.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 = ExternalToolsCoreUtil.getLocation(configuration); >+ monitor.worked(1); >+ >+ if (monitor.isCanceled()) { >+ return; >+ } >+ >+ if (!isSeparateJRE && AntRunner.isBuildRunning()) { >+ IStatus status = new Status( >+ IStatus.ERROR, >+ IAntLaunchConfigurationConstants.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( >+ IAntLaunchConfigurationConstants.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, >+ 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); >+ boolean debug = fMode.equals(ILaunchManager.DEBUG_MODE); >+ if (debug || launchManager.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 (launchManager.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 >+ launchManager.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()); >+ StringBuffer vmArgs = generateVMArguments(copy, setInputHandler, >+ antHome); >+ copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, >+ vmArgs.toString()); >+ copy.setAttribute(ILaunchManager.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(ILaunchManager.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 (launchManager.isLaunchInBackground(copy)) { >+ // refresh resources after process finishes >+ if (launchManager.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 >+ launchManager.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/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/AntCoreModelMessages.properties >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntCoreModelMessages.properties >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntCoreModelMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/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/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/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/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/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/AntCoreModelMessages.java >=================================================================== >RCS file: src/org/eclipse/ant/internal/launching/launchConfigurations/AntCoreModelMessages.java >diff -N src/org/eclipse/ant/internal/launching/launchConfigurations/AntCoreModelMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ant/internal/launching/launchConfigurations/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.launchConfigurations; >+ >+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/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 = IAntLaunchConfigurationConstants.LEFT_COLUMN_SIZE >+ - (taskName.length() + 3); >+ int offset = Math.max(size - 2, 1); >+ int length = IAntLaunchConfigurationConstants.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 = IAntLaunchConfigurationConstants.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: 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,59 @@ >+<?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> >+</plugin> >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/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,48 @@ >+/******************************************************************************* >+ * 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/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/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,39 @@ >+/********************************************************************** >+ * 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.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; >+ public static String AntDebugModelPresentation_3; >+ 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 >+ NLS.initializeMessages(BUNDLE_NAME, DebugModelMessages.class); >+ } >+} >\ 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/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,525 @@ >+/******************************************************************************* >+ * 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.AntCoreModelMessages; >+import org.eclipse.ant.internal.launching.launchConfigurations.AntHomeClasspathEntry; >+import org.eclipse.ant.internal.launching.launchConfigurations.AntProcess; >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; >+import org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntRuntimeProcess; >+import org.eclipse.core.internal.externaltools.model.ExternalToolBuilder; >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; >+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 (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 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( >+ 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 >+ * <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( >+ IAntLaunchConfigurationConstants.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( >+ IAntLaunchConfigurationConstants.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, >+ IAntLaunchConfigurationConstants.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( >+ IAntLaunchConfigurationConstants.ATTR_ANT_CUSTOM_CLASSPATH, >+ (String) null); >+ String oldAntHome = configuration.getAttribute( >+ 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.launching.launchConfigurations.IAntLaunchConfigurationConstants.ATTR_ANT_CUSTOM_CLASSPATH, >+ (String) null); >+ workingCopy >+ .setAttribute( >+ org.eclipse.ant.internal.launching.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(); >+ } >+ } >+ >+ 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/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,33 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.ant.internal.launching.launchConfigurations; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+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: 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/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/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/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,64 @@ >+/******************************************************************************* >+ * 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.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 = IAntLaunchConfigurationConstants.PLUGIN_ID + ".ANT_DEBUG_STREAM"; //$NON-NLS-1$ >+ public static final String ANT_VERBOSE_STREAM = IAntLaunchConfigurationConstants.PLUGIN_ID + ".ANT_VERBOSE_STREAM"; //$NON-NLS-1$ >+ public static final String ANT_WARNING_STREAM = IAntLaunchConfigurationConstants.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/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/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/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/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,51 @@ >+/******************************************************************************* >+ * 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) { >+ linkDescriptors.add(new LinkDescriptor(line, fileName, lineNumber, >+ offset, length)); >+ } >+ >+ public void removeLinkDescriptor(LinkDescriptor ld) { >+ linkDescriptors.remove(ld); >+ } >+ >+ public List getLinkDescriptors() { >+ return linkDescriptors; >+ } >+ >+ public void clearLinkDescriptors() { >+ linkDescriptors.clear(); >+ } >+ >+} >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/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.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: 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/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/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/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,28 @@ >+############################################################################### >+# 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 >+ >+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 >#P org.eclipse.ant.tests.ui >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 30 Sep 2009 16:25:00 -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.internal.externaltools.model.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; >@@ -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 30 Sep 2009 16:25:00 -0000 >@@ -18,8 +18,9 @@ > import java.util.Iterator; > import java.util.List; > >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > import org.eclipse.ant.internal.ui.IAntUIConstants; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.core.internal.externaltools.model.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; >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 30 Sep 2009 16:25:00 -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.internal.externaltools.model.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 30 Sep 2009 16:25:00 -0000 >@@ -15,12 +15,12 @@ > import junit.framework.TestSuite; > > import org.eclipse.ant.tests.ui.AbstractAntUIBuildPerformanceTest; >+import org.eclipse.core.internal.externaltools.model.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: 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 30 Sep 2009 16:25:00 -0000 >@@ -15,14 +15,14 @@ > > 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.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; >+import org.eclipse.core.internal.externaltools.model.IExternalToolConstants; > 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; > > /** >@@ -46,7 +46,7 @@ > 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]); >@@ -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 30 Sep 2009 16:25:00 -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: 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 30 Sep 2009 16:24:59 -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.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugException; >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 30 Sep 2009 16:24:59 -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 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 30 Sep 2009 16:24:59 -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/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 30 Sep 2009 16:24:59 -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.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugException; > import org.eclipse.debug.core.ILaunchConfiguration; >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 30 Sep 2009 16:24:59 -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; >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 30 Sep 2009 16:24:59 -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 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 30 Sep 2009 16:25:00 -0000 >@@ -14,12 +14,13 @@ > import java.io.File; > import java.io.FileNotFoundException; > import java.util.HashMap; >+import java.util.List; > import java.util.Map; > >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants; > 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 +42,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:")); > } >@@ -63,6 +64,10 @@ > */ > public void testBuildFailedMessage() throws CoreException { > launch("bad"); >+ List allMsg = ConsoleLineTracker.getAllMessages(); >+ for(int i = 0; i < allMsg.size(); i++){ >+ System.out.println(i + ":" + allMsg.get(i)); >+ } > assertTrue("Incorrect number of messages logged for build. Should be 10. Was " + ConsoleLineTracker.getNumberOfMessages(), ConsoleLineTracker.getNumberOfMessages() == 10); > String message= ConsoleLineTracker.getMessage(5); > assertTrue("Incorrect last message. Should start with BUILD FAILED. Message: " + message, message.startsWith("BUILD FAILED")); >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 30 Sep 2009 16:24:59 -0000 >@@ -14,14 +14,14 @@ > import java.util.HashMap; > import java.util.Map; > >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > import org.eclipse.ant.internal.ui.AntUtil; > import org.eclipse.ant.internal.ui.model.AntTargetNode; > import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest; >-import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants; >+import org.eclipse.core.internal.externaltools.model.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 { > >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 30 Sep 2009 16:25:00 -0000 >@@ -19,12 +19,12 @@ > import junit.framework.Test; > import junit.framework.TestSuite; > >+import org.eclipse.ant.internal.launching.launchConfigurations.IAntLaunchConfigurationConstants; > import org.eclipse.ant.internal.ui.AntUIPlugin; > import org.eclipse.ant.internal.ui.IAntUIPreferenceConstants; > 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;
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 Raw
Actions:
View
Attachments on
bug 264338
:
148142
|
148349
|
148353
|
148443
|
148455
|
148459
|
148730
|
148864
|
148946
|
149050