org.eclipse.debug.core_3.7.100.v20120521-2012

16:42:48.333 INFO  jd.cli.Main - Decompiling org.eclipse.debug.core_3.7.100.v20120521-2012.jar
package org.eclipse.debug.core;

import java.util.EventObject;
import org.eclipse.debug.internal.core.DebugCoreMessages;

public final class DebugEvent
  extends EventObject
{
  private static final long serialVersionUID = 1L;
  public static final int RESUME = 1;
  public static final int SUSPEND = 2;
  public static final int CREATE = 4;
  public static final int TERMINATE = 8;
  public static final int CHANGE = 16;
  public static final int MODEL_SPECIFIC = 32;
  public static final int STEP_INTO = 1;
  public static final int STEP_OVER = 2;
  public static final int STEP_RETURN = 4;
  public static final int STEP_END = 8;
  public static final int BREAKPOINT = 16;
  public static final int CLIENT_REQUEST = 32;
  public static final int EVALUATION = 64;
  public static final int EVALUATION_IMPLICIT = 128;
  public static final int STATE = 256;
  public static final int CONTENT = 512;
  public static final int UNSPECIFIED = 0;
  private int fKind = 0;
  private int fDetail = 0;
  private Object fData = null;
  
  public DebugEvent(Object eventSource, int kind)
  {
    this(eventSource, kind, 0);
  }
  
  public DebugEvent(Object eventSource, int kind, int detail)
  {
    super(eventSource);
    if ((kind & 0x3F) == 0) {
      throw new IllegalArgumentException(DebugCoreMessages.DebugEvent_illegal_kind);
    }
    if ((kind != 32) && (detail != 0) && ((detail & 0x3FF) == 0)) {
      throw new IllegalArgumentException(DebugCoreMessages.DebugEvent_illegal_detail);
    }
    fKind = kind;
    fDetail = detail;
  }
  
  public int getDetail()
  {
    return fDetail;
  }
  
  public int getKind()
  {
    return fKind;
  }
  
  public boolean isStepStart()
  {
    return (getDetail() & 0x7) > 0;
  }
  
  public boolean isEvaluation()
  {
    return (getDetail() & 0xC0) > 0;
  }
  
  public void setData(Object data)
  {
    fData = data;
  }
  
  public Object getData()
  {
    return fData;
  }
  
  public String toString()
  {
    StringBuffer buf = new StringBuffer("DebugEvent[");
    if (getSource() != null) {
      buf.append(getSource().toString());
    } else {
      buf.append("null");
    }
    buf.append(", ");
    switch (getKind())
    {
    case 4: 
      buf.append("CREATE");
      break;
    case 8: 
      buf.append("TERMINATE");
      break;
    case 1: 
      buf.append("RESUME");
      break;
    case 2: 
      buf.append("SUSPEND");
      break;
    case 16: 
      buf.append("CHANGE");
      break;
    case 0: 
      buf.append("UNSPECIFIED");
      break;
    case 32: 
      buf.append("MODEL_SPECIFIC");
    }
    buf.append(", ");
    switch (getDetail())
    {
    case 16: 
      buf.append("BREAKPOINT");
      break;
    case 32: 
      buf.append("CLIENT_REQUEST");
      break;
    case 8: 
      buf.append("STEP_END");
      break;
    case 1: 
      buf.append("STEP_INTO");
      break;
    case 2: 
      buf.append("STEP_OVER");
      break;
    case 4: 
      buf.append("STEP_RETURN");
      break;
    case 64: 
      buf.append("EVALUATION");
      break;
    case 128: 
      buf.append("EVALUATION_IMPLICIT");
      break;
    case 256: 
      buf.append("STATE");
      break;
    case 512: 
      buf.append("CONTENT");
      break;
    case 0: 
      buf.append("UNSPECIFIED");
      break;
    default: 
      buf.append(getDetail());
    }
    buf.append("]");
    return buf.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.debug.core.DebugEvent
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.debug.core;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;

public class DebugException
  extends CoreException
{
  private static final long serialVersionUID = 1L;
  public static final int TARGET_REQUEST_FAILED = 5010;
  public static final int NOT_SUPPORTED = 5011;
  public static final int REQUEST_FAILED = 5012;
  public static final int INTERNAL_ERROR = 5013;
  public static final int CONFIGURATION_INVALID = 5014;
  public static final int MISSING_LAUNCH_CONFIGURATION_TYPE = 5020;
  
  public DebugException(IStatus status)
  {
    super(status);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.debug.core.DebugException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.debug.core;

import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.internal.core.ExpressionManager;
import org.eclipse.debug.internal.core.Preferences;

class DebugPlugin$1
  implements ISaveParticipant
{
  final DebugPlugin this$0;
  
  DebugPlugin$1(DebugPlugin paramDebugPlugin)
  {
    this$0 = paramDebugPlugin;
  }
  
  public void saving(ISaveContext saveContext)
    throws CoreException
  {
    if (DebugPlugin.access$5(this$0) != null) {
      DebugPlugin.access$5(this$0).storeWatchExpressions();
    }
    Preferences.savePreferences(DebugPlugin.getUniqueIdentifier());
  }
  
  public void rollback(ISaveContext saveContext) {}
  
  public void prepareToSave(ISaveContext saveContext)
    throws CoreException
  {}
  
  public void doneSaving(ISaveContext saveContext) {}
}

/* Location:
 * Qualified Name:     org.eclipse.debug.core.DebugPlugin.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.debug.core;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.Platform;

class DebugPlugin$ArgumentParser
{
  private String fArgs;
  private int fIndex = 0;
  private int ch = -1;
  
  public DebugPlugin$ArgumentParser(String args)
  {
    fArgs = args;
  }
  
  public String[] parseArguments()
  {
    List v = new ArrayList();
    
    ch = getNext();
    while (ch > 0) {
      if (Character.isWhitespace((char)ch))
      {
        ch = getNext();
      }
      else if (ch == 34)
      {
        StringBuffer buf = new StringBuffer();
        buf.append(parseString());
        if ((buf.length() == 0) && (Platform.getOS().equals("win32"))) {
          buf.append("\"\"");
        }
        v.add(buf.toString());
      }
      else
      {
        v.add(parseToken());
      }
    }
    String[] result = new String[v.size()];
    v.toArray(result);
    return result;
  }
  
  private int getNext()
  {
    if (fIndex < fArgs.length()) {
      return fArgs.charAt(fIndex++);
    }
    return -1;
  }
  
  private String parseString()
  {
    ch = getNext();
    if (ch == 34)
    {
      ch = getNext();
      return "";
    }
    StringBuffer buf = new StringBuffer();
    while ((ch > 0) && (ch != 34))
    {
      if (ch == 92)
      {
        ch = getNext();
        if (ch != 34) {
          buf.append('\\');
        } else if (Platform.getOS().equals("win32")) {
          buf.append('\\');
        }
      }
      if (ch > 0)
      {
        buf.append((char)ch);
        ch = getNext();
      }
    }
    ch = getNext();
    return buf.toString();
  }
  
  private String parseToken()
  {
    StringBuffer buf = new StringBuffer();
    while ((ch > 0) && (!Character.isWhitespace((char)ch))) {
      if (ch == 92)
      {
        ch = getNext();
        if (Character.isWhitespace((char)ch))
        {
          buf.append('\\');
          return buf.toString();
        }
        if (ch > 0)
        {
          if (ch != 34) {
            buf.append('\\');
          } else if (Platform.getOS().equals("win32")) {
            buf.append('\\');
          }
          buf.append((char)ch);
          ch = getNext();
        }
        else if (ch == -1)
        {
          buf.append('\\');
        }
      }
      else if (ch == 34)
      {
        buf.append(parseString());
      }
      else
      {
        buf.append((char)ch);
        ch = getNext();
      }
    }
    return buf.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.debug.core.DebugPlugin.ArgumentParser
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.debug.core;

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.internal.core.DebugCoreMessages;

class DebugPlugin$AsynchRunner
  implements ISafeRunnable
{
  private Runnable fRunnable;
  final DebugPlugin this$0;
  
  DebugPlugin$AsynchRunner(DebugPlugin paramDebugPlugin)
  {
    this$0 = paramDebugPlugin;
    
    fRunnable = null;
  }
  
  void async(Runnable runnable)
  {
    fRunnable = runnable;
    SafeRunner.run(this);
    fRunnable = null;
  }
  
  public void handleException(Throwable exception)
  {
    IStatus status = new Status(4, DebugPlugin.getUniqueIdentifier(), 125, DebugCoreMessages.DebugPlugin_6, exception);
    DebugPlugin.log(status);
  }
  
  public void run()
    throws Exception
  {
    fRunnable.run();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.debug.core.DebugPlugin.AsynchRunner
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.debug.core;

import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.internal.core.DebugCoreMessages;

class DebugPlugin$EventDispatchJob
  extends Job
{
  DebugPlugin.EventNotifier fNotifier;
  DebugPlugin.AsynchRunner fRunner;
  final DebugPlugin this$0;
  
  public DebugPlugin$EventDispatchJob(DebugPlugin paramDebugPlugin)
  {
    super(DebugCoreMessages.DebugPlugin_1);this$0 = paramDebugPlugin;fNotifier = new DebugPlugin.EventNotifier(paramDebugPlugin);fRunner = new DebugPlugin.AsynchRunner(paramDebugPlugin);
    setPriority(10);
    setSystem(true);
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    while (!DebugPlugin.access$0(this$0).isEmpty())
    {
      Object next = null;
      synchronized (DebugPlugin.access$0(this$0))
      {
        if (!DebugPlugin.access$0(this$0).isEmpty()) {
          next = DebugPlugin.access$0(this$0).remove(0);
        }
      }
      if ((next instanceof Runnable)) {
        fRunner.async((Runnable)next);
      } else if (next != null) {
        fNotifier.dispatch((DebugEvent[])next);
      }
    }
    return Status.OK_STATUS;
  }
  
  public boolean shouldRun()
  {
    return shouldSchedule();
  }
  
  public boolean shouldSchedule()
  {
    return (!DebugPlugin.access$1(this$0)) && (!DebugPlugin.access$2(this$0).isEmpty());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.debug.core.DebugPlugin.EventDispatchJob
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.debug.core;

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.internal.core.DebugCoreMessages;
import org.eclipse.debug.internal.core.DebugOptions;

class DebugPlugin$EventNotifier
  implements ISafeRunnable
{
  private DebugEvent[] fEvents;
  private IDebugEventSetListener fListener;
  private IDebugEventFilter fFilter;
  private int fMode;
  final DebugPlugin this$0;
  
  DebugPlugin$EventNotifier(DebugPlugin paramDebugPlugin)
  {
    this$0 = paramDebugPlugin;
  }
  
  public void handleException(Throwable exception)
  {
    switch (fMode)
    {
    case 0: 
      IStatus status = new Status(4, DebugPlugin.getUniqueIdentifier(), 125, DebugCoreMessages.DebugPlugin_7, exception);
      DebugPlugin.log(status);
      break;
    case 1: 
      IStatus status = new Status(4, DebugPlugin.getUniqueIdentifier(), 125, DebugCoreMessages.DebugPlugin_8, exception);
      DebugPlugin.log(status);
    }
  }
  
  public void run()
    throws Exception
  {
    switch (fMode)
    {
    case 0: 
      fEvents = fFilter.filterDebugEvents(fEvents);
      break;
    case 1: 
      fListener.handleDebugEvents(fEvents);
    }
  }
  
  void dispatch(DebugEvent[] events)
  {
    fEvents = events;
    Object[] filters = DebugPlugin.access$3(this$0).getListeners();
    if (filters.length > 0)
    {
      fMode = 0;
      for (int i = 0; i < filters.length; i++)
      {
        fFilter = ((IDebugEventFilter)filters[i]);
        SafeRunner.run(this);
        if ((fEvents == null) || (fEvents.length == 0)) {
          return;
        }
      }
    }
    fMode = 1;
    Object[] listeners = DebugPlugin.access$4(this$0);
    if (DebugOptions.DEBUG_EVENTS) {
      for (int i = 0; i < fEvents.length; i++) {
        DebugOptions.trace(fEvents[i].toString());
      }
    }
    for (int i = 0; i < listeners.length; i++)
    {
      fListener = ((IDebugEventSetListener)listeners[i]);
      SafeRunner.run(this);
    }
    fEvents = null;
    fFilter = null;
    fListener = null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.debug.core.DebugPlugin.EventNotifier
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.debug.core;

class DebugPlugin$StatusHandlerKey
{
  String fPluginId;
  int fCode;
  final DebugPlugin this$0;
  
  DebugPlugin$StatusHandlerKey(DebugPlugin paramDebugPlugin, String pluginId, int code)
  {
    this$0 = paramDebugPlugin;
    fPluginId = pluginId;
    fCode = code;
  }
  
  public int hashCode()
  {
    return fPluginId.hashCode() + fCode;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof StatusHandlerKey))
    {
      StatusHandlerKey s = (StatusHandlerKey)obj;
      return (fCode == fCode) && (fPluginId.equals(fPluginId));
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.debug.core.DebugPlugin.StatusHandlerKey
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.debug.core;

import com.ibm.icu.text.MessageFormat;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDisconnect;
import org.eclipse.debug.core.model.IDropToFrame;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStep;
import org.eclipse.debug.core.model.IStepFilters;
import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.debug.core.model.ITerminate;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.RuntimeProcess;
import org.eclipse.debug.internal.core.BreakpointManager;
import org.eclipse.debug.internal.core.DebugCoreMessages;
import org.eclipse.debug.internal.core.DebugOptions;
import org.eclipse.debug.internal.core.ExpressionManager;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.core.LaunchManager;
import org.eclipse.debug.internal.core.LogicalStructureManager;
import org.eclipse.debug.internal.core.MemoryBlockManager;
import org.eclipse.debug.internal.core.Preferences;
import org.eclipse.debug.internal.core.StepFilterManager;
import org.eclipse.debug.internal.core.commands.CommandAdapterFactory;
import org.osgi.framework.BundleContext;
import org.w3c.dom.Document;

public class DebugPlugin
  extends Plugin
{
  private static final String PI_DEBUG_CORE = "org.eclipse.debug.core";
  public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES = "launchConfigurationTypes";
  public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS = "launchConfigurationComparators";
  public static final String EXTENSION_POINT_BREAKPOINTS = "breakpoints";
  public static final String EXTENSION_POINT_STATUS_HANDLERS = "statusHandlers";
  public static final String EXTENSION_POINT_SOURCE_LOCATORS = "sourceLocators";
  public static final String EXTENSION_POINT_LAUNCH_MODES = "launchModes";
  public static final String EXTENSION_POINT_LAUNCH_DELEGATES = "launchDelegates";
  public static final String EXTENSION_POINT_PROCESS_FACTORIES = "processFactories";
  public static final String EXTENSION_POINT_LOGICAL_STRUCTURE_TYPES = "logicalStructureTypes";
  public static final String EXTENSION_POINT_LOGICAL_STRUCTURE_PROVIDERS = "logicalStructureProviders";
  public static final String EXTENSION_POINT_SOURCE_CONTAINER_TYPES = "sourceContainerTypes";
  public static final String EXTENSION_POINT_SOURCE_PATH_COMPUTERS = "sourcePathComputers";
  public static final String EXTENSION_POINT_LAUNCH_OPTIONS = "launchOptions";
  public static final String EXTENSION_POINT_BREAKPOINT_IMPORT_PARTICIPANTS = "breakpointImportParticipants";
  public static final int ERROR = 125;
  public static final int INTERNAL_ERROR = 120;
  public static final int ERR_WORKING_DIRECTORY_NOT_SUPPORTED = 115;
  public static final String ATTR_PROCESS_FACTORY_ID = "process_factory_id";
  public static final String ATTR_CAPTURE_OUTPUT = "org.eclipse.debug.core.capture_output";
  public static final String ATTR_LAUNCH_TIMESTAMP = "org.eclipse.debug.core.launch.timestamp";
  public static final String ATTR_CONSOLE_ENCODING = "org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING";
  public static final String PREF_DELETE_CONFIGS_ON_PROJECT_DELETE = getUniqueIdentifier() + ".PREF_DELETE_CONFIGS_ON_PROJECT_DELETE";
  public static final String ATTR_BREAKPOINT_IS_DELETED = getUniqueIdentifier() + ".breakpointIsDeleted";
  private static DebugPlugin fgDebugPlugin = null;
  private BreakpointManager fBreakpointManager;
  private ExpressionManager fExpressionManager;
  private LaunchManager fLaunchManager;
  private MemoryBlockManager fMemoryBlockManager;
  private ListenerList fEventListeners = new ListenerList();
  private ListenerList fEventFilters = new ListenerList();
  private boolean fShuttingDown = false;
  private HashMap fStatusHandlers = null;
  private HashMap fProcessFactories = null;
  private static final int NOTIFY_FILTERS = 0;
  private static final int NOTIFY_EVENTS = 1;
  private List fEventQueue = new ArrayList();
  private EventDispatchJob fEventDispatchJob = new EventDispatchJob();
  
  class EventDispatchJob
    extends Job
  {
    DebugPlugin.EventNotifier fNotifier = new DebugPlugin.EventNotifier(DebugPlugin.this);
    DebugPlugin.AsynchRunner fRunner = new DebugPlugin.AsynchRunner(DebugPlugin.this);
    
    public EventDispatchJob()
    {
      super();
      setPriority(10);
      setSystem(true);
    }
    
    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;
    }
    
    public boolean shouldRun()
    {
      return shouldSchedule();
    }
    
    public boolean shouldSchedule()
    {
      return (!DebugPlugin.this.isShuttingDown()) && (!fEventListeners.isEmpty());
    }
  }
  
  public static DebugPlugin getDefault()
  {
    return fgDebugPlugin;
  }
  
  private static void setDefault(DebugPlugin plugin)
  {
    fgDebugPlugin = plugin;
  }
  
  public static String getUniqueIdentifier()
  {
    return "org.eclipse.debug.core";
  }
  
  public DebugPlugin()
  {
    setDefault(this);
  }
  
  public void addDebugEventListener(IDebugEventSetListener listener)
  {
    fEventListeners.add(listener);
  }
  
  public void fireDebugEventSet(DebugEvent[] events)
  {
    if ((isShuttingDown()) || (events == null) || (fEventListeners.isEmpty())) {
      return;
    }
    synchronized (fEventQueue)
    {
      fEventQueue.add(events);
    }
    fEventDispatchJob.schedule();
  }
  
  public void asyncExec(Runnable r)
  {
    synchronized (fEventQueue)
    {
      fEventQueue.add(r);
    }
    fEventDispatchJob.schedule();
  }
  
  public synchronized IBreakpointManager getBreakpointManager()
  {
    if (fBreakpointManager == null) {
      fBreakpointManager = new BreakpointManager();
    }
    return fBreakpointManager;
  }
  
  public synchronized ILaunchManager getLaunchManager()
  {
    if (fLaunchManager == null) {
      fLaunchManager = new LaunchManager();
    }
    return fLaunchManager;
  }
  
  public synchronized IMemoryBlockManager getMemoryBlockManager()
  {
    if (fMemoryBlockManager == null) {
      fMemoryBlockManager = new MemoryBlockManager();
    }
    return fMemoryBlockManager;
  }
  
  public IStatusHandler getStatusHandler(IStatus status)
  {
    boolean enabled = Platform.getPreferencesService().getBoolean(getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, true, null);
    if (!enabled) {
      return null;
    }
    StatusHandlerKey key = new StatusHandlerKey(status.getPlugin(), status.getCode());
    if (fStatusHandlers == null) {
      initializeStatusHandlers();
    }
    IConfigurationElement config = (IConfigurationElement)fStatusHandlers.get(key);
    if (config != null) {
      try
      {
        Object handler = config.createExecutableExtension("class");
        if ((handler instanceof IStatusHandler)) {
          return (IStatusHandler)handler;
        }
        invalidStatusHandler(null, MessageFormat.format("Registered status handler {0} does not implement required interface IStatusHandler.", new String[] { config.getDeclaringExtension().getUniqueIdentifier() }));
      }
      catch (CoreException e)
      {
        log(e);
      }
    }
    return null;
  }
  
  public synchronized IExpressionManager getExpressionManager()
  {
    if (fExpressionManager == null) {
      fExpressionManager = new ExpressionManager();
    }
    return fExpressionManager;
  }
  
  public void removeDebugEventListener(IDebugEventSetListener listener)
  {
    fEventListeners.remove(listener);
  }
  
  /* Error */
  public void stop(BundleContext context)
    throws Exception
  {
    // Byte code:
    //   0: aload_0
    //   1: iconst_1
    //   2: invokespecial 761	org/eclipse/debug/core/DebugPlugin:setShuttingDown	(Z)V
    //   5: aload_0
    //   6: getfield 707	org/eclipse/debug/core/DebugPlugin:fLaunchManager	Lorg/eclipse/debug/internal/core/LaunchManager;
    //   9: ifnull +10 -> 19
    //   12: aload_0
    //   13: getfield 707	org/eclipse/debug/core/DebugPlugin:fLaunchManager	Lorg/eclipse/debug/internal/core/LaunchManager;
    //   16: invokevirtual 789	org/eclipse/debug/internal/core/LaunchManager:shutdown	()V
    //   19: aload_0
    //   20: getfield 705	org/eclipse/debug/core/DebugPlugin:fBreakpointManager	Lorg/eclipse/debug/internal/core/BreakpointManager;
    //   23: ifnull +10 -> 33
    //   26: aload_0
    //   27: getfield 705	org/eclipse/debug/core/DebugPlugin:fBreakpointManager	Lorg/eclipse/debug/internal/core/BreakpointManager;
    //   30: invokevirtual 785	org/eclipse/debug/internal/core/BreakpointManager:shutdown	()V
    //   33: aload_0
    //   34: getfield 708	org/eclipse/debug/core/DebugPlugin:fMemoryBlockManager	Lorg/eclipse/debug/internal/core/MemoryBlockManager;
    //   37: ifnull +10 -> 47
    //   40: aload_0
    //   41: getfield 708	org/eclipse/debug/core/DebugPlugin:fMemoryBlockManager	Lorg/eclipse/debug/internal/core/MemoryBlockManager;
    //   44: invokevirtual 798	org/eclipse/debug/internal/core/MemoryBlockManager:shutdown	()V
    //   47: aload_0
    //   48: getfield 702	org/eclipse/debug/core/DebugPlugin:fEventListeners	Lorg/eclipse/core/runtime/ListenerList;
    //   51: invokevirtual 745	org/eclipse/core/runtime/ListenerList:clear	()V
    //   54: aload_0
    //   55: getfield 701	org/eclipse/debug/core/DebugPlugin:fEventFilters	Lorg/eclipse/core/runtime/ListenerList;
    //   58: invokevirtual 745	org/eclipse/core/runtime/ListenerList:clear	()V
    //   61: invokestatic 803	org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils:shutdown	()V
    //   64: invokestatic 763	org/eclipse/debug/core/DebugPlugin:getUniqueIdentifier	()Ljava/lang/String;
    //   67: invokestatic 799	org/eclipse/debug/internal/core/Preferences:savePreferences	(Ljava/lang/String;)V
    //   70: invokestatic 742	org/eclipse/core/resources/ResourcesPlugin:getWorkspace	()Lorg/eclipse/core/resources/IWorkspace;
    //   73: invokestatic 763	org/eclipse/debug/core/DebugPlugin:getUniqueIdentifier	()Ljava/lang/String;
    //   76: invokeinterface 806 2 0
    //   81: goto +15 -> 96
    //   84: astore_2
    //   85: aload_0
    //   86: aload_1
    //   87: invokespecial 755	org/eclipse/core/runtime/Plugin:stop	(Lorg/osgi/framework/BundleContext;)V
    //   90: aconst_null
    //   91: invokestatic 768	org/eclipse/debug/core/DebugPlugin:setDefault	(Lorg/eclipse/debug/core/DebugPlugin;)V
    //   94: aload_2
    //   95: athrow
    //   96: aload_0
    //   97: aload_1
    //   98: invokespecial 755	org/eclipse/core/runtime/Plugin:stop	(Lorg/osgi/framework/BundleContext;)V
    //   101: aconst_null
    //   102: invokestatic 768	org/eclipse/debug/core/DebugPlugin:setDefault	(Lorg/eclipse/debug/core/DebugPlugin;)V
    //   105: return
    // Line number table:
    //   Java source line #619	-> byte code offset #0
    //   Java source line #621	-> byte code offset #5
    //   Java source line #622	-> byte code offset #12
    //   Java source line #624	-> byte code offset #19
    //   Java source line #625	-> byte code offset #26
    //   Java source line #627	-> byte code offset #33
    //   Java source line #628	-> byte code offset #40
    //   Java source line #631	-> byte code offset #47
    //   Java source line #632	-> byte code offset #54
    //   Java source line #634	-> byte code offset #61
    //   Java source line #635	-> byte code offset #64
    //   Java source line #636	-> byte code offset #70
    //   Java source line #637	-> byte code offset #84
    //   Java source line #638	-> byte code offset #85
    //   Java source line #639	-> byte code offset #90
    //   Java source line #640	-> byte code offset #94
    //   Java source line #638	-> byte code offset #96
    //   Java source line #639	-> byte code offset #101
    //   Java source line #641	-> byte code offset #105
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	106	0	this	DebugPlugin
    //   0	106	1	context	BundleContext
    //   84	11	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	84	84	finally
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    new DebugOptions(context);
    ResourcesPlugin.getWorkspace().addSaveParticipant(getUniqueIdentifier(), 
      new ISaveParticipant()
      {
        public void saving(ISaveContext saveContext)
          throws CoreException
        {
          if (fExpressionManager != null) {
            fExpressionManager.storeWatchExpressions();
          }
          Preferences.savePreferences(DebugPlugin.getUniqueIdentifier());
        }
        
        public void rollback(ISaveContext saveContext) {}
        
        public void prepareToSave(ISaveContext saveContext)
          throws CoreException
        {}
        
        public void doneSaving(ISaveContext saveContext) {}
      });
    IAdapterManager manager = Platform.getAdapterManager();
    CommandAdapterFactory actionFactory = new CommandAdapterFactory();
    manager.registerAdapters(actionFactory, IDisconnect.class);
    manager.registerAdapters(actionFactory, IDropToFrame.class);
    manager.registerAdapters(actionFactory, IStep.class);
    manager.registerAdapters(actionFactory, IStepFilters.class);
    manager.registerAdapters(actionFactory, ISuspendResume.class);
    manager.registerAdapters(actionFactory, ITerminate.class);
    manager.registerAdapters(actionFactory, ILaunch.class);
    manager.registerAdapters(actionFactory, IProcess.class);
    manager.registerAdapters(actionFactory, IDebugElement.class);
  }
  
  public static IProcess newProcess(ILaunch launch, Process process, String label)
  {
    return newProcess(launch, process, label, null);
  }
  
  public static IProcess newProcess(ILaunch launch, Process process, String label, Map attributes)
  {
    ILaunchConfiguration config = launch.getLaunchConfiguration();
    String processFactoryID = null;
    if (config != null) {
      try
      {
        processFactoryID = config.getAttribute("process_factory_id", null);
      }
      catch (CoreException localCoreException1) {}
    }
    if (processFactoryID != null)
    {
      DebugPlugin plugin = getDefault();
      if (fProcessFactories == null) {
        plugin.initializeProcessFactories();
      }
      IConfigurationElement element = (IConfigurationElement)fProcessFactories.get(processFactoryID);
      if (element == null) {
        return null;
      }
      IProcessFactory processFactory = null;
      try
      {
        processFactory = (IProcessFactory)element.createExecutableExtension("class");
      }
      catch (CoreException exception)
      {
        log(exception);
        return null;
      }
      return processFactory.newProcess(launch, process, label, attributes);
    }
    return new RuntimeProcess(launch, process, label, attributes);
  }
  
  public static ILogicalStructureType[] getLogicalStructureTypes(IValue value)
  {
    return LogicalStructureManager.getDefault().getLogicalStructureTypes(value);
  }
  
  public static ILogicalStructureType getDefaultStructureType(ILogicalStructureType[] types)
  {
    return LogicalStructureManager.getDefault().getSelectedStructureType(types);
  }
  
  public static void setDefaultStructureType(ILogicalStructureType[] types, ILogicalStructureType def)
  {
    LogicalStructureManager.getDefault().setEnabledType(types, def);
  }
  
  public static Process exec(String[] cmdLine, File workingDirectory)
    throws CoreException
  {
    return exec(cmdLine, workingDirectory, null);
  }
  
  public static Process exec(String[] cmdLine, File workingDirectory, String[] envp)
    throws CoreException
  {
    Process p = null;
    try
    {
      if (workingDirectory == null) {
        p = Runtime.getRuntime().exec(cmdLine, envp);
      } else {
        p = Runtime.getRuntime().exec(cmdLine, envp, workingDirectory);
      }
    }
    catch (IOException e)
    {
      Status status = new Status(4, getUniqueIdentifier(), 125, DebugCoreMessages.DebugPlugin_0, e);
      throw new CoreException(status);
    }
    catch (NoSuchMethodError e)
    {
      IStatus status = new Status(4, getUniqueIdentifier(), 115, DebugCoreMessages.DebugPlugin_Eclipse_runtime_does_not_support_working_directory_2, e);
      IStatusHandler handler = getDefault().getStatusHandler(status);
      if (handler != null)
      {
        Object result = handler.handleStatus(status, null);
        if (((result instanceof Boolean)) && (((Boolean)result).booleanValue())) {
          p = exec(cmdLine, null);
        }
      }
    }
    return p;
  }
  
  private boolean isShuttingDown()
  {
    return fShuttingDown;
  }
  
  private void setShuttingDown(boolean value)
  {
    fShuttingDown = value;
  }
  
  private Object[] getEventListeners()
  {
    return fEventListeners.getListeners();
  }
  
  public void addDebugEventFilter(IDebugEventFilter filter)
  {
    fEventFilters.add(filter);
  }
  
  public void removeDebugEventFilter(IDebugEventFilter filter)
  {
    fEventFilters.remove(filter);
  }
  
  public static void logDebugMessage(String message)
  {
    if (getDefault().isDebugging()) {
      log(new Status(4, getUniqueIdentifier(), 125, MessageFormat.format(DebugCoreMessages.DebugPlugin_2, new String[] { message }), null));
    }
  }
  
  public static void logMessage(String message, Throwable throwable)
  {
    log(new Status(4, getUniqueIdentifier(), 125, message, throwable));
  }
  
  public static void log(IStatus status)
  {
    getDefault().getLog().log(status);
  }
  
  public static void log(Throwable t)
  {
    IStatus status = new Status(4, getUniqueIdentifier(), 125, DebugCoreMessages.DebugPlugin_3, t);
    log(status);
  }
  
  private void initializeStatusHandlers()
  {
    IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.debug.core", "statusHandlers");
    IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
    fStatusHandlers = new HashMap(infos.length);
    for (int i = 0; i < infos.length; i++)
    {
      IConfigurationElement configurationElement = infos[i];
      String id = configurationElement.getAttribute("plugin");
      String code = configurationElement.getAttribute("code");
      if ((id != null) && (code != null)) {
        try
        {
          StatusHandlerKey key = new StatusHandlerKey(id, Integer.parseInt(code));
          fStatusHandlers.put(key, configurationElement);
        }
        catch (NumberFormatException e)
        {
          invalidStatusHandler(e, configurationElement.getAttribute("id"));
        }
      } else {
        invalidStatusHandler(null, configurationElement.getAttribute("id"));
      }
    }
  }
  
  private void initializeProcessFactories()
  {
    IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.debug.core", "processFactories");
    IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
    fProcessFactories = new HashMap(infos.length);
    for (int i = 0; i < infos.length; i++)
    {
      IConfigurationElement configurationElement = infos[i];
      String id = configurationElement.getAttribute("id");
      String clss = configurationElement.getAttribute("class");
      if ((id != null) && (clss != null))
      {
        fProcessFactories.put(id, configurationElement);
      }
      else
      {
        String badDefiner = infos[i].getContributor().getName();
        log(new Status(4, "org.eclipse.debug.core", 125, MessageFormat.format(DebugCoreMessages.DebugPlugin_4, new String[] { badDefiner, id }), null));
      }
    }
  }
  
  private void invalidStatusHandler(Exception e, String id)
  {
    log(new Status(4, "org.eclipse.debug.core", 125, MessageFormat.format(DebugCoreMessages.DebugPlugin_5, new String[] { id }), e));
  }
  
  class StatusHandlerKey
  {
    String fPluginId;
    int fCode;
    
    StatusHandlerKey(String pluginId, int code)
    {
      fPluginId = pluginId;
      fCode = code;
    }
    
    public int hashCode()
    {
      return fPluginId.hashCode() + fCode;
    }
    
    public boolean equals(Object obj)
    {
      if ((obj instanceof StatusHandlerKey))
      {
        StatusHandlerKey s = (StatusHandlerKey)obj;
        return (fCode == fCode) && (fPluginId.equals(fPluginId));
      }
      return false;
    }
  }
  
  class AsynchRunner
    implements ISafeRunnable
  {
    private Runnable fRunnable = null;
    
    AsynchRunner() {}
    
    void async(Runnable runnable)
    {
      fRunnable = runnable;
      SafeRunner.run(this);
      fRunnable = null;
    }
    
    public void handleException(Throwable exception)
    {
      IStatus status = new Status(4, DebugPlugin.getUniqueIdentifier(), 125, DebugCoreMessages.DebugPlugin_6, exception);
      DebugPlugin.log(status);
    }
    
    public void run()
      throws Exception
    {
      fRunnable.run();
    }
  }
  
  class EventNotifier
    implements ISafeRunnable
  {
    private DebugEvent[] fEvents;
    private IDebugEventSetListener fListener;
    private IDebugEventFilter fFilter;
    private int fMode;
    
    EventNotifier() {}
    
    public void handleException(Throwable exception)
    {
      switch (fMode)
      {
      case 0: 
        IStatus status = new Status(4, DebugPlugin.getUniqueIdentifier(), 125, DebugCoreMessages.DebugPlugin_7, exception);
        DebugPlugin.log(status);
        break;
      case 1: 
        IStatus status = new Status(4, DebugPlugin.getUniqueIdentifier(), 125, DebugCoreMessages.DebugPlugin_8, exception);
        DebugPlugin.log(status);
      }
    }
    
    public void run()
      throws Exception
    {
      switch (fMode)
      {
      case 0: 
        fEvents = fFilter.filterDebugEvents(fEvents);
        break;
      case 1: 
        fListener.handleDebugEvents(fEvents);
      }
    }
    
    void dispatch(DebugEvent[] events)
    {
      fEvents = events;
      Object[] filters = fEventFilters.getListeners();
      if (filters.length > 0)
      {
        fMode = 0;
        for (int i = 0; i < filters.length; i++)
        {
          fFilter = ((IDebugEventFilter)filters[i]);
          SafeRunner.run(this);
          if ((fEvents == null) || (fEvents.length == 0)) {
            return;
          }
        }
      }
      fMode = 1;
      Object[] listeners = DebugPlugin.this.getEventListeners();
      if (DebugOptions.DEBUG_EVENTS) {
        for (int i = 0; i < fEvents.length; i++) {
          DebugOptions.trace(fEvents[i].toString());
        }
      }
      for (int i = 0; i < listeners.length; i++)
      {
        fListener = ((IDebugEventSetListener)listeners[i]);
        SafeRunner.run(this);
      }
      fEvents = null;
      fFilter = null;
      fListener = null;
    }
  }
  
  public static Document newDocument()
    throws CoreException
  {
    try
    {
      return LaunchManager.getDocument();
    }
    catch (ParserConfigurationException e)
    {
      abort("Unable to create new XML document.", e);
    }
    return null;
  }
  
  public static String serializeDocument(Document document)
    throws CoreException
  {
    try
    {
      return LaunchManager.serializeDocument(document);
    }
    catch (TransformerException e)
    {
      abort("Unable to serialize XML document.", e);
    }
    catch (IOException e)
    {
      abort("Unable to serialize XML document.", e);
    }
    return null;
  }
  
  /* Error */
  public static org.w3c.dom.Element parseDocument(String document)
    throws CoreException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_1
    //   2: aconst_null
    //   3: astore_2
    //   4: invokestatic 741	javax/xml/parsers/DocumentBuilderFactory:newInstance	()Ljavax/xml/parsers/DocumentBuilderFactory;
    //   7: invokevirtual 740	javax/xml/parsers/DocumentBuilderFactory:newDocumentBuilder	()Ljavax/xml/parsers/DocumentBuilder;
    //   10: astore_3
    //   11: aload_3
    //   12: new 434	org/xml/sax/helpers/DefaultHandler
    //   15: dup
    //   16: invokespecial 804	org/xml/sax/helpers/DefaultHandler:<init>	()V
    //   19: invokevirtual 738	javax/xml/parsers/DocumentBuilder:setErrorHandler	(Lorg/xml/sax
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd