diff options
Diffstat (limited to 'org.eclipse.debug.core/core/org/eclipse')
38 files changed, 1351 insertions, 1351 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java index 313d3218e..534b5a79b 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java @@ -154,10 +154,10 @@ import org.eclipse.debug.internal.core.DebugCoreMessages; */ public final class DebugEvent extends EventObject { - /** - * All objects that can be serialized should have a stable serialVersionUID - */ - private static final long serialVersionUID = 1L; + /** + * All objects that can be serialized should have a stable serialVersionUID + */ + private static final long serialVersionUID = 1L; /** * Resume event kind. diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java index c913ea4a3..cd3a23d3d 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java @@ -32,10 +32,10 @@ import org.eclipse.core.runtime.IStatus; */ public class DebugException extends CoreException { - /** - * All objects that can be serialized should have a stable serialVersionUID - */ - private static final long serialVersionUID = 1L; + /** + * All objects that can be serialized should have a stable serialVersionUID + */ + private static final long serialVersionUID = 1L; /** * Indicates a request made of a debug element has failed diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java index 53d6db5c2..b1d681ee0 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java @@ -276,21 +276,21 @@ public class DebugPlugin extends Plugin { */ public static final String ATTR_LAUNCH_TIMESTAMP = PI_DEBUG_CORE + ".launch.timestamp"; //$NON-NLS-1$ - /** - * This launch attribute designates the encoding to be used by the console - * associated with the launch. - * <p> - * For release 3.3, the system encoding is used when unspecified. Since 3.4, - * the inherited encoding is used when unspecified. See {@link ILaunchManager} for a - * description in <code>getEncoding(ILaunchConfiguration)</code>. - * </p> - * <p> - * Value of this constant is the same as the value of the old - * <code>IDebugUIConstants.ATTR_CONSOLE_ENCODING</code> constant for backward - * compatibility. - * </p> - * @since 3.3 - */ + /** + * This launch attribute designates the encoding to be used by the console + * associated with the launch. + * <p> + * For release 3.3, the system encoding is used when unspecified. Since 3.4, + * the inherited encoding is used when unspecified. See {@link ILaunchManager} for a + * description in <code>getEncoding(ILaunchConfiguration)</code>. + * </p> + * <p> + * Value of this constant is the same as the value of the old + * <code>IDebugUIConstants.ATTR_CONSOLE_ENCODING</code> constant for backward + * compatibility. + * </p> + * @since 3.3 + */ public static final String ATTR_CONSOLE_ENCODING = "org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING"; //$NON-NLS-1$ /** @@ -419,43 +419,43 @@ public class DebugPlugin extends Plugin { EventNotifier fNotifier = new EventNotifier(); AsynchRunner fRunner = new AsynchRunner(); - /** - * Creates a new event dispatch job. - */ - public EventDispatchJob() { - super(DebugCoreMessages.DebugPlugin_1); - setPriority(Job.INTERACTIVE); - setSystem(true); - } + /** + * Creates a new event dispatch job. + */ + public EventDispatchJob() { + super(DebugCoreMessages.DebugPlugin_1); + setPriority(Job.INTERACTIVE); + setSystem(true); + } - @Override + @Override protected IStatus run(IProgressMonitor monitor) { - while (!fEventQueue.isEmpty()) { - Object next = null; - synchronized (fEventQueue) { - if (!fEventQueue.isEmpty()) { - next = fEventQueue.remove(0); - } - } - if (next instanceof Runnable) { - fRunner.async((Runnable) next); - } else if (next != null) { - fNotifier.dispatch((DebugEvent[]) next); - } - } - return Status.OK_STATUS; - } - - @Override + while (!fEventQueue.isEmpty()) { + Object next = null; + synchronized (fEventQueue) { + if (!fEventQueue.isEmpty()) { + next = fEventQueue.remove(0); + } + } + if (next instanceof Runnable) { + fRunner.async((Runnable) next); + } else if (next != null) { + fNotifier.dispatch((DebugEvent[]) next); + } + } + return Status.OK_STATUS; + } + + @Override public boolean shouldRun() { - return shouldSchedule(); - } + return shouldSchedule(); + } - @Override + @Override public boolean shouldSchedule() { - return !(isShuttingDown() || fEventListeners.isEmpty()); - } + return !(isShuttingDown() || fEventListeners.isEmpty()); + } } @@ -662,7 +662,7 @@ public class DebugPlugin extends Plugin { } fEventListeners.clear(); - fEventFilters.clear(); + fEventFilters.clear(); SourceLookupUtils.shutdown(); Preferences.savePreferences(DebugPlugin.getUniqueIdentifier()); @@ -796,37 +796,37 @@ public class DebugPlugin extends Plugin { return LogicalStructureManager.getDefault().getLogicalStructureTypes(value); } - /** - * Returns the default logical structure type among the given combination of - * logical structure types, or <code>null</code> if none. When the given combination - * of logical structure type is applicable for a value, the default logical structure - * type is used to display a value. - * - * @param types a combination of structures applicable to a value - * @return the default structure that should be used to display the value - * or <code>null</code> if none - * - * @since 3.1 - */ - public static ILogicalStructureType getDefaultStructureType(ILogicalStructureType[] types) { - return LogicalStructureManager.getDefault().getSelectedStructureType(types); - } - - /** - * Sets the default logical structure type among the given combination of logical structure - * types. The logical structure types provided should all be applicable to a single - * value. Specifying <code>null</code> indicates there is no default logical structure - * for the given combination of types. - * - * @param types a combination of logical structure types applicable to a value - * @param def the default logical structure among the given combination of types - * or <code>null</code> if none - * - * @since 3.1 - */ - public static void setDefaultStructureType(ILogicalStructureType[] types, ILogicalStructureType def) { - LogicalStructureManager.getDefault().setEnabledType(types, def); - } + /** + * Returns the default logical structure type among the given combination of + * logical structure types, or <code>null</code> if none. When the given combination + * of logical structure type is applicable for a value, the default logical structure + * type is used to display a value. + * + * @param types a combination of structures applicable to a value + * @return the default structure that should be used to display the value + * or <code>null</code> if none + * + * @since 3.1 + */ + public static ILogicalStructureType getDefaultStructureType(ILogicalStructureType[] types) { + return LogicalStructureManager.getDefault().getSelectedStructureType(types); + } + + /** + * Sets the default logical structure type among the given combination of logical structure + * types. The logical structure types provided should all be applicable to a single + * value. Specifying <code>null</code> indicates there is no default logical structure + * for the given combination of types. + * + * @param types a combination of logical structure types applicable to a value + * @param def the default logical structure among the given combination of types + * or <code>null</code> if none + * + * @since 3.1 + */ + public static void setDefaultStructureType(ILogicalStructureType[] types, ILogicalStructureType def) { + LogicalStructureManager.getDefault().setEnabledType(types, def); + } /** * Convenience method that performs a runtime exec on the given command line @@ -876,8 +876,8 @@ public class DebugPlugin extends Plugin { p= Runtime.getRuntime().exec(cmdLine, envp, workingDirectory); } } catch (IOException e) { - Status status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_0, e); - throw new CoreException(status); + Status status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_0, e); + throw new CoreException(status); } catch (NoSuchMethodError e) { //attempting launches on 1.2.* - no ability to set working directory IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERR_WORKING_DIRECTORY_NOT_SUPPORTED, DebugCoreMessages.DebugPlugin_Eclipse_runtime_does_not_support_working_directory_2, e); @@ -1165,7 +1165,7 @@ public class DebugPlugin extends Plugin { } for (IDebugEventSetListener iDebugEventSetListener : fEventListeners) { fListener = iDebugEventSetListener; - SafeRunner.run(this); + SafeRunner.run(this); } fEvents = null; fFilter = null; @@ -1236,9 +1236,9 @@ public class DebugPlugin extends Plugin { abort("Unable to parse XML document.", e); //$NON-NLS-1$ } finally { try{ - if (stream != null) { - stream.close(); - } + if (stream != null) { + stream.close(); + } } catch(IOException e) { abort("Unable to parse XML document.", e); //$NON-NLS-1$ } @@ -1651,25 +1651,25 @@ public class DebugPlugin extends Plugin { * @since 3.4 */ public static Object getAdapter(Object element, Class<?> type) { - Object adapter = null; - if (element != null) { - if (type.isInstance(element)) { + Object adapter = null; + if (element != null) { + if (type.isInstance(element)) { return element; } else { if (element instanceof IAdaptable) { - adapter = ((IAdaptable)element).getAdapter(type); + adapter = ((IAdaptable)element).getAdapter(type); } // for objects that don't subclass PlatformObject, check the platform's adapter manager if (adapter == null && !(element instanceof PlatformObject)) { - adapter = Platform.getAdapterManager().getAdapter(element, type); + adapter = Platform.getAdapterManager().getAdapter(element, type); } // force load the adapter in case it really is available if (adapter == null) { adapter = Platform.getAdapterManager().loadAdapter(element, type.getName()); } } - } - return adapter; + } + return adapter; } } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java index 4228c4f93..892c97fee 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java @@ -241,28 +241,28 @@ public interface IBreakpointManager { */ void setEnabled(boolean enabled); - /** - * Returns the name (user readable String) of the given - * breakpoint's type or <code>null</code> if none has been - * specified. - * - * @param breakpoint the breakpoint - * @return the name of the given breakpoint's type or <code>null</code> - * @since 3.1 - */ - String getTypeName(IBreakpoint breakpoint); - - /** - * Returns an array of {@link IBreakpointImportParticipant}s for the given - * breakpoint marker id, never <code>null</code>. - * - * @param markertype the {@link String} identifier of the marker type - * @return an array of {@link IBreakpointImportParticipant}s for the given marker type, - * never <code>null</code> - * @throws CoreException if an exception occurs - * @since 3.5 - */ - IBreakpointImportParticipant[] getImportParticipants(String markertype) throws CoreException; + /** + * Returns the name (user readable String) of the given + * breakpoint's type or <code>null</code> if none has been + * specified. + * + * @param breakpoint the breakpoint + * @return the name of the given breakpoint's type or <code>null</code> + * @since 3.1 + */ + String getTypeName(IBreakpoint breakpoint); + + /** + * Returns an array of {@link IBreakpointImportParticipant}s for the given + * breakpoint marker id, never <code>null</code>. + * + * @param markertype the {@link String} identifier of the marker type + * @return an array of {@link IBreakpointImportParticipant}s for the given marker type, + * never <code>null</code> + * @throws CoreException if an exception occurs + * @since 3.5 + */ + IBreakpointImportParticipant[] getImportParticipants(String markertype) throws CoreException; /** * Returns the triggers for the breakpoints associated with the workspace or diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java index 6734919ee..461131954 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java @@ -156,17 +156,17 @@ public interface IExpressionManager { */ IWatchExpressionDelegate newWatchExpressionDelegate(String id); - /** - * Returns whether a watch expression delegate has been contributed for - * the given debug model. - * - * @param id the unique identifier of a debug model - * @return whether a watch expression delegate has been contributed for - * the given debug model - * @since 3.1 - * @see IWatchExpressionDelegate - */ - boolean hasWatchExpressionDelegate(String id); + /** + * Returns whether a watch expression delegate has been contributed for + * the given debug model. + * + * @param id the unique identifier of a debug model + * @return whether a watch expression delegate has been contributed for + * the given debug model + * @since 3.1 + * @see IWatchExpressionDelegate + */ + boolean hasWatchExpressionDelegate(String id); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IRequest.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IRequest.java index 827697b32..d220503fc 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IRequest.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IRequest.java @@ -37,51 +37,51 @@ import org.eclipse.core.runtime.IStatus; */ public interface IRequest { - /** - * Sets the status for this request indicating whether this request - * succeeded, failed, or was canceled. When a request fails, the status - * indicates why the request failed. A <code>null</code> status is considered - * to be successful. Only clients fulfilling a request should call this - * method. Clients making a request are not intended to call this method. - * - * @param status request status or <code>null</code> - */ - void setStatus(IStatus status); + /** + * Sets the status for this request indicating whether this request + * succeeded, failed, or was canceled. When a request fails, the status + * indicates why the request failed. A <code>null</code> status is considered + * to be successful. Only clients fulfilling a request should call this + * method. Clients making a request are not intended to call this method. + * + * @param status request status or <code>null</code> + */ + void setStatus(IStatus status); - /** - * Returns the status of this request, or <code>null</code>. - * - * @return request status - <code>null</code> is equivalent - * to an OK status - */ - IStatus getStatus(); + /** + * Returns the status of this request, or <code>null</code>. + * + * @return request status - <code>null</code> is equivalent + * to an OK status + */ + IStatus getStatus(); - /** - * Indicates this request is complete. Clients must call this method - * whether the request succeeds, fails, or is cancelled to indicate that - * processing is complete. Only clients fulfilling a request should call this - * method. Clients making a request are not intended to call this method. - */ - void done(); + /** + * Indicates this request is complete. Clients must call this method + * whether the request succeeds, fails, or is cancelled to indicate that + * processing is complete. Only clients fulfilling a request should call this + * method. Clients making a request are not intended to call this method. + */ + void done(); - /** - * Cancels this request. A request may be canceled by the originator of request - * or a client fulfilling a request. Optionally a canceled status may be set on - * this request with more details. A client fulfilling a request must still call - * <code>done()</code> to indicate the request is complete. - */ - void cancel(); + /** + * Cancels this request. A request may be canceled by the originator of request + * or a client fulfilling a request. Optionally a canceled status may be set on + * this request with more details. A client fulfilling a request must still call + * <code>done()</code> to indicate the request is complete. + */ + void cancel(); - /** - * Returns whether this request has been canceled. - * <p> - * Clients fulfilling a request are expected to poll a request (using <code>isCanceled</code>) - * periodically and abort at their earliest convenience calling <code>done()</code>. - * A request can be canceled by the originator of the request or a processor fulfilling a - * request. - * </p> - * @return whether this request has been canceled - */ - boolean isCanceled(); + /** + * Returns whether this request has been canceled. + * <p> + * Clients fulfilling a request are expected to poll a request (using <code>isCanceled</code>) + * periodically and abort at their earliest convenience calling <code>done()</code>. + * A request can be canceled by the originator of the request or a processor fulfilling a + * request. + * </p> + * @return whether this request has been canceled + */ + boolean isCanceled(); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java index fad75de0f..0f2cf17a3 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java @@ -493,9 +493,9 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau } /** - * Returns whether any processes or targets can be disconnected. - * Ones that are already terminated or disconnected are ignored. - * + * Returns whether any processes or targets can be disconnected. + * Ones that are already terminated or disconnected are ignored. + * * @see org.eclipse.debug.core.model.IDisconnect#canDisconnect() */ @Override @@ -517,7 +517,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau } finally { readLock.unlock(); } - return false; + return false; } /** @@ -546,10 +546,10 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau } /** - * Returns whether all of the contained targets and processes are - * disconnected. Processes that don't support disconnecting are not - * counted. - * + * Returns whether all of the contained targets and processes are + * disconnected. Processes that don't support disconnecting are not + * counted. + * * @see org.eclipse.debug.core.model.IDisconnect#isDisconnected() */ @Override @@ -571,8 +571,8 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau } finally { readLock.unlock(); } - // only return true if there are processes or targets that are disconnected - return hasChildren(); + // only return true if there are processes or targets that are disconnected + return hasChildren(); } @Override diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java index 0bc82a904..15b204aad 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java @@ -166,7 +166,7 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler { /** * Scheduling rule to serialize commands on an object */ - private class SerialPerObjectRule implements ISchedulingRule { + private class SerialPerObjectRule implements ISchedulingRule { private Object fObject = null; @@ -326,7 +326,7 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler { * @return adapter or <code>null</code> */ protected Object getAdapter(Object element, Class<?> type) { - return DebugPlugin.getAdapter(element, type); + return DebugPlugin.getAdapter(element, type); } /** diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java index b31cb9280..ef7c44ebf 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java @@ -346,14 +346,14 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint, * possibly <code>null</code> * @since 3.1 */ - protected ISchedulingRule getMarkerRule(IResource resource) { - ISchedulingRule rule = null; - if (resource != null) { - IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory(); - rule = ruleFactory.markerRule(resource); - } - return rule; - } + protected ISchedulingRule getMarkerRule(IResource resource) { + ISchedulingRule rule = null; + if (resource != null) { + IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory(); + rule = ruleFactory.markerRule(resource); + } + return rule; + } /** * Returns a scheduling rule to use when modifying or deleting this breakpoint's marker, @@ -364,34 +364,34 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint, * @return a scheduling rule to use when modifying or deleting this breakpoint's marker * @since 3.1 */ - protected ISchedulingRule getMarkerRule() { - ISchedulingRule rule = null; - IMarker marker = getMarker(); - if (marker != null) { - IResource resource = marker.getResource(); - if (resource != null) { - IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory(); - rule = ruleFactory.markerRule(resource); - } - } - return rule; - } - - /** + protected ISchedulingRule getMarkerRule() { + ISchedulingRule rule = null; + IMarker marker = getMarker(); + if (marker != null) { + IResource resource = marker.getResource(); + if (resource != null) { + IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory(); + rule = ruleFactory.markerRule(resource); + } + } + return rule; + } + + /** * Execute the given workspace runnable with the scheduling rule to use when running the operation. * * @param rule the rule to use when running the operation - * @param wr the runnable operation - * @throws DebugException If a core exception occurs performing the operation + * @param wr the runnable operation + * @throws DebugException If a core exception occurs performing the operation * @since 3.1 */ - protected void run(ISchedulingRule rule, IWorkspaceRunnable wr) throws DebugException { - try { - ResourcesPlugin.getWorkspace().run(wr, rule, IWorkspace.AVOID_UPDATE, null); - } catch (CoreException e) { - throw new DebugException(e.getStatus()); - } - } + protected void run(ISchedulingRule rule, IWorkspaceRunnable wr) throws DebugException { + try { + ResourcesPlugin.getWorkspace().run(wr, rule, IWorkspace.AVOID_UPDATE, null); + } catch (CoreException e) { + throw new DebugException(e.getStatus()); + } + } @Override public String toString() { diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java index 38bcb82dd..d8be9a753 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java @@ -31,27 +31,27 @@ import org.eclipse.debug.core.ILaunchConfiguration; */ 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; - } - - @Override + 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; + } + + @Override public IDebugTarget getDebugTarget() { - return fTarget; - } + return fTarget; + } - @Override + @Override public ILaunch getLaunch() { - return getDebugTarget().getLaunch(); - } + return getDebugTarget().getLaunch(); + } @SuppressWarnings("unchecked") @Override @@ -80,7 +80,7 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme return (T) getLaunch().getLaunchConfiguration(); } return super.getAdapter(adapter); - } + } /** * Fires a debug event. @@ -105,7 +105,7 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme /** * Fires a creation event for this debug element. */ - public void fireCreationEvent() { + public void fireCreationEvent() { fireEvent(new DebugEvent(this, DebugEvent.CREATE)); } @@ -116,7 +116,7 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme * @param detail detail code for the resume event, such * as <code>DebugEvent.STEP_OVER</code> */ - public void fireResumeEvent(int detail) { + public void fireResumeEvent(int detail) { fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail)); } @@ -127,14 +127,14 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme * @param detail detail code for the suspend event, such * as <code>DebugEvent.BREAKPOINT</code> */ - public void fireSuspendEvent(int detail) { + public void fireSuspendEvent(int detail) { fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail)); } /** * Fires a terminate event for this debug element. */ - public void fireTerminateEvent() { + public void fireTerminateEvent() { fireEvent(new DebugEvent(this, DebugEvent.TERMINATE)); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDropToFrame.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDropToFrame.java index 1ac3b6230..d207d5f3a 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDropToFrame.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDropToFrame.java @@ -24,23 +24,23 @@ import org.eclipse.debug.core.DebugException; */ public interface IDropToFrame { - /** - * Returns whether this element can currently perform a drop to frame. - * @return whether this element can currently perform a drop to frame - */ - boolean canDropToFrame(); + /** + * Returns whether this element can currently perform a drop to frame. + * @return whether this element can currently perform a drop to frame + */ + boolean canDropToFrame(); - /** - * Performs a drop to frame on this element. Implementations must generate - * events such that debug clients can update appropriately, such as corresponding - * <code>RESUME</code> and <code>SUSPEND</code> events, or a single <code>CHANGE</code> - * event when the drop is complete. Implementations should implement drop to frame - * in a non-blocking fashion. - * - * @throws DebugException on failure. Reasons include:<ul> - * <li>TARGET_REQUEST_FAILED - The request failed in the target</li> - * <li>NOT_SUPPORTED - The capability is not supported by the target</li> - * </ul> - */ - void dropToFrame() throws DebugException; + /** + * Performs a drop to frame on this element. Implementations must generate + * events such that debug clients can update appropriately, such as corresponding + * <code>RESUME</code> and <code>SUSPEND</code> events, or a single <code>CHANGE</code> + * event when the drop is complete. Implementations should implement drop to frame + * in a non-blocking fashion. + * + * @throws DebugException on failure. Reasons include:<ul> + * <li>TARGET_REQUEST_FAILED - The request failed in the target</li> + * <li>NOT_SUPPORTED - The capability is not supported by the target</li> + * </ul> + */ + void dropToFrame() throws DebugException; } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy2.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy2.java index ec2b81005..35f5eb121 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy2.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy2.java @@ -27,11 +27,11 @@ import java.io.IOException; */ public interface IStreamsProxy2 extends IStreamsProxy { - /** - * Closes the output stream connected to the standard input stream - * of this proxy's process. - * - * @throws IOException if unable to close the stream - */ - void closeInputStream() throws IOException; + /** + * Closes the output stream connected to the standard input stream + * of this proxy's process. + * + * @throws IOException if unable to close the stream + */ + void closeInputStream() throws IOException; } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java index 898a04197..18b6b4131 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java @@ -209,9 +209,9 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio } if (mode.equals(ILaunchManager.RUN_MODE) && configuration.supportsMode(ILaunchManager.DEBUG_MODE)) { IBreakpoint[] breakpoints= getBreakpoints(configuration); - if (breakpoints == null) { - return true; - } + if (breakpoints == null) { + return true; + } for (int i = 0; i < breakpoints.length; i++) { if (breakpoints[i].isEnabled()) { IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus); @@ -262,22 +262,22 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio } } - /** - * Returns the breakpoint collection that is relevant for this launch delegate. - * By default this is all the breakpoints registered with the Debug breakpoint manager. - * - * @param configuration the configuration to get associated breakpoints for - * @since 3.1 - * @return the breakpoints that are relevant for this launch delegate - */ - protected IBreakpoint[] getBreakpoints(ILaunchConfiguration configuration) { - IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); - if (!breakpointManager.isEnabled()) { - // no need to check breakpoints individually. - return null; - } - return breakpointManager.getBreakpoints(); - } + /** + * Returns the breakpoint collection that is relevant for this launch delegate. + * By default this is all the breakpoints registered with the Debug breakpoint manager. + * + * @param configuration the configuration to get associated breakpoints for + * @since 3.1 + * @return the breakpoints that are relevant for this launch delegate + */ + protected IBreakpoint[] getBreakpoints(ILaunchConfiguration configuration) { + IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); + if (!breakpointManager.isEnabled()) { + // no need to check breakpoints individually. + return null; + } + return breakpointManager.getBreakpoints(); + } /** * Returns an array of projects in their suggested build order diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/MemoryByte.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/MemoryByte.java index 829ebf1eb..16c8c2148 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/MemoryByte.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/MemoryByte.java @@ -27,9 +27,9 @@ package org.eclipse.debug.core.model; */ public class MemoryByte { - /** - * Bit mask used to indicate a byte is writable. - */ + /** + * Bit mask used to indicate a byte is writable. + */ public static final byte WRITABLE = 0x01; /** @@ -88,7 +88,7 @@ public class MemoryByte { * by default. */ public MemoryByte() { - this((byte)0, (byte)(WRITABLE | READABLE | ENDIANESS_KNOWN)); + this((byte)0, (byte)(WRITABLE | READABLE | ENDIANESS_KNOWN)); } /** @@ -100,7 +100,7 @@ public class MemoryByte { * */ public MemoryByte(byte byteValue) { - this(byteValue, (byte)(WRITABLE | READABLE | ENDIANESS_KNOWN)); + this(byteValue, (byte)(WRITABLE | READABLE | ENDIANESS_KNOWN)); } /** diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java index d34a62320..9f56edef5 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java @@ -203,12 +203,12 @@ public class RuntimeProcess extends PlatformObject implements IProcess { } Process process = getSystemProcess(); if (process != null) { - process.destroy(); + process.destroy(); } int attempts = 0; while (attempts < MAX_WAIT_FOR_DEATH_ATTEMPTS) { try { - process = getSystemProcess(); + process = getSystemProcess(); if (process != null) { fExitValue = process.exitValue(); // throws exception if process not exited } @@ -236,24 +236,24 @@ public class RuntimeProcess extends PlatformObject implements IProcess { * has terminated. */ protected void terminated() { - if (fStreamsProxy instanceof StreamsProxy) { - ((StreamsProxy)fStreamsProxy).close(); - } + if (fStreamsProxy instanceof StreamsProxy) { + ((StreamsProxy)fStreamsProxy).close(); + } - // Avoid calling IProcess.exitValue() inside a sync section (Bug 311813). - int exitValue = -1; - boolean running = false; - try { - exitValue = fProcess.exitValue(); - } catch (IllegalThreadStateException ie) { - running = true; - } + // Avoid calling IProcess.exitValue() inside a sync section (Bug 311813). + int exitValue = -1; + boolean running = false; + try { + exitValue = fProcess.exitValue(); + } catch (IllegalThreadStateException ie) { + running = true; + } synchronized (this) { fTerminated= true; if (!running) { - fExitValue = exitValue; + fExitValue = exitValue; } fProcess= null; } @@ -265,9 +265,9 @@ public class RuntimeProcess extends PlatformObject implements IProcess { */ @Override public IStreamsProxy getStreamsProxy() { - if (!fCaptureOutput) { - return null; - } + if (!fCaptureOutput) { + return null; + } return fStreamsProxy; } @@ -277,9 +277,9 @@ public class RuntimeProcess extends PlatformObject implements IProcess { * @return streams proxy */ protected IStreamsProxy createStreamsProxy() { - if (!fCaptureOutput) { - return new NullStreamsProxy(getSystemProcess()); - } + if (!fCaptureOutput) { + return new NullStreamsProxy(getSystemProcess()); + } String encoding = getLaunch().getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING); return new StreamsProxy(getSystemProcess(), encoding); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java index 332f6af9e..3612cb1ff 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java @@ -384,7 +384,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec @Override public void initializeFromMemento(String memento) throws CoreException { - doInitializeFromMemento(memento, true); + doInitializeFromMemento(memento, true); } /** @@ -398,9 +398,9 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec * @since 3.1 */ protected void doInitializeFromMemento(String memento, boolean dispose) throws CoreException { - if (dispose) { - dispose(); - } + if (dispose) { + dispose(); + } Element rootElement = DebugPlugin.parseDocument(memento); if (!rootElement.getNodeName().equalsIgnoreCase(DIRECTOR_ROOT_NODE)) { abort(SourceLookupMessages.AbstractSourceLookupDirector_14, null); @@ -547,7 +547,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec @Override public void initializeFromMemento(String memento, ILaunchConfiguration configuration) throws CoreException { - dispose(); + dispose(); setLaunchConfiguration(configuration); doInitializeFromMemento(memento, false); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupParticipant.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupParticipant.java index b8c37e660..5659f020f 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupParticipant.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupParticipant.java @@ -37,7 +37,7 @@ public interface ISourceLookupParticipant { /** * Notification this participant has been added to the specified * source lookup director. - * + * * @param director the source lookup director that this participant * has been added to */ diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java index 7777b1ec5..e44e6e227 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java @@ -59,7 +59,7 @@ public class ArchiveSourceContainer extends AbstractSourceContainer { fFile = archive; fDetectRoot = detectRootPath; if (archive.exists() && archive.getLocation() != null) { - fDelegateContainer = new ExternalArchiveSourceContainer(archive.getLocation().toOSString(), detectRootPath); + fDelegateContainer = new ExternalArchiveSourceContainer(archive.getLocation().toOSString(), detectRootPath); } } @@ -93,38 +93,38 @@ public class ArchiveSourceContainer extends AbstractSourceContainer { return getName().hashCode(); } - @Override + @Override public Object[] findSourceElements(String name) throws CoreException { - ExternalArchiveSourceContainer container = getDelegateContainer(); - if (container != null) { - return container.findSourceElements(name); - } - return EMPTY; - } + ExternalArchiveSourceContainer container = getDelegateContainer(); + if (container != null) { + return container.findSourceElements(name); + } + return EMPTY; + } - /** - * Returns the underlying external archive source container. - * - * @return underlying external archive source container - * @since 3.0.1.1 - */ - private ExternalArchiveSourceContainer getDelegateContainer() { - return fDelegateContainer; - } - @Override + /** + * Returns the underlying external archive source container. + * + * @return underlying external archive source container + * @since 3.0.1.1 + */ + private ExternalArchiveSourceContainer getDelegateContainer() { + return fDelegateContainer; + } + @Override public void init(ISourceLookupDirector director) { - super.init(director); - if (fDelegateContainer != null) { - fDelegateContainer.init(director); - } - } - @Override + super.init(director); + if (fDelegateContainer != null) { + fDelegateContainer.init(director); + } + } + @Override public void dispose() { - super.dispose(); - if (fDelegateContainer != null) { - fDelegateContainer.dispose(); - } - } + super.dispose(); + if (fDelegateContainer != null) { + fDelegateContainer.dispose(); + } + } /** * Returns whether root paths are automatically detected in this diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java index 6fb34cac5..0b21c4dc0 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java @@ -103,20 +103,20 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer } // bug 295828 root file may be null for an invalid linked resource if (fRootFile != null) { - // See bug 98090 - we need to handle relative path names - IFileStore target = fRootFile.getFileStore(new Path(name)); - if (target.fetchInfo().exists()) { - // We no longer have to account for bug 95832, and URIs take care - // of canonical paths (fix to bug 95679 was removed). - IFile[] files = fRoot.findFilesForLocationURI(target.toURI()); - if (isFindDuplicates() && files.length > 1) { - for (int i = 0; i < files.length; i++) { - sources.add(files[i]); - } - } else if (files.length > 0) { - sources.add(files[0]); - } - } + // See bug 98090 - we need to handle relative path names + IFileStore target = fRootFile.getFileStore(new Path(name)); + if (target.fetchInfo().exists()) { + // We no longer have to account for bug 95832, and URIs take care + // of canonical paths (fix to bug 95679 was removed). + IFile[] files = fRoot.findFilesForLocationURI(target.toURI()); + if (isFindDuplicates() && files.length > 1) { + for (int i = 0; i < files.length; i++) { + sources.add(files[i]); + } + } else if (files.length > 0) { + sources.add(files[0]); + } + } } } } 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 index cc991ebcb..9766252cb 100644 --- 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 @@ -336,14 +336,14 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis } // delete any markers that are not to be restored if (!delete.isEmpty()) { - final IMarker[] delMarkers = delete.toArray(new IMarker[delete.size()]); + final IMarker[] delMarkers = delete.toArray(new IMarker[delete.size()]); IWorkspaceRunnable wr = new IWorkspaceRunnable() { @Override public void run(IProgressMonitor pm) throws CoreException { - for (int i = 0; i < delMarkers.length; i++) { - IMarker marker = delMarkers[i]; - marker.delete(); - } + for (int i = 0; i < delMarkers.length; i++) { + IMarker marker = delMarkers[i]; + marker.delete(); + } } }; new BreakpointManagerJob(wr).schedule(); @@ -359,20 +359,20 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis getWorkspace().removeResourceChangeListener(this); getWorkspace().removeResourceChangeListener(fPostChangeListener); fBreakpointListeners.clear(); - fBreakpointsListeners.clear(); - fBreakpointManagerListeners.clear(); - if(fImportParticipants != null) { - fImportParticipants.clear(); - fImportParticipants = null; - fDefaultParticipant = null; - } - if(fBreakpoints != null) { - fBreakpoints.clear(); - fBreakpoints = null; - } - if(fMarkersToBreakpoints != null) { - fMarkersToBreakpoints.clear(); - } + fBreakpointsListeners.clear(); + fBreakpointManagerListeners.clear(); + if(fImportParticipants != null) { + fImportParticipants.clear(); + fImportParticipants = null; + fDefaultParticipant = null; + } + if(fBreakpoints != null) { + fBreakpoints.clear(); + fBreakpoints = null; + } + if(fMarkersToBreakpoints != null) { + fMarkersToBreakpoints.clear(); + } } /** @@ -597,7 +597,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis */ @Override public void addBreakpoints(IBreakpoint[] breakpoints) throws CoreException { - addBreakpoints(breakpoints, true); + addBreakpoints(breakpoints, true); } /** @@ -615,7 +615,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis if (!getBreakpoints0().contains(breakpoint)) { verifyBreakpoint(breakpoint); if (breakpoint.isRegistered()) { - // If notify == false, the breakpoints are just being added at startup + // If notify == false, the breakpoints are just being added at startup added.add(breakpoint); getBreakpoints0().add(breakpoint); fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint); @@ -626,7 +626,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis } } if (notify) { - fireUpdate(added, null, ADDED); + fireUpdate(added, null, ADDED); } if (!update.isEmpty()) { IWorkspaceRunnable r = new IWorkspaceRunnable() { @@ -646,7 +646,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis getWorkspace().run(r, null, 0, null); fSuppressChange.removeAll(update); if (notify) { - fireUpdate(update, null, ADDED); + fireUpdate(update, null, ADDED); } } } @@ -760,10 +760,10 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis IWorkspaceRunnable wRunnable= new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { - IMarker[] markers = fMoved.toArray(new IMarker[fMoved.size()]); + IMarker[] markers = fMoved.toArray(new IMarker[fMoved.size()]); for (int i = 0; i < markers.length; i++) { - markers[i].delete(); - } + markers[i].delete(); + } } }; try { @@ -1076,7 +1076,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis for (int j = 0; j < breakpoints.length; j++) { fBreakpoint = breakpoints[j]; fDelta = deltas[j]; - SafeRunner.run(this); + SafeRunner.run(this); } } fListener = null; @@ -1151,11 +1151,11 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis @Override public void setEnabled(final boolean enabled) { - if (isEnabled() != enabled) { - Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_BREAKPOINT_MANAGER_ENABLED_STATE, enabled, null); + if (isEnabled() != enabled) { + Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_BREAKPOINT_MANAGER_ENABLED_STATE, enabled, null); touchAllBreakpoints(); - new BreakpointManagerNotifier().notify(enabled); - } + new BreakpointManagerNotifier().notify(enabled); + } } @Override @@ -1197,7 +1197,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis fManagerEnabled= enabled; for (IBreakpointManagerListener iBreakpointManagerListener : fBreakpointManagerListeners) { fListener = iBreakpointManagerListener; - SafeRunner.run(this); + SafeRunner.run(this); } fListener = null; } @@ -1259,21 +1259,21 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis } } - @Override + @Override public String getTypeName(IBreakpoint breakpoint) { - String typeName= null; - IMarker marker = breakpoint.getMarker(); - if (marker != null) { - try { - IConfigurationElement element = fBreakpointExtensions.get(marker.getType()); - if (element != null) { - typeName= element.getAttribute(IConfigurationElementConstants.NAME); - } - } - catch (CoreException e) {} - } - return typeName; - } + String typeName= null; + IMarker marker = breakpoint.getMarker(); + if (marker != null) { + try { + IConfigurationElement element = fBreakpointExtensions.get(marker.getType()); + if (element != null) { + typeName= element.getAttribute(IConfigurationElementConstants.NAME); + } + } + catch (CoreException e) {} + } + return typeName; + } @Override public IBreakpointImportParticipant[] getImportParticipants(String markertype) throws CoreException { 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 index 0a9cba4e0..92f0d7ad0 100644 --- 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 @@ -40,12 +40,12 @@ public class EnvironmentVariableResolver implements IDynamicVariableResolver { String value = map.get(argument); if (value == null && Platform.getOS().equals(Constants.OS_WIN32)) { // On Win32, env variables are case insensitive, so we search the map - // for matches manually. + // for matches manually. for (Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); - if (key.equalsIgnoreCase(argument)) { - return entry.getValue(); - } + if (key.equalsIgnoreCase(argument)) { + return entry.getValue(); + } } } return value; 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 index c2ad9aca0..d3a27a28d 100644 --- 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 @@ -134,11 +134,11 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana } } - @Override + @Override public boolean hasWatchExpressionDelegate(String id) { - IConfigurationElement element= fWatchExpressionDelegates.get(id); - return element != null; - } + IConfigurationElement element= fWatchExpressionDelegates.get(id); + return element != null; + } /** * Loads any persisted watch expressions from the preferences. @@ -568,7 +568,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana fListener = iExpressionListener; for (int j = 0; j < expressions.length; j++) { fExpression = expressions[j]; - SafeRunner.run(this); + SafeRunner.run(this); } } } @@ -647,7 +647,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana fIndex = index; for (IExpressionsListener iExpressionsListener : fExpressionsListeners) { fListener = iExpressionsListener; - SafeRunner.run(this); + SafeRunner.run(this); } } fNotifierExpressions = null; diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java index 41f34957e..b77c5c957 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java @@ -328,23 +328,23 @@ public interface IConfigurationElementConstants { */ String MEMENTO = "memento"; //$NON-NLS-1$ - /** - * The selection node name for a configuration element. - * <p>Equal to the word: <code>selection</code></p> - */ - String SELECTION = "selection"; //$NON-NLS-1$ - - /** - * The debugContext node name for a configuration element. - * <p>Equal to the word: <code>debugContext</code></p> - */ - String DEBUG_CONTEXT = "debugContext"; //$NON-NLS-1$ - - /** - * The editorInput node name for a configuration element. - * <p>Equal to the word: <code>editorInput</code></p> - */ - String EDITOR_INPUT = "editorInput"; //$NON-NLS-1$ + /** + * The selection node name for a configuration element. + * <p>Equal to the word: <code>selection</code></p> + */ + String SELECTION = "selection"; //$NON-NLS-1$ + + /** + * The debugContext node name for a configuration element. + * <p>Equal to the word: <code>debugContext</code></p> + */ + String DEBUG_CONTEXT = "debugContext"; //$NON-NLS-1$ + + /** + * The editorInput node name for a configuration element. + * <p>Equal to the word: <code>editorInput</code></p> + */ + String EDITOR_INPUT = "editorInput"; //$NON-NLS-1$ /** * The allowPrototypes node name for a configuration element 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 index fe531aae3..d06a8346f 100644 --- 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 @@ -124,7 +124,7 @@ public class InputStreamMonitor { } if (!fClosed) { try { - fStream.close(); + fStream.close(); } catch (IOException e) { DebugPlugin.log(e); } @@ -157,20 +157,20 @@ public class InputStreamMonitor { } } - /** - * Closes the output stream attached to the standard input stream of this - * monitor's process. - * - * @exception IOException if an exception occurs closing the input stream - */ - public void closeInputStream() throws IOException { - if (!fClosed) { - fClosed = true; - fStream.close(); - } else { - throw new IOException(); - } - - } + /** + * Closes the output stream attached to the standard input stream of this + * monitor's process. + * + * @exception IOException if an exception occurs closing the input stream + */ + 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 index f017d5700..0a10cb9cb 100644 --- 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 @@ -291,8 +291,8 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig if (object instanceof LaunchConfiguration) { LaunchConfiguration otherConfig = (LaunchConfiguration) object; return getName().equals(otherConfig.getName()) - && getType().equals(otherConfig.getType()) - && equalOrNull(getContainer(), otherConfig.getContainer()) + && getType().equals(otherConfig.getType()) + && equalOrNull(getContainer(), otherConfig.getContainer()) && getInfo().equals(otherConfig.getInfo()); } return false; @@ -717,21 +717,21 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig @Override public ILaunch launch(String mode, IProgressMonitor monitor, boolean build) throws CoreException { - return launch(mode, monitor, build, true); + return launch(mode, monitor, build, true); } - @Override + @Override public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException { - /* Setup progress monitor - * - Prepare delegate (0) - * - Pre-launch check (1) - * - [Build before launch (7)] if build - * - [Incremental build before launch (3)] if build - * - Final launch validation (1) - * - Initialize source locator (1) - * - Launch delegate (10) */ + /* Setup progress monitor + * - Prepare delegate (0) + * - Pre-launch check (1) + * - [Build before launch (7)] if build + * - [Incremental build before launch (3)] if build + * - Final launch validation (1) + * - Initialize source locator (1) + * - Launch delegate (10) */ SubMonitor lmonitor = SubMonitor.convert(monitor, DebugCoreMessages.LaunchConfiguration_9, build ? 23 : 13); - try { + try { // bug 28245 - force the delegate to load in case it is interested in launch notifications Set<String> modes = getModes(); modes.add(mode); @@ -809,9 +809,9 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig launch.setAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP, Long.toString(System.currentTimeMillis())); boolean captureOutput = getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true); if(!captureOutput) { - launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, "false"); //$NON-NLS-1$ + launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, "false"); //$NON-NLS-1$ } else { - launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null); + launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null); } launch.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, getLaunchManager().getEncoding(this)); if (register) { @@ -884,13 +884,13 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig getLaunchManager().removeLaunch(launch); } return launch; - } - finally { + } + finally { lmonitor.done(); - } - } + } + } - @Override + @Override public void migrate() throws CoreException { ((LaunchConfigurationType)getType()).migrate(this); } 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 index ebe43feec..d505c00e9 100644 --- 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 @@ -124,24 +124,24 @@ import com.ibm.icu.text.MessageFormat; */ public class LaunchManager extends PlatformObject implements ILaunchManager, IResourceChangeListener { - /** - * Preferred launch delegate preference name. - * <p> - * Prior to 3.5 this preferred launch delegates for all launch - * configuration types were serialized into a single XML string - * and stored in this preference. - * </p> - * <p> - * Since 3.5, the preferred launch delegates are stored in a separate - * preference for each launch configuration type. The name of this - * preference is composed of the prefix, followed by a slash, followed by - * the launch configuration type id. The values contain a set of launch - * delegates, delimited by a semicolon, and each delegate entry contains - * the delegate ID, followed by a comma, followed by comma-delimited - * launch modes. - * - * @since 3.3 - */ + /** + * Preferred launch delegate preference name. + * <p> + * Prior to 3.5 this preferred launch delegates for all launch + * configuration types were serialized into a single XML string + * and stored in this preference. + * </p> + * <p> + * Since 3.5, the preferred launch delegates are stored in a separate + * preference for each launch configuration type. The name of this + * preference is composed of the prefix, followed by a slash, followed by + * the launch configuration type id. The values contain a set of launch + * delegates, delimited by a semicolon, and each delegate entry contains + * the delegate ID, followed by a comma, followed by comma-delimited + * launch modes. + * + * @since 3.3 + */ protected static final String PREF_PREFERRED_DELEGATES = DebugPlugin.getUniqueIdentifier() + ".PREFERRED_DELEGATES"; //$NON-NLS-1$ /** @@ -259,7 +259,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe fRegistered = null; for (ILaunchesListener iLaunchesListener : fLaunchesListeners) { fListener = iLaunchesListener; - SafeRunner.run(this); + SafeRunner.run(this); } fNotifierLaunches = null; fRegistered = null; @@ -357,7 +357,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe if (project.isOpen()) { LaunchManager.this.projectOpened(project); } else { - LaunchManager.this.projectClosed(project); + LaunchManager.this.projectClosed(project); } } return false; @@ -414,7 +414,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe fType = update; for (ILaunchListener iLaunchListener : fListeners) { fListener = iLaunchListener; - SafeRunner.run(this); + SafeRunner.run(this); } fLaunch = null; fListener = null; @@ -656,7 +656,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe private ILaunchConfiguration fTo; - /** + /** * Map of source container type extensions. Keys are extension ids * and values are associated configuration elements. */ @@ -776,7 +776,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe // pattern is [func name]=() { and we must find the '}' on its own line with no trailing ';' try (InputStream stream = process.getInputStream(); InputStreamReader isreader = new InputStreamReader(stream); - BufferedReader reader = new BufferedReader(isreader)) { + BufferedReader reader = new BufferedReader(isreader)) { String line = reader.readLine(); String key = null; String value = null; @@ -1097,7 +1097,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe if(reservednames == null) { return generateUniqueLaunchConfigurationNameFrom(basename); } - int index = 1; + int index = 1; int length= basename.length(); String base = basename; int copyIndex = base.lastIndexOf(" ("); //$NON-NLS-1$ @@ -1256,10 +1256,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe * @return the resource delta visitor for the launch manager */ private LaunchManagerVisitor getDeltaVisitor() { - if (fgVisitor == null) { + if (fgVisitor == null) { fgVisitor= new LaunchManagerVisitor(); } - return fgVisitor; + return fgVisitor; } /** @@ -1296,35 +1296,35 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe String nativeKey = null; for (Entry<String, String> entry : configEnv.entrySet()) { key = entry.getKey(); - value = entry.getValue(); - // translate any string substitution variables - if (value != null) { - value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value); - } - boolean added= false; + value = entry.getValue(); + // translate any string substitution variables + if (value != null) { + value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value); + } + boolean added= false; if (win32) { - // First, check if the key is an exact match for an existing key. + // First, check if the key is an exact match for an existing key. nativeValue = env.get(key); - if (nativeValue != null) { - // If an exact match is found, just replace the value - env.put(key, value); - } else { - // Win32 variables are case-insensitive. If an exact match isn't found, iterate to - // check for a case-insensitive match. We maintain the key's case (see bug 86725), - // but do a case-insensitive comparison (for example, "pAtH" will still override "PATH"). + if (nativeValue != null) { + // If an exact match is found, just replace the value + env.put(key, value); + } else { + // Win32 variables are case-insensitive. If an exact match isn't found, iterate to + // check for a case-insensitive match. We maintain the key's case (see bug 86725), + // but do a case-insensitive comparison (for example, "pAtH" will still override "PATH"). for (Entry<String, String> nativeEntry : env.entrySet()) { nativeKey = (nativeEntry).getKey(); - if (nativeKey.equalsIgnoreCase(key)) { - nativeEntry.setValue(value); - added = true; - break; - } - } - } - } - if (!added) { - env.put(key, value); - } + if (nativeKey.equalsIgnoreCase(key)) { + nativeEntry.setValue(value); + added = true; + break; + } + } + } + } + if (!added) { + env.put(key, value); + } } List<String> strings = new ArrayList<>(env.size()); StringBuilder buffer = null; @@ -1643,14 +1643,14 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe element = (Element) nodes.item(i); String delegateid = element.getAttribute(IConfigurationElementConstants.ID); typeid = element.getAttribute(IConfigurationElementConstants.TYPE_ID); - String[] modes = element.getAttribute(IConfigurationElementConstants.MODES).split(","); //$NON-NLS-1$ + String[] modes = element.getAttribute(IConfigurationElementConstants.MODES).split(","); //$NON-NLS-1$ modeset = new HashSet<>(Arrays.asList(modes)); LaunchDelegate delegate = getLaunchDelegateExtension(typeid, delegateid, modeset); if (delegate != null) { - //take type id, modeset, delegate and create entry - if(!IInternalDebugCoreConstants.EMPTY_STRING.equals(typeid) & modeset != null) { - fPreferredDelegates.add(new PreferredDelegate(delegate, typeid, modeset)); - } + //take type id, modeset, delegate and create entry + if(!IInternalDebugCoreConstants.EMPTY_STRING.equals(typeid) & modeset != null) { + fPreferredDelegates.add(new PreferredDelegate(delegate, typeid, modeset)); + } } } } @@ -1666,7 +1666,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe * @since 3.6 */ protected void resetPreferredDelegates() { - fPreferredDelegates = null; + fPreferredDelegates = null; } /** @@ -1678,8 +1678,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe * @since 3.3 */ protected ILaunchDelegate getPreferredDelegate(String typeid, Set<String> modes) { - // Retrieve preferred delegates using legacy mechanism for backward - // compatibility. + // Retrieve preferred delegates using legacy mechanism for backward + // compatibility. initializePreferredDelegates(); for (PreferredDelegate pd : fPreferredDelegates) { if(pd.getModes().equals(modes) & pd.getTypeId().equals(typeid)) { @@ -1690,23 +1690,23 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe // @since 3.5 // If the legacy mechanism didn't work, try the new preference name for // the given launch type. - String preferred = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), "//" + LaunchManager.PREF_PREFERRED_DELEGATES + '/' + typeid, IInternalDebugCoreConstants.EMPTY_STRING, null); //$NON-NLS-1$ - if (preferred != null && preferred.length() != 0) { - StringTokenizer tokenizer = new StringTokenizer(preferred, ";"); //$NON-NLS-1$ - while(tokenizer.hasMoreTokens()) { - StringTokenizer tokenizer2 = new StringTokenizer(tokenizer.nextToken(), ","); //$NON-NLS-1$ - String delegateId = tokenizer2.nextToken(); + String preferred = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), "//" + LaunchManager.PREF_PREFERRED_DELEGATES + '/' + typeid, IInternalDebugCoreConstants.EMPTY_STRING, null); //$NON-NLS-1$ + if (preferred != null && preferred.length() != 0) { + StringTokenizer tokenizer = new StringTokenizer(preferred, ";"); //$NON-NLS-1$ + while(tokenizer.hasMoreTokens()) { + StringTokenizer tokenizer2 = new StringTokenizer(tokenizer.nextToken(), ","); //$NON-NLS-1$ + String delegateId = tokenizer2.nextToken(); HashSet<String> modeset = new HashSet<>(); - while(tokenizer2.hasMoreTokens()) { - modeset.add(tokenizer2.nextToken()); - } - LaunchDelegate delegate = getLaunchDelegateExtension(typeid, delegateId, modeset); - if (delegate != null && modeset.equals(modes)) { - return delegate; - } - } - - } + while(tokenizer2.hasMoreTokens()) { + modeset.add(tokenizer2.nextToken()); + } + LaunchDelegate delegate = getLaunchDelegateExtension(typeid, delegateId, modeset); + if (delegate != null && modeset.equals(modes)) { + return delegate; + } + } + + } return null; } @@ -1723,16 +1723,16 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe * @since 3.5 */ private LaunchDelegate getLaunchDelegateExtension(String typeId, String id, Set<String> modeset) { - LaunchDelegate[] extensions = getLaunchDelegates(typeId); - for(int j = 0; j < extensions.length; j++) { - if(id.equals(extensions[j].getId())) { + LaunchDelegate[] extensions = getLaunchDelegates(typeId); + for(int j = 0; j < extensions.length; j++) { + if(id.equals(extensions[j].getId())) { List<Set<String>> modesets = extensions[j].getModes(); - if(modesets.contains(modeset)) { - return extensions[j]; - } - } - } - return null; + if(modesets.contains(modeset)) { + return extensions[j]; + } + } + } + return null; } /** @@ -1880,14 +1880,14 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe } /** - * Starts listening for resource change events - */ - private synchronized void hookResourceChangeListener() { - if (!fListening) { - ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE); - fListening = true; - } - } + * Starts listening for resource change events + */ + private synchronized void hookResourceChangeListener() { + if (!fListening) { + ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE); + fListening = true; + } + } /** * Load comparator extensions. @@ -2267,19 +2267,19 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); if (delta != null) { - LaunchManagerVisitor visitor = getDeltaVisitor(); - MappedResourceVisitor v = null; - if (isDeleteConfigurations()) { - v = getMappedResourceVisitor(); - } - try { - delta.accept(visitor); - if (v != null) { - delta.accept(v); - } - } catch (CoreException e) { - DebugPlugin.log(e.getStatus()); - } + LaunchManagerVisitor visitor = getDeltaVisitor(); + MappedResourceVisitor v = null; + if (isDeleteConfigurations()) { + v = getMappedResourceVisitor(); + } + try { + delta.accept(visitor); + if (v != null) { + delta.accept(v); + } + } catch (CoreException e) { + DebugPlugin.log(e.getStatus()); + } } } @@ -2311,8 +2311,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe } } } catch (CoreException e) { - DebugPlugin.log(e); - } + DebugPlugin.log(e); + } return list; } @@ -2343,15 +2343,15 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe launch = launches[i]; if(launch != null) { try { - if (launch instanceof IDisconnect) { - IDisconnect disconnect = (IDisconnect)launch; - if (disconnect.canDisconnect()) { - disconnect.disconnect(); - } - } - if (launch.canTerminate()) { - launch.terminate(); - } + if (launch instanceof IDisconnect) { + IDisconnect disconnect = (IDisconnect)launch; + if (disconnect.canDisconnect()) { + disconnect.disconnect(); + } + } + if (launch.canTerminate()) { + launch.terminate(); + } } catch (DebugException e) { DebugPlugin.log(e); } @@ -2370,10 +2370,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe * @since 3.3 */ public void persistPreferredLaunchDelegates() { - ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); - for(int i = 0; i < types.length; i++) { - persistPreferredLaunchDelegate((LaunchConfigurationType)types[i]); - } + ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); + for(int i = 0; i < types.length; i++) { + persistPreferredLaunchDelegate((LaunchConfigurationType)types[i]); + } } /** @@ -2382,31 +2382,31 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe * * @since 3.6 */ - public void persistPreferredLaunchDelegate(LaunchConfigurationType type) { - String preferenceName = PREF_PREFERRED_DELEGATES + '/' + type.getIdentifier(); + public void persistPreferredLaunchDelegate(LaunchConfigurationType type) { + String preferenceName = PREF_PREFERRED_DELEGATES + '/' + type.getIdentifier(); Map<Set<String>, ILaunchDelegate> preferred = type.getPreferredDelegates(); - if(preferred != null && preferred.size() > 0) { - StringBuilder str = new StringBuilder(); + if(preferred != null && preferred.size() > 0) { + StringBuilder str = new StringBuilder(); for (Entry<Set<String>, ILaunchDelegate> entry : preferred.entrySet()) { Set<String> modes = entry.getKey(); ILaunchDelegate delegate = entry.getValue(); if (delegate != null) { - str.append(delegate.getId()); - str.append(','); + str.append(delegate.getId()); + str.append(','); for (String mode : modes) { str.append(mode).append(','); - } + } str.append(';'); - } - } - Preferences.setString(DebugPlugin.getUniqueIdentifier(), preferenceName, str.toString(), null); - } else { - Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), preferenceName); - } + } + } + Preferences.setString(DebugPlugin.getUniqueIdentifier(), preferenceName, str.toString(), null); + } else { + Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), preferenceName); + } - // Reset the legacy preference string. - Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), PREF_PREFERRED_DELEGATES); - } + // Reset the legacy preference string. + Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), PREF_PREFERRED_DELEGATES); + } /** * finds and terminates any running launch configurations associated with the given resource @@ -2485,28 +2485,28 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe * @param label label to process * @return label without accelerators */ - public static String removeAccelerators(String label) { - String title = label; - if (title != null) { - // strip out any '&' (accelerators) - int index = title.indexOf('&'); - if (index == 0) { - title = title.substring(1); - } else if (index > 0) { - //DBCS languages use "(&X)" format - if (title.charAt(index - 1) == '(' && title.length() >= index + 3 && title.charAt(index + 2) == ')') { - String first = title.substring(0, index - 1); - String last = title.substring(index + 3); - title = first + last; - } else if (index < (title.length() - 1)) { - String first = title.substring(0, index); - String last = title.substring(index + 1); - title = first + last; - } - } - } - return title; - } + public static String removeAccelerators(String label) { + String title = label; + if (title != null) { + // strip out any '&' (accelerators) + int index = title.indexOf('&'); + if (index == 0) { + title = title.substring(1); + } else if (index > 0) { + //DBCS languages use "(&X)" format + if (title.charAt(index - 1) == '(' && title.length() >= index + 3 && title.charAt(index + 2) == ')') { + String first = title.substring(0, index - 1); + String last = title.substring(index + 3); + title = first + last; + } else if (index < (title.length() - 1)) { + String first = title.substring(0, index); + String last = title.substring(index + 1); + title = first + last; + } + } + } + return title; + } /** * Returns the singleton step filter manager. @@ -2615,7 +2615,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe while ((i = fis.read(buf)) != -1) { fos.write(buf, 0, i); } - } + } } /** 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 index 5362c0dd4..396160866 100644 --- 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 @@ -39,37 +39,37 @@ public class LogicalStructureManager { private List<LogicalStructureType> fTypes = null; private List<LogicalStructureProvider> fTypeProviders; - /** - * Map containing the user's selection for each combination of logical - * structure types. - * key: String - Comma-separated list of ints representing a combination of structure types. - * These integers are indeces into the fStructureTypeIds array. - * value: Integer - One of the ints from the combo key (the one chosen by the user) or -1 if - * the user has chosen not to display any structures for this combination - */ + /** + * Map containing the user's selection for each combination of logical + * structure types. + * key: String - Comma-separated list of ints representing a combination of structure types. + * These integers are indeces into the fStructureTypeIds array. + * value: Integer - One of the ints from the combo key (the one chosen by the user) or -1 if + * the user has chosen not to display any structures for this combination + */ private Map<String, Integer> fStructureTypeSelections = null; - /** - * List of known type identifiers. An identifier's index in this list is used as - * its ID number. This list is maintained as a space-saving measure so that the various - * combinations of structure types can be persisted using indeces instead of storing the - * full index strings. - */ + /** + * List of known type identifiers. An identifier's index in this list is used as + * its ID number. This list is maintained as a space-saving measure so that the various + * combinations of structure types can be persisted using indeces instead of storing the + * full index strings. + */ private List<String> fStructureTypeIds = null; - /** - * Preference key used for storing the user's selected structure for each combination - * or structures. The preference value is stored in the form: - * int,int,...,int|int,int,...int|... - * Where int is an integer index of a structure in the array of known structures. - */ - public static final String PREF_STRUCTURE_SELECTIONS= "selectedStructures"; //$NON-NLS-1$ - /** - * Preference key used for storing the array of known structures. The preference - * value is in the form: - * string,string,string,...,string, - * Where string is an identifier of a logical structure. - */ - public static final String PREF_STRUCTURE_IDS= "allStructures"; //$NON-NLS-1$ + /** + * Preference key used for storing the user's selected structure for each combination + * or structures. The preference value is stored in the form: + * int,int,...,int|int,int,...int|... + * Where int is an integer index of a structure in the array of known structures. + */ + public static final String PREF_STRUCTURE_SELECTIONS= "selectedStructures"; //$NON-NLS-1$ + /** + * Preference key used for storing the array of known structures. The preference + * value is in the form: + * string,string,string,...,string, + * Where string is an identifier of a logical structure. + */ + public static final String PREF_STRUCTURE_IDS= "allStructures"; //$NON-NLS-1$ public static LogicalStructureManager getDefault() { if (fgDefault == null) { @@ -78,11 +78,11 @@ public class LogicalStructureManager { return fgDefault; } - /** - * Returns the logical structure types that are applicable to the given value. - * @param value the value - * @return the logical structure types that are applicable to the given value - */ + /** + * Returns the logical structure types that are applicable to the given value. + * @param value the value + * @return the logical structure types that are applicable to the given value + */ public ILogicalStructureType[] getLogicalStructureTypes(IValue value) { initialize(); // looks in the logical structure types @@ -102,144 +102,144 @@ public class LogicalStructureManager { return select.toArray(new ILogicalStructureType[select.size()]); } - /** - * Loads the map of structure selections from the preference store. - */ - private void loadStructureTypeSelections() { + /** + * Loads the map of structure selections from the preference store. + */ + private void loadStructureTypeSelections() { fStructureTypeSelections = new HashMap<>(); - String selections= Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_SELECTIONS, IInternalDebugCoreConstants.EMPTY_STRING, null); - // selections are stored in the form: - // selection|selection|...selection| - StringTokenizer tokenizer= new StringTokenizer(selections, "|"); //$NON-NLS-1$ - while (tokenizer.hasMoreTokens()) { - String selection = tokenizer.nextToken(); - // selection string is of the form: - // id,id,...,selectedid - int i = selection.lastIndexOf(','); - if (i > 0 && i < selection.length() - 1) { - String comboKey= selection.substring(0, i + 1); - String selected= selection.substring(i + 1, selection.length()); - fStructureTypeSelections.put(comboKey, Integer.valueOf(Integer.parseInt(selected))); - } - } - } + String selections= Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_SELECTIONS, IInternalDebugCoreConstants.EMPTY_STRING, null); + // selections are stored in the form: + // selection|selection|...selection| + StringTokenizer tokenizer= new StringTokenizer(selections, "|"); //$NON-NLS-1$ + while (tokenizer.hasMoreTokens()) { + String selection = tokenizer.nextToken(); + // selection string is of the form: + // id,id,...,selectedid + int i = selection.lastIndexOf(','); + if (i > 0 && i < selection.length() - 1) { + String comboKey= selection.substring(0, i + 1); + String selected= selection.substring(i + 1, selection.length()); + fStructureTypeSelections.put(comboKey, Integer.valueOf(Integer.parseInt(selected))); + } + } + } - /** - * Stores the map of structure selections to the preference store - */ - private void storeStructureTypeSelections() { - StringBuilder buffer= new StringBuilder(); + /** + * Stores the map of structure selections to the preference store + */ + private void storeStructureTypeSelections() { + StringBuilder buffer= new StringBuilder(); for (Entry<String, Integer> entry : fStructureTypeSelections.entrySet()) { buffer.append(entry.getKey()); - buffer.append(entry.getValue()); - buffer.append('|'); - } - Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_SELECTIONS, buffer.toString(), null); - } + buffer.append(entry.getValue()); + buffer.append('|'); + } + Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_SELECTIONS, buffer.toString(), null); + } - /** - * Loads the collection of known structures identifiers from the preference store - */ - private void loadStructureTypeIds() { + /** + * Loads the collection of known structures identifiers from the preference store + */ + private void loadStructureTypeIds() { fStructureTypeIds = new ArrayList<>(); - // Types are stored as a comma-separated, ordered list. - String types= Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_IDS, IInternalDebugCoreConstants.EMPTY_STRING, null); - StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$ - while (tokenizer.hasMoreTokens()) { - String id= tokenizer.nextToken(); - if (id.length() > 0) { - fStructureTypeIds.add(id); - } - } - } + // Types are stored as a comma-separated, ordered list. + String types= Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_IDS, IInternalDebugCoreConstants.EMPTY_STRING, null); + StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$ + while (tokenizer.hasMoreTokens()) { + String id= tokenizer.nextToken(); + if (id.length() > 0) { + fStructureTypeIds.add(id); + } + } + } - /** - * Stores the collection of known structure identifiers to the preference store - */ - private void storeStructureTypeIds() { - StringBuilder buffer= new StringBuilder(); + /** + * Stores the collection of known structure identifiers to the preference store + */ + private void storeStructureTypeIds() { + StringBuilder buffer= new StringBuilder(); for (String id : fStructureTypeIds) { buffer.append(id).append(','); - } - Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_IDS, buffer.toString(), null); - } + } + Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_IDS, buffer.toString(), null); + } - /** - * Returns the structure that the user has chosen from among the given - * collection of structures or <code>null</code> if the user has chosen - * to display none. - * @param structureTypes the collection of structures available - * @return the structure that the user has chosen from among the given collection - * or <code>null</code> if the user has chosen to display none - */ - public ILogicalStructureType getSelectedStructureType(ILogicalStructureType[] structureTypes) { - if (structureTypes.length == 0) { - return null; - } - String combo= getComboString(structureTypes); - // Lookup the combo - Integer index = fStructureTypeSelections.get(combo); - if (index == null) { - // If the user hasn't explicitly chosen anything for this - // combo yet, just return the first type. - return structureTypes[0]; - } else if (index.intValue() == -1) { - // An index of -1 means the user has deselected all structures for this combo - return null; - } - // If an index is stored for this combo, retrieve the id at the index - String id= fStructureTypeIds.get(index.intValue()); - for (int i = 0; i < structureTypes.length; i++) { - // Return the type with the retrieved id - ILogicalStructureType type = structureTypes[i]; - if (type.getId().equals(id)) { - return type; - } - } - return structureTypes[0]; - } + /** + * Returns the structure that the user has chosen from among the given + * collection of structures or <code>null</code> if the user has chosen + * to display none. + * @param structureTypes the collection of structures available + * @return the structure that the user has chosen from among the given collection + * or <code>null</code> if the user has chosen to display none + */ + public ILogicalStructureType getSelectedStructureType(ILogicalStructureType[] structureTypes) { + if (structureTypes.length == 0) { + return null; + } + String combo= getComboString(structureTypes); + // Lookup the combo + Integer index = fStructureTypeSelections.get(combo); + if (index == null) { + // If the user hasn't explicitly chosen anything for this + // combo yet, just return the first type. + return structureTypes[0]; + } else if (index.intValue() == -1) { + // An index of -1 means the user has deselected all structures for this combo + return null; + } + // If an index is stored for this combo, retrieve the id at the index + String id= fStructureTypeIds.get(index.intValue()); + for (int i = 0; i < structureTypes.length; i++) { + // Return the type with the retrieved id + ILogicalStructureType type = structureTypes[i]; + if (type.getId().equals(id)) { + return type; + } + } + return structureTypes[0]; + } - /** - * - * @param types the array of types - * @param selected the type that is selected for the given combo or <code>null</code> - * if the user has de-selected any structure for the given combo - */ - public void setEnabledType(ILogicalStructureType[] types, ILogicalStructureType selected) { - String combo= getComboString(types); - int index= -1; // Initialize to "none selected" - if (selected != null) { - index= fStructureTypeIds.indexOf(selected.getId()); - } - Integer integer= Integer.valueOf(index); - fStructureTypeSelections.put(combo, integer); - storeStructureTypeSelections(); - storeStructureTypeIds(); - } + /** + * + * @param types the array of types + * @param selected the type that is selected for the given combo or <code>null</code> + * if the user has de-selected any structure for the given combo + */ + public void setEnabledType(ILogicalStructureType[] types, ILogicalStructureType selected) { + String combo= getComboString(types); + int index= -1; // Initialize to "none selected" + if (selected != null) { + index= fStructureTypeIds.indexOf(selected.getId()); + } + Integer integer= Integer.valueOf(index); + fStructureTypeSelections.put(combo, integer); + storeStructureTypeSelections(); + storeStructureTypeIds(); + } - /** - * Returns the string representing the given combination of logical - * structure types. This string will be a series of comma-separated - * indices representing the various types. If any of the given types - * don't have indices associated with them, this method will create - * the appropriate index. - * @param types the logical structure types - * @return the string representing the given combination of logical - * structure types - */ - protected String getComboString(ILogicalStructureType[] types) { - StringBuilder comboKey= new StringBuilder(); - for (int i = 0; i < types.length; i++) { - ILogicalStructureType type = types[i]; - int typeIndex = fStructureTypeIds.indexOf(type.getId()); - if (typeIndex == -1) { - typeIndex= fStructureTypeIds.size(); - fStructureTypeIds.add(type.getId()); - } - comboKey.append(typeIndex).append(','); - } - return comboKey.toString(); - } + /** + * Returns the string representing the given combination of logical + * structure types. This string will be a series of comma-separated + * indices representing the various types. If any of the given types + * don't have indices associated with them, this method will create + * the appropriate index. + * @param types the logical structure types + * @return the string representing the given combination of logical + * structure types + */ + protected String getComboString(ILogicalStructureType[] types) { + StringBuilder comboKey= new StringBuilder(); + for (int i = 0; i < types.length; i++) { + ILogicalStructureType type = types[i]; + int typeIndex = fStructureTypeIds.indexOf(type.getId()); + if (typeIndex == -1) { + typeIndex= fStructureTypeIds.size(); + fStructureTypeIds.add(type.getId()); + } + comboKey.append(typeIndex).append(','); + } + return comboKey.toString(); + } private synchronized void initialize() { if (fTypes == null) { @@ -269,11 +269,11 @@ public class LogicalStructureManager { } } } - if (fStructureTypeSelections == null) { - loadStructureTypeSelections(); - } - if (fStructureTypeIds == null) { - loadStructureTypeIds(); - } + if (fStructureTypeSelections == null) { + loadStructureTypeSelections(); + } + if (fStructureTypeIds == null) { + loadStructureTypeIds(); + } } } 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 index 0d801a2b0..470438bbe 100644 --- 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 @@ -131,16 +131,16 @@ public class LogicalStructureType implements ILogicalStructureType { return d2.getDescription(value); } if (!fVerifiedDescription) { - fVerifiedDescription = true; - try { - verifyAttributeExists(IConfigurationElementConstants.DESCRIPTION); - } catch (CoreException e) { - DebugPlugin.log(e); - } + fVerifiedDescription = true; + try { + verifyAttributeExists(IConfigurationElementConstants.DESCRIPTION); + } catch (CoreException e) { + DebugPlugin.log(e); + } } String description = getDescription(); if (description == null) { - return DebugCoreMessages.LogicalStructureType_0; + return DebugCoreMessages.LogicalStructureType_0; } 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 index e787aab35..65d9d71aa 100644 --- 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 @@ -87,7 +87,7 @@ public class MemoryBlockManager implements IMemoryBlockManager, IDebugEventSetLi for (int i= 0; i < copiedListeners.length; i++) { fListener = (IMemoryBlockListener)copiedListeners[i]; fMemoryBlocks = memBlocks; - SafeRunner.run(this); + SafeRunner.run(this); } } fListener = 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 index 5abe88d65..9a399e27d 100644 --- 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 @@ -21,41 +21,41 @@ 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; + private NullStreamMonitor outputStreamMonitor; + private NullStreamMonitor errorStreamMonitor; - public NullStreamsProxy(Process process) { - outputStreamMonitor = new NullStreamMonitor(process.getInputStream()); - errorStreamMonitor = new NullStreamMonitor(process.getErrorStream()); - } + public NullStreamsProxy(Process process) { + outputStreamMonitor = new NullStreamMonitor(process.getInputStream()); + errorStreamMonitor = new NullStreamMonitor(process.getErrorStream()); + } - @Override + @Override public void closeInputStream() throws IOException { - } + } - @Override + @Override public IStreamMonitor getErrorStreamMonitor() { - return errorStreamMonitor; - } + return errorStreamMonitor; + } - @Override + @Override public IStreamMonitor getOutputStreamMonitor() { - return outputStreamMonitor; - } + return outputStreamMonitor; + } - @Override + @Override public void write(String input) throws IOException { - } + } - private class NullStreamMonitor implements IStreamMonitor { - private InputStream fStream; + private class NullStreamMonitor implements IStreamMonitor { + private InputStream fStream; - public NullStreamMonitor(InputStream stream) { - fStream = stream; - startReaderThread(); - } + public NullStreamMonitor(InputStream stream) { + fStream = stream; + startReaderThread(); + } - private void startReaderThread() { + private void startReaderThread() { Thread thread = new Thread((Runnable) () -> { byte[] bytes = new byte[1024]; try { @@ -65,22 +65,22 @@ public class NullStreamsProxy implements IStreamsProxy2 { } catch (IOException e) { } }, DebugCoreMessages.NullStreamsProxy_0); - thread.setDaemon(true); - thread.start(); + thread.setDaemon(true); + thread.start(); - } + } - @Override + @Override public void addListener(IStreamListener listener) { - } + } - @Override + @Override public String getContents() { - return ""; //$NON-NLS-1$ - } + return ""; //$NON-NLS-1$ + } - @Override + @Override public void removeListener(IStreamListener listener) { - } - } + } + } } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java index f5c536ee1..c7dfd261b 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java @@ -52,7 +52,7 @@ public class PreferredDelegateModifyListener extends PreferenceModifyListener { // force VMs to be initialized before we import the new VMs node.accept(new Visitor()); } catch (BackingStoreException e) { - DebugPlugin.log(e); + DebugPlugin.log(e); } return node; } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ResourceFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ResourceFactory.java index 9830a8179..5bb348746 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ResourceFactory.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ResourceFactory.java @@ -27,36 +27,36 @@ import org.eclipse.core.runtime.Path; */ public class ResourceFactory { - // These persistence constants are stored in XML. Do not - // change them. - public static final String TAG_PATH = "path";//$NON-NLS-1$ + // These persistence constants are stored in XML. Do not + // change them. + public static final String TAG_PATH = "path";//$NON-NLS-1$ - public static final String TAG_TYPE = "type";//$NON-NLS-1$ + public static final String TAG_TYPE = "type";//$NON-NLS-1$ - /** - * Creates and returns an element based on the given memento - * - * @param memento element memento - * @return associated element - */ - public static IAdaptable createElement(XMLMemento memento) { - // Get the file name. - String fileName = memento.getString(TAG_PATH); - if (fileName == null) { + /** + * Creates and returns an element based on the given memento + * + * @param memento element memento + * @return associated element + */ + public static IAdaptable createElement(XMLMemento memento) { + // Get the file name. + String fileName = memento.getString(TAG_PATH); + if (fileName == null) { return null; } - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - String type = memento.getString(TAG_TYPE); - IResource res = null; - if (type == null) { - // Old format memento. Create an IResource using findMember. - // Will return null for resources in closed projects. - res = root.findMember(new Path(fileName)); - } else { - int resourceType = Integer.parseInt(type); + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + String type = memento.getString(TAG_TYPE); + IResource res = null; + if (type == null) { + // Old format memento. Create an IResource using findMember. + // Will return null for resources in closed projects. + res = root.findMember(new Path(fileName)); + } else { + int resourceType = Integer.parseInt(type); - if (resourceType == IResource.ROOT) { + if (resourceType == IResource.ROOT) { res = root; } else if (resourceType == IResource.PROJECT) { res = root.getProject(fileName); @@ -65,12 +65,12 @@ public class ResourceFactory { } else if (resourceType == IResource.FILE) { res = root.getFile(new Path(fileName)); } - } - return res; - } + } + return res; + } - public static void saveState(XMLMemento memento, IResource res) { - memento.putString(TAG_PATH, res.getFullPath().toString()); - memento.putString(TAG_TYPE, Integer.toString(res.getType())); - } + public static void saveState(XMLMemento memento, IResource res) { + memento.putString(TAG_PATH, res.getFullPath().toString()); + memento.putString(TAG_TYPE, Integer.toString(res.getType())); + } } 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 index c3fab169f..616e79674 100644 --- 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 @@ -86,11 +86,11 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 { * @return Returns whether the stream proxy was already closed. */ private synchronized boolean isClosed(boolean setClosed) { - boolean closed = fClosed; - if (setClosed) { - fClosed = true; - } - return closed; + boolean closed = fClosed; + if (setClosed) { + fClosed = true; + } + return closed; } /** @@ -100,9 +100,9 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 { * Data remaining in the streams is lost. */ public void kill() { - synchronized (this) { - fClosed= true; - } + synchronized (this) { + fClosed= true; + } fOutputMonitor.kill(); fErrorMonitor.kill(); fInputMonitor.close(); @@ -127,14 +127,14 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 { } } - @Override + @Override public void closeInputStream() throws IOException { - if (!isClosed(false)) { - fInputMonitor.closeInputStream(); - } else { - throw new IOException(); - } + if (!isClosed(false)) { + fInputMonitor.closeInputStream(); + } else { + throw new IOException(); + } - } + } } 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 index 3e66c8483..9a942eb6e 100644 --- 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 @@ -213,7 +213,7 @@ public class WatchExpression implements IWatchExpression { public ILaunch getLaunch() { IDebugTarget debugTarget = getDebugTarget(); if (debugTarget != null) { - return debugTarget.getLaunch(); + return debugTarget.getLaunch(); } return null; } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java index c2c59ad0e..d8b6fe817 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java @@ -39,227 +39,227 @@ import org.xml.sax.SAXException; * An XML memento. Copied from workspace plug-in. */ public final class XMLMemento { - private Document factory; - - private Element element; - - /** - * Creates a <code>Document</code> from the <code>Reader</code> - * and returns a memento on the first <code>Element</code> for reading - * the document. - * <p> - * Same as calling createReadRoot(reader, null) - * </p> - * - * @param reader the <code>Reader</code> used to create the memento's document - * @return a memento on the first <code>Element</code> for reading the document - * @throws Exception if IO problems, invalid format, or no element. - */ - public static XMLMemento createReadRoot(Reader reader) - throws Exception { - return createReadRoot(reader, null); - } - - /** - * Creates a <code>Document</code> from the <code>Reader</code> - * and returns a memento on the first <code>Element</code> for reading - * the document. - * - * @param reader the <code>Reader</code> used to create the memento's document - * @param baseDir the directory used to resolve relative file names - * in the XML document. This directory must exist and include the - * trailing separator. The directory format, including the separators, - * must be valid for the platform. Can be <code>null</code> if not - * needed. - * @return a memento on the first <code>Element</code> for reading the document - * @throws Exception if IO problems, invalid format, or no element. - */ - public static XMLMemento createReadRoot(Reader reader, String baseDir) - throws Exception { - String errorMessage = null; - Exception exception = null; - - try { - DocumentBuilderFactory factory = DocumentBuilderFactory - .newInstance(); - DocumentBuilder parser = factory.newDocumentBuilder(); - InputSource source = new InputSource(reader); - if (baseDir != null) { + private Document factory; + + private Element element; + + /** + * Creates a <code>Document</code> from the <code>Reader</code> + * and returns a memento on the first <code>Element</code> for reading + * the document. + * <p> + * Same as calling createReadRoot(reader, null) + * </p> + * + * @param reader the <code>Reader</code> used to create the memento's document + * @return a memento on the first <code>Element</code> for reading the document + * @throws Exception if IO problems, invalid format, or no element. + */ + public static XMLMemento createReadRoot(Reader reader) + throws Exception { + return createReadRoot(reader, null); + } + + /** + * Creates a <code>Document</code> from the <code>Reader</code> + * and returns a memento on the first <code>Element</code> for reading + * the document. + * + * @param reader the <code>Reader</code> used to create the memento's document + * @param baseDir the directory used to resolve relative file names + * in the XML document. This directory must exist and include the + * trailing separator. The directory format, including the separators, + * must be valid for the platform. Can be <code>null</code> if not + * needed. + * @return a memento on the first <code>Element</code> for reading the document + * @throws Exception if IO problems, invalid format, or no element. + */ + public static XMLMemento createReadRoot(Reader reader, String baseDir) + throws Exception { + String errorMessage = null; + Exception exception = null; + + try { + DocumentBuilderFactory factory = DocumentBuilderFactory + .newInstance(); + DocumentBuilder parser = factory.newDocumentBuilder(); + InputSource source = new InputSource(reader); + if (baseDir != null) { source.setSystemId(baseDir); } - Document document = parser.parse(source); - NodeList list = document.getChildNodes(); - for (int i = 0; i < list.getLength(); i++) { - Node node = list.item(i); - if (node instanceof Element) { + Document document = parser.parse(source); + NodeList list = document.getChildNodes(); + for (int i = 0; i < list.getLength(); i++) { + Node node = list.item(i); + if (node instanceof Element) { return new XMLMemento(document, (Element) node); } - } - } catch (ParserConfigurationException e) { - exception = e; - // errorMessage = WorkbenchMessages.XMLMemento_parserConfigError; - } catch (IOException e) { - exception = e; - // errorMessage = WorkbenchMessages.XMLMemento_ioError; - } catch (SAXException e) { - exception = e; - // errorMessage = WorkbenchMessages.XMLMemento_formatError; - } - - String problemText = null; - if (exception != null) { + } + } catch (ParserConfigurationException e) { + exception = e; + // errorMessage = WorkbenchMessages.XMLMemento_parserConfigError; + } catch (IOException e) { + exception = e; + // errorMessage = WorkbenchMessages.XMLMemento_ioError; + } catch (SAXException e) { + exception = e; + // errorMessage = WorkbenchMessages.XMLMemento_formatError; + } + + String problemText = null; + if (exception != null) { problemText = exception.getMessage(); } - if (problemText == null || problemText.length() == 0) { + if (problemText == null || problemText.length() == 0) { problemText = errorMessage != null ? errorMessage - :"ERROR"; //;WorkbenchMessages.XMLMemento_noElement; //$NON-NLS-1$ - } - throw new Exception(problemText, exception); - } - - /** - * Returns a root memento for writing a document. - * - * @param type the element node type to create on the document - * @return the root memento for writing a document - */ - public static XMLMemento createWriteRoot(String type) { - Document document; - try { - document = DocumentBuilderFactory.newInstance() - .newDocumentBuilder().newDocument(); - Element element = document.createElement(type); - document.appendChild(element); - return new XMLMemento(document, element); - } catch (ParserConfigurationException e) { + :"ERROR"; //;WorkbenchMessages.XMLMemento_noElement; //$NON-NLS-1$ + } + throw new Exception(problemText, exception); + } + + /** + * Returns a root memento for writing a document. + * + * @param type the element node type to create on the document + * @return the root memento for writing a document + */ + public static XMLMemento createWriteRoot(String type) { + Document document; + try { + document = DocumentBuilderFactory.newInstance() + .newDocumentBuilder().newDocument(); + Element element = document.createElement(type); + document.appendChild(element); + return new XMLMemento(document, element); + } catch (ParserConfigurationException e) { // throw new Error(e); - throw new Error(e.getMessage()); - } - } - - /** - * Creates a memento for the specified document and element. - * <p> - * Clients should use <code>createReadRoot</code> and - * <code>createWriteRoot</code> to create the initial - * memento on a document. - * </p> - * - * @param document the document for the memento - * @param element the element node for the memento - */ - public XMLMemento(Document document, Element element) { - super(); - this.factory = document; - this.element = element; - } + throw new Error(e.getMessage()); + } + } + + /** + * Creates a memento for the specified document and element. + * <p> + * Clients should use <code>createReadRoot</code> and + * <code>createWriteRoot</code> to create the initial + * memento on a document. + * </p> + * + * @param document the document for the memento + * @param element the element node for the memento + */ + public XMLMemento(Document document, Element element) { + super(); + this.factory = document; + this.element = element; + } /* * Method declared in XMLMemento. */ - public XMLMemento createChild(String type) { - Element child = factory.createElement(type); - element.appendChild(child); - return new XMLMemento(factory, child); - } + public XMLMemento createChild(String type) { + Element child = factory.createElement(type); + element.appendChild(child); + return new XMLMemento(factory, child); + } /* * Method declared in XMLMemento. */ - public XMLMemento createChild(String type, String id) { - Element child = factory.createElement(type); - child.setAttribute(IMementoConstants.TAG_ID, id == null ? "" : id); //$NON-NLS-1$ - element.appendChild(child); - return new XMLMemento(factory, child); - } + public XMLMemento createChild(String type, String id) { + Element child = factory.createElement(type); + child.setAttribute(IMementoConstants.TAG_ID, id == null ? "" : id); //$NON-NLS-1$ + element.appendChild(child); + return new XMLMemento(factory, child); + } /* * Method declared in XMLMemento. */ - public XMLMemento copyChild(XMLMemento child) { - Element childElement = child.element; - Element newElement = (Element) factory.importNode(childElement, true); - element.appendChild(newElement); - return new XMLMemento(factory, newElement); - } + public XMLMemento copyChild(XMLMemento child) { + Element childElement = child.element; + Element newElement = (Element) factory.importNode(childElement, true); + element.appendChild(newElement); + return new XMLMemento(factory, newElement); + } /* * Method declared in XMLMemento. */ - public XMLMemento getChild(String type) { + public XMLMemento getChild(String type) { - // Get the nodes. - NodeList nodes = element.getChildNodes(); - int size = nodes.getLength(); - if (size == 0) { + // Get the nodes. + NodeList nodes = element.getChildNodes(); + int size = nodes.getLength(); + if (size == 0) { return null; } - // Find the first node which is a child of this node. - for (int nX = 0; nX < size; nX++) { - Node node = nodes.item(nX); - if (node instanceof Element) { - Element element1 = (Element) node; - if (element1.getNodeName().equals(type)) { + // Find the first node which is a child of this node. + for (int nX = 0; nX < size; nX++) { + Node node = nodes.item(nX); + if (node instanceof Element) { + Element element1 = (Element) node; + if (element1.getNodeName().equals(type)) { return new XMLMemento(factory, element1); } - } - } + } + } - // A child was not found. - return null; - } + // A child was not found. + return null; + } /* * Method declared in XMLMemento. */ - public XMLMemento[] getChildren(String type) { + public XMLMemento[] getChildren(String type) { - // Get the nodes. - NodeList nodes = element.getChildNodes(); - int size = nodes.getLength(); - if (size == 0) { + // Get the nodes. + NodeList nodes = element.getChildNodes(); + int size = nodes.getLength(); + if (size == 0) { return new XMLMemento[0]; } - // Extract each node with given type. + // Extract each node with given type. ArrayList<Element> list = new ArrayList<>(size); - for (int nX = 0; nX < size; nX++) { - Node node = nodes.item(nX); - if (node instanceof Element) { - Element element1 = (Element) node; - if (element1.getNodeName().equals(type)) { + for (int nX = 0; nX < size; nX++) { + Node node = nodes.item(nX); + if (node instanceof Element) { + Element element1 = (Element) node; + if (element1.getNodeName().equals(type)) { list.add(element1); } - } - } - - // Create a memento for each node. - size = list.size(); - XMLMemento[] results = new XMLMemento[size]; - for (int x = 0; x < size; x++) { - results[x] = new XMLMemento(factory, list.get(x)); - } - return results; - } + } + } + + // Create a memento for each node. + size = list.size(); + XMLMemento[] results = new XMLMemento[size]; + for (int x = 0; x < size; x++) { + results[x] = new XMLMemento(factory, list.get(x)); + } + return results; + } /* * Method declared in XMLMemento. */ - public Float getFloat(String key) { - Attr attr = element.getAttributeNode(key); - if (attr == null) { + public Float getFloat(String key) { + Attr attr = element.getAttributeNode(key); + if (attr == null) { + return null; + } + String strValue = attr.getValue(); + try { + return Float.valueOf(strValue); + } catch (NumberFormatException e) { + DebugPlugin.logMessage("Memento problem - Invalid float for key: " //$NON-NLS-1$ + + key + " value: " + strValue, e); //$NON-NLS-1$ return null; } - String strValue = attr.getValue(); - try { - return Float.valueOf(strValue); - } catch (NumberFormatException e) { - DebugPlugin.logMessage("Memento problem - Invalid float for key: " //$NON-NLS-1$ - + key + " value: " + strValue, e); //$NON-NLS-1$ - return null; - } - } + } public String getType() { return element.getNodeName(); @@ -268,58 +268,58 @@ public final class XMLMemento { /* * Method declared in XMLMemento. */ - public String getID() { - return element.getAttribute(IMementoConstants.TAG_ID); - } + public String getID() { + return element.getAttribute(IMementoConstants.TAG_ID); + } /* * Method declared in XMLMemento. */ - public Integer getInteger(String key) { - Attr attr = element.getAttributeNode(key); - if (attr == null) { + public Integer getInteger(String key) { + Attr attr = element.getAttributeNode(key); + if (attr == null) { return null; } - String strValue = attr.getValue(); - try { - return Integer.valueOf(strValue); - } catch (NumberFormatException e) { - DebugPlugin - .logMessage("Memento problem - invalid integer for key: " + key //$NON-NLS-1$ - + " value: " + strValue, e); //$NON-NLS-1$ - return null; - } - } + String strValue = attr.getValue(); + try { + return Integer.valueOf(strValue); + } catch (NumberFormatException e) { + DebugPlugin + .logMessage("Memento problem - invalid integer for key: " + key //$NON-NLS-1$ + + " value: " + strValue, e); //$NON-NLS-1$ + return null; + } + } /* * Method declared in XMLMemento. */ - public String getString(String key) { - Attr attr = element.getAttributeNode(key); - if (attr == null) { + public String getString(String key) { + Attr attr = element.getAttributeNode(key); + if (attr == null) { return null; } - return attr.getValue(); - } + return attr.getValue(); + } public Boolean getBoolean(String key) { - Attr attr = element.getAttributeNode(key); - if (attr == null) { + Attr attr = element.getAttributeNode(key); + if (attr == null) { return null; } - return Boolean.valueOf(attr.getValue()); + return Boolean.valueOf(attr.getValue()); } /* * Method declared in XMLMemento. */ - public String getTextData() { - Text textNode = getTextNode(); - if (textNode != null) { - return textNode.getData(); - } - return null; - } + public String getTextData() { + Text textNode = getTextNode(); + if (textNode != null) { + return textNode.getData(); + } + return null; + } public String[] getAttributeKeys() { NamedNodeMap map = element.getAttributes(); @@ -332,92 +332,92 @@ public final class XMLMemento { return attributes; } - /** - * Returns the Text node of the memento. Each memento is allowed only - * one Text node. - * - * @return the Text node of the memento, or <code>null</code> if - * the memento has no Text node. - */ - private Text getTextNode() { - // Get the nodes. - NodeList nodes = element.getChildNodes(); - int size = nodes.getLength(); - if (size == 0) { + /** + * Returns the Text node of the memento. Each memento is allowed only + * one Text node. + * + * @return the Text node of the memento, or <code>null</code> if + * the memento has no Text node. + */ + private Text getTextNode() { + // Get the nodes. + NodeList nodes = element.getChildNodes(); + int size = nodes.getLength(); + if (size == 0) { return null; } - for (int nX = 0; nX < size; nX++) { - Node node = nodes.item(nX); - if (node instanceof Text) { - return (Text) node; - } - } - // a Text node was not found - return null; - } - - /** - * Places the element's attributes into the document. - * @param element1 the element - * @param copyText true if the first text node should be copied - */ - private void putElement(Element element1, boolean copyText) { - NamedNodeMap nodeMap = element1.getAttributes(); - int size = nodeMap.getLength(); - for (int i = 0; i < size; i++) { - Attr attr = (Attr) nodeMap.item(i); - putString(attr.getName(), attr.getValue()); - } - - NodeList nodes = element1.getChildNodes(); - size = nodes.getLength(); - // Copy first text node (fixes bug 113659). - // Note that text data will be added as the first child (see putTextData) - boolean needToCopyText = copyText; - for (int i = 0; i < size; i++) { - Node node = nodes.item(i); - if (node instanceof Element) { - XMLMemento child = createChild(node.getNodeName()); - child.putElement((Element) node, true); - } else if (node instanceof Text && needToCopyText) { - putTextData(((Text) node).getData()); - needToCopyText = false; - } - } - } + for (int nX = 0; nX < size; nX++) { + Node node = nodes.item(nX); + if (node instanceof Text) { + return (Text) node; + } + } + // a Text node was not found + return null; + } + + /** + * Places the element's attributes into the document. + * @param element1 the element + * @param copyText true if the first text node should be copied + */ + private void putElement(Element element1, boolean copyText) { + NamedNodeMap nodeMap = element1.getAttributes(); + int size = nodeMap.getLength(); + for (int i = 0; i < size; i++) { + Attr attr = (Attr) nodeMap.item(i); + putString(attr.getName(), attr.getValue()); + } + + NodeList nodes = element1.getChildNodes(); + size = nodes.getLength(); + // Copy first text node (fixes bug 113659). + // Note that text data will be added as the first child (see putTextData) + boolean needToCopyText = copyText; + for (int i = 0; i < size; i++) { + Node node = nodes.item(i); + if (node instanceof Element) { + XMLMemento child = createChild(node.getNodeName()); + child.putElement((Element) node, true); + } else if (node instanceof Text && needToCopyText) { + putTextData(((Text) node).getData()); + needToCopyText = false; + } + } + } /* * Method declared in XMLMemento. */ - public void putFloat(String key, float f) { - element.setAttribute(key, String.valueOf(f)); - } + public void putFloat(String key, float f) { + element.setAttribute(key, String.valueOf(f)); + } /* * Method declared in XMLMemento. */ - public void putInteger(String key, int n) { - element.setAttribute(key, String.valueOf(n)); - } + public void putInteger(String key, int n) { + element.setAttribute(key, String.valueOf(n)); + } /* * Method declared in XMLMemento. */ - public void putMemento(XMLMemento memento) { - // Do not copy the element's top level text node (this would overwrite the existing text). - // Text nodes of children are copied. - putElement(memento.element, false); - } + public void putMemento(XMLMemento memento) { + // Do not copy the element's top level text node (this would overwrite the existing text). + // Text nodes of children are copied. + putElement(memento.element, false); + } /* * Method declared in XMLMemento. */ - public void putString(String key, String value) { - if (value == null) { + public void putString(String key, String value) { + if (value == null) { return; } - element.setAttribute(key, value); - } + element.setAttribute(key, value); + } /** * @param key the attribute key @@ -431,162 +431,162 @@ public final class XMLMemento { /* * Method declared in XMLMemento. */ - public void putTextData(String data) { - Text textNode = getTextNode(); - if (textNode == null) { - textNode = factory.createTextNode(data); + public void putTextData(String data) { + Text textNode = getTextNode(); + if (textNode == null) { + textNode = factory.createTextNode(data); // Always add the text node as the first child (fixes bug 93718) element.insertBefore(textNode, element.getFirstChild()); - } else { - textNode.setData(data); - } - } - - /** - * Saves this memento's document current values to the - * specified writer. - * - * @param writer the writer used to save the memento's document - * @throws IOException if there is a problem serializing the document to the stream. - */ - public void save(Writer writer) throws IOException { + } else { + textNode.setData(data); + } + } + + /** + * Saves this memento's document current values to the + * specified writer. + * + * @param writer the writer used to save the memento's document + * @throws IOException if there is a problem serializing the document to the stream. + */ + public void save(Writer writer) throws IOException { try (DOMWriter out = new DOMWriter(writer)) { - out.print(element); + out.print(element); } } /** - * A simple XML writer. Using this instead of the javax.xml.transform classes allows - * compilation against JCL Foundation (bug 80053). - */ - private static final class DOMWriter extends PrintWriter { + * A simple XML writer. Using this instead of the javax.xml.transform classes allows + * compilation against JCL Foundation (bug 80053). + */ + private static final class DOMWriter extends PrintWriter { // private int tab; - /* constants */ - private static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$ + /* constants */ + private static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$ - /** - * Creates a new DOM writer on the given output writer. - * - * @param output the output writer - */ - public DOMWriter(Writer output) { - super(output); + /** + * Creates a new DOM writer on the given output writer. + * + * @param output the output writer + */ + public DOMWriter(Writer output) { + super(output); // tab = 0; - println(XML_VERSION); - } - - /** - * Prints the given element. - * - * @param element the element to print - */ - public void print(Element element) { - // Ensure extra whitespace is not emitted next to a Text node, - // as that will result in a situation where the restored text data is not the - // same as the saved text data. - boolean hasChildren = element.hasChildNodes(); - startTag(element, hasChildren); - if (hasChildren) { + println(XML_VERSION); + } + + /** + * Prints the given element. + * + * @param element the element to print + */ + public void print(Element element) { + // Ensure extra whitespace is not emitted next to a Text node, + // as that will result in a situation where the restored text data is not the + // same as the saved text data. + boolean hasChildren = element.hasChildNodes(); + startTag(element, hasChildren); + if (hasChildren) { // tab++; - boolean prevWasText = false; - NodeList children = element.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - if (node instanceof Element) { - if (!prevWasText) { - println(); - printTabulation(); - } - print((Element) children.item(i)); - prevWasText = false; - } - else if (node instanceof Text) { - print(getEscaped(node.getNodeValue())); - prevWasText = true; - } - } + boolean prevWasText = false; + NodeList children = element.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + if (node instanceof Element) { + if (!prevWasText) { + println(); + printTabulation(); + } + print((Element) children.item(i)); + prevWasText = false; + } + else if (node instanceof Text) { + print(getEscaped(node.getNodeValue())); + prevWasText = true; + } + } // tab--; - if (!prevWasText) { - println(); - printTabulation(); - } - endTag(element); - } - } - - private void printTabulation() { - // Indenting is disabled, as it can affect the result of getTextData(). - // In 3.0, elements were separated by a newline but not indented. - // This causes getTextData() to return "\n" even if no text data had explicitly been set. - // The code here emulates that behaviour. + if (!prevWasText) { + println(); + printTabulation(); + } + endTag(element); + } + } + + private void printTabulation() { + // Indenting is disabled, as it can affect the result of getTextData(). + // In 3.0, elements were separated by a newline but not indented. + // This causes getTextData() to return "\n" even if no text data had explicitly been set. + // The code here emulates that behaviour. // for (int i = 0; i < tab; i++) // super.print("\t"); //$NON-NLS-1$ - } - - private void startTag(Element element, boolean hasChildren) { - StringBuilder sb = new StringBuilder(); - sb.append("<"); //$NON-NLS-1$ - sb.append(element.getTagName()); - NamedNodeMap attributes = element.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - Attr attribute = (Attr)attributes.item(i); + } + + private void startTag(Element element, boolean hasChildren) { + StringBuilder sb = new StringBuilder(); + sb.append("<"); //$NON-NLS-1$ + sb.append(element.getTagName()); + NamedNodeMap attributes = element.getAttributes(); + for (int i = 0; i < attributes.getLength(); i++) { + Attr attribute = (Attr)attributes.item(i); sb.append(" "); //$NON-NLS-1$ sb.append(attribute.getName()); sb.append("=\""); //$NON-NLS-1$ sb.append(getEscaped(String.valueOf(attribute.getValue()))); sb.append("\""); //$NON-NLS-1$ - } - sb.append(hasChildren ? ">" : "/>"); //$NON-NLS-1$ //$NON-NLS-2$ - print(sb.toString()); - } - - private void endTag(Element element) { - StringBuilder sb = new StringBuilder(); - sb.append("</"); //$NON-NLS-1$ - sb.append(element.getNodeName()); - sb.append(">"); //$NON-NLS-1$ - print(sb.toString()); - } - - private static void appendEscapedChar(StringBuilder buffer, char c) { - String replacement = getReplacement(c); - if (replacement != null) { - buffer.append('&'); - buffer.append(replacement); - buffer.append(';'); - } else if (c==9 || c==10 || c==13 || c>=32){ - buffer.append(c); - } - } - - private static String getEscaped(String s) { - StringBuilder result = new StringBuilder(s.length() + 10); - for (int i = 0; i < s.length(); ++i) { + } + sb.append(hasChildren ? ">" : "/>"); //$NON-NLS-1$ //$NON-NLS-2$ + print(sb.toString()); + } + + private void endTag(Element element) { + StringBuilder sb = new StringBuilder(); + sb.append("</"); //$NON-NLS-1$ + sb.append(element.getNodeName()); + sb.append(">"); //$NON-NLS-1$ + print(sb.toString()); + } + + private static void appendEscapedChar(StringBuilder buffer, char c) { + String replacement = getReplacement(c); + if (replacement != null) { + buffer.append('&'); + buffer.append(replacement); + buffer.append(';'); + } else if (c==9 || c==10 || c==13 || c>=32){ + buffer.append(c); + } + } + + private static String getEscaped(String s) { + StringBuilder result = new StringBuilder(s.length() + 10); + for (int i = 0; i < s.length(); ++i) { appendEscapedChar(result, s.charAt(i)); } - return result.toString(); - } + return result.toString(); + } - private static String getReplacement(char c) { - // Encode special XML characters into the equivalent character references. + private static String getReplacement(char c) { + // Encode special XML characters into the equivalent character references. // The first five are defined by default for all XML documents. // The next three (#xD, #xA, #x9) are encoded to avoid them // being converted to spaces on deserialization // (fixes bug 93720) - switch (c) { - case '<' : - return "lt"; //$NON-NLS-1$ - case '>' : - return "gt"; //$NON-NLS-1$ - case '"' : - return "quot"; //$NON-NLS-1$ - case '\'' : - return "apos"; //$NON-NLS-1$ - case '&' : - return "amp"; //$NON-NLS-1$ + switch (c) { + case '<' : + return "lt"; //$NON-NLS-1$ + case '>' : + return "gt"; //$NON-NLS-1$ + case '"' : + return "quot"; //$NON-NLS-1$ + case '\'' : + return "apos"; //$NON-NLS-1$ + case '&' : + return "amp"; //$NON-NLS-1$ case '\r': return "#x0D"; //$NON-NLS-1$ case '\n': @@ -595,8 +595,8 @@ public final class XMLMemento { return "#x09"; //$NON-NLS-1$ default: break; - } - return null; - } - } + } + return null; + } + } } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java index 1db82aa0a..7ac3e1cea 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java @@ -48,10 +48,10 @@ public class StepFiltersCommand extends ForEachCommand implements IStepFiltersHa } return filters; } - return null; + return null; } - private IDebugTarget[] getDebugTargets(Object element) { + private IDebugTarget[] getDebugTargets(Object element) { if (element instanceof IDebugElement) { IDebugElement debugElement = (IDebugElement) element; return new IDebugTarget[] { debugElement.getDebugTarget() }; diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/ProcessObserver.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/ProcessObserver.java index e1d29bbb3..c20aad296 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/ProcessObserver.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/ProcessObserver.java @@ -25,33 +25,33 @@ import org.eclipse.debug.core.model.IProcess; * a {@linkplain CountDownLatch synchronization object} when the process terminates. */ public final class ProcessObserver implements Callable<Integer> { - private final IProcess p; - private final IProgressMonitor pMonitor; - private final CountDownLatch countDownLatch; + private final IProcess p; + private final IProgressMonitor pMonitor; + private final CountDownLatch countDownLatch; - public ProcessObserver(IProgressMonitor monitor, IProcess p, CountDownLatch countDownLatch) { - this.p = p; - this.pMonitor = monitor; - this.countDownLatch = countDownLatch; - } + public ProcessObserver(IProgressMonitor monitor, IProcess p, CountDownLatch countDownLatch) { + this.p = p; + this.pMonitor = monitor; + this.countDownLatch = countDownLatch; + } - @Override - public Integer call() throws Exception { - try { - while (!p.isTerminated() && !pMonitor.isCanceled()) { - TimeUnit.MILLISECONDS.sleep(250); + @Override + public Integer call() throws Exception { + try { + while (!p.isTerminated() && !pMonitor.isCanceled()) { + TimeUnit.MILLISECONDS.sleep(250); - if (countDownLatch.getCount() == 0) { - break; - } - } - // check if terminated or timeout - if (p.isTerminated()) { - return p.getExitValue(); - } - return 0; - } finally { - countDownLatch.countDown(); - } - } + if (countDownLatch.getCount() == 0) { + break; + } + } + // check if terminated or timeout + if (p.isTerminated()) { + return p.getExitValue(); + } + return 0; + } finally { + countDownLatch.countDown(); + } + } } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/StreamObserver.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/StreamObserver.java index 9e1a227f0..f7c08c78c 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/StreamObserver.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/StreamObserver.java @@ -29,48 +29,48 @@ import org.eclipse.debug.core.model.IStreamsProxy; * output. */ public class StreamObserver implements Runnable { - private final String stringPattern; - private final IProcess process; - private final CountDownLatch countDownLatch; - private final IProgressMonitor pMonitor; + private final String stringPattern; + private final IProcess process; + private final CountDownLatch countDownLatch; + private final IProgressMonitor pMonitor; - public StreamObserver(IProgressMonitor monitor, IProcess process, String pattern, - CountDownLatch countDownLatch) { - this.process = process; - this.pMonitor = monitor; - this.stringPattern = pattern; - this.countDownLatch = countDownLatch; - } + public StreamObserver(IProgressMonitor monitor, IProcess process, String pattern, + CountDownLatch countDownLatch) { + this.process = process; + this.pMonitor = monitor; + this.stringPattern = pattern; + this.countDownLatch = countDownLatch; + } - @Override - public void run() { - // append wild card if not provided - StringBuilder patternBuilder = new StringBuilder(); - if (!stringPattern.startsWith(".*")) { //$NON-NLS-1$ - patternBuilder.append(".*"); //$NON-NLS-1$ - } - patternBuilder.append(stringPattern); - if (!stringPattern.endsWith(".*")) { //$NON-NLS-1$ - patternBuilder.append(".*"); //$NON-NLS-1$ - } - // create pattern and start listening to the output - final Pattern pattern = Pattern.compile(patternBuilder.toString(), Pattern.MULTILINE); - final IStreamMonitor outputStreamMonitor = process.getStreamsProxy() - .getOutputStreamMonitor(); - outputStreamMonitor.addListener(new IStreamListener() { - @Override - public void streamAppended(String text, IStreamMonitor monitor) { - if (countDownLatch.getCount() == 0) { - outputStreamMonitor.removeListener(this); - return; - } + @Override + public void run() { + // append wild card if not provided + StringBuilder patternBuilder = new StringBuilder(); + if (!stringPattern.startsWith(".*")) { //$NON-NLS-1$ + patternBuilder.append(".*"); //$NON-NLS-1$ + } + patternBuilder.append(stringPattern); + if (!stringPattern.endsWith(".*")) { //$NON-NLS-1$ + patternBuilder.append(".*"); //$NON-NLS-1$ + } + // create pattern and start listening to the output + final Pattern pattern = Pattern.compile(patternBuilder.toString(), Pattern.MULTILINE); + final IStreamMonitor outputStreamMonitor = process.getStreamsProxy() + .getOutputStreamMonitor(); + outputStreamMonitor.addListener(new IStreamListener() { + @Override + public void streamAppended(String text, IStreamMonitor monitor) { + if (countDownLatch.getCount() == 0) { + outputStreamMonitor.removeListener(this); + return; + } - Matcher matcher = pattern.matcher(text); - if (!matcher.find() && !pMonitor.isCanceled()) { - return; - } - countDownLatch.countDown(); - } - }); - } + Matcher matcher = pattern.matcher(text); + if (!matcher.find() && !pMonitor.isCanceled()) { + return; + } + countDownLatch.countDown(); + } + }); + } } |