Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.core/core/org/eclipse/debug/internal/core')
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java1040
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ContributedDelegate.java119
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java32
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties106
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugElement.java135
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java46
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java581
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java151
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java602
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationComparator.java65
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java574
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java278
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java595
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java1834
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchMode.java75
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ListenerList.java137
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java93
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureProvider.java70
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java140
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java315
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java98
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java255
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java124
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/SystemVariableResolver.java77
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java262
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceContainerType.java90
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLocatorMementoComparator.java53
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.java28
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.properties59
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils.java158
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourcePathComputer.java70
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ArchiveSourceContainerType.java70
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ContainerSourceContainer.java156
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainerType.java56
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DirectorySourceContainerType.java69
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ExternalArchiveSourceContainerType.java66
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/FolderSourceContainerType.java74
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ProjectSourceContainerType.java72
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/WorkspaceSourceContainerType.java53
39 files changed, 0 insertions, 8878 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
deleted file mode 100644
index 84b18980a..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
+++ /dev/null
@@ -1,1040 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-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.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointListener;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.IBreakpointManagerListener;
-import org.eclipse.debug.core.IBreakpointsListener;
-import org.eclipse.debug.core.model.IBreakpoint;
-
-/**
- * The breakpoint manager manages all registered breakpoints
- * for the debug plugin. It is instantiated by the debug plugin at startup.
- *
- * @see IBreakpointManager
- */
-public class BreakpointManager implements IBreakpointManager, IResourceChangeListener {
-
- /**
- * Constants for breakpoint add/remove/change updates
- */
- private final static int ADDED = 0;
- private final static int REMOVED = 1;
- private final static int CHANGED = 2;
-
- /**
- * String constants corresponding to XML extension keys
- */
- private final static String CLASS = "class"; //$NON-NLS-1$
-
- /**
- * Attribute name for the <code>"markerType"</code> attribute of
- * a breakpoint extension.
- */
- private static final String MARKER_TYPE= "markerType"; //$NON-NLS-1$
-
- /**
- * Attribute name for the <code>"name"</code> attribute of a
- * breakpoint extension.
- */
- private static final String TYPE_NAME= "name"; //$NON-NLS-1$
-
- /**
- * Preference constant used to persist the auto group
- */
- private static final String PREF_AUTO_GROUP = "AUTO_GROUP"; //$NON-NLS-1$
-
- /**
- * A collection of breakpoints registered with this manager.
- */
- private Vector fBreakpoints= null;
-
- /**
- * Collection of breakpoints being added currently. Used to
- * suppress change notication of "REGISTERED" attribute when
- * being added.
- */
- private List fSuppressChange = new ArrayList();
-
- /**
- * A table of breakpoint extension points, keyed by
- * marker type
- * key: a marker type
- * value: the breakpoint extension which corresponds to that marker type
- */
- private HashMap fBreakpointExtensions;
-
- /**
- * Collection of markers that associates markers to breakpoints
- * key: a marker
- * value: the breakpoint which contains that marker
- */
- private HashMap fMarkersToBreakpoints;
-
- /**
- * Collection of breakpoint listeners.
- */
- private ListenerList fBreakpointListeners= new ListenerList(6);
-
- /**
- * Collection of (multi) breakpoint listeners.
- */
- private ListenerList fBreakpointsListeners= new ListenerList(6);
-
- /**
- * Singleton resource delta visitor which handles marker
- * additions, changes, and removals.
- */
- private static BreakpointManagerVisitor fgVisitor;
-
- /**
- * Whether or not this breakpoint manager is enabled.
- */
- private boolean fEnabled= true;
-
- /**
- * Collection of breakpoint manager listeners which are
- * notified when this manager's enablement changes.
- */
- private ListenerList fBreakpointManagerListeners= new ListenerList(2);
-
- /**
- * Constructs a new breakpoint manager.
- */
- public BreakpointManager() {
- fMarkersToBreakpoints= new HashMap(10);
- fBreakpointExtensions= new HashMap(15);
- }
-
- /**
- * Loads all the breakpoints on the given resource.
- *
- * @param resource the resource which contains the breakpoints
- * @param notify whether to notify of the breakpoint additions
- */
- private void loadBreakpoints(IResource resource, boolean notify) throws CoreException {
- initBreakpointExtensions();
- IMarker[] markers= getPersistedMarkers(resource);
- List added = new ArrayList();
- for (int i = 0; i < markers.length; i++) {
- IMarker marker= markers[i];
- try {
- IBreakpoint breakpoint = createBreakpoint(marker);
- if (breakpoint.isRegistered()) {
- added.add(breakpoint);
- }
- } catch (DebugException e) {
- DebugPlugin.log(e);
- }
- }
- addBreakpoints((IBreakpoint[])added.toArray(new IBreakpoint[added.size()]), notify, true);
- }
-
- /**
- * Returns the persisted markers associated with the given resource.
- *
- * Delete any invalid breakpoint markers. This is done at startup rather
- * than shutdown, since the changes made at shutdown are not persisted as
- * the workspace state has already been saved. See bug 7683.
- *
- * Since the <code>TRANSIENT</code> marker attribute/feature has been added,
- * we no longer have to manully delete non-persisted markers - the platform
- * does this for us (at shutdown, transient markers are not saved). However,
- * the code is still present to delete non-persisted markers from old
- * workspaces.
- */
- protected IMarker[] getPersistedMarkers(IResource resource) throws CoreException {
- IMarker[] markers= resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
- final List delete = new ArrayList();
- List persisted= new ArrayList();
- for (int i = 0; i < markers.length; i++) {
- IMarker marker= markers[i];
- // ensure the marker has a valid model identifier attribute
- // and delete the breakpoint if not
- String modelId = marker.getAttribute(IBreakpoint.ID, null);
- if (modelId == null) {
- // marker with old/invalid format - delete
- delete.add(marker);
- } else if (!marker.getAttribute(IBreakpoint.PERSISTED, true)) {
- // the breakpoint is marked as not to be persisted,
- // schedule for deletion
- delete.add(marker);
- } else {
- persisted.add(marker);
- }
- }
- // delete any markers that are not to be restored
- if (!delete.isEmpty()) {
- final IMarker[] delMarkers = (IMarker[])delete.toArray(new IMarker[delete.size()]);
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
- public void run(IProgressMonitor pm) throws CoreException {
- for (int i = 0; i < delMarkers.length; i++) {
- IMarker marker = delMarkers[i];
- marker.delete();
- }
- }
- };
- new BreakpointManagerJob(wr).schedule();
- }
- return (IMarker[])persisted.toArray(new IMarker[persisted.size()]);
- }
-
- /**
- * Removes this manager as a resource change listener
- * and removes all breakpoint listeners.
- */
- public void shutdown() {
- getWorkspace().removeResourceChangeListener(this);
- fBreakpointListeners.removeAll();
- }
-
- /**
- * Find the defined breakpoint extensions and cache them for use in recreating
- * breakpoints from markers.
- */
- private void initBreakpointExtensions() {
- IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_BREAKPOINTS);
- IConfigurationElement[] elements = ep.getConfigurationElements();
- for (int i= 0; i < elements.length; i++) {
- String markerType = elements[i].getAttribute(MARKER_TYPE);
- String className = elements[i].getAttribute(CLASS);
- if (markerType == null) {
- invalidBreakpointExtension(MessageFormat.format(DebugCoreMessages.getString("BreakpointManager.Breakpoint_extension_{0}_missing_required_attribute__markerType_1"), new String[]{elements[i].getDeclaringExtension().getUniqueIdentifier()})); //$NON-NLS-1$
- } else if (className == null){
- invalidBreakpointExtension(MessageFormat.format(DebugCoreMessages.getString("BreakpointManager.Breakpoint_extension_{0}_missing_required_attribute__class_2"), new String[]{elements[i].getDeclaringExtension().getUniqueIdentifier()})); //$NON-NLS-1$
- } else {
- fBreakpointExtensions.put(markerType, elements[i]);
- }
- }
- }
-
- private void invalidBreakpointExtension(String message) {
- IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, message, null);
- DebugPlugin.log(status);
- }
-
- /**
- * Convenience method to get the workspace
- */
- private IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * @see IBreakpointManager#getBreakpoint(IMarker)
- */
- public IBreakpoint getBreakpoint(IMarker marker) {
- // ensure that breakpoints are initialized
- getBreakpoints0();
- return (IBreakpoint)fMarkersToBreakpoints.get(marker);
- }
-
- /**
- * @see IBreakpointManager#getBreakpoints()
- */
- public IBreakpoint[] getBreakpoints() {
- Vector breakpoints= getBreakpoints0();
- IBreakpoint[] temp= new IBreakpoint[breakpoints.size()];
- breakpoints.copyInto(temp);
- return temp;
- }
-
- /**
- * The BreakpointManager waits to load the breakpoints
- * of the workspace until a request is made to retrieve the
- * breakpoints.
- */
- private Vector getBreakpoints0() {
- if (fBreakpoints == null) {
- initializeBreakpoints();
- }
- return fBreakpoints;
- }
-
- /**
- * @see IBreakpointManager#getBreakpoints(String)
- */
- public IBreakpoint[] getBreakpoints(String modelIdentifier) {
- Vector allBreakpoints= getBreakpoints0();
- ArrayList temp= new ArrayList(allBreakpoints.size());
- Iterator breakpoints= allBreakpoints.iterator();
- while (breakpoints.hasNext()) {
- IBreakpoint breakpoint= (IBreakpoint) breakpoints.next();
- String id= breakpoint.getModelIdentifier();
- if (id != null && id.equals(modelIdentifier)) {
- temp.add(breakpoint);
- }
- }
- return (IBreakpoint[]) temp.toArray(new IBreakpoint[temp.size()]);
- }
-
- /**
- * Loads the list of breakpoints from the breakpoint markers in the
- * workspace. Start listening to resource deltas.
- */
- private void initializeBreakpoints() {
- setBreakpoints(new Vector(10));
- try {
- loadBreakpoints(getWorkspace().getRoot(), false);
- getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_BUILD);
- } catch (CoreException ce) {
- DebugPlugin.log(ce);
- setBreakpoints(new Vector(0));
- }
- }
-
- /**
- * @see IBreakpointManager#isRegistered(IBreakpoint)
- */
- public boolean isRegistered(IBreakpoint breakpoint) {
- return getBreakpoints0().contains(breakpoint);
- }
-
-
- /**
- * @see IBreakpointManager#removeBreakpoint(IBreakpoint, boolean)
- */
- public void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException {
- removeBreakpoints(new IBreakpoint[]{breakpoint}, delete);
- }
-
- /**
- * @see IBreakpointManager#removeBreakpoints(IBreakpoint[], boolean)
- */
- public void removeBreakpoints(IBreakpoint[] breakpoints, final boolean delete) throws CoreException {
- final List remove = new ArrayList(breakpoints.length);
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- if (getBreakpoints0().contains(breakpoint)) {
- remove.add(breakpoint);
- }
- }
- if (!remove.isEmpty()) {
- Iterator iter = remove.iterator();
- while (iter.hasNext()) {
- IBreakpoint breakpoint = (IBreakpoint)iter.next();
- getBreakpoints0().remove(breakpoint);
- fMarkersToBreakpoints.remove(breakpoint.getMarker());
- }
- fireUpdate(remove, null, REMOVED);
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
- public void run(IProgressMonitor montitor) throws CoreException {
- Iterator innerIter = remove.iterator();
- while (innerIter.hasNext()) {
- IBreakpoint breakpoint = (IBreakpoint)innerIter.next();
- if (delete) {
- breakpoint.delete();
- } else {
- // if the breakpoint is being removed from the manager
- // because the project is closing, the breakpoint should
- // remain as registered, otherwise, the breakpoint should
- // be marked as deregistered
- IMarker marker = breakpoint.getMarker();
- if (marker.exists()) {
- IProject project = breakpoint.getMarker().getResource().getProject();
- if (project == null || project.isOpen()) {
- breakpoint.setRegistered(false);
- }
- }
- }
- }
- }
- };
- getWorkspace().run(r, null, 0, null);
- }
- }
-
- /**
- * Create a breakpoint for the given marker. The created breakpoint
- * is of the type specified in the breakpoint extension associated
- * with the given marker type.
- *
- * @return a breakpoint on this marker
- * @exception DebugException if breakpoint creation fails. Reasons for
- * failure include:
- * <ol>
- * <li>The breakpoint manager cannot determine what kind of breakpoint
- * to instantiate for the given marker type</li>
- * <li>A lower level exception occurred while accessing the given marker</li>
- * </ol>
- */
- private IBreakpoint createBreakpoint(IMarker marker) throws DebugException {
- IBreakpoint breakpoint= (IBreakpoint) fMarkersToBreakpoints.get(marker);
- if (breakpoint != null) {
- return breakpoint;
- }
- try {
- IConfigurationElement config = (IConfigurationElement)fBreakpointExtensions.get(marker.getType());
- if (config == null) {
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.CONFIGURATION_INVALID, MessageFormat.format(DebugCoreMessages.getString("BreakpointManager.Missing_breakpoint_definition"), new String[] {marker.getType()}), null)); //$NON-NLS-1$
- }
- Object object = config.createExecutableExtension(CLASS);
- if (object instanceof IBreakpoint) {
- breakpoint = (IBreakpoint)object;
- breakpoint.setMarker(marker);
- } else {
- invalidBreakpointExtension(MessageFormat.format(DebugCoreMessages.getString("BreakpointManager.Class_{0}_specified_by_breakpoint_extension_{1}_does_not_implement_required_interface_IBreakpoint._3"), new String[]{config.getAttribute(CLASS), config.getDeclaringExtension().getUniqueIdentifier()})); //$NON-NLS-1$
- }
- return breakpoint;
- } catch (CoreException e) {
- throw new DebugException(e.getStatus());
- }
- }
-
- /**
- * @see IBreakpointManager#addBreakpoint(IBreakpoint)
- */
- public void addBreakpoint(IBreakpoint breakpoint) throws CoreException {
- addBreakpoints(new IBreakpoint[]{breakpoint});
- }
-
- /**
- * @see IBreakpointManager#addBreakpoints(IBreakpoint[])
- */
- public void addBreakpoints(IBreakpoint[] breakpoints) throws CoreException {
- addBreakpoints(breakpoints, true, false);
- }
-
- /**
- * Registers the given breakpoints and notifies listeners if specified.
- *
- * @param breakpoints the breakpoints to register
- * @param notify whether to notify listeners of the add
- * @param loading whether the given breakpoints are being automatically loaded
- * from previously persisted markers
- */
- private void addBreakpoints(IBreakpoint[] breakpoints, boolean notify, final boolean loading) throws CoreException {
- List added = new ArrayList(breakpoints.length);
- final List update = new ArrayList();
- final String autoGroup = getAutoGroup();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- if (!getBreakpoints0().contains(breakpoint)) {
- verifyBreakpoint(breakpoint);
- if (autoGroup == null && breakpoint.isRegistered()) {
- // If notify == false, the breakpoints are just being added at startup
- added.add(breakpoint);
- getBreakpoints0().add(breakpoint);
- fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint);
- } else {
- // need to update the 'registered' and/or 'group' attributes
- update.add(breakpoint);
- }
- }
- }
- if (notify) {
- fireUpdate(added, null, ADDED);
- }
- if (!update.isEmpty()) {
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- Iterator iter = update.iterator();
- while (iter.hasNext()) {
- IBreakpoint breakpoint = (IBreakpoint)iter.next();
- getBreakpoints0().add(breakpoint);
- breakpoint.setRegistered(true);
- if (!loading && autoGroup != null && autoGroup.length() > 0 && breakpoint.getGroup() == null) {
- breakpoint.setGroup(autoGroup);
- }
- fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint);
- }
- }
- };
- // Need to suppress change notification, since this is really
- // an add notification
- fSuppressChange.addAll(update);
- getWorkspace().run(r, null, 0, null);
- fSuppressChange.removeAll(update);
- if (notify) {
- fireUpdate(update, null, ADDED);
- }
- }
- }
-
- /**
- * Returns whether change notification is to be suppressed for the given breakpoint.
- * Used when adding breakpoints and changing the "REGISTERED" attribute.
- *
- * @param breakpoint
- * @return boolean whether change notification is suppressed
- */
- protected boolean isChangeSuppressed(IBreakpoint breakpoint) {
- return fSuppressChange.contains(breakpoint);
- }
-
- /**
- * @see IBreakpointManager#fireBreakpointChanged(IBreakpoint)
- */
- public void fireBreakpointChanged(IBreakpoint breakpoint) {
- if (getBreakpoints0().contains(breakpoint)) {
- List changed = new ArrayList();
- changed.add(breakpoint);
- fireUpdate(changed, null, CHANGED);
- }
- }
-
- /**
- * Verifies that the breakpoint marker has the minimal required attributes,
- * and throws a debug exception if not.
- */
- private void verifyBreakpoint(IBreakpoint breakpoint) throws DebugException {
- try {
- String id= breakpoint.getModelIdentifier();
- if (id == null) {
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.CONFIGURATION_INVALID, DebugCoreMessages.getString("BreakpointManager.Missing_model_identifier"), null)); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- throw new DebugException(e.getStatus());
- }
- }
-
- /**
- * A resource has changed. Traverses the delta for breakpoint changes.
- */
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta delta= event.getDelta();
- if (delta != null) {
- try {
- if (fgVisitor == null) {
- fgVisitor= new BreakpointManagerVisitor();
- }
- delta.accept(fgVisitor);
- fgVisitor.update();
- } catch (CoreException ce) {
- DebugPlugin.log(ce);
- }
- }
- }
-
- /**
- * Visitor for handling resource deltas
- */
- class BreakpointManagerVisitor implements IResourceDeltaVisitor {
- /**
- * Moved markers
- */
- private List fMoved = new ArrayList();
- /**
- * Removed breakpoints
- */
- private List fRemoved = new ArrayList();
- /**
- * Changed breakpoints and associated marker deltas
- */
- private List fChanged = new ArrayList();
- private List fChangedDeltas = new ArrayList();
-
- /**
- * Resets the visitor for a delta traversal - empties
- * collections of removed/changed breakpoints.
- */
- protected void reset() {
- fMoved.clear();
- fRemoved.clear();
- fChanged.clear();
- fChangedDeltas.clear();
- }
-
- /**
- * Performs updates on accumlated changes, and fires change notification after
- * a traversal. Accumlated updates are reset.
- */
- public void update() {
- if (!fMoved.isEmpty()) {
- // delete moved markers
- IWorkspaceRunnable wRunnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IMarker[] markers = (IMarker[])fMoved.toArray(new IMarker[fMoved.size()]);
- for (int i = 0; i < markers.length; i++) {
- markers[i].delete();
- }
- }
- };
- try {
- getWorkspace().run(wRunnable, null, 0, null);
- } catch (CoreException e) {
- }
- }
- if (!fRemoved.isEmpty()) {
- try {
- removeBreakpoints((IBreakpoint[])fRemoved.toArray(new IBreakpoint[fRemoved.size()]), false);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- if (!fChanged.isEmpty()) {
- fireUpdate(fChanged, fChangedDeltas, CHANGED);
- }
- reset();
- }
-
- /**
- * @see IResourceDeltaVisitor#visit(IResourceDelta)
- */
- public boolean visit(IResourceDelta delta) {
- if (delta == null) {
- return false;
- }
- if (0 != (delta.getFlags() & IResourceDelta.OPEN) && 0 == (delta.getFlags() & IResourceDelta.MOVED_FROM)) {
- handleProjectResourceOpenStateChange(delta.getResource());
- return false;
- }
- IMarkerDelta[] markerDeltas= delta.getMarkerDeltas();
- for (int i= 0; i < markerDeltas.length; i++) {
- IMarkerDelta markerDelta= markerDeltas[i];
- if (markerDelta.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
- switch (markerDelta.getKind()) {
- case IResourceDelta.ADDED :
- handleAddBreakpoint(delta, markerDelta.getMarker());
- break;
- case IResourceDelta.REMOVED :
- handleRemoveBreakpoint(markerDelta.getMarker());
- break;
- case IResourceDelta.CHANGED :
- handleChangeBreakpoint(markerDelta.getMarker(), markerDelta);
- break;
- }
- }
- }
-
- return true;
- }
-
- /**
- * Wrapper for handling adds
- */
- protected void handleAddBreakpoint(IResourceDelta rDelta, final IMarker marker) {
- if (0 != (rDelta.getFlags() & IResourceDelta.MOVED_FROM)) {
- // This breakpoint has actually been moved - already removed
- // from the Breakpoint manager during the remove callback.
- // Schedule the marker associated with the new resource for deletion.
- if (getBreakpoint(marker) == null) {
- fMoved.add(marker);
- }
- } else {
- // do nothing - we do not add until explicitly added
- }
- }
-
- /**
- * Wrapper for handling removes
- */
- protected void handleRemoveBreakpoint(IMarker marker) {
- IBreakpoint breakpoint= getBreakpoint(marker);
- if (breakpoint != null) {
- fRemoved.add(breakpoint);
- }
- }
-
- /**
- * Wrapper for handling changes
- */
- protected void handleChangeBreakpoint(IMarker marker, IMarkerDelta delta) {
- final IBreakpoint breakpoint= getBreakpoint(marker);
- if (breakpoint != null && isRegistered(breakpoint) && !isChangeSuppressed(breakpoint)) {
- fChanged.add(breakpoint);
- fChangedDeltas.add(delta);
- }
- }
-
- /**
- * A project has been opened or closed. Updates the breakpoints for
- * that project
- */
- private void handleProjectResourceOpenStateChange(final IResource project) {
- if (!project.isAccessible()) {
- //closed
- Enumeration breakpoints= ((Vector)getBreakpoints0().clone()).elements();
- while (breakpoints.hasMoreElements()) {
- IBreakpoint breakpoint= (IBreakpoint) breakpoints.nextElement();
- IResource markerResource= breakpoint.getMarker().getResource();
- if (project.getFullPath().isPrefixOf(markerResource.getFullPath())) {
- fRemoved.add(breakpoint);
- }
- }
- return;
- }
- try {
- loadBreakpoints(project, true);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- }
-
- /**
- * @see IBreakpointManager#addBreakpointListener(IBreakpointListener)
- */
- public void addBreakpointListener(IBreakpointListener listener) {
- fBreakpointListeners.add(listener);
- }
-
- /**
- * @see IBreakpointManager#removeBreakpointListener(IBreakpointListener)
- */
- public void removeBreakpointListener(IBreakpointListener listener) {
- fBreakpointListeners.remove(listener);
- }
-
- /**
- * Notifies listeners of the adds/removes/changes
- *
- * @param breakpoints associated breakpoints
- * @param deltas or <code>null</code>
- * @param update type of change
- */
- private void fireUpdate(List breakpoints, List deltas, int update) {
- if (breakpoints.isEmpty()) {
- return;
- }
- IBreakpoint[] bpArray = (IBreakpoint[])breakpoints.toArray(new IBreakpoint[breakpoints.size()]);
- IMarkerDelta[] deltaArray = new IMarkerDelta[bpArray.length];
- if (deltas != null) {
- deltaArray = (IMarkerDelta[])deltas.toArray(deltaArray);
- }
- // single listeners
- getBreakpointNotifier().notify(bpArray, deltaArray, update);
-
- // multi listeners
- getBreakpointsNotifier().notify(bpArray, deltaArray, update);
- }
-
- protected void setBreakpoints(Vector breakpoints) {
- fBreakpoints = breakpoints;
- }
-
- /**
- * @see IBreakpointManager#hasBreakpoints()
- */
- public boolean hasBreakpoints() {
- return !getBreakpoints0().isEmpty();
- }
-
- /**
- * @see org.eclipse.debug.core.IBreakpointManager#addBreakpointListener(org.eclipse.debug.core.IBreakpointsListener)
- */
- public void addBreakpointListener(IBreakpointsListener listener) {
- fBreakpointsListeners.add(listener);
- }
-
- /**
- * @see org.eclipse.debug.core.IBreakpointManager#removeBreakpointListener(org.eclipse.debug.core.IBreakpointsListener)
- */
- public void removeBreakpointListener(IBreakpointsListener listener) {
- fBreakpointsListeners.remove(listener);
- }
-
- private BreakpointNotifier getBreakpointNotifier() {
- return new BreakpointNotifier();
- }
-
- /**
- * Notifies breakpoint listener (single breakpoint) in a safe runnable to
- * handle exceptions.
- */
- class BreakpointNotifier implements ISafeRunnable {
-
- private IBreakpointListener fListener;
- private int fType;
- private IMarkerDelta fDelta;
- private IBreakpoint fBreakpoint;
-
- /**
- * @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, DebugCoreMessages.getString("BreakpointManager.An_exception_occurred_during_breakpoint_change_notification._4"), exception); //$NON-NLS-1$
- DebugPlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- switch (fType) {
- case ADDED:
- fListener.breakpointAdded(fBreakpoint);
- break;
- case REMOVED:
- fListener.breakpointRemoved(fBreakpoint, fDelta);
- break;
- case CHANGED:
- fListener.breakpointChanged(fBreakpoint, fDelta);
- break;
- }
- }
-
- /**
- * Notifies the listeners of the add/change/remove
- *
- * @param breakpoints the breakpoints that changed
- * @param deltas the deltas associated with the change
- * @param update the type of change
- */
- public void notify(IBreakpoint[] breakpoints, IMarkerDelta[] deltas, int update) {
- fType = update;
- Object[] copiedListeners= fBreakpointListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IBreakpointListener)copiedListeners[i];
- for (int j = 0; j < breakpoints.length; j++) {
- fBreakpoint = breakpoints[j];
- fDelta = deltas[j];
- Platform.run(this);
- }
- }
- fListener = null;
- fDelta = null;
- fBreakpoint = null;
- }
- }
-
- private BreakpointsNotifier getBreakpointsNotifier() {
- return new BreakpointsNotifier();
- }
-
- /**
- * Notifies breakpoint listener (multiple breakpoints) in a safe runnable to
- * handle exceptions.
- */
- class BreakpointsNotifier implements ISafeRunnable {
-
- private IBreakpointsListener fListener;
- private int fType;
- private IMarkerDelta[] fDeltas;
- private IBreakpoint[] fNotifierBreakpoints;
-
- /**
- * @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, DebugCoreMessages.getString("BreakpointManager.An_exception_occurred_during_breakpoint_change_notification._5"), exception); //$NON-NLS-1$
- DebugPlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- switch (fType) {
- case ADDED:
- fListener.breakpointsAdded(fNotifierBreakpoints);
- break;
- case REMOVED:
- fListener.breakpointsRemoved(fNotifierBreakpoints, fDeltas);
- break;
- case CHANGED:
- fListener.breakpointsChanged(fNotifierBreakpoints, fDeltas);
- break;
- }
- }
-
- /**
- * Notifies the listeners of the adds/changes/removes
- *
- * @param breakpoints the breakpoints that changed
- * @param deltas the deltas associated with the changed breakpoints
- * @param update the type of change
- */
- public void notify(IBreakpoint[] breakpoints, IMarkerDelta[] deltas, int update) {
- fType = update;
- fNotifierBreakpoints = breakpoints;
- fDeltas = deltas;
- Object[] copiedListeners = fBreakpointsListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IBreakpointsListener)copiedListeners[i];
- Platform.run(this);
- }
- fDeltas = null;
- fNotifierBreakpoints = null;
- fListener = null;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManager#isEnabled()
- */
- public boolean isEnabled() {
- return fEnabled;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManager#setEnabled(boolean)
- */
- public void setEnabled(final boolean enabled) {
- if (fEnabled != enabled) {
- fEnabled= enabled;
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IBreakpoint[] breakpoints = getBreakpoints();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- breakpoint.getMarker().setAttribute(IBreakpoint.SKIP, !enabled);
- }
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE ,null);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- new BreakpointManagerNotifier().notify(enabled);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManager#addBreakpointManagerListener(org.eclipse.debug.core.IBreakpointManagerListener)
- */
- public void addBreakpointManagerListener(IBreakpointManagerListener listener) {
- fBreakpointManagerListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManager#removeBreakpointManagerListener(org.eclipse.debug.core.IBreakpointManagerListener)
- */
- public void removeBreakpointManagerListener(IBreakpointManagerListener listener) {
- fBreakpointManagerListeners.remove(listener);
- }
-
- /**
- * Notifies breakpoint manager listeners in a safe runnable to
- * handle exceptions.
- */
- class BreakpointManagerNotifier implements ISafeRunnable {
-
- private IBreakpointManagerListener fListener;
- private boolean fManagerEnabled;
-
- /**
- * @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, DebugCoreMessages.getString("BreakpointManager.An_exception_occurred_during_breakpoint_change_notification._5"), exception); //$NON-NLS-1$
- DebugPlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- fListener.breakpointManagerEnablementChanged(fManagerEnabled);
- }
-
- /**
- * Notifies the listeners of the adds/changes/removes
- *
- * @param breakpoints the breakpoints that changed
- * @param deltas the deltas associated with the changed breakpoints
- * @param update the type of change
- */
- public void notify(boolean enabled) {
- fManagerEnabled= enabled;
- Object[] copiedListeners = fBreakpointManagerListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IBreakpointManagerListener)copiedListeners[i];
- Platform.run(this);
- }
- fListener = null;
- }
- }
-
- class BreakpointManagerJob extends Job {
-
- private final IWorkspaceRunnable fRunnable;
-
- public BreakpointManagerJob (IWorkspaceRunnable wRunnable) {
- super("breakpoint manager job"); //$NON-NLS-1$
- fRunnable= wRunnable;
- setSystem(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- try {
- getWorkspace().run(fRunnable, null, 0, null);
- } catch (CoreException ce) {
- DebugPlugin.log(ce);
- }
- return new Status(IStatus.OK, DebugPlugin.getUniqueIdentifier(), IStatus.OK, "", null); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManager#getTypeName(org.eclipse.debug.core.model.IBreakpoint)
- */
- public String getTypeName(IBreakpoint breakpoint) {
- String typeName= null;
- IMarker marker = breakpoint.getMarker();
- if (marker != null) {
- try {
- IConfigurationElement element = (IConfigurationElement) fBreakpointExtensions.get(marker.getType());
- if (element != null) {
- typeName= element.getAttribute(TYPE_NAME);
- }
- } catch (CoreException e) {
- }
- }
- return typeName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManager#setAutoGroup(java.lang.String)
- */
- public void setAutoGroup(String group) {
- if (group == null) {
- group= ""; //$NON-NLS-1$
- }
- DebugPlugin.getDefault().getPluginPreferences().setValue(PREF_AUTO_GROUP, group);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManager#getAutoGroup()
- */
- public String getAutoGroup() {
- return DebugPlugin.getDefault().getPluginPreferences().getString(PREF_AUTO_GROUP);
- }
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ContributedDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ContributedDelegate.java
deleted file mode 100644
index 3caf3a72c..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ContributedDelegate.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-import java.text.MessageFormat;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-
-/**
- * A placeholder for a launch delegate contributed for a launch mode for an
- * existing launch configuration type.
- */
-public class ContributedDelegate {
-
- /**
- * The configuration element of the extension.
- */
- private IConfigurationElement fElement;
-
- /**
- * Modes this delegate supports.
- */
- private Set fModes;
-
- /**
- * Delegate, or <code>null</code> if not yet instantiated.
- */
- private ILaunchConfigurationDelegate fDelegate;
-
- /**
- * Constructs a new contributed delegate on the
- * given configuration element.
- *
- * @param element configuration element
- */
- protected ContributedDelegate(IConfigurationElement element) {
- setConfigurationElement(element);
- }
-
- /**
- * Sets this delegate's configuration element.
- *
- * @param element this delegate's configuration element
- */
- private void setConfigurationElement(IConfigurationElement element) {
- fElement = element;
- }
-
- /**
- * Returns this delegate's configuration element.
- *
- * @return this delegate's configuration element
- */
- protected IConfigurationElement getConfigurationElement() {
- return fElement;
- }
-
- /**
- * Returns the set of modes specified in the configuration data.
- *
- * @return the set of modes specified in the configuration data
- */
- protected Set getModes() {
- if (fModes == null) {
- String modes= getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$
- if (modes == null) {
- return new HashSet(0);
- }
- String[] strings = modes.split(","); //$NON-NLS-1$
- fModes = new HashSet(3);
- for (int i = 0; i < strings.length; i++) {
- String string = strings[i];
- fModes.add(string.trim());
- }
- }
- return fModes;
- }
-
- /**
- * Returns the type identifier of launch configuration type this delegate is
- * contributed to.
- */
- protected String getLaunchConfigurationType() {
- return getConfigurationElement().getAttribute("type"); //$NON-NLS-1$
- }
-
- protected ILaunchConfigurationDelegate getDelegate() throws CoreException {
- if (fDelegate == null) {
- Object object = getConfigurationElement().createExecutableExtension("delegate"); //$NON-NLS-1$
- if (object instanceof ILaunchConfigurationDelegate) {
- fDelegate = (ILaunchConfigurationDelegate)object;
- } else {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationType.Launch_delegate_for_{0}_does_not_implement_required_interface_ILaunchConfigurationDelegate._1"), new String[]{getIdentifier()}), null)); //$NON-NLS-1$
- }
- }
- return fDelegate;
- }
-
- /**
- * Returns the identifier of this extension point.
- */
- protected String getIdentifier() {
- return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
deleted file mode 100644
index f5fa326f4..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class DebugCoreMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.debug.internal.core.DebugCoreMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private DebugCoreMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
deleted file mode 100644
index 2d3cdc1ac..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
+++ /dev/null
@@ -1,106 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-Breakpoint.no_associated_marker=Breakpoint does not have an associated marker.
-
-BreakpointManager.Missing_breakpoint_definition=Missing breakpoint definition for marker type {0}
-BreakpointManager.Missing_model_identifier=Breakpoint missing debug model identifier
-BreakpointManager.Breakpoint_extension_{0}_missing_required_attribute__markerType_1=Breakpoint extension {0} missing required attribute: markerType
-BreakpointManager.Breakpoint_extension_{0}_missing_required_attribute__class_2=Breakpoint extension {0} missing required attribute: class
-BreakpointManager.Class_{0}_specified_by_breakpoint_extension_{1}_does_not_implement_required_interface_IBreakpoint._3=Class {0} specified by breakpoint extension {1} does not implement required interface IBreakpoint.
-BreakpointManager.An_exception_occurred_during_breakpoint_change_notification._4=An exception occurred during breakpoint change notification.
-BreakpointManager.An_exception_occurred_during_breakpoint_change_notification._5=An exception occurred during breakpoint change notification.
-
-DebugEvent.illegal_detail=detail is not one of the allowed constants, see IDebugEventConstants
-DebugEvent.illegal_kind=kind is not one of the allowed constants, see IDebugEventConstants
-
-DebugPlugin.Invalid_status_handler_extension__{0}_2=Invalid status handler extension: {0}
-DebugPlugin.Debug_async_queue_1=Debug async queue
-DebugPlugin.Exception_occurred_executing_command_line._1=Exception occurred executing command line.
-DebugPlugin.Eclipse_runtime_does_not_support_working_directory_2=Eclipse runtime does not support working directory
-DebugPlugin.Registered_status_handler_{0}_does_not_implement_required_interface_IStatusHandler._1=Registered status handler {0} does not implement required interface IStatusHandler.
-DebugPlugin.An_exception_occurred_while_dispatching_debug_events._2=An exception occurred while dispatching debug events.
-DebugPlugin.An_exception_occurred_while_filtering_debug_events._3=An exception occurred while filtering debug events.
-DebugPlugin.31=Invalid process factory extension contributed by {0}; id: {1}
-DebugPlugin.0=Exception processing debug async queue
-DebugPlugin.1=Debug Event Dispatch
-
-EnvironmentVariableResolver.0=Environment variable not specified
-
-InputStreamMonitor.label=Input Stream Monitor
-
-Launch.terminate_failed=Terminate failed
-
-LaunchConfiguration.Exception_occurred_creating_launch_configuration_memento_9=Exception occurred creating launch configuration memento
-LaunchConfiguration.Exception_occurred_parsing_memento_5=Exception occurred parsing memento
-LaunchConfiguration.Failed_to_delete_launch_configuration._1=Failed to delete launch configuration.
-LaunchConfiguration.Invalid_launch_configuration_memento__missing_path_attribute_3=Invalid launch configuration memento: missing path attribute
-LaunchConfiguration.Invalid_launch_configuration_memento__missing_local_attribute_4=Invalid launch configuration memento: missing local attribute
-LaunchConfiguration.Unable_to_restore_location_for_launch_configuration_from_memento__{0}_1=Unable to restore location for launch configuration from memento: {0}
-LaunchConfiguration.Unable_to_generate_memento_for_{0},_shared_file_does_not_exist._1=Unable to generate memento for {0}, shared file does not exist.
-LaunchConfiguration.13=Incompatible launch mode: expecting {0} instead of {1}
-LaunchConfigurationDelegate.6=Searching for errors
-LaunchConfigurationDelegate.7=Searching for errors in
-
-LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_boolean._3=Attribute {0} is not of type boolean.
-LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_int._2=Attribute {0} is not of type int.
-LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.lang.String._1=Attribute {0} is not of type java.lang.String.
-LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.List._1=Attribute {0} is not of type java.util.List.
-LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.Map._1=Attribute {0} is not of type java.util.Map.
-LaunchConfigurationInfo.Invalid_launch_configuration_XML._10=Invalid launch configuration XML.
-LaunchConfigurationInfo.missing_type=Launch configuration type id \"{0}\" does not exist.\nPossible causes:\n\tMissing specification of a launch type (missing plug-in)\n\tIncorrect launch configuration XML
-LaunchConfigurationInfo.36=A null key has been specified for an attribute in this launch configuration
-
-LaunchConfigurationWorkingCopy.{0}_occurred_generating_launch_configuration_XML._1={0} occurred generating launch configuration XML.
-LaunchConfigurationWorkingCopy.Specified_container_for_launch_configuration_does_not_exist_2=Specified container for launch configuration does not exist
-LaunchConfigurationWorkingCopy.5=Unable to save launch configuration.
-
-LaunchManager.{0}_occurred_while_reading_launch_configuration_file_{1}._1={0} occurred while reading launch configuration file: {1}.
-LaunchManager.Invalid_launch_configuration_index._18=Invalid launch configuration index.
-LaunchManager.Invalid_source_locator_extentsion_defined_by_plug-in___{0}______id___not_specified_12=Invalid source locator extension defined by plug-in \"{0}\": \"id\" not specified
-LaunchManager.does_not_exist=Launch configuration {0} at {1} does not exist.
-LaunchManager.Source_locator_does_not_exist__{0}_13=Source locator does not exist: {0}
-LaunchManager.Invalid_launch_configuration_comparator_extension_defined_by_plug-in_{0}_-_attribute_not_specified_1=Invalid launch configuration comparator extension defined by plug-in {0} - attribute not specified
-LaunchManager.An_exception_occurred_during_launch_change_notification._1=An exception occurred during launch change notification.
-LaunchManager.An_exception_occurred_during_launch_configuration_change_notification._3=An exception occurred during launch configuration change notification.
-LaunchManager.30=Unable to retrieve shared launch configuration file for {0}
-
-LaunchMode.1=Required attribute {0} missing for launchMode extension.
-
-LogicalStructureType.7=Required attribute {0} missing for logicalStructureType extension.
-LogicalStructureType.0=<Missing Description>
-LogicalStructureProvider.0=Required attribute modelIdentifier missing for logicalStructureType extension.
-LogicalStructureProvider.1=Required attribute class missing for logicalStructureType extension.
-
-OutputStreamMonitor.label=Output Stream Monitor
-
-ProcessMonitorJob.0=Process monitor
-
-RuntimeProcess.terminate_failed=Terminate failed
-RuntimeProcess.Exit_value_not_available_until_process_terminates._1=Exit value not available until process terminates.
-
-ExpressionManager.An_exception_occurred_during_expression_change_notification._1=An exception occurred during expression change notification.
-
-LaunchConfigurationType.Launch_delegate_for_{0}_does_not_implement_required_interface_ILaunchConfigurationDelegate._1=Launch delegate for {0} does not implement required interface ILaunchConfigurationDelegate.
-LaunchConfigurationType.9=Launch mode {0} not supported for configuration type {1}
-LaunchConfigurationType.10=Launch delegate not registered for configuration type {0}, mode {1}
-
-MemoryRenderingManager.ErrorMsg = The selected rendering cannot be created: {0}
-WatchExpression.0=(Watch expressions not supported)
-NullStreamsProxy.0=Null Stream Monitor
-SourceLookupUtils.3=
-SourceLookupUtils.4=
-SourceLookupUtils.5=
-SourceLookupUtils.6=
-SourceLookupUtils.7=
-SourceLookupUtils.8=
-SourceLookupUtils.9=
-SourceLookupUtils.10=
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugElement.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugElement.java
deleted file mode 100644
index 53fd618f7..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugElement.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-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.IDebugElement;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IStepFilters;
-
-/**
- * Implementation of common function for debug elements.
- * <p>
- * Clients may subclass this class.
- * TODO: in progress, make API
- * </p>
- * @since 3.1
- */
-public abstract class DebugElement extends PlatformObject implements IDebugElement {
-
- private IDebugTarget fTarget;
-
- /**
- * Constructs a debug element referring to an artifact in the given
- * debug target.
- *
- * @param target debug target containing this element
- */
- public DebugElement(IDebugTarget target) {
- fTarget = target;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
- */
- public IDebugTarget getDebugTarget() {
- return fTarget;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
- */
- public ILaunch getLaunch() {
- return getDebugTarget().getLaunch();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IDebugElement.class) {
- return this;
- }
- if (adapter == IStepFilters.class) {
- return getDebugTarget();
- }
- if (adapter == IDebugTarget.class) {
- return getDebugTarget();
- }
- if (adapter == ILaunch.class) {
- return getLaunch();
- }
- if (adapter == IProcess.class) {
- return getDebugTarget().getProcess();
- }
- return super.getAdapter(adapter);
- }
-
- /**
- * Fires a debug event.
- *
- * @param event debug event to fire
- */
- protected void fireEvent(DebugEvent event) {
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
- }
-
- /**
- * Fires a change event for this debug element
- * with the specified detail code.
- *
- * @param detail detail code for the change event,
- * such as <code>DebugEvent.STATE</code> or <code>DebugEvent.CONTENT</code>
- */
- public void fireChangeEvent(int detail) {
- fireEvent(new DebugEvent(this, DebugEvent.CHANGE, detail));
- }
-
- /**
- * Fires a creation event for this debug element.
- */
- protected void fireCreationEvent() {
- fireEvent(new DebugEvent(this, DebugEvent.CREATE));
- }
-
- /**
- * Fires a resume for this debug element with
- * the specified detail code.
- *
- * @param detail detail code for the resume event, such
- * as <code>DebugEvent.STEP_OVER</code>
- */
- protected void fireResumeEvent(int detail) {
- fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail));
- }
-
- /**
- * Fires a suspend event for this debug element with
- * the specified detail code.
- *
- * @param detail detail code for the suspend event, such
- * as <code>DebugEvent.BREAKPOINT</code>
- */
- protected void fireSuspendEvent(int detail) {
- fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail));
- }
-
- /**
- * Fires a terminate event for this debug element.
- */
- protected void fireTerminateEvent() {
- fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java
deleted file mode 100644
index e92c73a2c..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.debug.internal.core;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-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.osgi.service.environment.Constants;
-
-/**
- * Resolves the value of environment variables.
- */
-public class EnvironmentVariableResolver implements IDynamicVariableResolver {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IDynamicVariableResolver#resolveValue(org.eclipse.core.variables.IDynamicVariable, java.lang.String)
- */
- public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
- if (argument == null) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), IStatus.ERROR, DebugCoreMessages.getString("EnvironmentVariableResolver.0"), null)); //$NON-NLS-1$
- }
- Map map= DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment();
- if (Platform.getOS().equals(Constants.OS_WIN32)) {
- // On Win32, env variables are case insensitive, so we uppercase everything
- // for map matches
- argument= argument.toUpperCase();
- }
- return (String) map.get(argument);
- }
-
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
deleted file mode 100644
index 7e7c49cc9..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
+++ /dev/null
@@ -1,581 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.IExpressionListener;
-import org.eclipse.debug.core.IExpressionManager;
-import org.eclipse.debug.core.IExpressionsListener;
-import org.eclipse.debug.core.model.IExpression;
-import org.eclipse.debug.core.model.IWatchExpression;
-import org.eclipse.debug.core.model.IWatchExpressionDelegate;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * The expression manager manages all registered expressions
- * for the debug plugin. It is instantiated by the debug plugin
- * at startup.
- *
- * @see IExpressionManager
- */
-public class ExpressionManager implements IExpressionManager, IDebugEventSetListener {
-
- /**
- * Collection of registered expressions.
- */
- private Vector fExpressions = null;
-
- /**
- * List of expression listeners
- */
- private ListenerList fListeners = null;
-
- /**
- * List of (multi) expressions listeners
- */
- private ListenerList fExpressionsListeners = null;
-
- /**
- * Mapping of debug model identifiers (String) to
- * expression delegate extensions (IConfigurationElement)
- */
- private Map fWatchExpressionDelegates= new HashMap();
-
- // Constants for add/remove/change notification
- private static final int ADDED = 1;
- private static final int CHANGED = 2;
- private static final int REMOVED = 3;
-
- // Preference for persisted watch expressions
- private static final String PREF_WATCH_EXPRESSIONS= "prefWatchExpressions"; //$NON-NLS-1$
- // Persisted watch expression XML tags
- private static final String WATCH_EXPRESSIONS_TAG= "watchExpressions"; //$NON-NLS-1$
- private static final String EXPRESSION_TAG= "expression"; //$NON-NLS-1$
- private static final String TEXT_TAG= "text"; //$NON-NLS-1$
- private static final String ENABLED_TAG= "enabled"; //$NON-NLS-1$
- // XML values
- private static final String TRUE_VALUE= "true"; //$NON-NLS-1$
- private static final String FALSE_VALUE= "false"; //$NON-NLS-1$
-
- public ExpressionManager() {
- loadPersistedExpressions();
- loadWatchExpressionDelegates();
- }
-
- /**
- * Loads the mapping of debug models to watch expression delegates
- * from the org.eclipse.debug.core.watchExpressionDelegates
- * extension point.
- */
- private void loadWatchExpressionDelegates() {
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), "watchExpressionDelegates"); //$NON-NLS-1$
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element = configurationElements[i];
- if (element.getName().equals("watchExpressionDelegate")) { //$NON-NLS-1$
- String debugModel = element.getAttribute("debugModel"); //$NON-NLS-1$
- if (debugModel == null || debugModel.length() == 0) {
- continue;
- }
- fWatchExpressionDelegates.put(debugModel, element);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IExpressionManager#newWatchExpressionDelegate(java.lang.String)
- */
- public IWatchExpressionDelegate newWatchExpressionDelegate(String debugModel) {
- try {
- IConfigurationElement element= (IConfigurationElement) fWatchExpressionDelegates.get(debugModel);
- if (element != null) {
- return (IWatchExpressionDelegate) element.createExecutableExtension("delegateClass"); //$NON-NLS-1$
- }
- return null;
- } catch (CoreException e) {
- DebugPlugin.log(e);
- return null;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IExpressionManager#hasWatchExpressionDelegate(java.lang.String)
- */
- public boolean hasWatchExpressionDelegate(String id) {
- IConfigurationElement element= (IConfigurationElement) fWatchExpressionDelegates.get(id);
- return element != null;
- }
-
- /**
- * Loads any persisted watch expresions from the preferences.
- * NOTE: It's important that no setter methods are called on
- * the watchpoints which will fire change events as this
- * will cause an infinite loop (see Bug 27281).
- */
- private void loadPersistedExpressions() {
- String expressionsString= DebugPlugin.getDefault().getPluginPreferences().getString(PREF_WATCH_EXPRESSIONS);
- if (expressionsString.length() == 0) {
- return;
- }
- Element root;
- try {
- root = DebugPlugin.parseDocument(expressionsString);
- } catch (CoreException e) {
- DebugPlugin.logMessage("An exception occurred while loading watch expressions.", e); //$NON-NLS-1$
- return;
- }
- if (!root.getNodeName().equals(WATCH_EXPRESSIONS_TAG)) {
- DebugPlugin.logMessage("Invalid format encountered while loading watch expressions.", null); //$NON-NLS-1$
- return;
- }
- NodeList list= root.getChildNodes();
- boolean expressionsAdded= false;
- for (int i= 0, numItems= list.getLength(); i < numItems; i++) {
- Node node= list.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element= (Element) node;
- if (!element.getNodeName().equals(EXPRESSION_TAG)) {
- DebugPlugin.logMessage(MessageFormat.format("Invalid XML element encountered while loading watch expressions: {0}", new String[] {node.getNodeName()}), null); //$NON-NLS-1$
- continue;
- }
- String expressionText= element.getAttribute(TEXT_TAG);
- if (expressionText.length() > 0) {
- boolean enabled= TRUE_VALUE.equals(element.getAttribute(ENABLED_TAG));
- IWatchExpression expression= newWatchExpression(expressionText, enabled);
- if (fExpressions == null) {
- fExpressions= new Vector(list.getLength());
- }
- fExpressions.add(expression);
- expressionsAdded= true;
- } else {
- DebugPlugin.logMessage("Invalid expression entry encountered while loading watch expressions. Expression text is empty.", null); //$NON-NLS-1$
- }
- }
- }
- if (expressionsAdded) {
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
- }
-
- /**
- * Creates a new watch expression with the given expression
- * and the given enablement;
- *
- * @param expressionText the text of the expression to be evaluated
- * @param enabled whether or not the new expression should be enabled
- * @return the new watch expression
- */
- private IWatchExpression newWatchExpression(String expressionText, boolean enabled) {
- return new WatchExpression(expressionText, enabled);
- }
-
- /**
- * @see IExpressionManager#newWatchExpression(String)
- */
- public IWatchExpression newWatchExpression(String expressionText) {
- return new WatchExpression(expressionText);
- }
-
- /**
- * Persists this manager's watch expressions as XML in the
- * preference store.
- */
- public void storeWatchExpressions() {
- Preferences prefs= DebugPlugin.getDefault().getPluginPreferences();
- String expressionString= ""; //$NON-NLS-1$
- try {
- expressionString= getWatchExpressionsAsXML();
- } catch (IOException e) {
- DebugPlugin.log(e);
- } catch (ParserConfigurationException e) {
- DebugPlugin.log(e);
- } catch (TransformerException e) {
- DebugPlugin.log(e);
- }
- prefs.setValue(PREF_WATCH_EXPRESSIONS, expressionString);
- DebugPlugin.getDefault().savePluginPreferences();
- }
-
- /**
- * Returns this manager's watch expressions as XML.
- * @return this manager's watch expressions as XML
- * @throws IOException if an exception occurs while creating
- * the XML document.
- * @throws ParserConfigurationException if an exception occurs while creating
- * the XML document.
- * @throws TransformerException if an exception occurs while creating
- * the XML document.
- */
- private String getWatchExpressionsAsXML() throws IOException, ParserConfigurationException, TransformerException {
- IExpression[] expressions= getExpressions();
- Document document= LaunchManager.getDocument();
- Element rootElement= document.createElement(WATCH_EXPRESSIONS_TAG);
- document.appendChild(rootElement);
- for (int i = 0; i < expressions.length; i++) {
- IExpression expression= expressions[i];
- if (expression instanceof IWatchExpression) {
- Element element= document.createElement(EXPRESSION_TAG);
- element.setAttribute(TEXT_TAG, expression.getExpressionText());
- element.setAttribute(ENABLED_TAG, ((IWatchExpression) expression).isEnabled() ? TRUE_VALUE : FALSE_VALUE);
- rootElement.appendChild(element);
- }
- }
- return LaunchManager.serializeDocument(document);
- }
-
- /**
- * @see IExpressionManager#addExpression(IExpression)
- */
- public void addExpression(IExpression expression) {
- addExpressions(new IExpression[]{expression});
- }
-
- /**
- * @see IExpressionManager#addExpressions(IExpression[])
- */
- public void addExpressions(IExpression[] expressions) {
- if (fExpressions == null) {
- fExpressions = new Vector(expressions.length);
- }
- boolean addedWatchExpression= false;
- boolean wasEmpty = fExpressions.isEmpty();
- List added = new ArrayList(expressions.length);
- for (int i = 0; i < expressions.length; i++) {
- IExpression expression = expressions[i];
- if (fExpressions.indexOf(expression) == -1) {
- added.add(expression);
- fExpressions.add(expression);
- if (expression instanceof IWatchExpression) {
- addedWatchExpression= true;
- }
- }
- }
- if (wasEmpty) {
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
- if (!added.isEmpty()) {
- fireUpdate((IExpression[])added.toArray(new IExpression[added.size()]), ADDED);
- }
- if (addedWatchExpression) {
- storeWatchExpressions();
- }
- }
-
- /**
- * @see IExpressionManager#getExpressions()
- */
- public IExpression[] getExpressions() {
- if (fExpressions == null) {
- return new IExpression[0];
- }
- IExpression[] temp= new IExpression[fExpressions.size()];
- fExpressions.copyInto(temp);
- return temp;
- }
-
- /**
- * @see IExpressionManager#getExpressions(String)
- */
- public IExpression[] getExpressions(String modelIdentifier) {
- if (fExpressions == null) {
- return new IExpression[0];
- }
- ArrayList temp= new ArrayList(fExpressions.size());
- Iterator iter= fExpressions.iterator();
- while (iter.hasNext()) {
- IExpression expression= (IExpression) iter.next();
- String id= expression.getModelIdentifier();
- if (id != null && id.equals(modelIdentifier)) {
- temp.add(expression);
- }
- }
- return (IExpression[]) temp.toArray(new IExpression[temp.size()]);
- }
-
- /**
- * @see IExpressionManager#removeExpression(IExpression)
- */
- public void removeExpression(IExpression expression) {
- removeExpressions(new IExpression[] {expression});
- }
-
- /**
- * @see IExpressionManager#removeExpressions(IExpression[])
- */
- public void removeExpressions(IExpression[] expressions) {
- if (fExpressions == null) {
- return;
- }
- List removed = new ArrayList(expressions.length);
- for (int i = 0; i < expressions.length; i++) {
- IExpression expression = expressions[i];
- if (fExpressions.remove(expression)) {
- removed.add(expression);
- expression.dispose();
- }
- }
- if (fExpressions.isEmpty()) {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- }
- if (!removed.isEmpty()) {
- fireUpdate((IExpression[])removed.toArray(new IExpression[removed.size()]), REMOVED);
- storeWatchExpressions();
- }
- }
-
- /**
- * @see IExpressionManager#addExpressionListener(IExpressionListener)
- */
- public void addExpressionListener(IExpressionListener listener) {
- if (fListeners == null) {
- fListeners = new ListenerList(2);
- }
- fListeners.add(listener);
- }
-
- /**
- * @see IExpressionManager#removeExpressionListener(IExpressionListener)
- */
- public void removeExpressionListener(IExpressionListener listener) {
- if (fListeners == null) {
- return;
- }
- fListeners.remove(listener);
- }
-
- /**
- * @see IDebugEventSetListener#handleDebugEvent(DebugEvent)
- */
- public void handleDebugEvents(DebugEvent[] events) {
- List changed = null;
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
- if (event.getSource() instanceof IExpression) {
- switch (event.getKind()) {
- case DebugEvent.CHANGE:
- if (changed == null) {
- changed = new ArrayList(1);
- }
- changed.add(event.getSource());
- break;
- default:
- break;
- }
- }
- }
- if (changed != null) {
- IExpression[] array = (IExpression[])changed.toArray(new IExpression[changed.size()]);
- fireUpdate(array, CHANGED);
- }
- }
-
- /**
- * The given watch expression has changed. Update the persisted
- * expressions to store this change.
- *
- * @param expression the changed expression
- */
- protected void watchExpressionChanged(IWatchExpression expression) {
- if (fExpressions != null && fExpressions.contains(expression)) {
- storeWatchExpressions();
- }
- }
-
- /**
- * Notifies listeners of the adds/removes/changes
- *
- * @param breakpoints associated breakpoints
- * @param deltas or <code>null</code>
- * @param update type of change
- */
- private void fireUpdate(IExpression[] expressions, int update) {
- // single listeners
- getExpressionNotifier().notify(expressions, update);
-
- // multi listeners
- getExpressionsNotifier().notify(expressions, update);
- }
-
- /**
- * @see IExpressionManager#hasExpressions()
- */
- public boolean hasExpressions() {
- return fExpressions != null && !fExpressions.isEmpty();
- }
-
- /**
- * @see org.eclipse.debug.core.IExpressionManager#addExpressionListener(org.eclipse.debug.core.IExpressionsListener)
- */
- public void addExpressionListener(IExpressionsListener listener) {
- if (fExpressionsListeners == null) {
- fExpressionsListeners = new ListenerList(2);
- }
- fExpressionsListeners.add(listener);
- }
-
- /**
- * @see org.eclipse.debug.core.IExpressionManager#removeExpressionListener(org.eclipse.debug.core.IExpressionsListener)
- */
- public void removeExpressionListener(IExpressionsListener listener) {
- if (fExpressionsListeners == null) {
- return;
- }
- fExpressionsListeners.remove(listener);
- }
-
- private ExpressionNotifier getExpressionNotifier() {
- return new ExpressionNotifier();
- }
-
- /**
- * Notifies an expression listener (single expression) in a safe runnable to
- * handle exceptions.
- */
- class ExpressionNotifier implements ISafeRunnable {
-
- private IExpressionListener fListener;
- private int fType;
- private IExpression fExpression;
-
- /**
- * @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, DebugCoreMessages.getString("ExpressionManager.An_exception_occurred_during_expression_change_notification._1"), exception); //$NON-NLS-1$
- DebugPlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- switch (fType) {
- case ADDED:
- fListener.expressionAdded(fExpression);
- break;
- case REMOVED:
- fListener.expressionRemoved(fExpression);
- break;
- case CHANGED:
- fListener.expressionChanged(fExpression);
- break;
- }
- }
-
- /**
- * Notifies listeners of the add/change/remove
- *
- * @param expression the expression that has changed
- * @param update the type of change
- */
- public void notify(IExpression[] expressions, int update) {
- if (fListeners != null) {
- fType = update;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IExpressionListener)copiedListeners[i];
- for (int j = 0; j < expressions.length; j++) {
- fExpression = expressions[j];
- Platform.run(this);
- }
- }
- }
- fListener = null;
- fExpression = null;
- }
- }
-
- private ExpressionsNotifier getExpressionsNotifier() {
- return new ExpressionsNotifier();
- }
-
- /**
- * Notifies an expression listener (multiple expressions) in a safe runnable
- * to handle exceptions.
- */
- class ExpressionsNotifier implements ISafeRunnable {
-
- private IExpressionsListener fListener;
- private int fType;
- private IExpression[] fNotifierExpressions;
-
- /**
- * @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, DebugCoreMessages.getString("ExpressionManager.An_exception_occurred_during_expression_change_notification._1"), exception); //$NON-NLS-1$
- DebugPlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- switch (fType) {
- case ADDED:
- fListener.expressionsAdded(fNotifierExpressions);
- break;
- case REMOVED:
- fListener.expressionsRemoved(fNotifierExpressions);
- break;
- case CHANGED:
- fListener.expressionsChanged(fNotifierExpressions);
- break;
- }
- }
-
- /**
- * Notifies listeners of the adds/changes/removes
- *
- * @param expressions the expressions that changed
- * @param update the type of change
- */
- public void notify(IExpression[] expressions, int update) {
- if (fExpressionsListeners != null) {
- fNotifierExpressions = expressions;
- fType = update;
- Object[] copiedListeners = fExpressionsListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IExpressionsListener)copiedListeners[i];
- Platform.run(this);
- }
- }
- fNotifierExpressions = null;
- fListener = null;
- }
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
deleted file mode 100644
index 3c8da0692..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Vector;
-
-import org.eclipse.debug.core.DebugPlugin;
-
-/**
- * Writes to the input stream of a system process,
- * queueing output if the stream is blocked.
- *
- * The input stream monitor writes to system in via
- * an output stream.
- */
-public class InputStreamMonitor {
-
- /**
- * The stream which is being written to (connected to system in).
- */
- private OutputStream fStream;
- /**
- * The queue of output.
- */
- private Vector fQueue;
- /**
- * The thread which writes to the stream.
- */
- private Thread fThread;
- /**
- * A lock for ensuring that writes to the queue are contiguous
- */
- private Object fLock;
-
- /**
- * Wether the underlying output stream has been closed
- */
- private boolean fClosed = false;
-
- /**
- * Creates an input stream monitor which writes
- * to system in via the given output stream.
- */
- public InputStreamMonitor(OutputStream stream) {
- fStream= stream;
- fQueue= new Vector();
- fLock= new Object();
- }
-
- /**
- * Appends the given text to the stream, or
- * queues the text to be written at a later time
- * if the stream is blocked.
- */
- public void write(String text) {
- synchronized(fLock) {
- fQueue.add(text);
- fLock.notifyAll();
- }
- }
-
- /**
- * Starts a thread which writes the stream.
- */
- public void startMonitoring() {
- if (fThread == null) {
- fThread= new Thread(new Runnable() {
- public void run() {
- write();
- }
- }, DebugCoreMessages.getString("InputStreamMonitor.label")); //$NON-NLS-1$
- fThread.start();
- }
- }
-
- /**
- * Close all communications between this
- * monitor and the underlying stream.
- */
- public void close() {
- if (fThread != null) {
- Thread thread= fThread;
- fThread= null;
- thread.interrupt();
- }
- }
-
- /**
- * Continuously writes to the stream.
- */
- protected void write() {
- while (fThread != null) {
- writeNext();
- }
- if (!fClosed) {
- try {
- fStream.close();
- } catch (IOException e) {
- DebugPlugin.log(e);
- }
- }
- }
-
- /**
- * Write the text in the queue to the stream.
- */
- protected void writeNext() {
- while (!fQueue.isEmpty() && !fClosed) {
- String text = (String)fQueue.firstElement();
- fQueue.removeElementAt(0);
- try {
- fStream.write(text.getBytes());
- fStream.flush();
- } catch (IOException e) {
- DebugPlugin.log(e);
- }
- }
- try {
- synchronized(fLock) {
- fLock.wait();
- }
- } catch (InterruptedException e) {
- }
- }
-
- /**
- * Closes the output stream attached to the standard input stream of this
- * monitor's process.
- */
- public void closeInputStream() throws IOException {
- if (!fClosed) {
- fClosed = true;
- fStream.close();
- } else {
- throw new IOException();
- }
-
- }
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
deleted file mode 100644
index c1e1a1bca..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
+++ /dev/null
@@ -1,602 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.debug.core.DebugException;
-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.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.Launch;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2;
-import org.eclipse.debug.core.model.IPersistableSourceLocator;
-import org.eclipse.debug.core.sourcelookup.IPersistableSourceLocator2;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Launch configuration handle.
- *
- * @see ILaunchConfiguration
- */
-public class LaunchConfiguration extends PlatformObject implements ILaunchConfiguration {
-
- /**
- * Location this configuration is stored in. This
- * is the key for a launch configuration handle.
- */
- private IPath fLocation;
-
- /**
- * Constructs a launch configuration in the given location.
- *
- * @param location path to where this launch configuration's
- * underlying file is located
- */
- protected LaunchConfiguration(IPath location) {
- setLocation(location);
- }
-
- /**
- * Constructs a launch configuration from the given
- * memento.
- *
- * @param memento launch configuration memento
- * @exception CoreException if the memento is invalid or
- * an exception occurs reading the memento
- */
- protected LaunchConfiguration(String memento) throws CoreException {
- Exception ex = null;
- try {
- Element root = null;
- DocumentBuilder parser =
- DocumentBuilderFactory.newInstance().newDocumentBuilder();
- StringReader reader = new StringReader(memento);
- InputSource source = new InputSource(reader);
- root = parser.parse(source).getDocumentElement();
-
- String localString = root.getAttribute("local"); //$NON-NLS-1$
- String path = root.getAttribute("path"); //$NON-NLS-1$
-
- String message = null;
- if (path == null) {
- message = DebugCoreMessages.getString("LaunchConfiguration.Invalid_launch_configuration_memento__missing_path_attribute_3"); //$NON-NLS-1$
- } else if (localString == null) {
- message = DebugCoreMessages.getString("LaunchConfiguration.Invalid_launch_configuration_memento__missing_local_attribute_4"); //$NON-NLS-1$
- }
- if (message != null) {
- IStatus s = newStatus(message, DebugException.INTERNAL_ERROR, null);
- throw new CoreException(s);
- }
-
- IPath location = null;
- boolean local = (Boolean.valueOf(localString)).booleanValue();
- if (local) {
- location = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.append(path);
- } else {
- location = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path)).getLocation();
- }
- setLocation(location);
- if (location == null) {
- IStatus s = newStatus(MessageFormat.format(DebugCoreMessages.getString("LaunchConfiguration.Unable_to_restore_location_for_launch_configuration_from_memento__{0}_1"), new String[]{path}), DebugPlugin.INTERNAL_ERROR, null); //$NON-NLS-1$
- throw new CoreException(s);
- }
- return;
- } catch (ParserConfigurationException e) {
- ex = e;
- } catch (SAXException e) {
- ex = e;
- } catch (IOException e) {
- ex = e;
- }
- IStatus s = newStatus(DebugCoreMessages.getString("LaunchConfiguration.Exception_occurred_parsing_memento_5"), DebugException.INTERNAL_ERROR, ex); //$NON-NLS-1$
- throw new CoreException(s);
- }
-
- /**
- * Creates and returns a new error status based on
- * the given message, code, and exception.
- *
- * @param message error message
- * @param code error code
- * @param e exception or <code>null</code>
- * @return status
- */
- protected IStatus newStatus(String message, int code, Throwable e) {
- return new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), code, message, e);
- }
-
- /**
- * @see ILaunchConfiguration#launch(String, IProgressMonitor)
- */
- public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException {
- return launch(mode, monitor, false);
- }
-
- /**
- * Set the source locator to use with the launch, if specified
- * by this configuration.
- *
- * @param launch the launch on which to set the source locator
- */
- protected void initializeSourceLocator(ILaunch launch) throws CoreException {
- if (launch.getSourceLocator() == null) {
- String type = getAttribute(ATTR_SOURCE_LOCATOR_ID, (String)null);
- if (type == null) {
- type = getType().getSourceLocatorId();
- }
- if (type != null) {
- IPersistableSourceLocator locator = getLaunchManager().newSourceLocator(type);
- String memento = getAttribute(ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
- if (memento == null) {
- locator.initializeDefaults(this);
- } else {
- if(locator instanceof IPersistableSourceLocator2)
- ((IPersistableSourceLocator2)locator).initializeFromMemento(memento, this);
- else
- locator.initializeFromMemento(memento);
- }
- launch.setSourceLocator(locator);
- }
- }
- }
-
- /**
- * @see ILaunchConfiguration#supportsMode(String)
- */
- public boolean supportsMode(String mode) throws CoreException {
- return getType().supportsMode(mode);
- }
-
- /**
- * A configuration's name is that of the last segment
- * in it's location (subtract the ".launch" extension).
- *
- * @see ILaunchConfiguration#getName()
- */
- public String getName() {
- return getLastLocationSegment();
- }
-
- private String getLastLocationSegment() {
- String name = getLocation().lastSegment();
- if (name.length() > LAUNCH_CONFIGURATION_FILE_EXTENSION.length()) {
- name = name.substring(0, name.length() - (LAUNCH_CONFIGURATION_FILE_EXTENSION.length() + 1));
- }
- return name;
- }
-
- /**
- * @see ILaunchConfiguration#getLocation()
- */
- public IPath getLocation() {
- return fLocation;
- }
-
- /**
- * Sets the location of this configuration's underlying
- * file.
- *
- * @param location the location of this configuration's underlying
- * file
- */
- private void setLocation(IPath location) {
- fLocation = location;
- }
-
- /**
- * @see ILaunchConfiguration#exists()
- */
- public boolean exists() {
- return getLocation().toFile().exists();
- }
-
- /**
- * @see ILaunchConfiguration#getAttribute(String, int)
- */
- public int getAttribute(String attributeName, int defaultValue) throws CoreException {
- return getInfo().getIntAttribute(attributeName, defaultValue);
- }
-
- /**
- * @see ILaunchConfiguration#getAttribute(String, String)
- */
- public String getAttribute(String attributeName, String defaultValue) throws CoreException {
- return getInfo().getStringAttribute(attributeName, defaultValue);
- }
-
- /**
- * @see ILaunchConfiguration#getAttribute(String, boolean)
- */
- public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException {
- return getInfo().getBooleanAttribute(attributeName, defaultValue);
- }
-
- /**
- * @see ILaunchConfiguration#getAttribute(String, List)
- */
- public List getAttribute(String attributeName, List defaultValue) throws CoreException {
- return getInfo().getListAttribute(attributeName, defaultValue);
- }
-
- /**
- * @see ILaunchConfiguration#getAttribute(String, Map)
- */
- public Map getAttribute(String attributeName, Map defaultValue) throws CoreException {
- return getInfo().getMapAttribute(attributeName, defaultValue);
- }
-
- /**
- * @see ILaunchConfiguration#getType()
- */
- public ILaunchConfigurationType getType() throws CoreException {
- return getInfo().getType();
- }
-
- /**
- * @see ILaunchConfiguration#isLocal()
- */
- public boolean isLocal() {
- IPath localPath = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
- return localPath.isPrefixOf(getLocation());
- }
-
- /**
- * @see ILaunchConfiguration#getWorkingCopy()
- */
- public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
- return new LaunchConfigurationWorkingCopy(this);
- }
-
- /**
- * @see ILaunchConfiguration#copy(String name)
- */
- public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException {
- ILaunchConfigurationWorkingCopy copy = new LaunchConfigurationWorkingCopy(this, name);
- return copy;
- }
-
- /**
- * @see ILaunchConfiguration#isWorkingCopy()
- */
- public boolean isWorkingCopy() {
- return false;
- }
-
- /**
- * @see ILaunchConfiguration#delete()
- */
- public void delete() throws CoreException {
- if (exists()) {
- if (isLocal()) {
- if (!(getLocation().toFile().delete())) {
- throw new DebugException(
- new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfiguration.Failed_to_delete_launch_configuration._1"), null) //$NON-NLS-1$
- );
- }
- // manually update the launch manager cache since there
- // will be no resource delta
- getLaunchManager().launchConfigurationDeleted(this);
- } else {
- // delete the resource using IFile API such that
- // resource deltas are fired.
- IFile file = getFile();
- if (file != null) {
- // validate edit
- if (file.isReadOnly()) {
- IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] {file}, null);
- if (!status.isOK()) {
- throw new CoreException(status);
- }
- }
- file.delete(true, null);
- } else {
- // Error - the exists test passed, but could not locate file
- }
- }
- }
- }
-
- /**
- * Returns the info object containing the attributes
- * of this configuration
- *
- * @return info for this handle
- * @exception CoreException if unable to retrieve the
- * info object
- */
- protected LaunchConfigurationInfo getInfo() throws CoreException {
- return getLaunchManager().getInfo(this);
- }
-
- /**
- * Returns the launch configuration delegate for this
- * launch configuration, for the specified launch mode.
- *
- * @param mode launch mode
- * @return launch configuration delegate
- * @exception CoreException if the delegate was unable
- * to be created
- */
- protected ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException {
- return getType().getDelegate(mode);
- }
-
- /**
- * Returns the launch manager
- *
- * @return launch manager
- */
- protected LaunchManager getLaunchManager() {
- return (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
- }
-
- /**
- * @see ILaunchConfiguration#getMemento()
- */
- public String getMemento() throws CoreException {
- IPath relativePath = null;
- if (isLocal()) {
- IPath rootPath = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
- IPath configPath = getLocation();
- relativePath = configPath.removeFirstSegments(rootPath.segmentCount());
- relativePath = relativePath.setDevice(null);
- } else {
- IFile file = getFile();
- if (file == null) {
- // cannot generate memento - missing file
- IStatus status = newStatus(MessageFormat.format(DebugCoreMessages.getString("LaunchConfiguration.Unable_to_generate_memento_for_{0},_shared_file_does_not_exist._1"), new String[]{getName()}), DebugException.INTERNAL_ERROR, null); //$NON-NLS-1$
- throw new CoreException(status);
- }
- relativePath = getFile().getFullPath();
- }
- Exception e= null;
- try {
- Document doc = LaunchManager.getDocument();
- Element node = doc.createElement("launchConfiguration"); //$NON-NLS-1$
- doc.appendChild(node);
- node.setAttribute("local", (new Boolean(isLocal())).toString()); //$NON-NLS-1$
- node.setAttribute("path", relativePath.toString()); //$NON-NLS-1$
- return LaunchManager.serializeDocument(doc);
- } catch (IOException ioe) {
- e= ioe;
- } catch (ParserConfigurationException pce) {
- e= pce;
- } catch (TransformerException te) {
- e= te;
- }
- if (e != null) {
- IStatus status = newStatus(DebugCoreMessages.getString("LaunchConfiguration.Exception_occurred_creating_launch_configuration_memento_9"), DebugException.INTERNAL_ERROR, e); //$NON-NLS-1$
- throw new CoreException(status);
- }
- //execution will never reach here
- return null;
-
- }
-
- /**
- * @see ILaunchConfiguration#getFile()
- */
- public IFile getFile() {
- if (isLocal()) {
- return null;
- }
- IFile[] files= ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(getLocation());
- if (files.length > 0) {
- return files[0];
- }
- return null;
- }
-
- /**
- * @see ILaunchConfiguration#contentsEqual(ILaunchConfiguration)
- */
- public boolean contentsEqual(ILaunchConfiguration object) {
- try {
- if (object instanceof LaunchConfiguration) {
- LaunchConfiguration otherConfig = (LaunchConfiguration) object;
- return getName().equals(otherConfig.getName())
- && getType().equals(otherConfig.getType())
- && getLocation().equals(otherConfig.getLocation())
- && getInfo().equals(otherConfig.getInfo());
- }
- return false;
- } catch (CoreException ce) {
- return false;
- }
- }
-
- /**
- * Returns whether this configuration is equal to the
- * given configuration. Two configurations are equal if
- * they are stored in the same location (and neither one
- * is a working copy).
- *
- * @return whether this configuration is equal to the
- * given configuration
- * @see Object#equals(Object)
- */
- public boolean equals(Object object) {
- if (object instanceof ILaunchConfiguration) {
- if (isWorkingCopy()) {
- return this == object;
- }
- ILaunchConfiguration config = (ILaunchConfiguration) object;
- if (!config.isWorkingCopy()) {
- return config.getLocation().equals(getLocation());
- }
- }
- return false;
- }
-
- /**
- * @see Object#hashCode()
- */
- public int hashCode() {
- return getLocation().hashCode();
- }
-
- /**
- * Returns the container this launch configuration is
- * stored in, or <code>null</code> if this launch configuration
- * is stored locally.
- *
- * @return the container this launch configuration is
- * stored in, or <code>null</code> if this launch configuration
- * is stored locally
- */
- protected IContainer getContainer() {
- IFile file = getFile();
- if (file != null) {
- return file.getParent();
- }
- return null;
- }
-
- /**
- * @see org.eclipse.debug.core.ILaunchConfiguration#getCategory()
- */
- public String getCategory() throws CoreException {
- return getType().getCategory();
- }
-
- /**
- * @see org.eclipse.debug.core.ILaunchConfiguration#getAttributes()
- */
- public Map getAttributes() throws CoreException {
- LaunchConfigurationInfo info = getInfo();
- return info.getAttributes();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfiguration#launch(java.lang.String, org.eclipse.core.runtime.IProgressMonitor, boolean)
- */
- public ILaunch launch(String mode, IProgressMonitor monitor, boolean build) throws CoreException {
- return launch(mode, monitor, build, true);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfiguration#launch(java.lang.String, org.eclipse.core.runtime.IProgressMonitor, boolean, boolean)
- */
- public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException {
- // bug 28245 - force the delegate to load in case it is interested in launch notifications
- ILaunchConfigurationDelegate delegate= getDelegate(mode);
- ILaunchConfigurationDelegate2 delegate2 = null;
- if (delegate instanceof ILaunchConfigurationDelegate2) {
- delegate2 = (ILaunchConfigurationDelegate2) delegate;
- }
- // allow the delegate to provide a launch implementation
- ILaunch launch = null;
- if (delegate2 != null) {
- launch = delegate2.getLaunch(this, mode);
- }
- if (launch == null) {
- launch = new Launch(this, mode, null);
- } else {
- // ensure the launch mode is valid
- if (!mode.equals(launch.getLaunchMode())) {
- IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR,
- MessageFormat.format(DebugCoreMessages.getString("LaunchConfiguration.13"), new String[]{mode, launch.getLaunchMode()}), null); //$NON-NLS-1$
- throw new CoreException(status);
- }
- }
-
- boolean captureOutput = getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true);
- if(!captureOutput) {
- launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, "false"); //$NON-NLS-1$
- } else {
- launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null);
- }
-
-
- if (monitor == null) {
- monitor= new NullProgressMonitor();
- }
- // perform initial pre-launch sanity checks
- if (delegate2 != null) {
- if (!(delegate2.preLaunchCheck(this, mode, monitor))) {
- // canceled
- monitor.setCanceled(true);
- return launch;
- }
- }
- // preform pre-launch build
- IProgressMonitor subMonitor = monitor;
- if (build) {
- subMonitor = new SubProgressMonitor(monitor, 100);
- if (delegate2 != null) {
- build = delegate2.buildForLaunch(this, mode, subMonitor);
- }
- if (build) {
- ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, subMonitor);
- }
- subMonitor = new SubProgressMonitor(monitor, 100);
- }
- // final validation
- if (delegate2 != null) {
- if (!(delegate2.finalLaunchCheck(this, mode, subMonitor))) {
- // canceled
- monitor.setCanceled(true);
- return launch;
- }
- }
-
- if (register) {
- getLaunchManager().addLaunch(launch);
- }
- try {
- initializeSourceLocator(launch);
- delegate.launch(this, mode, launch, subMonitor);
- } catch (CoreException e) {
- // if there was an exception, and the launch is empty, remove it
- if (!launch.hasChildren()) {
- getLaunchManager().removeLaunch(launch);
- }
- throw e;
- }
- if (monitor.isCanceled()) {
- getLaunchManager().removeLaunch(launch);
- }
- return launch;
- }
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationComparator.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationComparator.java
deleted file mode 100644
index 2032315f5..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationComparator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.util.Comparator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.debug.core.DebugPlugin;
-
-/**
- * Proxy to a runtime classpath entry resolver extension.
- */
-public class LaunchConfigurationComparator implements Comparator {
-
- private IConfigurationElement fConfigurationElement;
-
- private Comparator fDelegate;
-
- /**
- * Constructs a new resolver on the given configuration element
- */
- public LaunchConfigurationComparator(IConfigurationElement element) {
- fConfigurationElement = element;
- }
-
- /**
- * Returns the resolver delegate (and creates if required)
- */
- protected Comparator getComparator() {
- if (fDelegate == null) {
- try {
- fDelegate = (Comparator)fConfigurationElement.createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- return fDelegate;
- }
-
-
- /**
- * @see Comparator#compare(Object, Object)
- */
- public int compare(Object o1, Object o2) {
- return getComparator().compare(o1, o2);
- }
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
- return getComparator().equals(obj);
- }
-
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
deleted file mode 100644
index df35b7e69..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
+++ /dev/null
@@ -1,574 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * The information associated with a launch configuration
- * handle.
- */
-public class LaunchConfigurationInfo {
-
- /**
- * This configurations attribute table.
- * Keys are <code>String</code>s and values
- * are one of <code>String</code>, <code>Integer</code>,
- * or <code>Boolean</code>.
- */
- private HashMap fAttributes;
-
- /**
- * This launch configuration's type
- */
- private ILaunchConfigurationType fType;
-
- /**
- * Constructs a new empty info
- */
- protected LaunchConfigurationInfo() {
- setAttributeTable(new HashMap(10));
- }
-
- /**
- * Returns this configuration's attribute table.
- *
- * @return attribute table
- */
- private HashMap getAttributeTable() {
- return fAttributes;
- }
-
- /**
- * Sets this configuration's attribute table.
- *
- * @param table attribute table
- */
- private void setAttributeTable(HashMap table) {
- fAttributes = table;
- }
-
- /**
- * Sets the attributes in this info to those in the given map.
- *
- * @param map
- */
- protected void setAttributes(Map map) {
- if (map == null) {
- setAttributeTable(new HashMap());
- return;
- }
- Set entrySet = map.entrySet();
- HashMap attributes = new HashMap(entrySet.size());
- Iterator iter = entrySet.iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- attributes.put(entry.getKey(), entry.getValue());
- }
- setAttributeTable(attributes);
- }
-
- /**
- * Returns the <code>String</code> attribute with the
- * given key or the given default value if undefined.
- *
- * @return attribute specified by given key or the defaultValue
- * if undefined
- * @throws CoreException if the attribute with the given key exists
- * but is not a <code>String</code>
- */
- protected String getStringAttribute(String key, String defaultValue) throws CoreException {
- Object attr = getAttributeTable().get(key);
- if (attr != null) {
- if (attr instanceof String) {
- return (String)attr;
- }
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.lang.String._1"), new String[] {key}), null //$NON-NLS-1$
- )
- );
- }
- return defaultValue;
- }
-
- /**
- * Returns the <code>int</code> attribute with the
- * given key or the given default value if undefined.
- *
- * @return attribute specified by given key or the defaultValue
- * if undefined
- * @throws CoreException if the attribute with the given key exists
- * but is not an <code>int</code>
- */
- protected int getIntAttribute(String key, int defaultValue) throws CoreException {
- Object attr = getAttributeTable().get(key);
- if (attr != null) {
- if (attr instanceof Integer) {
- return ((Integer)attr).intValue();
- }
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_int._2"), new String[] {key}), null //$NON-NLS-1$
- )
- );
- }
- return defaultValue;
- }
-
- /**
- * Returns the <code>boolean</code> attribute with the
- * given key or the given default value if undefined.
- *
- * @return attribute specified by given key or the defaultValue
- * if undefined
- * @throws CoreException if the attribute with the given key exists
- * but is not a <code>boolean</code>
- */
- protected boolean getBooleanAttribute(String key, boolean defaultValue) throws CoreException {
- Object attr = getAttributeTable().get(key);
- if (attr != null) {
- if (attr instanceof Boolean) {
- return ((Boolean)attr).booleanValue();
- }
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_boolean._3"), new String[] {key}), null //$NON-NLS-1$
- )
- );
- }
- return defaultValue;
- }
-
- /**
- * Returns the <code>java.util.List</code> attribute with the
- * given key or the given default value if undefined.
- *
- * @return attribute specified by given key or the defaultValue
- * if undefined
- * @throws CoreException if the attribute with the given key exists
- * but is not a <code>java.util.List</code>
- */
- protected List getListAttribute(String key, List defaultValue) throws CoreException {
- Object attr = getAttributeTable().get(key);
- if (attr != null) {
- if (attr instanceof List) {
- return (List)attr;
- }
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.List._1"), new String[] {key}), null //$NON-NLS-1$
- )
- );
- }
- return defaultValue;
- }
-
- /**
- * Returns the <code>java.util.Map</code> attribute with the
- * given key or the given default value if undefined.
- *
- * @return attribute specified by given key or the defaultValue
- * if undefined
- * @throws CoreException if the attribute with the given key exists
- * but is not a <code>java.util.Map</code>
- */
- protected Map getMapAttribute(String key, Map defaultValue) throws CoreException {
- Object attr = getAttributeTable().get(key);
- if (attr != null) {
- if (attr instanceof Map) {
- return (Map)attr;
- }
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.Map._1"), new String[] {key}), null //$NON-NLS-1$
- )
- );
- }
- return defaultValue;
- }
-
- /**
- * Sets this configuration's type.
- *
- * @param type launch configuration type
- */
- protected void setType(ILaunchConfigurationType type) {
- fType = type;
- }
-
- /**
- * Returns this configuration's type.
- *
- * @return launch configuration type
- */
- protected ILaunchConfigurationType getType() {
- return fType;
- }
-
-
- /**
- * Returns a copy of this info object
- *
- * @return copy of this info
- */
- protected LaunchConfigurationInfo getCopy() {
- LaunchConfigurationInfo copy = new LaunchConfigurationInfo();
- copy.setType(getType());
- copy.setAttributeTable(getAttributes());
- return copy;
- }
-
- /**
- * Returns a copy of this info's attribute map.
- *
- * @return a copy of this info's attribute map
- */
- protected HashMap getAttributes() {
- return (HashMap)getAttributeTable().clone();
- }
-
- /**
- * Sets the given attribute to the given value. Only
- * working copy's should use this API.
- *
- * @param key attribute key
- * @param value attribute value
- */
- protected void setAttribute(String key, Object value) {
- if (value == null) {
- getAttributeTable().remove(key);
- } else {
- getAttributeTable().put(key, value);
- }
- }
-
- /**
- * Returns the content of this info as XML
- *
- * @return the content of this info as XML
- * @throws CoreException if a attribute has been set with a null key
- * @throws IOException if an exception occurs creating the XML
- * @throws ParserConfigurationException if an exception occurs creating the XML
- * @throws TransformerException if an exception occurs creating the XML
- */
- protected String getAsXML() throws CoreException, IOException, ParserConfigurationException, TransformerException {
-
- Document doc = LaunchManager.getDocument();
- Element configRootElement = doc.createElement("launchConfiguration"); //$NON-NLS-1$
- doc.appendChild(configRootElement);
-
- configRootElement.setAttribute("type", getType().getIdentifier()); //$NON-NLS-1$
-
- Iterator keys = getAttributeTable().keySet().iterator();
- while (keys.hasNext()) {
- String key = (String)keys.next();
- if (key == null) {
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfigurationInfo.36"), null //$NON-NLS-1$
- )
- );
- }
- Object value = getAttributeTable().get(key);
- if (value == null) {
- continue;
- }
- Element element = null;
- String valueString = null;
- if (value instanceof String) {
- valueString = (String)value;
- element = createKeyValueElement(doc, "stringAttribute", key, valueString); //$NON-NLS-1$
- } else if (value instanceof Integer) {
- valueString = ((Integer)value).toString();
- element = createKeyValueElement(doc, "intAttribute", key, valueString); //$NON-NLS-1$
- } else if (value instanceof Boolean) {
- valueString = ((Boolean)value).toString();
- element = createKeyValueElement(doc, "booleanAttribute", key, valueString); //$NON-NLS-1$
- } else if (value instanceof List) {
- element = createListElement(doc, "listAttribute", key, (List)value); //$NON-NLS-1$
- } else if (value instanceof Map) {
- element = createMapElement(doc, "mapAttribute", key, (Map)value); //$NON-NLS-1$
- }
- configRootElement.appendChild(element);
- }
-
- return LaunchManager.serializeDocument(doc);
- }
-
- /**
- * Helper method that creates a 'key value' element of the specified type with the
- * specified attribute values.
- */
- protected Element createKeyValueElement(Document doc, String elementType, String key, String value) {
- Element element = doc.createElement(elementType);
- element.setAttribute("key", key); //$NON-NLS-1$
- element.setAttribute("value", value); //$NON-NLS-1$
- return element;
- }
-
- protected Element createListElement(Document doc, String elementType, String listKey, List list) {
- Element listElement = doc.createElement(elementType);
- listElement.setAttribute("key", listKey); //$NON-NLS-1$
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- String value = (String) iterator.next();
- Element element = doc.createElement("listEntry"); //$NON-NLS-1$
- element.setAttribute("value", value); //$NON-NLS-1$
- listElement.appendChild(element);
- }
- return listElement;
- }
-
- protected Element createMapElement(Document doc, String elementType, String mapKey, Map map) {
- Element mapElement = doc.createElement(elementType);
- mapElement.setAttribute("key", mapKey); //$NON-NLS-1$
- Iterator iterator = map.keySet().iterator();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- String value = (String) map.get(key);
- Element element = doc.createElement("mapEntry"); //$NON-NLS-1$
- element.setAttribute("key", key); //$NON-NLS-1$
- element.setAttribute("value", value); //$NON-NLS-1$
- mapElement.appendChild(element);
- }
- return mapElement;
- }
-
- protected void initializeFromXML(Element root) throws CoreException {
- if (!root.getNodeName().equalsIgnoreCase("launchConfiguration")) { //$NON-NLS-1$
- throw getInvalidFormatDebugException();
- }
-
- // read type
- String id = root.getAttribute("type"); //$NON-NLS-1$
- if (id == null) {
- throw getInvalidFormatDebugException();
- }
-
- ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(id);
- if (type == null) {
- String message= MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.missing_type"), new Object[]{id}); //$NON-NLS-1$
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.MISSING_LAUNCH_CONFIGURATION_TYPE, message, null)
- );
- }
- setType(type);
-
- NodeList list = root.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node node = list.item(i);
- short nodeType = node.getNodeType();
- if (nodeType == Node.ELEMENT_NODE) {
- Element element = (Element) node;
- String nodeName = element.getNodeName();
-
- if (nodeName.equalsIgnoreCase("stringAttribute")) { //$NON-NLS-1$
- setStringAttribute(element);
- } else if (nodeName.equalsIgnoreCase("intAttribute")) { //$NON-NLS-1$
- setIntegerAttribute(element);
- } else if (nodeName.equalsIgnoreCase("booleanAttribute")) { //$NON-NLS-1$
- setBooleanAttribute(element);
- } else if (nodeName.equalsIgnoreCase("listAttribute")) { //$NON-NLS-1$
- setListAttribute(element);
- } else if (nodeName.equalsIgnoreCase("mapAttribute")) { //$NON-NLS-1$
- setMapAttribute(element);
- }
- }
- }
- }
-
- protected void setStringAttribute(Element element) throws CoreException {
- String key = getKeyAttribute(element);
- String value = getValueAttribute(element);
- setAttribute(key, value);
- }
-
- protected void setIntegerAttribute(Element element) throws CoreException {
- String key = getKeyAttribute(element);
- String value = getValueAttribute(element);
- setAttribute(key, new Integer(value));
- }
-
- protected void setBooleanAttribute(Element element) throws CoreException {
- String key = getKeyAttribute(element);
- String value = getValueAttribute(element);
- setAttribute(key, new Boolean(value));
- }
-
- protected void setListAttribute(Element element) throws CoreException {
- String listKey = element.getAttribute("key"); //$NON-NLS-1$
- NodeList nodeList = element.getChildNodes();
- int entryCount = nodeList.getLength();
- List list = new ArrayList(entryCount);
- for (int i = 0; i < entryCount; i++) {
- Node node = nodeList.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element subElement = (Element) node;
- String nodeName = subElement.getNodeName();
- if (!nodeName.equalsIgnoreCase("listEntry")) { //$NON-NLS-1$
- throw getInvalidFormatDebugException();
- }
- String value = getValueAttribute(subElement);
- list.add(value);
- }
- }
- setAttribute(listKey, list);
- }
-
- protected void setMapAttribute(Element element) throws CoreException {
- String mapKey = element.getAttribute("key"); //$NON-NLS-1$
- NodeList nodeList = element.getChildNodes();
- int entryCount = nodeList.getLength();
- Map map = new HashMap(entryCount);
- for (int i = 0; i < entryCount; i++) {
- Node node = nodeList.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element subElement = (Element) node;
- String nodeName = subElement.getNodeName();
- if (!nodeName.equalsIgnoreCase("mapEntry")) { //$NON-NLS-1$
- throw getInvalidFormatDebugException();
- }
- String key = getKeyAttribute(subElement);
- String value = getValueAttribute(subElement);
- map.put(key, value);
- }
- }
- setAttribute(mapKey, map);
- }
-
- protected String getKeyAttribute(Element element) throws CoreException {
- String key = element.getAttribute("key"); //$NON-NLS-1$
- if (key == null) {
- throw getInvalidFormatDebugException();
- }
- return key;
- }
-
- protected String getValueAttribute(Element element) throws CoreException {
- String value = element.getAttribute("value"); //$NON-NLS-1$
- if (value == null) {
- throw getInvalidFormatDebugException();
- }
- return value;
- }
-
- protected DebugException getInvalidFormatDebugException() {
- return
- new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfigurationInfo.Invalid_launch_configuration_XML._10"), null //$NON-NLS-1$
- )
- );
- }
-
- /**
- * Two <code>LaunchConfigurationInfo</code> objects are equal if and only if they have the
- * same type and they have the same set of attributes with the same values.
- *
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
-
- // Make sure it's a LaunchConfigurationInfo object
- if (!(obj instanceof LaunchConfigurationInfo)) {
- return false;
- }
-
- // Make sure the types are the same
- LaunchConfigurationInfo other = (LaunchConfigurationInfo) obj;
- if (!fType.getIdentifier().equals(other.getType().getIdentifier())) {
- return false;
- }
-
- // Make sure the attributes are the same
- return compareAttributes(fAttributes, other.getAttributeTable());
- }
-
- /**
- * Returns whether the two attribute maps are equal, consulting
- * registered comparator extensions.
- *
- * @param map1 attribute map
- * @param map2 attribute map
- * @return whether the two attribute maps are equal
- */
- protected boolean compareAttributes(HashMap map1, HashMap map2) {
- LaunchManager manager = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
- if (map1.size() == map2.size()) {
- Iterator attributes = map1.keySet().iterator();
- while (attributes.hasNext()) {
- String key = (String)attributes.next();
- Object attr1 = map1.get(key);
- Object attr2 = map2.get(key);
- if (attr2 == null) {
- return false;
- }
- Comparator comp = manager.getComparator(key);
- if (comp == null) {
- if (!attr1.equals(attr2)) {
- return false;
- }
- } else {
- if (comp.compare(attr1, attr2) != 0) {
- return false;
- }
- }
- }
- return true;
- }
- return false;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fType.hashCode() + fAttributes.size();
- }
-
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
deleted file mode 100644
index 7a6873a24..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.text.MessageFormat;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
-
-/**
- * A launch configuration type wrappers a configuration
- * element for a <code>launchConfigurationType</code>
- * extension.
- */
-public class LaunchConfigurationType extends PlatformObject implements ILaunchConfigurationType {
-
- /**
- * The configuration element of the extension.
- */
- private IConfigurationElement fElement;
-
- /**
- * Base modes this type supports.
- */
- private Set fBaseModes;
-
- /**
- * Modes that delegates have been contributed for
- */
- private Set fContributedModes;
-
- /**
- * The delegates for launch configurations of this type.
- * Delegates are instantiated lazily as required. There may
- * be different delegates for different modes (since 3.0).
- * Map of mode -> delegate
- */
- private Map fDelegates;
-
- /**
- * Constructs a new launch configuration type on the
- * given configuration element.
- *
- * @param element configuration element
- */
- protected LaunchConfigurationType(IConfigurationElement element) {
- setConfigurationElement(element);
- }
-
- /**
- * Sets this type's configuration element.
- *
- * @param element this type's configuration element
- */
- private void setConfigurationElement(IConfigurationElement element) {
- fElement = element;
- }
-
- /**
- * Returns this type's configuration element.
- *
- * @return this type's configuration element
- */
- protected IConfigurationElement getConfigurationElement() {
- return fElement;
- }
-
-
- /**
- * @see ILaunchConfigurationType#supportsMode(String)
- */
- public boolean supportsMode(String mode) {
- return getBaseModes().contains(mode) || getContributedModes().contains(mode);
- }
-
- /**
- * Returns the set of modes specified in the configuration data.
- *
- * @return the set of modes specified in the configuration data
- */
- protected Set getBaseModes() {
- if (fBaseModes == null) {
- String modes= getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$
- if (modes == null) {
- return new HashSet(0);
- }
- StringTokenizer tokenizer= new StringTokenizer(modes, ","); //$NON-NLS-1$
- fBaseModes = new HashSet(tokenizer.countTokens());
- while (tokenizer.hasMoreTokens()) {
- fBaseModes.add(tokenizer.nextToken().trim());
- }
- }
- return fBaseModes;
- }
-
- /**
- * Returns the set of modes delegates have been contributed for
- *
- * @return the set of modes delegates have been contributed for
- */
- protected Set getContributedModes() {
- if (fContributedModes == null) {
- fContributedModes = new HashSet(0);
- // add modes for contributed delegates
- List delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates();
- Iterator iterator = delegates.iterator();
- while (iterator.hasNext()) {
- ContributedDelegate delegate = (ContributedDelegate)iterator.next();
- if (delegate.getLaunchConfigurationType().equals(getIdentifier())) {
- fContributedModes.addAll(delegate.getModes());
- }
- }
- }
- return fContributedModes;
- }
-
- /**
- * @see ILaunchConfigurationType#getName()
- */
- public String getName() {
- return getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
- }
-
- /**
- * @see ILaunchConfigurationType#getSourcePathComputer()
- */
- public ISourcePathComputer getSourcePathComputer() {
- String id = getConfigurationElement().getAttribute("sourcePathComputerId"); //$NON-NLS-1$
- if (id != null && id.length() > 0) {
- return DebugPlugin.getDefault().getLaunchManager().getSourcePathComputer(id);
- }
- return null;
- }
-
- /**
- * @see ILaunchConfigurationType#getIdentifier()
- */
- public String getIdentifier() {
- return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$
- }
-
- /**
- * @see ILaunchConfigurationType#getCategory()
- */
- public String getCategory() {
- return getConfigurationElement().getAttribute("category"); //$NON-NLS-1$
- }
-
- /**
- * @see ILaunchConfigurationType#getAttribute(String)
- */
- public String getAttribute(String attributeName) {
- return getConfigurationElement().getAttribute(attributeName);
- }
-
- /**
- * @see ILaunchConfigurationType#isPublic()
- */
- public boolean isPublic() {
- String publicString = getConfigurationElement().getAttribute("public"); //$NON-NLS-1$
- if (publicString != null) {
- if (publicString.equalsIgnoreCase("false")) { //$NON-NLS-1$
- return false;
- }
- }
- return true;
- }
-
- /**
- * @see ILaunchConfigurationType#newInstance(IContainer, String)
- */
- public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) {
- return new LaunchConfigurationWorkingCopy(container, name, this);
- }
-
- /**
- * Returns the launch configuration delegate for launch
- * configurations of this type. The first time this method
- * is called, the delegate is instantiated.
- *
- * @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegate()
- * @return launch configuration delegate
- * @exception CoreException if unable to instantiate the
- * delegate
- * @deprecated use <code>getDelegate(String)</code> to specify mode
- */
- public ILaunchConfigurationDelegate getDelegate() throws CoreException {
- return getDelegate(ILaunchManager.RUN_MODE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegate(java.lang.String)
- */
- public ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException {
- if (!supportsMode(mode)) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationType.9"), new String[] {mode, getIdentifier()}), null)); //$NON-NLS-1$
- }
- if (fDelegates == null) {
- // initialize delegate table with base modes
- fDelegates = new Hashtable(3);
- }
- ILaunchConfigurationDelegate delegate = (ILaunchConfigurationDelegate)fDelegates.get(mode);
- if (delegate == null) {
- Set modes = getBaseModes();
- if (modes.contains(mode)) {
- Object object = getConfigurationElement().createExecutableExtension("delegate"); //$NON-NLS-1$
- if (object instanceof ILaunchConfigurationDelegate) {
- Iterator iter = modes.iterator();
- while (iter.hasNext()) {
- fDelegates.put(iter.next(), object);
- }
- return (ILaunchConfigurationDelegate)object;
- }
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationType.Launch_delegate_for_{0}_does_not_implement_required_interface_ILaunchConfigurationDelegate._1"), new String[]{getName()}), null)); //$NON-NLS-1$
- }
- // contributed modes
- List contributed = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates();
- Iterator iterator = contributed.iterator();
- while (iterator.hasNext()) {
- ContributedDelegate contributedDelegate = (ContributedDelegate)iterator.next();
- if (getIdentifier().equals(contributedDelegate.getLaunchConfigurationType())) {
- modes = contributedDelegate.getModes();
- if (modes.contains(mode)) {
- delegate = contributedDelegate.getDelegate();
- Iterator modesIterator = modes.iterator();
- while (modesIterator.hasNext()) {
- fDelegates.put(modesIterator.next(), delegate);
- }
- return delegate;
- }
- }
- }
- } else {
- return delegate;
- }
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationType.10"), new String[] {getIdentifier(), mode}), null)); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourceLocatorId()
- */
- public String getSourceLocatorId() {
- return getAttribute("sourceLocatorId"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationType#getPluginId()
- */
- public String getPluginIdentifier() {
- return fElement.getNamespace();
- }
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
deleted file mode 100644
index 4aa555ce5..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
+++ /dev/null
@@ -1,595 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResourceRuleFactory;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-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.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-
-/**
- * A working copy launch configuration
- */
-public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implements ILaunchConfigurationWorkingCopy {
-
- /**
- * Handle of original launch configuration this
- * working copy is based on
- */
- private LaunchConfiguration fOriginal;
-
- /**
- * Working copy of attributes.
- */
- private LaunchConfigurationInfo fInfo;
-
- /**
- * Whether this working copy has been modified since
- * it was created
- */
- private boolean fDirty = false;
-
- /**
- * The name for this configuration.
- */
- private String fName;
-
- /**
- * Indicates whether this working copy has been explicitly renamed.
- */
- private boolean fRenamed = false;
-
- /**
- * Suppress change notification until created
- */
- private boolean fSuppressChange = true;
-
- /**
- * The container this working copy will be
- * stored in when saved.
- */
- private IContainer fContainer;
-
- /**
- * Constructs a working copy of the specified launch
- * configuration.
- *
- * @param original launch configuration to make
- * a working copy of
- * @exception CoreException if unable to initialize this
- * working copy's attributes based on the original configuration
- */
- protected LaunchConfigurationWorkingCopy(LaunchConfiguration original) throws CoreException {
- super(original.getLocation());
- setName(original.getName());
- copyFrom(original);
- setOriginal(original);
- fSuppressChange = false;
- }
-
- /**
- * Constructs a copy of the specified launch
- * configuration, with the given (new) name.
- *
- * @param original launch configuration to make
- * a working copy of
- * @param name the new name for the copy of the launch
- * configuration
- * @exception CoreException if unable to initialize this
- * working copy's attributes based on the original configuration
- */
- protected LaunchConfigurationWorkingCopy(LaunchConfiguration original, String name) throws CoreException {
- super(original.getLocation());
- copyFrom(original);
- setName(name);
- fSuppressChange = false;
- }
-
- /**
- * Constructs a new working copy to be created in the specified
- * location.
- *
- * @param container the container that the configuration will be created in
- * or <code>null</code> if to be local
- * @param name the name of the new launch configuration
- * @param type the type of this working copy
- */
- protected LaunchConfigurationWorkingCopy(IContainer container, String name, ILaunchConfigurationType type) {
- super((IPath)null);
- setName(name);
- setInfo(new LaunchConfigurationInfo());
- getInfo().setType(type);
- setContainer(container);
- fSuppressChange = false;
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#isDirty()
- */
- public boolean isDirty() {
- return fDirty;
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#doSave()
- */
- public ILaunchConfiguration doSave() throws CoreException {
- if (isDirty()) {
- boolean useRunnable= true;
- if (isLocal()) {
- if (isMoved()) {
- // If this config was moved from a shared location, saving
- // it will delete the original from the workspace. Use runnable.
- useRunnable= !isNew() && !getOriginal().isLocal();
- } else {
- useRunnable= false;
- }
- }
-
- if (useRunnable) {
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
- public void run(IProgressMonitor pm) throws CoreException {
- doSave0();
- }
- };
-
- ResourcesPlugin.getWorkspace().run(wr, getSchedulingRule(), 0, null);
- } else {
- //file is persisted in the metadata not the workspace
- doSave0();
- }
-
- getLaunchManager().setMovedFromTo(null, null);
- }
-
- return new LaunchConfiguration(getLocation());
- }
-
- /**
- * Returns the scheduling rule to be used when saving this launch configuration.
- * <code>null</code> is a valid scheduling rule.
- *
- * @return the scheduling rule to be used when saving this launch configuration
- */
- private ISchedulingRule getSchedulingRule() {
- List rules= new ArrayList(2);
- IResourceRuleFactory fac = ResourcesPlugin.getWorkspace().getRuleFactory();
- if (!isLocal()) {
- //working copy will be saved to a workspace location - create or modify
- IFile[] files= ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(getLocation());
- if (files.length > 0) {
- IFile file = files[0];
- ISchedulingRule rule = null;
- if (file.exists()) {
- rule = fac.modifyRule(file);
- } else {
- rule = fac.createRule(file);
- }
- rules.add(MultiRule.combine(rule, fac.validateEditRule(files)));
- }
- }
- ILaunchConfiguration original = getOriginal();
- if (!isNew() && isMoved() && !original.isLocal()) {
- IFile[] files= ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(original.getLocation());
- if (files.length > 0) {
- rules.add(MultiRule.combine(fac.deleteRule(files[0]), fac.validateEditRule(files)));
- }
- }
- if (rules.isEmpty()) {
- return null;
- }
- return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
- }
-
- private void doSave0() throws CoreException {
- // set up from/to information if this is a move
- boolean moved = (!isNew() && isMoved());
- if (moved) {
- ILaunchConfiguration to = new LaunchConfiguration(getLocation());
- ILaunchConfiguration from = getOriginal();
- getLaunchManager().setMovedFromTo(from, to);
- }
- // delete the old file if this is not a new configuration
- // or the file was renamed/moved
- if (moved) {
- getOriginal().delete();
- }
- // write the new file
- writeNewFile();
- resetDirty();
- }
-
- /**
- * Writes the new configuration information to a file.
- *
- * @exception CoreException if writing the file fails
- */
- protected void writeNewFile() throws CoreException {
- String xml = null;
- Exception e= null;
- try {
- xml = getInfo().getAsXML();
- } catch (IOException ioe) {
- e= ioe;
- } catch (ParserConfigurationException pce) {
- e= pce;
- } catch (TransformerException te) {
- e= te;
- }
- if (e != null) {
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationWorkingCopy.{0}_occurred_generating_launch_configuration_XML._1"), new String[]{e.toString()}), null //$NON-NLS-1$
- )
- );
- }
-
- if (isLocal()) {
- // use java.io to update configuration file
- try {
- boolean added = false;
- File file = getLocation().toFile();
- File dir = getLocation().removeLastSegments(1).toFile();
- dir.mkdirs();
- if (!file.exists()) {
- added = true;
- file.createNewFile();
- }
- FileOutputStream stream = new FileOutputStream(file);
- stream.write(xml.getBytes("UTF8")); //$NON-NLS-1$
- stream.close();
- if (added) {
- getLaunchManager().launchConfigurationAdded(new LaunchConfiguration(getLocation()));
- } else {
- getLaunchManager().launchConfigurationChanged(new LaunchConfiguration(getLocation()));
- }
- } catch (IOException ie) {
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationWorkingCopy.{0}_occurred_generating_launch_configuration_XML._1"), new String[]{ie.toString()}), null //$NON-NLS-1$
- )
- );
- }
- } else {
- // use resource API to update configuration file
- IFile file = getFile();
- IContainer dir = file.getParent();
- if (!dir.exists()) {
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfigurationWorkingCopy.Specified_container_for_launch_configuration_does_not_exist_2"), null //$NON-NLS-1$
- )
- );
- }
- ByteArrayInputStream stream = null;
- try {
- stream = new ByteArrayInputStream(xml.getBytes("UTF8")); //$NON-NLS-1$
- } catch (UnsupportedEncodingException ue) {
- throw new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfigurationWorkingCopy.5"), null //$NON-NLS-1$
- ));
- }
- if (!file.exists()) {
- file.create(stream, false, null);
- } else {
- // validate edit
- if (file.isReadOnly()) {
- IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] {file}, null);
- if (!status.isOK()) {
- throw new CoreException(status);
- }
- }
- file.setContents(stream, false, false, null);
- }
- }
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setAttribute(String, int)
- */
- public void setAttribute(String attributeName, int value) {
- getInfo().setAttribute(attributeName, new Integer(value));
- setDirty();
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setAttribute(String, String)
- */
- public void setAttribute(String attributeName, String value) {
- getInfo().setAttribute(attributeName, value);
- setDirty();
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setAttribute(String, boolean)
- */
- public void setAttribute(String attributeName, boolean value) {
- getInfo().setAttribute(attributeName, new Boolean(value));
- setDirty();
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setAttribute(String, List)
- */
- public void setAttribute(String attributeName, List value) {
- getInfo().setAttribute(attributeName, value);
- setDirty();
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setAttribute(String, Map)
- */
- public void setAttribute(String attributeName, Map value) {
- getInfo().setAttribute(attributeName, value);
- setDirty();
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#getOriginal()
- */
- public ILaunchConfiguration getOriginal() {
- return fOriginal;
- }
-
- /**
- * Sets the launch configuration this working copy
- * is based on. Initializes the attributes of this
- * working copy to the current values of the given
- * configuration.
- *
- * @param originl the launch configuration this working
- * copy is based on.
- * @exception CoreException if unable to initialize this
- * working copy based on the original's current attribute
- * set
- */
- private void copyFrom(LaunchConfiguration original) throws CoreException {
- LaunchConfigurationInfo info = original.getInfo();
- setInfo(info.getCopy());
- setContainer(original.getContainer());
- resetDirty();
- }
-
- /**
- * Sets the launch configuration this working copy
- * is based on.
- *
- * @param original the launch configuration this working
- * copy is based on.
- */
- private void setOriginal(LaunchConfiguration original) {
- fOriginal = original;
- }
-
- /**
- * Sets the working copy info object for this working copy.
- *
- * @param info a copy of attributes from this working copy's
- * original launch configuration
- */
- protected void setInfo(LaunchConfigurationInfo info) {
- fInfo = info;
- }
-
- /**
- * @see ILaunchConfiguration#isWorkingCopy()
- */
- public boolean isWorkingCopy() {
- return true;
- }
-
- /**
- * A working copy keeps a local info object that is not
- * cached with the launch manager.
- *
- * @see LaunchConfiguration#getInfo()
- */
- protected LaunchConfigurationInfo getInfo() {
- return fInfo;
- }
-
- /**
- * Sets this working copy's state to dirty.
- * Notifies listeners that this working copy has
- * changed.
- */
- private void setDirty() {
- fDirty = true;
- if (!suppressChangeNotification()) {
- getLaunchManager().getConfigurationNotifier().notify(this, LaunchManager.CHANGED);
- }
- }
-
- /**
- * Sets this working copy's state to not dirty.
- */
- private void resetDirty() {
- fDirty = false;
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#rename(String)
- */
- public void rename(String name) {
- if (!getName().equals(name)) {
- setName(name);
- fRenamed = isNew() || !(getOriginal().getName().equals(name));
- }
- }
-
- /**
- * Sets the new name for this configuration.
- *
- * @param name the new name for this configuration
- */
- private void setName(String name) {
- fName = name;
- setDirty();
- }
-
- /**
- * @see ILaunchConfiguration#getName()
- */
- public String getName() {
- return fName;
- }
-
- /**
- * @see ILaunchConfiguration#isLocal()
- */
- public boolean isLocal() {
- return getContainer() == null;
- }
-
- /**
- * Returns the location this launch configuration will reside at
- * when saved.
- *
- * @see ILaunchConfiguration#getLocation()
- */
- public IPath getLocation() {
- if (isMoved()) {
- IPath path = null;
- if (isLocal()) {
- path = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
- } else {
- path = getContainer().getLocation();
- }
- path = path.append(getName() + "." + LAUNCH_CONFIGURATION_FILE_EXTENSION); //$NON-NLS-1$
- return path;
- }
- return getOriginal().getLocation();
- }
-
- /**
- * Returns whether this working copy is new, or is a
- * working copy of another launch configuration.
- *
- * @return whether this working copy is new, or is a
- * working copy of another launch configuration
- */
- protected boolean isNew() {
- return getOriginal() == null;
- }
-
- /**
- * Returns whether this working copy is new or if its
- * location has changed from that of its original.
- *
- * @return whether this working copy is new or if its
- * location has changed from that of its original
- */
- protected boolean isMoved() {
- if (isNew() || fRenamed) {
- return true;
- }
- IContainer newContainer = getContainer();
- IContainer originalContainer = ((LaunchConfiguration)getOriginal()).getContainer();
- if (newContainer == originalContainer) {
- return false;
- }
- if (newContainer == null) {
- return !originalContainer.equals(newContainer);
- }
- return !newContainer.equals(originalContainer);
- }
-
- /**
- * A working copy cannot generate a memento.
- *
- * @see ILaunchConfiguration#getMemento()
- */
- public String getMemento() {
- return null;
- }
-
- /**
- * Returns whether change notification should be
- * suppressed
- */
- protected boolean suppressChangeNotification() {
- return fSuppressChange;
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setContainer(IContainer)
- */
- public void setContainer(IContainer container) {
- if (container == fContainer) {
- return;
- }
- if (container != null) {
- if (container.equals(fContainer)) {
- return;
- }
- } else {
- if (fContainer.equals(container)) {
- return;
- }
- }
- fContainer = container;
- setDirty();
- }
-
- /**
- * Returns the container this working copy will be
- * stored in when saved, or <code>null</code> if
- * this working copy is local.
- *
- * @return the container this working copy will be
- * stored in when saved, or <code>null</code> if
- * this working copy is local
- */
- protected IContainer getContainer() {
- return fContainer;
- }
-
- /**
- * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setAttributes(java.util.Map)
- */
- public void setAttributes(Map attributes) {
- getInfo().setAttributes(attributes);
- }
-
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
deleted file mode 100644
index 2000721ef..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ /dev/null
@@ -1,1834 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Sebastian Davids - bug 50567 Eclipse native environment support on Win98
- * Pawel Piech - Bug 82001: When shutting down the IDE, the debugger should first
- * attempt to disconnect debug targets before terminating them
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-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.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationListener;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchListener;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.ILaunchMode;
-import org.eclipse.debug.core.ILaunchesListener;
-import org.eclipse.debug.core.ILaunchesListener2;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IDisconnect;
-import org.eclipse.debug.core.model.IPersistableSourceLocator;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
-import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
-import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
-import org.eclipse.debug.internal.core.sourcelookup.SourceContainerType;
-import org.eclipse.debug.internal.core.sourcelookup.SourcePathComputer;
-import org.eclipse.osgi.service.environment.Constants;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Manages launch configurations, launch configuration types, and registered launches.
- *
- * @see ILaunchManager
- */
-/**
- * LaunchManager
- */
-public class LaunchManager extends PlatformObject implements ILaunchManager, IResourceChangeListener {
-
- /**
- * Collection of defined launch configuration type
- * extensions.
- */
- 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.
- */
- private Map fComparators = null;
-
- /**
- * Registered launch modes, or <code>null</code> if not initialized.
- * Keys are mode identifiers, values are <code>ILaunchMode</code>s.
- */
- private Map fLaunchModes = null;
-
- /**
- * List of contributed launch delegates (delegates contributed for existing
- * launch configuration types).
- */
- private List fContributedDelegates = null;
-
- /**
- * 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;
-
- /**
- * Collection of launches
- */
- private Vector fLaunches= new Vector(10);
-
- /**
- * Set of launches for efficient 'isRegistered()' check
- */
- private Set fLaunchSet = new HashSet(10);
-
- /**
- * Collection of listeners
- */
- private ListenerList fListeners= new ListenerList(5);
-
- /**
- * Collection of "plural" listeners.
- * @since 2.1
- */
- private ListenerList fLaunchesListeners = new ListenerList(5);
-
- /**
- * Visitor used to process resource deltas,
- * to update launch configuration index.
- */
- private LaunchManagerVisitor fgVisitor;
-
- /**
- * Whether this manager is listening for resouce change events
- */
- private boolean fListening = false;
-
- /**
- * Launch configuration listeners
- */
- private ListenerList fLaunchConfigurationListeners = new ListenerList(5);
-
- /**
- * Table of source locator extensions. Keys
- * are identifiers, and values are associated
- * configuration elements.
- */
- private Map fSourceLocators = null;
-
- /**
- * The handles of launch configurations being moved, or <code>null</code>
- */
- private ILaunchConfiguration fFrom;
- private ILaunchConfiguration fTo;
-
- /**
- * Path to the local directory where local launch configurations
- * are stored with the workspace.
- */
- protected static final IPath LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH =
- DebugPlugin.getDefault().getStateLocation().append(".launches"); //$NON-NLS-1$
-
-
- /**
- * 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.
- */
- private Map sourcePathComputers;
-
- /**
- * Serializes a XML document into a string - encoded in UTF8 format,
- * with platform line separators.
- *
- * @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
- */
- public static String serializeDocument(Document doc) throws TransformerException, IOException {
- ByteArrayOutputStream s= new ByteArrayOutputStream();
-
- TransformerFactory factory= TransformerFactory.newInstance();
- Transformer transformer= factory.newTransformer();
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
-
- DOMSource source= new DOMSource(doc);
- StreamResult outputTarget= new StreamResult(s);
- transformer.transform(source, outputTarget);
-
- return s.toString("UTF8"); //$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
- * @since 3.0
- */
- public static Document getDocument() throws ParserConfigurationException {
- DocumentBuilderFactory dfactory= DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder= dfactory.newDocumentBuilder();
- Document doc= docBuilder.newDocument();
- return doc;
- }
-
- /**
- * @see ILaunchManager#addLaunchListener(ILaunchListener)
- */
- public void addLaunchListener(ILaunchListener listener) {
- fListeners.add(listener);
- }
-
- /**
- * Returns a collection of all launch configuration handles in
- * the workspace. This collection is initialized lazily.
- *
- * @return all launch configuration handles
- */
- private List getAllLaunchConfigurations() {
- if (fLaunchConfigurationIndex == null) {
- try {
- fLaunchConfigurationIndex = new ArrayList(20);
- List configs = findLocalLaunchConfigurations();
- verifyConfigurations(configs, fLaunchConfigurationIndex);
- configs = findLaunchConfigurations(getWorkspaceRoot());
- verifyConfigurations(configs, fLaunchConfigurationIndex);
- } finally {
- hookResourceChangeListener();
- }
- }
- return fLaunchConfigurationIndex;
- }
-
- /**
- * Starts listening for resource change events
- */
- private synchronized void hookResourceChangeListener() {
- if (!fListening) {
- getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE);
- fListening = true;
- }
- }
-
- /**
- * Verify basic integrity of launch configurations in the given list,
- * adding valid configs to the collection of all launch configurations.
- * Exceptions are logged for invalid configs.
- *
- * @param verify the list of configs to verify
- * @param valid the list to place valid configrations in
- */
- protected void verifyConfigurations(List verify, List valid) {
- Iterator configs = verify.iterator();
- while (configs.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration)configs.next();
- if (isValid(config)) {
- valid.add(config);
- }
- }
- }
-
- /**
- * Returns whether the given launch configuration passes a basic
- * integritiy test by retrieving its type.
- *
- * @param config the configuration to verify
- * @return whether the config meets basic integrity constraints
- */
- protected boolean isValid(ILaunchConfiguration config) {
- try {
- config.getType();
- } catch (CoreException e) {
- if (e.getStatus().getCode() != DebugException.MISSING_LAUNCH_CONFIGURATION_TYPE) {
- // only log warnings due to something other than a missing
- // launch config type
- DebugPlugin.log(e);
- }
- return false;
- }
- return true;
- }
-
- /**
- * Clears all launch configurations (if any have been accessed)
- */
- private void clearAllLaunchConfigurations() {
- if (fLaunchConfigurationTypes != null) {
- fLaunchConfigurationTypes.clear();
- }
- if (fLaunchConfigurationIndex != null) {
- fLaunchConfigurationIndex.clear();
- }
- }
-
- /**
- * @see ILaunchManager#removeLaunch(ILaunch)
- */
- public void removeLaunch(ILaunch launch) {
- if (internalRemoveLaunch(launch)) {
- fireUpdate(launch, REMOVED);
- fireUpdate(new ILaunch[] {launch}, REMOVED);
- }
- }
-
- /**
- * Removes the given launch object from the collection of registered
- * launches. Returns whether the launch was removed.
- *
- * @param launch the launch to remove
- * @return whether the launch was removed
- */
- protected synchronized boolean internalRemoveLaunch(ILaunch launch) {
- if (launch == null) {
- return false;
- }
- fLaunchSet.remove(launch);
- return fLaunches.remove(launch);
- }
-
- /**
- * Fires notification to (single) listeners that a launch has been
- * added/changed/removed..
- */
- public void fireUpdate(ILaunch launch, int update) {
- getLaunchNotifier().notify(launch, update);
- }
-
- /**
- * Fires notification to (multi) listeners that a launch has been
- * added/changed/removed.
- */
- public void fireUpdate(ILaunch[] launches, int update) {
- getLaunchesNotifier().notify(launches, update);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchManager#isRegistered(org.eclipse.debug.core.ILaunch)
- */
- public synchronized boolean isRegistered(ILaunch launch) {
- return fLaunchSet.contains(launch);
- }
-
- /**
- * @see ILaunchManager#getDebugTargets()
- */
- public IDebugTarget[] getDebugTargets() {
- List allTargets= new ArrayList(fLaunches.size());
- if (fLaunches.size() > 0) {
- Iterator e= fLaunches.iterator();
- while (e.hasNext()) {
- IDebugTarget[] targets= ((ILaunch) e.next()).getDebugTargets();
- for (int i = 0; i < targets.length; i++) {
- allTargets.add(targets[i]);
- }
- }
- }
- return (IDebugTarget[])allTargets.toArray(new IDebugTarget[allTargets.size()]);
- }
-
- /**
- * @see ILaunchManager#getLaunches()
- */
- public ILaunch[] getLaunches() {
- return (ILaunch[])fLaunches.toArray(new ILaunch[fLaunches.size()]);
- }
-
- /**
- * @see ILaunchManager#getProcesses()
- */
- public IProcess[] getProcesses() {
- List allProcesses= new ArrayList(fLaunches.size());
- Iterator e= fLaunches.iterator();
- while (e.hasNext()) {
- IProcess[] processes= ((ILaunch) e.next()).getProcesses();
- for (int i= 0; i < processes.length; i++) {
- allProcesses.add(processes[i]);
- }
- }
- return (IProcess[])allProcesses.toArray(new IProcess[allProcesses.size()]);
- }
-
- /**
- * @see ILaunchManager#addLaunch(ILaunch)
- */
- public void addLaunch(ILaunch launch) {
- if (internalAddLaunch(launch)) {
- fireUpdate(launch, ADDED);
- fireUpdate(new ILaunch[] {launch}, ADDED);
- }
- }
-
- /**
- * Adds the given launch object to the list of registered launches,
- * and returns whether the launch was added.
- *
- * @param launch launch to register
- * @return whether the launch was added
- */
- protected synchronized boolean internalAddLaunch(ILaunch launch) {
- if (fLaunches.contains(launch)) {
- return false;
- }
- fLaunches.add(launch);
- fLaunchSet.add(launch);
- return true;
- }
-
- /**
- * @see ILaunchManager#removeLaunchListener(ILaunchListener)
- */
- public void removeLaunchListener(ILaunchListener listener) {
- fListeners.remove(listener);
- }
-
- /**
- * 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 {
- Element root = null;
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- root = parser.parse(new InputSource(stream)).getDocumentElement();
- LaunchConfigurationInfo info = new LaunchConfigurationInfo();
- info.initializeFromXML(root);
- return info;
- }
-
- /**
- * Terminates/Disconnects any active debug targets/processes.
- * Clears launch configuration types.
- */
- public void shutdown() {
- fListeners.removeAll();
- ILaunch[] launches = getLaunches();
- for (int i= 0; i < launches.length; i++) {
- ILaunch launch= launches[i];
- try {
- if (launch instanceof IDisconnect) {
- IDisconnect disconnect = (IDisconnect)launch;
- if (disconnect.canDisconnect()) {
- disconnect.disconnect();
- }
- }
- if (launch.canTerminate()) {
- launch.terminate();
- }
- } catch (DebugException e) {
- DebugPlugin.log(e);
- }
- }
-
- clearAllLaunchConfigurations();
-
- getWorkspace().removeResourceChangeListener(this);
- }
-
- /**
- * 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
- */
- protected LaunchConfigurationInfo getInfo(ILaunchConfiguration config) throws CoreException {
- LaunchConfigurationInfo info = (LaunchConfigurationInfo)fLaunchConfigurations.get(config);
- if (info == null) {
- if (config.exists()) {
- InputStream stream = null;
- try {
- if (config.isLocal()) {
- IPath path = config.getLocation();
- File file = path.toFile();
- stream = new FileInputStream(file);
- } else {
- IFile file = ((LaunchConfiguration) config).getFile();
- if (file == null) {
- throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.30"), new String[] {config.getName()}), null); //$NON-NLS-1$
- }
- stream = file.getContents();
- }
- info = createInfoFromXML(stream);
- fLaunchConfigurations.put(config, info);
- } catch (FileNotFoundException e) {
- throwException(config, e);
- } catch (SAXException e) {
- throwException(config, e);
- } catch (ParserConfigurationException e) {
- throwException(config, e);
- } catch (IOException e) {
- throwException(config, e);
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- throwException(config, e);
- }
- }
- }
-
- } else {
- throw createDebugException(
- MessageFormat.format(DebugCoreMessages.getString("LaunchManager.does_not_exist"), new String[]{config.getName(), config.getLocation().toOSString()}), null); //$NON-NLS-1$
- }
- }
- return info;
- }
-
- /**
- * Throws a debug exception with the given throwable that occurred
- * while processing the given configuration.
- */
- private void throwException(ILaunchConfiguration config, Throwable e) throws DebugException {
- IPath path = config.getLocation();
- throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file_{1}._1"), new String[]{e.toString(), path.toOSString()}), e); //$NON-NLS-1$
- }
-
- /**
- * 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
- )
- );
- }
-
- /**
- * Removes the given launch configuration from the cache of configurations.
- * When a local configuration is deleted, this method is called, as there will
- * be no resource delta generated to auto-update the cache.
- *
- * @param configuration the configuration to remove
- */
- private void removeInfo(ILaunchConfiguration configuration) {
- fLaunchConfigurations.remove(configuration);
- }
-
- /**
- * @see ILaunchManager#getLaunchConfigurations()
- */
- public ILaunchConfiguration[] getLaunchConfigurations() {
- List allConfigs = getAllLaunchConfigurations();
- return (ILaunchConfiguration[])allConfigs.toArray(new ILaunchConfiguration[allConfigs.size()]);
- }
-
- /**
- * @see ILaunchManager#getLaunchConfigurations(ILaunchConfigurationType)
- */
- public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException {
- Iterator iter = getAllLaunchConfigurations().iterator();
- List configs = new ArrayList();
- while (iter.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
- if (config.getType().equals(type)) {
- configs.add(config);
- }
- }
- return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]);
- }
-
- /**
- * Returns all launch configurations that are stored as resources
- * in the given project.
- *
- * @param project a project
- * @return collection of launch configurations that are stored as resources
- * in the given project
- */
- protected List getLaunchConfigurations(IProject project) {
- Iterator iter = getAllLaunchConfigurations().iterator();
- List configs = new ArrayList();
- while (iter.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
- IFile file = config.getFile();
- if (file != null && file.getProject().equals(project)) {
- configs.add(config);
- }
- }
- return configs;
- }
-
- /**
- * Returns all launch configurations that are stored locally.
- *
- * @return collection of launch configurations stored lcoally
- */
- protected List getLocalLaunchConfigurations() {
- Iterator iter = getAllLaunchConfigurations().iterator();
- List configs = new ArrayList();
- while (iter.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
- if (config.isLocal()) {
- configs.add(config);
- }
- }
- return configs;
- }
-
- /**
- * @see ILaunchManager#getLaunchConfiguration(IFile)
- */
- public ILaunchConfiguration getLaunchConfiguration(IFile file) {
- hookResourceChangeListener();
- return new LaunchConfiguration(file.getLocation());
- }
-
- /**
- * @see ILaunchManager#getLaunchConfiguration(String)
- */
- public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException {
- hookResourceChangeListener();
- return new LaunchConfiguration(memento);
- }
-
- /**
- * @see ILaunchManager#getLaunchConfigurationTypes()
- */
- public ILaunchConfigurationType[] getLaunchConfigurationTypes() {
- List types= getLaunchConfigurationTypeList();
- return (ILaunchConfigurationType[])types.toArray(new ILaunchConfigurationType[types.size()]);
- }
-
- /**
- * @see ILaunchManager#getLaunchConfigurationType(String)
- */
- public ILaunchConfigurationType getLaunchConfigurationType(String id) {
- Iterator iter = getLaunchConfigurationTypeList().iterator();
- while (iter.hasNext()) {
- ILaunchConfigurationType type = (ILaunchConfigurationType)iter.next();
- if (type.getIdentifier().equals(id)) {
- return type;
- }
- }
- return null;
- }
-
- private List getLaunchConfigurationTypeList() {
- initializeLaunchConfigurationTypes();
- return fLaunchConfigurationTypes;
- }
-
- 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();
- fLaunchConfigurationTypes= new ArrayList(infos.length);
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
- LaunchConfigurationType configType = new LaunchConfigurationType(configurationElement);
- fLaunchConfigurationTypes.add(configType);
- }
- }
- }
-
- /**
- * Initializes contributed launch delegates (i.e. delegates contributed
- * to an existing launch configuration type).
- */
- private synchronized void initializeContributedDelegates() {
- if (fContributedDelegates == null) {
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES);
- IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
- fContributedDelegates= new ArrayList(infos.length);
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
- ContributedDelegate delegate = new ContributedDelegate(configurationElement);
- fContributedDelegates.add(delegate);
- }
- }
- }
-
- /**
- * Returns a list of launch delegates contributed for existing launch configuration
- * types.
- *
- * @return list of ContributedDelegate
- */
- protected List getContributedDelegates() {
- initializeContributedDelegates();
- return fContributedDelegates;
- }
- /**
- * Notifies the launch manager that a launch configuration
- * has been deleted. The configuration is removed from the
- * cache of infos and from the index of configurations by
- * project, and listeners are notified.
- *
- * @param config the launch configuration that was deleted
- */
- protected void launchConfigurationDeleted(ILaunchConfiguration config) {
- removeInfo(config);
- getAllLaunchConfigurations().remove(config);
- getConfigurationNotifier().notify(config, REMOVED);
- clearConfigNameCache();
- }
-
- /**
- * 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
- */
- protected void launchConfigurationAdded(ILaunchConfiguration config) {
- if (config.isWorkingCopy()) {
- return;
- }
- if (isValid(config)) {
- List allConfigs = getAllLaunchConfigurations();
- if (!allConfigs.contains(config)) {
- allConfigs.add(config);
- getConfigurationNotifier().notify(config, ADDED);
- clearConfigNameCache();
- }
- } else {
- 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.
- *
- * @param config the launch configuration that was changed
- */
- protected void launchConfigurationChanged(ILaunchConfiguration config) {
- removeInfo(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),
- // add it back (will only add if required)
- launchConfigurationAdded(config);
- getConfigurationNotifier().notify(config, CHANGED);
- } else {
- launchConfigurationDeleted(config);
- }
- }
-
- /**
- * @see ILaunchManager#isExistingLaunchConfigurationName(String)
- */
- public boolean isExistingLaunchConfigurationName(String name) {
- String[] sortedConfigNames = getAllSortedConfigNames();
- int index = Arrays.binarySearch(sortedConfigNames, name);
- if (index < 0) {
- return false;
- }
- return true;
- }
-
- /**
- * @see org.eclipse.debug.core.ILaunchManager#generateUniqueLaunchConfigurationNameFrom(String)
- */
- public String generateUniqueLaunchConfigurationNameFrom(String baseName) {
- int index = 1;
- 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 (isNumber(trailer)) {
- try {
- index = Integer.parseInt(trailer);
- baseName = baseName.substring(0, copyIndex);
- } catch (NumberFormatException nfe) {
- }
- }
- }
- String newName = baseName;
-
- StringBuffer buffer= null;
- while (isExistingLaunchConfigurationName(newName)) {
- buffer = new StringBuffer(baseName);
- buffer.append(" ("); //$NON-NLS-1$
- buffer.append(String.valueOf(index));
- index++;
- buffer.append(')');
- newName = buffer.toString();
- }
-
- return newName;
- }
-
- /**
- * Returns whether the given String is composed solely of digits
- */
- private boolean isNumber(String string) {
- int numChars= string.length();
- if (numChars == 0) {
- return false;
- }
- for (int i= 0; i < numChars; i++) {
- if (!Character.isDigit(string.charAt(i))) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * 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 String[] getAllSortedConfigNames() {
- if (fSortedConfigNames == null) {
- ILaunchConfiguration[] configs = getLaunchConfigurations();
- fSortedConfigNames = new String[configs.length];
- for (int i = 0; i < configs.length; i++) {
- fSortedConfigNames[i] = configs[i].getName();
- }
- Arrays.sort(fSortedConfigNames);
- }
- return fSortedConfigNames;
- }
-
- /**
- * The launch config name cache is cleared when a config is added, deleted or changed.
- */
- protected void clearConfigNameCache() {
- fSortedConfigNames = null;
- }
-
- /**
- * Finds and returns all local launch configurations.
- *
- * @return all local launch configurations
- * @exception CoreException if there is a lower level
- * IO exception
- */
- protected List findLocalLaunchConfigurations() {
- IPath containerPath = LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
- List configs = new ArrayList(10);
- final File directory = containerPath.toFile();
- 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);
- }
- };
- String[] files = directory.list(filter);
- for (int i = 0; i < files.length; i++) {
- LaunchConfiguration config = new LaunchConfiguration(containerPath.append(files[i]));
- configs.add(config);
- }
- }
- return configs;
- }
-
- /**
- * Finds and returns all launch configurations in the given
- * container (and subcontainers)
- *
- * @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()) {
- return list;
- }
- ResourceProxyVisitor visitor= new ResourceProxyVisitor(list);
- try {
- container.accept(visitor, IResource.NONE);
- } catch (CoreException ce) {
- //Closed project...should not be possible with previous check
- }
- Iterator iter = list.iterator();
- List configs = new ArrayList(list.size());
- while (iter.hasNext()) {
- IFile file = (IFile)iter.next();
- configs.add(getLaunchConfiguration(file));
- }
- return configs;
- }
-
- /**
- * Traverses the delta looking for added/removed/changed launch
- * configuration files.
- *
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta delta= event.getDelta();
- if (delta == null) {
- // pre-delete
- LaunchManagerVisitor visitor = getDeltaVisitor();
- IResource resource = event.getResource();
- if (resource instanceof IProject) {
- IProject project = (IProject) resource;
- visitor.preDelete(project);
- }
- } else {
- try {
- LaunchManagerVisitor visitor = getDeltaVisitor();
- delta.accept(visitor);
- visitor.reset();
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- }
-
- /**
- * 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();
- }
- return fgVisitor;
- }
-
- /**
- * Returns the launch configurations specified by the given
- * XML document.
- *
- * @param root XML document
- * @return list of launch configurations
- * @exception IOException if an exception occurs reading the XML
- */
- protected List getConfigsFromXML(Element root) throws CoreException {
- DebugException invalidFormat =
- new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchManager.Invalid_launch_configuration_index._18"), null //$NON-NLS-1$
- )
- );
-
- if (!root.getNodeName().equalsIgnoreCase("launchConfigurations")) { //$NON-NLS-1$
- throw invalidFormat;
- }
-
- // read each launch configuration
- List configs = new ArrayList(4);
- NodeList list = root.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node node = list.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- String nodeName = entry.getNodeName();
- if (!nodeName.equals("launchConfiguration")) { //$NON-NLS-1$
- throw invalidFormat;
- }
- String memento = entry.getAttribute("memento"); //$NON-NLS-1$
- if (memento == null) {
- throw invalidFormat;
- }
- configs.add(getLaunchConfiguration(memento));
- }
- }
- return 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
- */
- protected void projectOpened(IProject project) {
- List configs = findLaunchConfigurations(project);
- if (!configs.isEmpty()) {
- Iterator iterator = configs.iterator();
- while (iterator.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration) iterator.next();
- launchConfigurationAdded(config);
- }
- }
- }
-
- /**
- * 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
- */
- protected void projectClosed(IProject project) {
- List configs = getLaunchConfigurations(project);
- if (!configs.isEmpty()) {
- Iterator iterator = configs.iterator();
- while (iterator.hasNext()) {
- ILaunchConfiguration configuration = (ILaunchConfiguration)iterator.next();
- launchConfigurationDeleted(configuration);
- }
- }
- }
-
- /**
- * Visitor for handling resource deltas.
- */
- class LaunchManagerVisitor implements IResourceDeltaVisitor {
-
- /**
- * Map of files to associated (shared) launch configs in a project
- * that is going to be deleted.
- */
- private Map fFileToConfig = new HashMap();
-
- /**
- * @see IResourceDeltaVisitor#visit(IResourceDelta)
- */
- public boolean visit(IResourceDelta delta) {
- if (delta == null) {
- return false;
- }
- if (0 != (delta.getFlags() & IResourceDelta.OPEN)) {
- if (delta.getResource() instanceof IProject) {
- IProject project = (IProject)delta.getResource();
-
- if (project.isOpen()) {
- LaunchManager.this.projectOpened(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())) {
- IPath configPath = file.getLocation();
- ILaunchConfiguration handle = null;
- // If the file has already been deleted, reconstruct the handle from our cache
- if (configPath == null) {
- handle = (ILaunchConfiguration) fFileToConfig.get(file);
- } else {
- handle = new LaunchConfiguration(configPath);
- }
- if (handle != null) {
- 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;
- } else if (resource instanceof IContainer) {
- return true;
- }
- return true;
- }
-
- /**
- * Builds a cache of configs that will be deleted in the given project
- */
- public void preDelete(IProject project) {
- List list = findLaunchConfigurations(project);
- Iterator configs = list.iterator();
- while (configs.hasNext()) {
- ILaunchConfiguration configuration = (ILaunchConfiguration) configs.next();
- IFile file = configuration.getFile();
- if (file != null) {
- fFileToConfig.put(file, configuration);
- }
- }
- }
-
- /**
- * Resets this resource delta visitor for a new pass.
- */
- public void reset() {
- fFileToConfig.clear();
- }
- }
-
- /**
- * @see ILaunchManager#addLaunchConfigurationListener(ILaunchConfigurationListener)
- */
- public void addLaunchConfigurationListener(ILaunchConfigurationListener listener) {
- fLaunchConfigurationListeners.add(listener);
- }
-
- /**
- * @see ILaunchManager#removeLaunchConfigurationListener(ILaunchConfigurationListener)
- */
- public void removeLaunchConfigurationListener(ILaunchConfigurationListener listener) {
- fLaunchConfigurationListeners.remove(listener);
- }
-
- /**
- * Register source locators.
- *
- * @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);
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
- String id = configurationElement.getAttribute("id"); //$NON-NLS-1$
- if (id != null) {
- fSourceLocators.put(id,configurationElement);
- } else {
- // invalid status handler
- IStatus s = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
- MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Invalid_source_locator_extentsion_defined_by_plug-in___{0}______id___not_specified_12"), new String[] {configurationElement.getNamespace()} ), null); //$NON-NLS-1$
- DebugPlugin.log(s);
- }
- }
- }
- }
-
-
- /**
- * 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();
- fComparators = new HashMap(infos.length);
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
- String attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$
- if (attr != null) {
- fComparators.put(attr, new LaunchConfigurationComparator(configurationElement));
- } else {
- // invalid status handler
- IStatus s = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
- MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Invalid_launch_configuration_comparator_extension_defined_by_plug-in_{0}_-_attribute_not_specified_1"), new String[] {configurationElement.getNamespace()}), null); //$NON-NLS-1$
- DebugPlugin.log(s);
- }
- }
- }
- }
-
- /**
- * @see ILaunchManager#newSourceLocator(String)
- */
- public IPersistableSourceLocator newSourceLocator(String identifier) throws CoreException {
- initializeSourceLocators();
- IConfigurationElement config = (IConfigurationElement)fSourceLocators.get(identifier);
- if (config == null) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
- MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Source_locator_does_not_exist__{0}_13"), new String[] {identifier} ), null)); //$NON-NLS-1$
- }
- IPersistableSourceLocator sourceLocator = (IPersistableSourceLocator)config.createExecutableExtension("class"); //$NON-NLS-1$
- if (sourceLocator instanceof AbstractSourceLookupDirector) {
- ((AbstractSourceLookupDirector)sourceLocator).setId(identifier);
- }
- return sourceLocator;
- }
-
- /**
- * Returns the comparator registered for the given attribute, or
- * <code>null</code> if none.
- *
- * @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);
- }
-
- /**
- * Returns comparators, loading if required
- */
- protected Map getComparators() {
- initializeComparators();
- return fComparators;
- }
-
- private IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- private IWorkspaceRoot getWorkspaceRoot() {
- return getWorkspace().getRoot();
- }
-
- /**
- * @see org.eclipse.debug.core.ILaunchManager#addLaunches(org.eclipse.debug.core.ILaunch)
- */
- public void addLaunches(ILaunch[] launches) {
- List added = new ArrayList(launches.length);
- for (int i = 0; i < launches.length; i++) {
- if (internalAddLaunch(launches[i])) {
- added.add(launches[i]);
- }
- }
- if (!added.isEmpty()) {
- 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 org.eclipse.debug.core.ILaunchManager#removeLaunches(org.eclipse.debug.core.ILaunch)
- */
- public void removeLaunches(ILaunch[] launches) {
- List removed = new ArrayList(launches.length);
- for (int i = 0; i < launches.length; i++) {
- if (internalRemoveLaunch(launches[i])) {
- removed.add(launches[i]);
- }
- }
- if (!removed.isEmpty()) {
- 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);
- }
-
- /**
- * 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>
- */
- protected void setMovedFromTo(ILaunchConfiguration from, ILaunchConfiguration to) {
- fFrom = from;
- fTo = to;
- }
- /**
- * @see org.eclipse.debug.core.ILaunchManager#getMovedFrom(org.eclipse.debug.core.ILaunchConfiguration)
- */
- 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) {
- if (removedConfiguration.equals(fFrom)) {
- return fTo;
- }
- return null;
- }
-
- /**
- * Collects files whose extension matches the launch configuration file
- * extension.
- */
- class ResourceProxyVisitor implements IResourceProxyVisitor {
-
- private List fList;
-
- protected ResourceProxyVisitor(List 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())) {
- fList.add(proxy.requestResource());
- }
- return false;
- }
- return true;
- }
- }
-
- private LaunchNotifier getLaunchNotifier() {
- return new LaunchNotifier();
- }
-
- /**
- * 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, DebugCoreMessages.getString("LaunchManager.An_exception_occurred_during_launch_change_notification._1"), exception); //$NON-NLS-1$
- DebugPlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- 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;
- }
- }
-
- /**
- * Notifies the given listener of the add/change/remove
- *
- * @param listener the listener to notify
- * @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];
- Platform.run(this);
- }
- fLaunch = null;
- fListener = null;
- }
- }
-
- private LaunchesNotifier getLaunchesNotifier() {
- return new LaunchesNotifier();
- }
-
- /**
- * 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, DebugCoreMessages.getString("LaunchManager.An_exception_occurred_during_launch_change_notification._1"), exception); //$NON-NLS-1$
- DebugPlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- 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]);
- }
- }
- }
- }
- 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;
- }
- }
-
- /**
- * Notifies the given listener of the adds/changes/removes
- *
- * @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];
- Platform.run(this);
- }
- fNotifierLaunches = null;
- fRegistered = null;
- fListener = null;
- }
- }
-
- protected ConfigurationNotifier getConfigurationNotifier() {
- return new ConfigurationNotifier();
- }
-
- /**
- * 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, DebugCoreMessages.getString("LaunchManager.An_exception_occurred_during_launch_configuration_change_notification._3"), exception); //$NON-NLS-1$
- DebugPlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- 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;
- }
- }
-
- /**
- * Notifies the given listener of the add/change/remove
- *
- * @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();
- for (int i = 0; i < listeners.length; i++) {
- fListener = (ILaunchConfigurationListener)listeners[i];
- Platform.run(this);
- }
- }
- fConfiguration = null;
- fListener = null;
- }
- }
-
- /**
- * Load comparator extensions.
- *
- * @exception CoreException if an exception occurs reading
- * the extensions
- */
- private synchronized void initializeLaunchModes() {
- if (fLaunchModes == null) {
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_MODES);
- IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
- fLaunchModes = new HashMap();
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
- try {
- ILaunchMode mode = new LaunchMode(configurationElement);
- fLaunchModes.put(mode.getIdentifier(), mode);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
-
- }
- }
- }
-
- /**
- * Returns an array of environment variables to be used 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
- */
- public String[] getEnvironment(ILaunchConfiguration configuration) throws CoreException {
- Map envMap = configuration.getAttribute(ATTR_ENVIRONMENT_VARIABLES, (Map) null);
- if (envMap == null) {
- return null;
- }
- Map env = null;
- // build base environment
- env= new HashMap();
- boolean append= configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
- if (append) {
- env.putAll(getNativeEnvironment());
- }
-
- // Add variables from config
- Iterator iter= envMap.entrySet().iterator();
- boolean win32= Platform.getOS().equals(Constants.OS_WIN32);
- while (iter.hasNext()) {
- Map.Entry entry= (Map.Entry) iter.next();
- String key= (String) entry.getKey();
- if (win32) {
- // Win32 vars are case insensitive. Uppercase everything so
- // that (for example) "pAtH" will correctly replace "PATH"
- key= key.toUpperCase();
- }
- String value = (String) entry.getValue();
- // translate any string substitution variables
- String translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value);
- env.put(key, translated);
- }
-
- iter= env.entrySet().iterator();
- List strings= new ArrayList(env.size());
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry) iter.next();
- StringBuffer buffer= new StringBuffer((String) entry.getKey());
- buffer.append('=').append((String) entry.getValue());
- strings.add(buffer.toString());
- }
- return (String[]) strings.toArray(new String[strings.size()]);
- }
-
-
- /**
- * Returns a copy of the native system environment variables. On WIN32,
- * all keys (variable names) are returned in uppercase. Note
- * that WIN32's environment is not case sensitive.
- *
- * @return the a copy of the native system environment variables
- */
- public Map getNativeEnvironment() {
- if (fgNativeEnv != null) {
- return new HashMap(fgNativeEnv);
- }
- fgNativeEnv= new HashMap();
- try {
- String nativeCommand= null;
- boolean windowsOS= false;
- boolean isWin9xME= false; //see bug 50567
- String fileName= null;
- if (Platform.getOS().equals(Constants.OS_WIN32)) {
- windowsOS= true;
- 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$
- } else {
- // Win NT, 2K, XP
- nativeCommand= "cmd.exe /C set"; //$NON-NLS-1$
- }
- } else if (!Platform.getOS().equals(Constants.OS_UNKNOWN)){
- nativeCommand= "printenv"; //$NON-NLS-1$
- }
- if (nativeCommand == null) {
- return fgNativeEnv;
- }
- 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);
- FileInputStream stream= new FileInputStream(file);
- p.load(stream);
- stream.close();
- if (!file.delete()) {
- file.deleteOnExit(); // if delete() fails try again on VM close
- }
- for (Enumeration enumeration = p.keys(); enumeration.hasMoreElements();) {
- // Win32's environment vars 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()).toUpperCase();
- //no need to cast value
- fgNativeEnv.put(key, p.get(key));
- }
- } else {
- //read process directly on other platforms
- BufferedReader reader= new BufferedReader(new InputStreamReader(process.getInputStream()));
- String line= reader.readLine();
- while (line != null) {
- int separator= line.indexOf('=');
- if (separator > 0) {
- String key= line.substring(0, separator);
- if (windowsOS) {
- // Win32's environment vars are case insensitive. Put everything
- // to uppercase so that (for example) the "PATH" variable will match
- // "pAtH" correctly on Windows.
- key= key.toUpperCase();
- }
- String value= line.substring(separator + 1);
- fgNativeEnv.put(key, value);
- }
- line= reader.readLine();
- }
- reader.close();
- }
- } catch (IOException e) {
- // Native environment-fetching code failed.
- // This can easily happen and is not useful to log.
- }
- return new HashMap(fgNativeEnv);
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchManager#newSourcePathComputer(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public ISourcePathComputer getSourcePathComputer(ILaunchConfiguration configuration) throws CoreException {
- String id = 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();
- }
- return getSourcePathComputer(id);
- }
-
- /**
- * 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();
- sourceContainerTypes = new HashMap();
- for (int i = 0; i < extensions.length; i++) {
- sourceContainerTypes.put(
- extensions[i].getAttribute("id"), //$NON-NLS-1$
- new SourceContainerType(extensions[i]));
- }
- 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("id"), //$NON-NLS-1$
- new SourcePathComputer(extensions[i]));
- }
- }
- }
-
- /* (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)
- * @see org.eclipse.debug.core.ILaunchManager#getSourceContainerTypes()
- */
- public ISourceContainerType[] getSourceContainerTypes() {
- initializeSourceContainerTypes();
- Collection containers = sourceContainerTypes.values();
- return (ISourceContainerType[]) containers.toArray(new ISourceContainerType[containers.size()]);
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchManager#getSourcePathComputer(java.lang.String)
- */
- public ISourcePathComputer getSourcePathComputer(String id) {
- initializeSourceContainerTypes();
- return (ISourcePathComputer) sourcePathComputers.get(id);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchManager#getLaunchModes()
- */
- public ILaunchMode[] getLaunchModes() {
- initializeLaunchModes();
- Collection collection = fLaunchModes.values();
- return (ILaunchMode[]) collection.toArray(new ILaunchMode[collection.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String)
- */
- public ILaunchMode getLaunchMode(String mode) {
- initializeLaunchModes();
- return (ILaunchMode) fLaunchModes.get(mode);
- }
-
-
-} \ No newline at end of file
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchMode.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchMode.java
deleted file mode 100644
index 805e4b8b2..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchMode.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-import java.text.MessageFormat;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchMode;
-
-/**
- * Proxy to a launch mode extension.
- */
-public class LaunchMode implements ILaunchMode {
-
- private IConfigurationElement fConfigurationElement;
-
- /**
- * Constructs a new launch mode.
- *
- * @exception CoreException if required attributes are missing
- */
- public LaunchMode(IConfigurationElement element) throws CoreException {
- fConfigurationElement = element;
- verifyAttributes();
- }
-
- /**
- * Verifies required attributes.
- *
- * @exception CoreException if required attributes are missing
- */
- private void verifyAttributes() throws CoreException {
- verifyAttributeExists("mode"); //$NON-NLS-1$
- verifyAttributeExists("label"); //$NON-NLS-1$
- }
-
- /**
- * Verifies the given attribute exists
- *
- * @exception CoreException if attribute does not exist
- */
- private void verifyAttributeExists(String name) throws CoreException {
- if (fConfigurationElement.getAttribute(name) == null) {
- missingAttribute(name);
- }
- }
-
- private void missingAttribute(String attrName) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.getString("LaunchMode.1"),new String[]{attrName}), null)); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchMode#getIdentifier()
- */
- public String getIdentifier() {
- return fConfigurationElement.getAttribute("mode"); //$NON-NLS-1$;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchMode#getLabel()
- */
- public String getLabel() {
- return fConfigurationElement.getAttribute("label"); //$NON-NLS-1$;
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ListenerList.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ListenerList.java
deleted file mode 100644
index 39e7635ea..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ListenerList.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-/**
- * Local version of org.eclipse.jface.util.ListenerList (modified)s
- */
-public class ListenerList {
- /**
- * The current number of listeners.
- * Maintains invariant: 0 <= fSize <= listeners.length.
- */
- private int fSize;
-
- /**
- * The list of listeners. Initially <code>null</code> but initialized
- * to an array of size capacity the first time a listener is added.
- * Maintains invariant: listeners != null if and only if fSize != 0
- */
- private Object[] fListeners= null;
-
- /**
- * The empty array singleton instance, returned by getListeners()
- * when size == 0.
- */
- private static final Object[] EmptyArray= new Object[0];
-
- /**
- * Creates a listener list with the given initial capacity.
- *
- * @param capacity the number of listeners which this list can initially accept
- * without growing its internal representation; must be at least 1
- */
- public ListenerList(int capacity) {
- if (capacity < 1) {
- throw new IllegalArgumentException();
- }
- fListeners= new Object[capacity];
- fSize= 0;
- }
-
- /**
- * Adds a listener to the list.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a listener
- */
- public synchronized void add(Object listener) {
- if (listener == null) {
- throw new IllegalArgumentException();
- }
- // check for duplicates using identity
- for (int i= 0; i < fSize; ++i) {
- if (fListeners[i] == listener) {
- return;
- }
- }
- // grow array if necessary
- if (fSize == fListeners.length) {
- Object[] temp= new Object[(fSize * 2) + 1];
- System.arraycopy(fListeners, 0, temp, 0, fSize);
- fListeners= temp;
- }
- fListeners[fSize++]= listener;
- }
-
- /**
- * Returns an array containing all the registered listeners.
- * The resulting array is unaffected by subsequent adds or removes.
- * If there are no listeners registered, the result is an empty array
- * singleton instance (no garbage is created).
- * Use this method when notifying listeners, so that any modifications
- * to the listener list during the notification will have no effect on the
- * notification itself.
- */
- public synchronized Object[] getListeners() {
- if (fSize == 0) {
- return EmptyArray;
- }
- Object[] result= new Object[fSize];
- System.arraycopy(fListeners, 0, result, 0, fSize);
- return result;
- }
-
- /**
- * Removes a listener from the list.
- * Has no effect if an identical listener was not already registered.
- *
- * @param listener a listener
- */
- public synchronized void remove(Object listener) {
- if (listener == null) {
- throw new IllegalArgumentException();
- }
-
- for (int i= 0; i < fSize; ++i) {
- if (fListeners[i] == listener) {
- if (--fSize == 0) {
- fListeners= new Object[1];
- } else {
- if (i < fSize) {
- fListeners[i]= fListeners[fSize];
- }
- fListeners[fSize]= null;
- }
- return;
- }
- }
- }
-
- /**
- * Removes all the listeners from the list.
- */
- public synchronized void removeAll() {
- fListeners= new Object[0];
- fSize= 0;
- }
-
- /**
- * Returns the number of registered listeners
- *
- * @return the number of registered listeners
- */
- public int size() {
- return fSize;
- }
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java
deleted file mode 100644
index 905b3948e..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILogicalStructureType;
-import org.eclipse.debug.core.model.IValue;
-
-/**
- * Manages logical structure extensions
- *
- * @since 3.0
- */
-public class LogicalStructureManager {
-
- private static LogicalStructureManager fgDefault;
- private List fTypes = null;
- private List fTypeProviders;
-
- public static LogicalStructureManager getDefault() {
- if (fgDefault == null) {
- fgDefault = new LogicalStructureManager();
- }
- return fgDefault;
- }
-
- public ILogicalStructureType[] getLogicalStructureTypes(IValue value) {
- initialize();
- // looks in the logical structure types
- Iterator iterator = fTypes.iterator();
- List select = new ArrayList();
- while (iterator.hasNext()) {
- ILogicalStructureType type = (ILogicalStructureType)iterator.next();
- if (type.providesLogicalStructure(value)) {
- select.add(type);
- }
- }
- // asks the logical structure providers
- for (Iterator iter= fTypeProviders.iterator(); iter.hasNext();) {
- ILogicalStructureType[] logicalStructures= ((LogicalStructureProvider) iter.next()).getLogicalStructures(value);
- for (int i= 0; i < logicalStructures.length; i++) {
- select.add(logicalStructures[i]);
- }
- }
- return (ILogicalStructureType[]) select.toArray(new ILogicalStructureType[select.size()]);
- }
-
- private void initialize() {
- if (fTypes == null) {
- //get the logical structure types from the extension points
- IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LOGICAL_STRUCTURE_TYPES);
- IConfigurationElement[] extensions = point.getConfigurationElements();
- fTypes = new ArrayList(extensions.length);
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement extension = extensions[i];
- LogicalStructureType type;
- try {
- type = new LogicalStructureType(extension);
- fTypes.add(type);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- // get the logical structure providers from the extension point
- point= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LOGICAL_STRUCTURE_PROVIDERS);
- extensions= point.getConfigurationElements();
- fTypeProviders= new ArrayList(extensions.length);
- for (int i= 0; i < extensions.length; i++) {
- try {
- fTypeProviders.add(new LogicalStructureProvider(extensions[i]));
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- }
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureProvider.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureProvider.java
deleted file mode 100644
index e7f3dc52d..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureProvider.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILogicalStructureProvider;
-import org.eclipse.debug.core.ILogicalStructureType;
-import org.eclipse.debug.core.model.IValue;
-
-/**
- * Manage logical structure provider extensions
- */
-public class LogicalStructureProvider {
-
- private IConfigurationElement fConfigurationElement;
-
- private String fModelIdentifier;
-
- private ILogicalStructureProvider fDelegate;
-
- public LogicalStructureProvider(IConfigurationElement element) throws CoreException {
- fConfigurationElement= element;
- fModelIdentifier= fConfigurationElement.getAttribute("modelIdentifier"); //$NON-NLS-1$
- if (fModelIdentifier == null) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, DebugCoreMessages.getString("LogicalStructureProvider.0"), null)); //$NON-NLS-1$
- }
- String className= fConfigurationElement.getAttribute("class"); //$NON-NLS-1$
- if (className == null) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, DebugCoreMessages.getString("LogicalStructureProvider.1"), null)); //$NON-NLS-1$
- }
- }
-
- /**
- * Return the logical structure type able to provide a logical structure for
- * the given value.
- */
- public ILogicalStructureType[] getLogicalStructures(IValue value) {
- if (fModelIdentifier.equals(value.getModelIdentifier())) {
- return getDelegate().getLogicalStructureTypes(value);
- }
- return new ILogicalStructureType[0];
- }
-
- /**
- * Return the ILogicalStructureProvider for this extension.
- */
- protected ILogicalStructureProvider getDelegate() {
- if (fDelegate == null) {
- try {
- fDelegate = (ILogicalStructureProvider) fConfigurationElement.createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- return fDelegate;
- }
-
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java
deleted file mode 100644
index f847446b4..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.*;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.*;
-import org.eclipse.debug.core.model.IValue;
-
-/**
- * Proxy to a logical structure type extension.
- */
-public class LogicalStructureType implements ILogicalStructureType {
-
- private IConfigurationElement fConfigurationElement;
- private ILogicalStructureTypeDelegate fDelegate;
- private String fModelId;
- // whether the 'description' attribute has been verified to exist: it is only
- // required when the delegate does *not* implement ILogicalStructureTypeDelegate2.
- private boolean fVerifiedDescription = false;
-
- /**
- * Constructs a new logical structure type, and verifies required attributes.
- *
- * @exception CoreException if required attributes are missing
- */
- public LogicalStructureType(IConfigurationElement element) throws CoreException {
- fConfigurationElement = element;
- verifyAttributes();
- }
-
- /**
- * Verifies required attributes.
- *
- * @exception CoreException if required attributes are missing
- */
- private void verifyAttributes() throws CoreException {
- verifyAttributeExists("id"); //$NON-NLS-1$
- verifyAttributeExists("class"); //$NON-NLS-1$
- fModelId = fConfigurationElement.getAttribute("modelIdentifier"); //$NON-NLS-1$
- if (fModelId == null) {
- missingAttribute("modelIdentifier"); //$NON-NLS-1$
- }
- }
-
- /**
- * Verifies the given attribute exists
- *
- * @exception CoreException if attribute does not exist
- */
- private void verifyAttributeExists(String name) throws CoreException {
- if (fConfigurationElement.getAttribute(name) == null) {
- missingAttribute(name);
- }
- }
-
- private void missingAttribute(String attrName) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.getString("LogicalStructureType.7"),new String[]{attrName}), null)); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.ILogicalStructureType#getDescription()
- */
- public String getDescription() {
- return fConfigurationElement.getAttribute("description"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.ILogicalStructureType#getId()
- */
- public String getId() {
- return fConfigurationElement.getAttribute("id"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.ILogicalStructureType#getLogicalStructure(org.eclipse.debug.core.model.IValue)
- */
- public IValue getLogicalStructure(IValue value) throws CoreException {
- return getDelegate().getLogicalStructure(value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.ILogicalStructureType#providesLogicalStructure(org.eclipse.debug.core.model.IValue)
- */
- public boolean providesLogicalStructure(IValue value) {
- if (value.getModelIdentifier().equals(fModelId)) {
- return getDelegate().providesLogicalStructure(value);
- }
- return false;
- }
-
- protected ILogicalStructureTypeDelegate getDelegate() {
- if (fDelegate == null) {
- try {
- fDelegate = (ILogicalStructureTypeDelegate) fConfigurationElement.createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- return fDelegate;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ILogicalStructureTypeDelegate2#getDescription(org.eclipse.debug.core.model.IValue)
- */
- public String getDescription(IValue value) {
- ILogicalStructureTypeDelegate delegate = getDelegate();
- if (delegate instanceof ILogicalStructureTypeDelegate2) {
- ILogicalStructureTypeDelegate2 d2 = (ILogicalStructureTypeDelegate2) delegate;
- return d2.getDescription(value);
- }
- if (!fVerifiedDescription) {
- fVerifiedDescription = true;
- try {
- verifyAttributeExists("description"); //$NON-NLS-1$
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- String description = getDescription();
- if (description == null) {
- return DebugCoreMessages.getString("LogicalStructureType.0"); //$NON-NLS-1$
- }
- return description;
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java
deleted file mode 100644
index 07d9e7c4d..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.debug.internal.core;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.IMemoryBlockListener;
-import org.eclipse.debug.core.IMemoryBlockManager;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.core.model.IMemoryBlockExtension;
-import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
-
-
-/**
- * Implementation of IMemoryBlockManager
- * The manager is responsible to manage all memory blocks in the workbench.
- *
- * @since 3.1
- *
- */
-/**
- * MemoryBlockManager
- */
-/**
- * MemoryBlockManager
- */
-public class MemoryBlockManager implements IMemoryBlockManager, IDebugEventSetListener {
-
- private ArrayList listeners = new ArrayList(); // list of all IMemoryBlockListener
- private ArrayList memoryBlocks = new ArrayList(); // list of all memory blocks
-
- private static final int ADDED = 0;
- private static final int REMOVED = 1;
- /**
- * Notifies a memory block listener in a safe runnable to
- * handle exceptions.
- */
- class MemoryBlockNotifier implements ISafeRunnable {
-
- private IMemoryBlockListener fListener;
- private int fType;
- private IMemoryBlock[] fMemoryBlocks;
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
- */
- public void handleException(Throwable exception) {
- DebugPlugin.log(exception);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- switch (fType) {
- case ADDED:
- fListener.memoryBlocksAdded(fMemoryBlocks);
- break;
- case REMOVED:
- fListener.memoryBlocksRemoved(fMemoryBlocks);
- break;
- }
- }
-
- /**
- * Notify listeners of added/removed memory block events
- */
- public void notify(IMemoryBlock[] memBlocks, int update) {
- if (listeners != null) {
- fType = update;
- Object[] copiedListeners= listeners.toArray(new IMemoryBlockListener[listeners.size()]);
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IMemoryBlockListener)copiedListeners[i];
- fMemoryBlocks = memBlocks;
- Platform.run(this);
- }
- }
- fListener = null;
- fMemoryBlocks = null;
- }
- }
-
- private MemoryBlockNotifier getMemoryBlockNotifier() {
- return new MemoryBlockNotifier();
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IMemoryBlockManager#addMemoryBlock(org.eclipse.debug.core.model.IMemoryBlock)
- */
- public void addMemoryBlocks(IMemoryBlock[] mem) {
-
- if (memoryBlocks == null)
- return;
-
- if (mem == null){
- DebugPlugin.logMessage("Null argument passed into IMemoryBlockManager.addMemoryBlock", null); //$NON-NLS-1$
- return;
- }
-
- ArrayList newMemoryBlocks = new ArrayList();
-
- for (int i=0; i<mem.length; i++)
- {
- // do not allow duplicates
- if (!memoryBlocks.contains(mem[i]))
- {
-
- newMemoryBlocks.add(mem[i]);
- memoryBlocks.add(mem[i]);
-
- // add listener for the first memory block added
- if (memoryBlocks.size() == 1)
- {
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
- }
- }
-
- notifyListeners((IMemoryBlock[])newMemoryBlocks.toArray(new IMemoryBlock[newMemoryBlocks.size()]), ADDED);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IMemoryBlockManager#removeMemoryBlock(org.eclipse.debug.core.model.IMemoryBlock)
- */
- public void removeMemoryBlocks(IMemoryBlock[] memBlocks) {
-
- if (memoryBlocks == null)
- return;
-
- if (memBlocks == null){
- DebugPlugin.logMessage("Null argument passed into IMemoryBlockManager.removeMemoryBlock", null); //$NON-NLS-1$
- return;
- }
-
- for (int i=0; i<memBlocks.length; i++)
- {
- memoryBlocks.remove(memBlocks[i]);
- // remove listener after the last memory block has been removed
- if (memoryBlocks.size() == 0)
- {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- }
-
- if (memBlocks[i] instanceof IMemoryBlockExtension)
- {
- ((IMemoryBlockExtension)memBlocks[i]).dispose();
- }
- }
-
- notifyListeners(memBlocks, REMOVED);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IMemoryBlockManager#addListener(org.eclipse.debug.ui.IMemoryBlockListener)
- */
- public void addListener(IMemoryBlockListener listener) {
-
- if(listeners == null)
- return;
-
- if(listener == null){
- DebugPlugin.logMessage("Null argument passed into IMemoryBlockManager.addListener", null); //$NON-NLS-1$
- return;
- }
-
- if (!listeners.contains(listener))
- listeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IMemoryBlockManager#removeListener(org.eclipse.debug.ui.IMemoryBlockListener)
- */
- public void removeListener(IMemoryBlockListener listener) {
-
- if(listeners == null)
- return;
-
- if(listener == null){
- DebugPlugin.logMessage("Null argument passed into IMemoryBlockManager.removeListener", null); //$NON-NLS-1$
- return;
- }
-
- if (listeners.contains(listener))
- listeners.remove(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IMemoryBlockManager#getMemoryBlocks()
- */
- public IMemoryBlock[] getMemoryBlocks() {
-
- IMemoryBlock[] blocks = (IMemoryBlock[])memoryBlocks.toArray(new IMemoryBlock[memoryBlocks.size()]);
-
- return blocks;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IMemoryBlockManager#getMemoryBlocks(org.eclipse.debug.core.model.IDebugTarget)
- */
- public IMemoryBlock[] getMemoryBlocks(IDebugTarget debugTarget) {
-
- IMemoryBlock[] blocks = (IMemoryBlock[])memoryBlocks.toArray(new IMemoryBlock[memoryBlocks.size()]);
-
- ArrayList memoryBlocksList = new ArrayList();
-
- for (int i=0; i<blocks.length; i++)
- {
- if (blocks[i].getDebugTarget() == debugTarget)
- memoryBlocksList.add(blocks[i]);
- }
-
- return (IMemoryBlock[])memoryBlocksList.toArray(new IMemoryBlock[memoryBlocksList.size()]);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IMemoryBlockManager#getMemoryBlocks(org.eclipse.debug.core.model.IMemoryBlockRetrieval)
- */
- public IMemoryBlock[] getMemoryBlocks(IMemoryBlockRetrieval retrieve) {
- IMemoryBlock[] blocks = (IMemoryBlock[])memoryBlocks.toArray(new IMemoryBlock[memoryBlocks.size()]);
-
- ArrayList memoryBlocksList = new ArrayList(blocks.length);
-
- for (int i=0; i<blocks.length; i++)
- {
- if (blocks[i] instanceof IMemoryBlockExtension)
- {
-
- if (((IMemoryBlockExtension)blocks[i]).getMemoryBlockRetrieval() == retrieve)
- {
- memoryBlocksList.add(blocks[i]);
- }
- }
- else
- {
- // standard memory block always uses the debug target as the memory block retrieval
- if (blocks[i].getDebugTarget() == retrieve)
- memoryBlocksList.add(blocks[i]);
- }
- }
-
- return (IMemoryBlock[])memoryBlocksList.toArray(new IMemoryBlock[memoryBlocksList.size()]);
- }
-
-
- private void notifyListeners(IMemoryBlock[] memBlocks, int event)
- {
- getMemoryBlockNotifier().notify(memBlocks, event);
- }
-
-
- /* (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++)
- handleDebugEvent(events[i]);
-
- }
-
- public void handleDebugEvent(DebugEvent event) {
- Object obj = event.getSource();
- IDebugTarget dt = null;
-
- if (event.getKind() == DebugEvent.TERMINATE)
- {
- // a terminate event could happen from an IThread or IDebugTarget
- // only handle a debug event from the debug target
- if (obj instanceof IDebugTarget)
- {
- dt = ((IDebugTarget)obj);
-
- // getMemoryBlocks will return an empty array if dt is null
- IMemoryBlock[] deletedMemoryBlocks = getMemoryBlocks(dt);
- removeMemoryBlocks(deletedMemoryBlocks);
- }
- }
- }
-
- /**
- * Clean up when the plugin is shut down
- */
- public void shutdown()
- {
- if (listeners != null)
- {
- listeners.clear();
- listeners = null;
- }
-
- if (memoryBlocks != null)
- {
- memoryBlocks.clear();
- memoryBlocks = null;
- }
- }
-
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java
deleted file mode 100644
index aa92d10d7..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.debug.core.IStreamListener;
-import org.eclipse.debug.core.model.IStreamMonitor;
-import org.eclipse.debug.core.model.IStreamsProxy2;
-
-public class NullStreamsProxy implements IStreamsProxy2 {
- private NullStreamMonitor outputStreamMonitor;
- private NullStreamMonitor errorStreamMonitor;
-
- public NullStreamsProxy(Process process) {
- outputStreamMonitor = new NullStreamMonitor(process.getInputStream());
- errorStreamMonitor = new NullStreamMonitor(process.getErrorStream());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamsProxy2#closeInputStream()
- */
- public void closeInputStream() throws IOException {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamsProxy#getErrorStreamMonitor()
- */
- public IStreamMonitor getErrorStreamMonitor() {
- return errorStreamMonitor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamsProxy#getOutputStreamMonitor()
- */
- public IStreamMonitor getOutputStreamMonitor() {
- return outputStreamMonitor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamsProxy#write(java.lang.String)
- */
- public void write(String input) throws IOException {
- }
-
- private class NullStreamMonitor implements IStreamMonitor {
- private InputStream fStream;
-
- public NullStreamMonitor(InputStream stream) {
- fStream = stream;
- startReaderThread();
- }
-
- private void startReaderThread() {
- Thread thread = new Thread(new Runnable() {
- public void run() {
- byte[] bytes = new byte[1024];
- try {
- while(fStream.read(bytes) >= 0) {
- //do nothing
- }
- } catch (IOException e) {
- }
- }
- }, DebugCoreMessages.getString("NullStreamsProxy.0")); //$NON-NLS-1$
- thread.start();
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamMonitor#addListener(org.eclipse.debug.core.IStreamListener)
- */
- public void addListener(IStreamListener listener) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamMonitor#getContents()
- */
- public String getContents() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamMonitor#removeListener(org.eclipse.debug.core.IStreamListener)
- */
- public void removeListener(IStreamListener listener) {
- }
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
deleted file mode 100644
index 58878c383..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IStreamListener;
-import org.eclipse.debug.core.model.IFlushableStreamMonitor;
-
-/**
- * Monitors the output stream of a system process and notifies
- * listeners of additions to the stream.
- *
- * The output stream monitor reads system out (or err) via
- * and input stream.
- */
-public class OutputStreamMonitor implements IFlushableStreamMonitor {
- /**
- * The stream being monitored (connected system out or err).
- */
- private InputStream fStream;
-
- /**
- * A collection of listeners
- */
- private ListenerList fListeners= new ListenerList(1);
-
- /**
- * Whether content is being buffered
- */
- private boolean fBuffered = true;
-
- /**
- * The local copy of the stream contents
- */
- private StringBuffer fContents;
-
- /**
- * The thread which reads from the stream
- */
- private Thread fThread;
-
- /**
- * The size of the read buffer
- */
- private static final int BUFFER_SIZE= 8192;
-
- /**
- * Whether or not this monitor has been killed.
- * When the monitor is killed, it stops reading
- * from the stream immediately.
- */
- private boolean fKilled= false;
-
- /**
- * Creates an output stream monitor on the
- * given stream (connected to system out or err).
- */
- public OutputStreamMonitor(InputStream stream) {
- fStream= stream;
- fContents= new StringBuffer();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamMonitor#addListener(org.eclipse.debug.core.IStreamListener)
- */
- public synchronized void addListener(IStreamListener listener) {
- fListeners.add(listener);
- }
-
- /**
- * Causes the monitor to close all
- * communications between it and the
- * underlying stream by waiting for the thread to terminate.
- */
- protected void close() {
- if (fThread != null) {
- Thread thread= fThread;
- fThread= null;
- try {
- thread.join();
- } catch (InterruptedException ie) {
- }
- fListeners.removeAll();
- }
- }
-
- /**
- * Notifies the listeners that text has
- * been appended to the stream.
- */
- private void fireStreamAppended(String text) {
- getNotifier().notifyAppend(text);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamMonitor#getContents()
- */
- public synchronized String getContents() {
- return fContents.toString();
- }
-
- /**
- * Continually reads from the stream.
- * <p>
- * This method, along with the <code>startReading</code>
- * method is used to allow <code>OutputStreamMonitor</code>
- * to implement <code>Runnable</code> without publicly
- * exposing a <code>run</code> method.
- */
- private void read() {
- byte[] bytes= new byte[BUFFER_SIZE];
- int read = 0;
- int count = 0;
- while (read >= 0) {
- try {
- if (fKilled) {
- break;
- }
- read= fStream.read(bytes);
- if (read > 0) {
- String text= new String(bytes, 0, read);
- synchronized (this) {
- if (isBuffered()) {
- fContents.append(text);
- }
- fireStreamAppended(text);
- }
- if (count == 10) {
- try {
- //allow other threads to do some processing.
- //heavy console output can make this loop busy.
- Thread.sleep(10);
- } catch (InterruptedException e) {
- }
- count = 0;
- } else {
- count++;
- }
- }
- } catch (IOException ioe) {
- DebugPlugin.log(ioe);
- return;
- } catch (NullPointerException e) {
- // killing the stream monitor while reading can cause an NPE
- // when reading from the stream
- if (!fKilled && fThread != null) {
- DebugPlugin.log(e);
- }
- return;
- }
- }
- try {
- fStream.close();
- } catch (IOException e) {
- DebugPlugin.log(e);
- }
- }
-
- protected void kill() {
- fKilled= true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamMonitor#removeListener(org.eclipse.debug.core.IStreamListener)
- */
- public synchronized void removeListener(IStreamListener listener) {
- fListeners.remove(listener);
- }
-
- /**
- * Starts a thread which reads from the stream
- */
- protected void startMonitoring() {
- if (fThread == null) {
- fThread= new Thread(new Runnable() {
- public void run() {
- read();
- }
- }, DebugCoreMessages.getString("OutputStreamMonitor.label")); //$NON-NLS-1$
- fThread.start();
- }
- }
-
- /**
- * @see org.eclipse.debug.core.model.IFlushableStreamMonitor#setBuffered(boolean)
- */
- public synchronized void setBuffered(boolean buffer) {
- fBuffered = buffer;
- }
-
- /**
- * @see org.eclipse.debug.core.model.IFlushableStreamMonitor#flushContents()
- */
- public synchronized void flushContents() {
- fContents.setLength(0);
- }
-
- /**
- * @see IFlushableStreamMonitor#isBuffered()
- */
- public synchronized boolean isBuffered() {
- return fBuffered;
- }
-
- private ContentNotifier getNotifier() {
- return new ContentNotifier();
- }
-
- class ContentNotifier implements ISafeRunnable {
-
- private IStreamListener fListener;
- private String fText;
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
- */
- public void handleException(Throwable exception) {
- DebugPlugin.log(exception);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- fListener.streamAppended(fText, OutputStreamMonitor.this);
- }
-
- public void notifyAppend(String text) {
- if (text == null)
- return;
- fText = text;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IStreamListener) copiedListeners[i];
- Platform.run(this);
- }
- fListener = null;
- fText = null;
- }
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
deleted file mode 100644
index eb785b460..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-
-import java.io.IOException;
-
-import org.eclipse.debug.core.model.IStreamMonitor;
-import org.eclipse.debug.core.model.IStreamsProxy;
-import org.eclipse.debug.core.model.IStreamsProxy2;
-
-/**
- * Standard implementation of a streams proxy for s
- * StreamsProxy
- */
-
-public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 {
- /**
- * The monitor for the output stream (connected to standard out of the process)
- */
- private OutputStreamMonitor fOutputMonitor;
- /**
- * The monitor for the error stream (connected to standard error of the process)
- */
- private OutputStreamMonitor fErrorMonitor;
- /**
- * The monitor for the input stream (connected to standard in of the process)
- */
- private InputStreamMonitor fInputMonitor;
- /**
- * Records the open/closed state of communications with
- * the underlying streams.
- */
- private boolean fClosed= false;
- /**
- * Creates a <code>StreamsProxy</code> on the streams
- * of the given system process.
- */
- public StreamsProxy(Process process) {
- if (process == null) {
- return;
- }
- fOutputMonitor= new OutputStreamMonitor(process.getInputStream());
- fErrorMonitor= new OutputStreamMonitor(process.getErrorStream());
- fInputMonitor= new InputStreamMonitor(process.getOutputStream());
- fOutputMonitor.startMonitoring();
- fErrorMonitor.startMonitoring();
- fInputMonitor.startMonitoring();
- }
-
- /**
- * Causes the proxy to close all
- * communications between it and the
- * underlying streams after all remaining data
- * in the streams is read.
- */
- public void close() {
- if (!fClosed) {
- fClosed= true;
- fOutputMonitor.close();
- fErrorMonitor.close();
- fInputMonitor.close();
- }
- }
-
- /**
- * Causes the proxy to close all
- * communications between it and the
- * underlying streams immediately.
- * Data remaining in the streams is lost.
- */
- public void kill() {
- fClosed= true;
- fOutputMonitor.kill();
- fErrorMonitor.kill();
- fInputMonitor.close();
- }
-
- /**
- * @see IStreamsProxy#getErrorStreamMonitor()
- */
- public IStreamMonitor getErrorStreamMonitor() {
- return fErrorMonitor;
- }
-
- /**
- * @see IStreamsProxy#getOutputStreamMonitor()
- */
- public IStreamMonitor getOutputStreamMonitor() {
- return fOutputMonitor;
- }
-
- /**
- * @see IStreamsProxy#write(String)
- */
- public void write(String input) throws IOException {
- if (!fClosed) {
- fInputMonitor.write(input);
- } else {
- throw new IOException();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStreamsProxy2#closeInputStream()
- */
- public void closeInputStream() throws IOException {
- if (!fClosed) {
- fInputMonitor.closeInputStream();
- } else {
- throw new IOException();
- }
-
- }
-
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/SystemVariableResolver.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/SystemVariableResolver.java
deleted file mode 100644
index 8a78e134c..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/SystemVariableResolver.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.variables.IDynamicVariable;
-import org.eclipse.core.variables.IDynamicVariableResolver;
-
-/**
- * Resolves common system variables. The current set of variables
- * supported (referenced as an argument to this variable) are:
- * <ul>
- * <li>ARCH - value of <code>BootLoader.getOSArch()</code></li>
- * <li>ECLIPSE_HOME - location of the Eclipse installation</li>
- * <li>NL - value of <code>BootLoader.getNL()</code></li>
- * <li>OS - value of <code>BootLoader.getOS()</code></li>
- * <li>WS - value of <code>BootLoader.getWS()</code></li>
- * </ul>
- * @since 3.0
- */
-public class SystemVariableResolver implements IDynamicVariableResolver {
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IDynamicVariableResolver#resolveValue(org.eclipse.core.variables.IDynamicVariable, java.lang.String)
- */
- public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
- if ("ARCH".equals(argument)) { //$NON-NLS-1$
- return Platform.getOSArch();
- } else if ("ECLIPSE_HOME".equals(argument)) { //$NON-NLS-1$
- URL installURL = Platform.getInstallLocation().getURL();
- IPath ppath = new Path(installURL.getFile()).removeTrailingSeparator();
- return getCorrectPath(ppath.toOSString());
- } else if ("NL".equals(argument)) { //$NON-NLS-1$
- return Platform.getNL();
- } else if ("OS".equals(argument)) { //$NON-NLS-1$
- return Platform.getOS();
- } else if ("WS".equals(argument)) { //$NON-NLS-1$
- return Platform.getWS();
- }
- return null;
- }
-
- private static String getCorrectPath(String path) {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < path.length(); i++) {
- char c = path.charAt(i);
- if (Platform.getOS().equals("win32")) { //$NON-NLS-1$
- if (i == 0 && c == '/')
- continue;
- }
- // Some VMs may return %20 instead of a space
- if (c == '%' && i + 2 < path.length()) {
- char c1 = path.charAt(i + 1);
- char c2 = path.charAt(i + 2);
- if (c1 == '2' && c2 == '0') {
- i += 2;
- buf.append(" "); //$NON-NLS-1$
- continue;
- }
- }
- buf.append(c);
- }
- return buf.toString();
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java
deleted file mode 100644
index ddeb19501..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IWatchExpression;
-import org.eclipse.debug.core.model.IWatchExpressionDelegate;
-import org.eclipse.debug.core.model.IWatchExpressionListener;
-import org.eclipse.debug.core.model.IWatchExpressionResult;
-
-/**
- * Base watch expression implementation.
- * <p>
- * Clients may extend this class.
- * </p>
- * @since 3.0
- */
-public class WatchExpression implements IWatchExpression {
-
- protected String fExpressionText;
- protected IWatchExpressionResult fResult;
- protected IDebugTarget fDebugTarget;
- protected IDebugElement fCurrentContext;
- private boolean fEnabled= true;
- private boolean fPending= false;
-
- /**
- * Creates a new watch expression with the given expression
- * text.
- * @param expression the text of the expression to be evaluated.
- */
- public WatchExpression(String expression) {
- fExpressionText= expression;
- }
-
- /**
- * Creates a new watch expression with the given expression
- * and the given enablement;
- *
- * @param expressionText the text of the expression to be evaluated
- * @param enabled whether or not the new expression should be enabled
- */
- public WatchExpression(String expressionText, boolean enabled) {
- this(expressionText);
- fEnabled= enabled;
- }
-
- /**
- * @see org.eclipse.debug.core.model.IWatchExpression#evaluate()
- */
- public void evaluate() {
- if (fCurrentContext == null) {
- return;
- }
- IDebugElement context= fCurrentContext;
- fDebugTarget= context.getDebugTarget();
-
- IWatchExpressionListener listener= new IWatchExpressionListener() {
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IWatchExpressionListener#watchEvaluationFinished(org.eclipse.debug.core.model.IWatchExpressionResult)
- */
- public void watchEvaluationFinished(IWatchExpressionResult result) {
- setPending(false);
- setResult(result);
- }
- };
- setPending(true);
- IWatchExpressionDelegate delegate= DebugPlugin.getDefault().getExpressionManager().newWatchExpressionDelegate(context.getModelIdentifier());
- if (delegate != null) {
- delegate.evaluateExpression(getExpressionText(), context, listener);
- } else {
- // No delegate provided
- listener.watchEvaluationFinished(new IWatchExpressionResult() {
- public IValue getValue() {
- return null;
- }
- public boolean hasErrors() {
- return true;
- }
- public String[] getErrorMessages() {
- return new String[] { DebugCoreMessages.getString("WatchExpression.0") }; //$NON-NLS-1$
- }
- public String getExpressionText() {
- return WatchExpression.this.getExpressionText();
- }
- public DebugException getException() {
- return null;
- }
- });
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IWatchExpression#setExpressionContext(org.eclipse.debug.core.model.IDebugElement)
- */
- public void setExpressionContext(IDebugElement context) {
- fCurrentContext= context;
- if (context == null) {
- setResult(null);
- return;
- }
- if (!isEnabled()) {
- return;
- }
-
- evaluate();
- }
-
- /**
- * Sets the result of the last expression and fires notification that
- * this expression's value has changed.
- */
- public void setResult(IWatchExpressionResult result) {
- fResult= result;
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {new DebugEvent(this, DebugEvent.CHANGE)});
- }
-
- /**
- * Notifies the expression manager that this watch expression's
- * values have changed so the manager can update the
- * persisted expression.
- */
- private void watchExpressionChanged() {
- ((ExpressionManager)DebugPlugin.getDefault().getExpressionManager()).watchExpressionChanged(this);
- }
-
- /**
- * @see org.eclipse.debug.core.model.IExpression#getExpressionText()
- */
- public String getExpressionText() {
- return fExpressionText;
- }
-
- /**
- * @see org.eclipse.debug.core.model.IExpression#getValue()
- */
- public IValue getValue() {
- if (fResult == null) {
- return null;
- }
- return fResult.getValue();
- }
-
- /**
- * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
- */
- public IDebugTarget getDebugTarget() {
- return fDebugTarget;
- }
-
- /**
- * @see org.eclipse.debug.core.model.IExpression#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
- */
- public String getModelIdentifier() {
- if (fCurrentContext != null) {
- return fCurrentContext.getModelIdentifier();
- }
- return DebugPlugin.getUniqueIdentifier();
- }
-
- /**
- * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
- */
- public ILaunch getLaunch() {
- IDebugTarget debugTarget = getDebugTarget();
- if (debugTarget != null) {
- return debugTarget.getLaunch();
- }
- return null;
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * @param enabled
- */
- public void setEnabled(boolean enabled) {
- fEnabled= enabled;
- watchExpressionChanged();
- evaluate();
- }
-
- /**
- * @param expression
- */
- public void setExpressionText(String expression) {
- fExpressionText= expression;
- watchExpressionChanged();
- evaluate();
- }
-
- /**
- * @return Whether or not this watch expression is currently enabled.
- * Enabled watch expressions will continue to update their value
- * automatically. Disabled expressions require a manual update.
- */
- public boolean isEnabled() {
- return fEnabled;
- }
-
- /**
- * @see org.eclipse.debug.core.model.IWatchExpression#isPending()
- */
- public boolean isPending() {
- return fPending;
- }
-
- /**
- * Sets the pending state of this expression.
- *
- * @param pending whether or not this expression should be
- * flagged as pending
- */
- protected void setPending(boolean pending) {
- fPending= pending;
- watchExpressionChanged();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IErrorReportingExpression#hasErrors()
- */
- public boolean hasErrors() {
- return fResult != null && fResult.hasErrors();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IErrorReportingExpression#getErrorMessages()
- */
- public String[] getErrorMessages() {
- if (fResult == null) {
- return new String[0];
- }
- return fResult.getErrorMessages();
- }
-
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceContainerType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceContainerType.java
deleted file mode 100644
index 8e0ac910d..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceContainerType.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
-import org.eclipse.debug.core.sourcelookup.ISourceContainerTypeDelegate;
-
-/**
- * Proxy to contributed source container type extension.
- *
- * @since 3.0
- */
-public class SourceContainerType implements ISourceContainerType {
-
- // lazily instantiated delegate
- private ISourceContainerTypeDelegate fDelegate = null;
-
- // extension definition
- private IConfigurationElement fElement = null;
-
- /**
- * Constructs a source container type on the given extension.
- *
- * @param element extension definition
- */
- public SourceContainerType(IConfigurationElement element) {
- fElement = element;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#createSourceContainer(java.lang.String)
- */
- public ISourceContainer createSourceContainer(String memento) throws CoreException {
- return getDelegate().createSourceContainer(memento);
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#getMemento(org.eclipse.debug.internal.core.sourcelookup.ISourceContainer)
- */
- public String getMemento(ISourceContainer container) throws CoreException {
- if (this.equals(container.getType())) {
- return getDelegate().getMemento(container);
- }
- IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, SourceLookupMessages.getString("SourceContainerType.3"), null); //$NON-NLS-1$
- throw new CoreException(status);
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#getName()
- */
- public String getName() {
- return fElement.getAttribute("name"); //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#getId()
- */
- public String getId() {
- return fElement.getAttribute("id"); //$NON-NLS-1$
- }
-
- /**
- * Lazily instantiates and returns the underlying source container type.
- *
- * @exception CoreException if unable to instantiate
- */
- private ISourceContainerTypeDelegate getDelegate() throws CoreException {
- if (fDelegate == null) {
- fDelegate = (ISourceContainerTypeDelegate) fElement.createExecutableExtension("class"); //$NON-NLS-1$
- }
- return fDelegate;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#getDescription()
- */
- public String getDescription() {
- return fElement.getAttribute("description"); //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLocatorMementoComparator.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLocatorMementoComparator.java
deleted file mode 100644
index 4c49167ca..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLocatorMementoComparator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup;
-
-import java.util.Comparator;
-
-/**
- * Comparator for source locator mementors. Ignores whitespace differences.
- *
- * @since 3.0
- */
-public class SourceLocatorMementoComparator implements Comparator {
- /* (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- String m1 = (String)o1;
- String m2 = (String)o2;
- int i1 = 0, i2 = 0;
- while (i1 < m1.length()) {
- i1 = skipWhitespace(m1, i1);
- i2 = skipWhitespace(m2, i2);
- if (i1 < m1.length() && i2 < m2.length()) {
- if (m1.charAt(i1) != m2.charAt(i2)) {
- return -1;
- }
- i1++;
- i2++;
- } else {
- if (i2 < m2.length()) {
- return -1;
- }
- return 0;
- }
- }
- return 0;
- }
-
- private int skipWhitespace(String string, int offset) {
- while (offset < string.length() && Character.isWhitespace(string.charAt(offset))) {
- offset++;
- }
- return offset;
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.java
deleted file mode 100644
index 59eaf1499..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class SourceLookupMessages {
- private static final String BUNDLE_NAME = "org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages";//$NON-NLS-1$
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private SourceLookupMessages() {
- }
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.properties b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.properties
deleted file mode 100644
index 87a6b7cf7..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.properties
+++ /dev/null
@@ -1,59 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-AbstractSourceLookupDirector.11=Unable to restore source lookup path - expecting typeId attribute.
-AbstractSourceLookupDirector.12=Unable to restore source lookup path - unknown type source container type specified: {0}
-AbstractSourceLookupDirector.13=Unable to restore source lookup path - expecting memento attribute.
-AbstractSourceLookupDirector.14=Unable to read source lookup path - expecting sourceLookupDirector node.
-AbstractSourceLookupDirector.19=Source lookup error
-CompositeSourceContainer.0=Source lookup error
-
-ExternalArchiveSourceContainer.1=Exception occurred while detecting root directory in archive {0}
-ExternalArchiveSourceContainer.2=Unable to access archive {0}
-
-ExternalArchiveSourceContainerType.10=Invalid or missing <path> attribute in archive memento.
-ExternalArchiveSourceContainerType.11=Missing <archive> node in archive memento.
-ExternalArchiveSourceContainerType.12=Invalid archive memento
-
-DefaultSourceContainer.0=Default
-DefaultSourceContainerType.6=Unable to restore default source lookup path - expecting default element.
-DefaultSourceContainerType.7=Unable to restore default source lookup path - invalid memento.
-
-DirectorySourceContainerType.10=Unable to restore directory source lookup entry - missing path attribute.
-DirectorySourceContainerType.11=Unable to restore directory source lookup entry - expecting directory element.
-DirectorySourceContainerType.12=Unable to restore directory source lookup entry - invalid memento.
-
-FolderSourceContainerType.10=Unable to restore source lookup folder - missing path attribute.
-FolderSourceContainerType.11=Unable to restore source lookup folder - expecting folder element.
-FolderSourceContainerType.12=Unable to restore source lookup folder - invalid memento.
-
-LocalFileStorage.0=Exception ocurred retrieving file contents.
-
-ProjectSourceContainerType.10=Unable to restore project source lookup entry - missing name attribute.
-ProjectSourceContainerType.11=Unable to restore project source lookup entry - expecting project element.
-ProjectSourceContainerType.12=Unable to restore project source lookup entry - invalid memento.
-
-SourceLookupUtils.3=Unable to create new XML document.
-SourceLookupUtils.4=Unable to serialize XML document.
-SourceLookupUtils.5=Unable to serialize XML document.
-SourceLookupUtils.6=Unable to parse XML document.
-SourceLookupUtils.7=Unable to parse XML document.
-SourceLookupUtils.8=Unable to parse XML document.
-SourceLookupUtils.9=Unable to parse XML document.
-SourceLookupUtils.10=Unable to parse XML document.
-SourceContainerType.3=Unable to persist source lookup path.
-
-WorkspaceSourceContainer.0=Workspace
-
-WorkspaceSourceContainerType.3=Unable to restore workspace source lookup entry - expecting workspace element.
-WorkspaceSourceContainerType.4=Unable to restore workspace source lookup entry - invalid memento.
-
-ZipEntryStorage.0=Unable to read ZipEntry contents
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils.java
deleted file mode 100644
index 38f6ad212..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.zip.ZipFile;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchesListener;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IProcess;
-
-/**
- * Utility and supporting methods for source location. Most of these
- * utilities should be migrated to the DebugPlugin and LanuchManager
- * when this facility becomes public API.
- * <p>
- * This class is experimental and temporary.
- * </p>
- * @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector
- * @since 3.0
- */
-public class SourceLookupUtils {
-
- /**
- * Cache of shared zip files. Zip files are closed
- * when this class's plug-in is shutdown, when a project
- * is about to be closed or deleted, when a launch is
- * removed, and when a debug target or process terminates.
- */
- private static HashMap fgZipFileCache = new HashMap(5);
- private static ArchiveCleaner fgCleaner = null;
-
- /**
- * Returns a zip file with the given name
- *
- * @param name zip file name
- * @return The zip file with the given name
- * @exception IOException if unable to create the specified zip
- * file
- */
- public static ZipFile getZipFile(String name) throws IOException {
- synchronized (fgZipFileCache) {
- if (fgCleaner == null) {
- fgCleaner = new ArchiveCleaner();
- DebugPlugin.getDefault().addDebugEventListener(fgCleaner);
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(fgCleaner);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(fgCleaner, IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.PRE_CLOSE);
- }
- ZipFile zip = (ZipFile)fgZipFileCache.get(name);
- if (zip == null) {
- zip = new ZipFile(name);
- fgZipFileCache.put(name, zip);
- }
- return zip;
- }
- }
-
- /**
- * Closes all zip files that have been opened,
- * and removes them from the zip file cache.
- * This method is only to be called by the debug
- * plug-in.
- */
- public static void closeArchives() {
- synchronized (fgZipFileCache) {
- Iterator iter = fgZipFileCache.values().iterator();
- while (iter.hasNext()) {
- ZipFile file = (ZipFile)iter.next();
- synchronized (file) {
- try {
- file.close();
- } catch (IOException e) {
- DebugPlugin.log(e);
- }
- }
- }
- fgZipFileCache.clear();
- }
- }
-
- /**
- * Called when the debug plug-in shuts down.
- */
- public static void shutdown() {
- closeArchives();
- if (fgCleaner != null) {
- DebugPlugin.getDefault().removeDebugEventListener(fgCleaner);
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(fgCleaner);
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(fgCleaner);
- }
- }
-
- /**
- * Clears the cache of open zip files when a debug target or process
- * terminates, when a launch is removed, or when a project is about
- * to be deleted or closed.
- */
- static class ArchiveCleaner implements IDebugEventSetListener, ILaunchesListener, IResourceChangeListener {
-
- /* (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) {
- Object source = event.getSource();
- if (source instanceof IDebugTarget || source instanceof IProcess) {
- SourceLookupUtils.closeArchives();
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchesListener#launchesRemoved(org.eclipse.debug.core.ILaunch[])
- */
- public void launchesRemoved(ILaunch[] launches) {
- SourceLookupUtils.closeArchives();
- }
-
- /* (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.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- SourceLookupUtils.closeArchives();
- }
-
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourcePathComputer.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourcePathComputer.java
deleted file mode 100644
index f861ab451..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourcePathComputer.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.sourcelookup.*;
-
-/**
- * Proxy to contributed source path computer extension.
- */
-public class SourcePathComputer implements ISourcePathComputer {
-
- // lazily instantiated delegate
- private ISourcePathComputerDelegate fDelegate = null;
-
- // extension definition
- private IConfigurationElement fElement = null;
-
- /**
- * Constructs a source path computer on the given extension.
- *
- * @param element extension definition
- */
- public SourcePathComputer(IConfigurationElement element) {
- fElement = element;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#getId()
- */
- public String getId() {
- return fElement.getAttribute("id"); //$NON-NLS-1$
- }
-
- /**
- * Lazily instantiates and returns the underlying source container type.
- *
- * @exception CoreException if unable to instantiate
- */
- private ISourcePathComputerDelegate getDelegate() throws CoreException {
- if (fDelegate == null) {
- fDelegate = (ISourcePathComputerDelegate) fElement.createExecutableExtension("class"); //$NON-NLS-1$
- }
- return fDelegate;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourcePathComputer#computeSourceContainers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.IProgressMonitor)
- */
- public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) {
- try {
- return getDelegate().computeSourceContainers(configuration, monitor);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- return new ISourceContainer[0];
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ArchiveSourceContainerType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ArchiveSourceContainerType.java
deleted file mode 100644
index 44ea90586..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ArchiveSourceContainerType.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup.containers;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
-import org.eclipse.debug.core.sourcelookup.containers.ArchiveSourceContainer;
-import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * Archive source container type for archives in the workspace.
- *
- * @since 3.0
- */
-public class ArchiveSourceContainerType extends AbstractSourceContainerTypeDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerTypeDelegate#createSourceContainer(java.lang.String)
- */
- public ISourceContainer createSourceContainer(String memento) throws CoreException {
- Node node = parseDocument(memento);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element)node;
- if ("archive".equals(element.getNodeName())) { //$NON-NLS-1$
- String string = element.getAttribute("path"); //$NON-NLS-1$
- if (string == null || string.length() == 0) {
- abort(SourceLookupMessages.getString("ExternalArchiveSourceContainerType.10"), null); //$NON-NLS-1$
- }
- String detect = element.getAttribute("detectRoot"); //$NON-NLS-1$
- boolean auto = "true".equals(detect); //$NON-NLS-1$
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(string));
- return new ArchiveSourceContainer(file, auto);
- }
- abort(SourceLookupMessages.getString("ExternalArchiveSourceContainerType.11"), null); //$NON-NLS-1$
- }
- abort(SourceLookupMessages.getString("ExternalArchiveSourceContainerType.12"), null); //$NON-NLS-1$
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerTypeDelegate#getMemento(org.eclipse.debug.internal.core.sourcelookup.ISourceContainer)
- */
- public String getMemento(ISourceContainer container) throws CoreException {
- ArchiveSourceContainer archive = (ArchiveSourceContainer) container;
- Document document = newDocument();
- Element element = document.createElement("archive"); //$NON-NLS-1$
- element.setAttribute("path", archive.getFile().getFullPath().toString()); //$NON-NLS-1$
- String detectRoot = "false"; //$NON-NLS-1$
- if (archive.isDetectRoot()) {
- detectRoot = "true"; //$NON-NLS-1$
- }
- element.setAttribute("detectRoot", detectRoot); //$NON-NLS-1$
- document.appendChild(element);
- return serializeDocument(document);
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ContainerSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ContainerSourceContainer.java
deleted file mode 100644
index bc46007eb..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ContainerSourceContainer.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup.containers;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer;
-
-/**
- * A container in the workspace. Source elements are searched
- * for within this container and optionally nested containers.
- * <p>
- * Names specified in <code>findSourceElements</code> method can
- * be simple or qualified. When a name is qualified, a file will
- * be searched for relative to this container, and optionally
- * nested containers.
- * </p>
- *
- * @since 3.0
- */
-public abstract class ContainerSourceContainer extends CompositeSourceContainer {
-
- private IContainer fContainer = null;
- private boolean fSubfolders = false;
-
- /**
- * Constructs a source container on the given workspace container.
- *
- * @param container the container to search for source in
- * @param subfolders whether nested folders should be searched
- * for source elements
- */
- public ContainerSourceContainer(IContainer container, boolean subfolders) {
- fContainer = container;
- fSubfolders = subfolders;
- }
-
- /**
- * Returns the workspace container this source container is
- * rooted at.
- *
- * @return the workspace container this source container is
- * rooted at
- */
- public IContainer getContainer() {
- return fContainer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String)
- */
- public Object[] findSourceElements(String name) throws CoreException {
- ArrayList sources = new ArrayList();
- IContainer container = getContainer();
- IPath path = new Path(name);
- IFile file = container.getFile(path);
- if (file.exists()) {
- sources.add(file);
- }
-
- //check subfolders
- if ((isFindDuplicates() && fSubfolders) || (sources.isEmpty() && fSubfolders)) {
- ISourceContainer[] containers = getSourceContainers();
- for (int i=0; i < containers.length; i++) {
- Object[] objects = containers[i].findSourceElements(name);
- if (objects == null || objects.length == 0) {
- continue;
- }
- if (isFindDuplicates()) {
- for(int j=0; j < objects.length; j++)
- sources.add(objects[j]);
- } else {
- sources.add(objects[0]);
- break;
- }
- }
- }
-
- if(sources.isEmpty())
- return EMPTY;
- return sources.toArray();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getName()
- */
- public String getName() {
- return getContainer().getName();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj != null && obj instanceof ContainerSourceContainer) {
- ContainerSourceContainer loc = (ContainerSourceContainer) obj;
- return loc.getContainer().equals(getContainer());
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getContainer().hashCode();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#isComposite()
- */
- public boolean isComposite() {
- return fSubfolders;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers()
- */
- protected ISourceContainer[] createSourceContainers() throws CoreException {
- if(fSubfolders) {
- IResource[] resources = getContainer().members();
- List list = new ArrayList(resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (resource.getType() == IResource.FOLDER) {
- list.add(new FolderSourceContainer((IFolder)resource, fSubfolders));
- }
- }
- ISourceContainer[] containers = (ISourceContainer[]) list.toArray(new ISourceContainer[list.size()]);
- for (int i = 0; i < containers.length; i++) {
- ISourceContainer container = containers[i];
- container.init(getDirector());
- }
- return containers;
- }
- return new ISourceContainer[0];
- }
-
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainerType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainerType.java
deleted file mode 100644
index 0be367573..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainerType.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup.containers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
-import org.eclipse.debug.core.sourcelookup.containers.DefaultSourceContainer;
-import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * A default source lookup path. The default path is computed by a
- * source path computer.
- *
- * @since 3.0
- */
-public class DefaultSourceContainerType extends AbstractSourceContainerTypeDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#getMemento(org.eclipse.debug.internal.core.sourcelookup.ISourceContainer)
- */
- public String getMemento(ISourceContainer container) throws CoreException {
- Document document = newDocument();
- Element element = document.createElement("default"); //$NON-NLS-1$
- document.appendChild(element);
- return serializeDocument(document);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#createSourceContainer(java.lang.String)
- */
- public ISourceContainer createSourceContainer(String memento)throws CoreException {
- Node node = parseDocument(memento);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element)node;
- if ("default".equals(element.getNodeName())) { //$NON-NLS-1$
- return new DefaultSourceContainer();
- }
- abort(SourceLookupMessages.getString("DefaultSourceContainerType.6"), null); //$NON-NLS-1$
- }
- abort(SourceLookupMessages.getString("DefaultSourceContainerType.7"), null); //$NON-NLS-1$
- return null;
- }
-
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DirectorySourceContainerType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DirectorySourceContainerType.java
deleted file mode 100644
index cdee83234..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DirectorySourceContainerType.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup.containers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
-import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
-import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * A folder in the local file system.
- *
- * @since 3.0
- */
-public class DirectorySourceContainerType extends AbstractSourceContainerTypeDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#createSourceContainer(java.lang.String)
- */
- public ISourceContainer createSourceContainer(String memento) throws CoreException {
- Node node = parseDocument(memento);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element)node;
- if ("directory".equals(element.getNodeName())) { //$NON-NLS-1$
- String string = element.getAttribute("path"); //$NON-NLS-1$
- if (string == null || string.length() == 0) {
- abort(SourceLookupMessages.getString("DirectorySourceContainerType.10"), null); //$NON-NLS-1$
- }
- String nest = element.getAttribute("nest"); //$NON-NLS-1$
- boolean nested = "true".equals(nest); //$NON-NLS-1$
- return new DirectorySourceContainer(new Path(string), nested);
- }
- abort(SourceLookupMessages.getString("DirectorySourceContainerType.11"), null); //$NON-NLS-1$
- }
- abort(SourceLookupMessages.getString("DirectorySourceContainerType.12"), null); //$NON-NLS-1$
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#getMemento(org.eclipse.debug.internal.core.sourcelookup.ISourceContainer)
- */
- public String getMemento(ISourceContainer container) throws CoreException {
- DirectorySourceContainer folder = (DirectorySourceContainer) container;
- Document document = newDocument();
- Element element = document.createElement("directory"); //$NON-NLS-1$
- element.setAttribute("path", folder.getDirectory().getAbsolutePath()); //$NON-NLS-1$
- String nest = "false"; //$NON-NLS-1$
- if (folder.isComposite()) {
- nest = "true"; //$NON-NLS-1$
- }
- element.setAttribute("nest", nest); //$NON-NLS-1$
- document.appendChild(element);
- return serializeDocument(document);
- }
-
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ExternalArchiveSourceContainerType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ExternalArchiveSourceContainerType.java
deleted file mode 100644
index 884d71d39..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ExternalArchiveSourceContainerType.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup.containers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
-import org.eclipse.debug.core.sourcelookup.containers.ExternalArchiveSourceContainer;
-import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * External archive source container type.
- *
- * @since 3.0
- */
-public class ExternalArchiveSourceContainerType extends AbstractSourceContainerTypeDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerTypeDelegate#createSourceContainer(java.lang.String)
- */
- public ISourceContainer createSourceContainer(String memento) throws CoreException {
- Node node = parseDocument(memento);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element)node;
- if ("archive".equals(element.getNodeName())) { //$NON-NLS-1$
- String string = element.getAttribute("path"); //$NON-NLS-1$
- if (string == null || string.length() == 0) {
- abort(SourceLookupMessages.getString("ExternalArchiveSourceContainerType.10"), null); //$NON-NLS-1$
- }
- String detect = element.getAttribute("detectRoot"); //$NON-NLS-1$
- boolean auto = "true".equals(detect); //$NON-NLS-1$
- return new ExternalArchiveSourceContainer(string, auto);
- }
- abort(SourceLookupMessages.getString("ExternalArchiveSourceContainerType.11"), null); //$NON-NLS-1$
- }
- abort(SourceLookupMessages.getString("ExternalArchiveSourceContainerType.12"), null); //$NON-NLS-1$
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerTypeDelegate#getMemento(org.eclipse.debug.internal.core.sourcelookup.ISourceContainer)
- */
- public String getMemento(ISourceContainer container) throws CoreException {
- ExternalArchiveSourceContainer archive = (ExternalArchiveSourceContainer) container;
- Document document = newDocument();
- Element element = document.createElement("archive"); //$NON-NLS-1$
- element.setAttribute("path", archive.getName()); //$NON-NLS-1$
- String detectRoot = "false"; //$NON-NLS-1$
- if (archive.isDetectRoot()) {
- detectRoot = "true"; //$NON-NLS-1$
- }
- element.setAttribute("detectRoot", detectRoot); //$NON-NLS-1$
- document.appendChild(element);
- return serializeDocument(document);
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/FolderSourceContainerType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/FolderSourceContainerType.java
deleted file mode 100644
index e4e425877..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/FolderSourceContainerType.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup.containers;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
-import org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer;
-import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * A folder in the workspace.
- *
- * @since 3.0
- */
-public class FolderSourceContainerType extends AbstractSourceContainerTypeDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#getMemento(org.eclipse.debug.internal.core.sourcelookup.ISourceContainer)
- */
- public String getMemento(ISourceContainer container) throws CoreException {
- FolderSourceContainer folderSourceContainer = (FolderSourceContainer)container;
- Document document = newDocument();
- Element element = document.createElement("folder"); //$NON-NLS-1$
- element.setAttribute("path", folderSourceContainer.getContainer().getFullPath().toString()); //$NON-NLS-1$
- String nest = "false"; //$NON-NLS-1$
- if (folderSourceContainer.isComposite()) {
- nest = "true"; //$NON-NLS-1$
- }
- element.setAttribute("nest", nest); //$NON-NLS-1$
- document.appendChild(element);
- return serializeDocument(document);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#createSourceContainer(java.lang.String)
- */
- public ISourceContainer createSourceContainer(String memento) throws CoreException {
- Node node = parseDocument(memento);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element)node;
- if ("folder".equals(element.getNodeName())) { //$NON-NLS-1$
- String string = element.getAttribute("path"); //$NON-NLS-1$
- if (string == null || string.length() == 0) {
- abort(SourceLookupMessages.getString("FolderSourceContainerType.10"), null); //$NON-NLS-1$
- }
- String nest = element.getAttribute("nest"); //$NON-NLS-1$
- boolean nested = "true".equals(nest); //$NON-NLS-1$
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IFolder folder = workspace.getRoot().getFolder(new Path(string));
- // TODO: what if folder does not exist
- return new FolderSourceContainer(folder, nested);
- }
- abort(SourceLookupMessages.getString("FolderSourceContainerType.11"), null); //$NON-NLS-1$
- }
- abort(SourceLookupMessages.getString("FolderSourceContainerType.12"), null); //$NON-NLS-1$
- return null;
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ProjectSourceContainerType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ProjectSourceContainerType.java
deleted file mode 100644
index 51d1a9f14..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ProjectSourceContainerType.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup.containers;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
-import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
-import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * The type for creating/restoring a project source container.
- *
- * @since 3.0
- */
-public class ProjectSourceContainerType extends AbstractSourceContainerTypeDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#getMemento(org.eclipse.debug.internal.core.sourcelookup.ISourceContainer)
- */
- public String getMemento(ISourceContainer container) throws CoreException {
- ProjectSourceContainer project = (ProjectSourceContainer) container;
- Document document = newDocument();
- Element element = document.createElement("project"); //$NON-NLS-1$
- element.setAttribute("name", project.getContainer().getName()); //$NON-NLS-1$
- String referenced = "false"; //$NON-NLS-1$
- if (project.isSearchReferencedProjects()) {
- referenced = "true"; //$NON-NLS-1$
- }
- element.setAttribute("referencedProjects", referenced); //$NON-NLS-1$
- document.appendChild(element);
- return serializeDocument(document);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType#createSourceContainer(java.lang.String)
- */
- public ISourceContainer createSourceContainer(String memento) throws CoreException {
- Node node = parseDocument(memento);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element)node;
- if ("project".equals(element.getNodeName())) { //$NON-NLS-1$
- String string = element.getAttribute("name"); //$NON-NLS-1$
- if (string == null || string.length() == 0) {
- abort(SourceLookupMessages.getString("ProjectSourceContainerType.10"), null); //$NON-NLS-1$
- }
- String nest = element.getAttribute("referencedProjects"); //$NON-NLS-1$
- boolean ref = "true".equals(nest); //$NON-NLS-1$
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(string);
- return new ProjectSourceContainer(project, ref);
- }
- abort(SourceLookupMessages.getString("ProjectSourceContainerType.11"), null); //$NON-NLS-1$
- }
- abort(SourceLookupMessages.getString("ProjectSourceContainerType.12"), null); //$NON-NLS-1$
- return null;
- }
-}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/WorkspaceSourceContainerType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/WorkspaceSourceContainerType.java
deleted file mode 100644
index 053093c1b..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/WorkspaceSourceContainerType.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core.sourcelookup.containers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
-import org.eclipse.debug.core.sourcelookup.containers.WorkspaceSourceContainer;
-import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * The type for creating/restoring workspace source containers.
- *
- * @since 3.0
- */
-public class WorkspaceSourceContainerType extends AbstractSourceContainerTypeDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerTypeDelegate#createSourceContainer(java.lang.String)
- */
- public ISourceContainer createSourceContainer(String memento) throws CoreException {
- Node node = parseDocument(memento);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element)node;
- if ("workspace".equals(element.getNodeName())) { //$NON-NLS-1$
- return new WorkspaceSourceContainer();
- }
- abort(SourceLookupMessages.getString("WorkspaceSourceContainerType.3"), null); //$NON-NLS-1$
- }
- abort(SourceLookupMessages.getString("WorkspaceSourceContainerType.4"), null); //$NON-NLS-1$
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainerTypeDelegate#getMemento(org.eclipse.debug.internal.core.sourcelookup.ISourceContainer)
- */
- public String getMemento(ISourceContainer container) throws CoreException {
- Document document = newDocument();
- Element element = document.createElement("workspace"); //$NON-NLS-1$
- document.appendChild(element);
- return serializeDocument(document);
- }
-}

Back to the top