org.eclipse.wst.jsdt.debug.ui_1.0.101.v201201112313

16:49:11.712 INFO  jd.cli.Main - Decompiling org.eclipse.wst.jsdt.debug.ui_1.0.101.v201201112313.jar
package org.eclipse.wst.jsdt.debug.internal.ui;

public abstract interface Constants
{
  public static final String SHOW_FUNCTIONS = "org.eclipse.wst.jsdt.debug.ui.show_functions";
  public static final String SHOW_PROTOTYPES = "org.eclipse.wst.jsdt.debug.ui.show_prototypes";
  public static final String SHOW_THIS = "org.eclipse.wst.jsdt.debug.uishow_this";
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.Constants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import org.eclipse.ui.IEditorInput;
import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
import org.eclipse.wst.jsdt.internal.ui.javaeditor.WorkingCopyManager;
import org.eclipse.wst.jsdt.ui.JavaScriptUI;

public class DebugWCManager
{
  public static IJavaScriptUnit getCompilationUnit(IEditorInput input, boolean primaryOnly)
  {
    return ((WorkingCopyManager)JavaScriptUI.getWorkingCopyManager()).getWorkingCopy(input, primaryOnly);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.DebugWCManager
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

public abstract interface IHelpContextIds
{
  public static final String STANDARD_BREAKPOINT_EDITOR = "org.eclipse.wst.jsdt.debug.ui.standard_breakpoint_editor";
  public static final String JAVASCRIPT_BREAKPOINT_PROPERTY_PAGE = "org.eclipse.wst.jsdt.debug.ui.breakpoint_property_page";
  public static final String CONNECT_TAB = "org.eclipse.wst.jsdt.debug.ui.connect_tab";
  public static final String DEBUG_PREFERENCE_PAGE = "org.eclipse.wst.jsdt.debug.ui.debug_pref_page";
  public static final String SOURCE_LOOKUP_TAB = "org.eclipse.wst.jsdt.debug.ui.source_lookup_tab";
  public static final String ENVIRONMENT_TAB = "org.eclipse.wst.jsdt.debug.ui.environment_tab";
  public static final String COMMON_TAB = "org.eclipse.wst.jsdt.debug.ui.common_tab";
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.IHelpContextIds
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

public abstract interface ISharedImages
{
  public static final String IMG_SCRIPT = "IMG_SCRIPT";
  public static final String IMG_SCRIPT_GRP = "IMG_SCRIPT_GRP";
  public static final String IMG_LOCAL_VAR = "IMG_LOCAL_VAR";
  public static final String IMG_THIS_VAR = "IMG_THIS_VAR";
  public static final String IMG_PROTO_VAR = "IMG_PROTO_VAR";
  public static final String IMG_BRKP = "IMG_BRKP";
  public static final String IMG_CONNECT = "IMG_CONNECT";
  public static final String IMG_SOURCE = "IMG_SOURCE";
  public static final String IMG_BRKP_DISABLED = "IMG_BRKP_DISABLED";
  public static final String IMG_OVR_CONDITIONAL = "IMG_OVR_CONDITIONAL";
  public static final String IMG_OVR_CONDITIONAL_DISABLED = "IMG_OVR_CONDITIONAL_DISABLED";
  public static final String IMG_OVR_ENTRY = "IMG_OVR_ENTRY";
  public static final String IMG_OVR_ENTRY_DISABLED = "IMG_OVR_ENTRY_DISABLED";
  public static final String IMG_OVR_EXIT = "IMG_OVR_EXIT";
  public static final String IMG_OVR_EXIT_DISABLED = "IMG_OVR_EXIT_DISABLED";
  public static final String IMG_OVR_INSTALLED = "IMG_OVR_INSTALLED";
  public static final String IMG_OVR_INSTALLED_DISABLED = "IMG_OVR_INSTALLED_DISABLED";
  public static final String IMG_OVR_SCOPED = "IMG_OVR_SCOPED";
  public static final String IMG_OVR_SCOPED_DISABLED = "IMG_OVR_SCOPED_DISABLED";
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.ISharedImages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import org.eclipse.swt.widgets.Display;

class ImageDescriptorRegistry$1
  implements Runnable
{
  final ImageDescriptorRegistry this$0;
  
  ImageDescriptorRegistry$1(ImageDescriptorRegistry paramImageDescriptorRegistry)
  {
    this$0 = paramImageDescriptorRegistry;
  }
  
  public void run()
  {
    ImageDescriptorRegistry.access$0(this$0).disposeExec(new ImageDescriptorRegistry.2(this));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.ImageDescriptorRegistry.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

class ImageDescriptorRegistry$2
  implements Runnable
{
  final ImageDescriptorRegistry.1 this$1;
  
  ImageDescriptorRegistry$2(ImageDescriptorRegistry.1 param1)
  {
    this$1 = param1;
  }
  
  public void run()
  {
    ImageDescriptorRegistry.1.access$0(this$1).dispose();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.ImageDescriptorRegistry.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class ImageDescriptorRegistry
{
  private HashMap fRegistry = new HashMap(10);
  private Display fDisplay;
  
  public ImageDescriptorRegistry()
  {
    this(PlatformUI.getWorkbench().getDisplay());
  }
  
  public ImageDescriptorRegistry(Display display)
  {
    fDisplay = display;
    Assert.isNotNull(fDisplay);
    hookDisplay();
  }
  
  public Image get(ImageDescriptor descriptor)
  {
    ImageDescriptor desc = descriptor;
    if (desc == null) {
      desc = ImageDescriptor.getMissingImageDescriptor();
    }
    Image result = (Image)fRegistry.get(desc);
    if (result != null) {
      return result;
    }
    result = desc.createImage();
    if (result != null) {
      fRegistry.put(desc, result);
    }
    return result;
  }
  
  public void dispose()
  {
    for (Iterator iter = fRegistry.values().iterator(); iter.hasNext();)
    {
      Image image = (Image)iter.next();
      image.dispose();
    }
    fRegistry.clear();
  }
  
  private void hookDisplay()
  {
    fDisplay.asyncExec(new Runnable()
    {
      public void run()
      {
        fDisplay.disposeExec(new ImageDescriptorRegistry.2(this));
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.ImageDescriptorRegistry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import java.util.ArrayList;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.ResourceUtil;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.wst.jsdt.debug.internal.core.JavaScriptDebugPlugin;
import org.eclipse.wst.jsdt.debug.internal.ui.eval.EvaluationManager;
import org.osgi.framework.BundleContext;

public class JavaScriptDebugUIPlugin
  extends AbstractUIPlugin
  implements IWorkbenchListener
{
  public static final int INTERNAL_ERROR = 120;
  public static final String PLUGIN_ID = "org.eclipse.wst.jsdt.debug.ui";
  private static JavaScriptDebugUIPlugin plugin;
  private static ScopedPreferenceStore corestore = new ScopedPreferenceStore(new InstanceScope(), "org.eclipse.wst.jsdt.debug.core");
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
    PlatformUI.getWorkbench().addWorkbenchListener(this);
    EvaluationManager.getManager().start();
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    try
    {
      plugin = null;
      PlatformUI.getWorkbench().removeWorkbenchListener(this);
      EvaluationManager.getManager().stop();
      super.stop(context);
    }
    finally
    {
      JavaScriptImageRegistry.dispose();
    }
  }
  
  public static JavaScriptDebugUIPlugin getDefault()
  {
    return plugin;
  }
  
  public static void log(IStatus status)
  {
    if (plugin != null) {
      plugin.getLog().log(status);
    }
  }
  
  public static void log(Throwable t)
  {
    log(newErrorStatus("Error logged from JavaScript Debug UI: ", t));
  }
  
  public static void logErrorMessage(String message)
  {
    log(newErrorStatus("Internal message logged from JavaScript Debug UI: " + message, null));
  }
  
  public static IStatus newErrorStatus(String message, Throwable exception)
  {
    return new Status(4, "org.eclipse.wst.jsdt.debug.ui", 120, message, exception);
  }
  
  protected void closeEditors()
    throws PartInitException
  {
    IProject project = JavaScriptDebugPlugin.getExternalSourceProject(false);
    if (project != null)
    {
      IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
      ArrayList editors = new ArrayList(8);
      for (int l = 0; l < windows.length; l++)
      {
        IWorkbenchPage[] pages = windows[l].getPages();
        for (int i = 0; i < pages.length; i++)
        {
          IEditorReference[] erefs = pages[i].getEditorReferences();
          for (int j = 0; j < erefs.length; j++)
          {
            IFile file = ResourceUtil.getFile(erefs[j].getEditorInput());
            if ((file != null) && 
              (project.equals(file.getProject()))) {
              editors.add(erefs[j]);
            }
          }
          if (editors.size() > 0)
          {
            pages[i].closeEditors((IEditorReference[])editors.toArray(new IEditorReference[editors.size()]), false);
            editors.clear();
          }
        }
      }
    }
  }
  
  public boolean preShutdown(IWorkbench workbench, boolean forced)
  {
    try
    {
      closeEditors();
    }
    catch (PartInitException e)
    {
      log(e);
    }
    return true;
  }
  
  public void postShutdown(IWorkbench workbench) {}
  
  public static Display getStandardDisplay()
  {
    Display display = Display.getCurrent();
    if (display == null) {
      display = Display.getDefault();
    }
    return display;
  }
  
  public static IPreferenceStore getCorePreferenceStore()
  {
    return corestore;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.JavaScriptDebugUIPlugin
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;

public class JavaScriptDebugUIPreferenceInitializer
  extends AbstractPreferenceInitializer
{
  public void initializeDefaultPreferences()
  {
    IPreferenceStore store = JavaScriptDebugUIPlugin.getDefault().getPreferenceStore();
    store.setDefault("org.eclipse.wst.jsdt.debug.ui.show_functions", true);
    store.setDefault("org.eclipse.wst.jsdt.debug.ui.show_prototypes", true);
    store.setDefault("org.eclipse.wst.jsdt.debug.uishow_this", true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.JavaScriptDebugUIPreferenceInitializer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;

public class JavaScriptImageDescriptor
  extends CompositeImageDescriptor
{
  public static final int INSTALLED = 1;
  public static final int ENTRY = 2;
  public static final int EXIT = 4;
  public static final int ENABLED = 8;
  public static final int CONDITIONAL = 16;
  public static final int SCOPED = 32;
  private Image fBaseImage;
  private int fFlags;
  private Point fSize;
  
  public JavaScriptImageDescriptor(Image baseImage, int flags)
  {
    setBaseImage(baseImage);
    setFlags(flags);
  }
  
  protected Point getSize()
  {
    if (fSize == null)
    {
      ImageData data = getBaseImage().getImageData();
      setSize(new Point(width, height));
    }
    return fSize;
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof JavaScriptImageDescriptor)) {
      return false;
    }
    JavaScriptImageDescriptor other = (JavaScriptImageDescriptor)object;
    return (getBaseImage().equals(other.getBaseImage())) && (getFlags() == other.getFlags());
  }
  
  public int hashCode()
  {
    return getBaseImage().hashCode() | getFlags();
  }
  
  protected void drawCompositeImage(int width, int height)
  {
    ImageData bg = getBaseImage().getImageData();
    if (bg == null) {
      bg = DEFAULT_IMAGE_DATA;
    }
    drawImage(bg, 0, 0);
    drawOverlays();
  }
  
  private ImageData getImageData(String imageDescriptorKey)
  {
    return JavaScriptImageRegistry.getSharedImage(imageDescriptorKey).getImageData();
  }
  
  protected void drawOverlays()
  {
    int flags = getFlags();
    int x = 0;
    int y = 0;
    ImageData data = null;
    if ((flags & 0x1) != 0)
    {
      x = 0;
      y = getSizey;
      if ((flags & 0x8) != 0) {
        data = getImageData("IMG_OVR_INSTALLED");
      } else {
        data = getImageData("IMG_OVR_INSTALLED_DISABLED");
      }
      y -= height;
      drawImage(data, x, y);
    }
    if ((flags & 0x20) != 0)
    {
      if ((flags & 0x8) != 0) {
        data = getImageData("IMG_OVR_SCOPED");
      } else {
        data = getImageData("IMG_OVR_SCOPED_DISABLED");
      }
      x = 0;
      y = getSizey;
      y -= height;
      drawImage(data, x, y);
    }
    if ((flags & 0x10) != 0)
    {
      if ((flags & 0x8) != 0) {
        data = getImageData("IMG_OVR_CONDITIONAL");
      } else {
        data = getImageData("IMG_OVR_CONDITIONAL_DISABLED");
      }
      x = 0;
      y = 0;
      drawImage(data, x, y);
    }
    if ((flags & 0x2) != 0)
    {
      x = getSizex;
      y = 0;
      if ((flags & 0x8) != 0) {
        data = getImageData("IMG_OVR_ENTRY");
      } else {
        data = getImageData("IMG_OVR_ENTRY_DISABLED");
      }
      x -= width;
      x -= 2;
      drawImage(data, x, y);
    }
    if ((flags & 0x4) != 0)
    {
      x = getSizex;
      y = getSizey;
      if ((flags & 0x8) != 0) {
        data = getImageData("IMG_OVR_EXIT");
      } else {
        data = getImageData("IMG_OVR_EXIT_DISABLED");
      }
      x -= width;
      x -= 2;
      y -= height;
      drawImage(data, x, y);
    }
  }
  
  protected Image getBaseImage()
  {
    return fBaseImage;
  }
  
  protected void setBaseImage(Image baseImage)
  {
    fBaseImage = baseImage;
  }
  
  protected int getFlags()
  {
    return fFlags;
  }
  
  protected void setFlags(int flags)
  {
    fFlags = flags;
  }
  
  protected void setSize(Point size)
  {
    fSize = size;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.JavaScriptImageDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.osgi.framework.Bundle;

public final class JavaScriptImageRegistry
{
  private static ImageRegistry imageRegistry;
  private static ImageDescriptorRegistry descRegistry;
  private static String ICONS_PATH = "$nl$/icons/";
  private static final String ELCL = ICONS_PATH + "elcl16/";
  private static final String OVR = ICONS_PATH + "ovr16/";
  private static final String DLCL = ICONS_PATH + "dlcl16/";
  
  private static void declareImages()
  {
    declareRegistryImage("IMG_SCRIPT", ELCL + "script.gif");
    declareRegistryImage("IMG_SCRIPT_GRP", ELCL + "script_grp.gif");
    declareRegistryImage("IMG_LOCAL_VAR", ELCL + "localvariable.gif");
    declareRegistryImage("IMG_CONNECT", ELCL + "connect.gif");
    declareRegistryImage("IMG_BRKP", ELCL + "brkp_obj.gif");
    declareRegistryImage("IMG_THIS_VAR", ELCL + "this_var.gif");
    declareRegistryImage("IMG_PROTO_VAR", ELCL + "proto_var.gif");
    declareRegistryImage("IMG_SOURCE", ELCL + "source.gif");
    
    declareRegistryImage("IMG_BRKP_DISABLED", DLCL + "brkpd_obj.gif");
    
    declareRegistryImage("IMG_OVR_CONDITIONAL", OVR + "conditional_ovr.gif");
    declareRegistryImage("IMG_OVR_CONDITIONAL_DISABLED", OVR + "conditional_ovr_disabled.gif");
    declareRegistryImage("IMG_OVR_ENTRY", OVR + "entry_ovr.gif");
    declareRegistryImage("IMG_OVR_ENTRY_DISABLED", OVR + "entry_ovr_disabled.gif");
    declareRegistryImage("IMG_OVR_EXIT", OVR + "exit_ovr.gif");
    declareRegistryImage("IMG_OVR_EXIT_DISABLED", OVR + "exit_ovr_disabled.gif");
    declareRegistryImage("IMG_OVR_INSTALLED", OVR + "installed_ovr.gif");
    declareRegistryImage("IMG_OVR_INSTALLED_DISABLED", OVR + "installed_ovr_disabled.gif");
    declareRegistryImage("IMG_OVR_SCOPED", OVR + "scoped_ovr.gif");
    declareRegistryImage("IMG_OVR_SCOPED_DISABLED", OVR + "scoped_ovr_disabled.gif");
  }
  
  private static final void declareRegistryImage(String key, String path)
  {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle("org.eclipse.wst.jsdt.debug.ui");
    URL url = null;
    if (bundle != null)
    {
      url = FileLocator.find(bundle, new Path(path), null);
      if (url != null) {
        desc = ImageDescriptor.createFromURL(url);
      }
    }
    imageRegistry.put(key, desc);
  }
  
  public static Image getSharedImage(String key)
  {
    if (imageRegistry == null) {
      initializeImageRegistry();
    }
    return imageRegistry.get(key);
  }
  
  private static synchronized ImageRegistry initializeImageRegistry()
  {
    if (imageRegistry == null)
    {
      imageRegistry = new ImageRegistry(PlatformUI.getWorkbench().getDisplay());
      declareImages();
    }
    return imageRegistry;
  }
  
  public static Image getImage(ImageDescriptor descriptor)
  {
    if (descRegistry == null) {
      descRegistry = new ImageDescriptorRegistry();
    }
    return descRegistry.get(descriptor);
  }
  
  public static void dispose()
  {
    if (imageRegistry != null) {
      imageRegistry.dispose();
    }
    if (descRegistry != null) {
      descRegistry.dispose();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.JavaScriptImageRegistry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.util.HashMap;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IDisconnect;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.ITerminate;
import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
import org.eclipse.debug.ui.IDebugModelPresentationExtension;
import org.eclipse.debug.ui.IValueDetailListener;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.jsdt.core.Signature;
import org.eclipse.wst.jsdt.debug.core.breakpoints.IJavaScriptBreakpoint;
import org.eclipse.wst.jsdt.debug.core.breakpoints.IJavaScriptFunctionBreakpoint;
import org.eclipse.wst.jsdt.debug.core.breakpoints.IJavaScriptLineBreakpoint;
import org.eclipse.wst.jsdt.debug.core.breakpoints.IJavaScriptLoadBreakpoint;
import org.eclipse.wst.jsdt.debug.core.model.IJavaScriptStackFrame;
import org.eclipse.wst.jsdt.debug.core.model.IJavaScriptThread;
import org.eclipse.wst.jsdt.debug.core.model.IJavaScriptValue;
import org.eclipse.wst.jsdt.debug.core.model.IScript;
import org.eclipse.wst.jsdt.debug.core.model.IScriptGroup;
import org.eclipse.wst.jsdt.debug.internal.core.JavaScriptDebugPlugin;
import org.eclipse.wst.jsdt.debug.internal.core.TextUtils;
import org.eclipse.wst.jsdt.debug.internal.core.breakpoints.JavaScriptExceptionBreakpoint;
import org.eclipse.wst.jsdt.debug.internal.ui.eval.JavaScriptInspectExpression;

public class JavaScriptModelPresentation
  extends LabelProvider
  implements IDebugModelPresentationExtension
{
  static final String DISPLAY_QUALIFIED_NAMES = "DISPLAY_QUALIFIED_NAMES";
  HashMap attributes = null;
  
  public boolean requiresUIThread(Object element)
  {
    return false;
  }
  
  public void computeDetail(IValue value, IValueDetailListener listener)
  {
    if ((value instanceof IJavaScriptValue)) {
      listener.detailComputed(value, ((IJavaScriptValue)value).getDetailString());
    }
  }
  
  public void setAttribute(String attribute, Object value)
  {
    if (attributes == null) {
      attributes = new HashMap();
    }
    attributes.put(attribute, value);
  }
  
  public void dispose()
  {
    if (attributes != null)
    {
      attributes.clear();
      attributes = null;
    }
    super.dispose();
  }
  
  boolean showQualifiedNames()
  {
    if (attributes != null)
    {
      Boolean show = (Boolean)attributes.get("DISPLAY_QUALIFIED_NAMES");
      if (show != null) {
        return show.booleanValue();
      }
    }
    return true;
  }
  
  public String getText(Object element)
  {
    StringBuffer buffer = new StringBuffer();
    try
    {
      if ((element instanceof IDebugElement)) {
        if ((element instanceof IDebugTarget)) {
          buffer.append(((IDebugTarget)element).getName());
        } else if ((element instanceof IStackFrame)) {
          buffer.append(getStackframeText((IJavaScriptStackFrame)element));
        } else if ((element instanceof IThread)) {
          buffer.append(getThreadText((IJavaScriptThread)element));
        } else if ((element instanceof IVariable)) {
          buffer.append(((IVariable)element).getName());
        } else if ((element instanceof IValue)) {
          buffer.append(((IValue)element).getValueString());
        } else if ((element instanceof IScriptGroup)) {
          buffer.append(Messages.scripts);
        } else if ((element instanceof IScript)) {
          buffer.append(getScriptText((IScript)element));
        }
      }
      if ((element instanceof JavaScriptInspectExpression))
      {
        JavaScriptInspectExpression exp = (JavaScriptInspectExpression)element;
        return exp.getValue().getReferenceTypeName();
      }
      if ((element instanceof ITerminate))
      {
        if (((ITerminate)element).isTerminated()) {
          buffer.insert(0, Messages.terminated);
        } else if (((element instanceof IDisconnect)) && 
          (((IDisconnect)element).isDisconnected())) {
          buffer.insert(0, Messages.disconnected);
        }
      }
      else if ((element instanceof IDisconnect))
      {
        if (((IDisconnect)element).isDisconnected()) {
          buffer.insert(0, Messages.disconnected);
        }
      }
      else if ((element instanceof IJavaScriptFunctionBreakpoint)) {
        buffer.append(getFunctionBreakpointText((IJavaScriptFunctionBreakpoint)element));
      } else if ((element instanceof IJavaScriptLoadBreakpoint)) {
        buffer.append(getScriptLoadBreakpointText((IJavaScriptLoadBreakpoint)element));
      } else if ((element instanceof IJavaScriptLineBreakpoint)) {
        buffer.append(getLineBreakpointText((IJavaScriptLineBreakpoint)element));
      }
    }
    catch (CoreException ce)
    {
      JavaScriptDebugUIPlugin.log(ce);
      buffer.append(Messages.unknown);
    }
    if (buffer.length() < 1) {
      return Messages.unknown;
    }
    return buffer.toString();
  }
  
  String getThreadText(IJavaScriptThread thread)
    throws DebugException
  {
    String adornment = Messages.unknown_state;
    if (thread.isSuspended())
    {
      IBreakpoint[] bps = thread.getBreakpoints();
      if (bps.length > 0) {
        try
        {
          IJavaScriptBreakpoint breakpoint = (IJavaScriptBreakpoint)bps[0];
          if ((breakpoint instanceof IJavaScriptLoadBreakpoint))
          {
            String name = breakpoint.getScriptPath();
            if ("".equals(name)) {
              name = getSourceName(thread);
            } else {
              try
              {
                name = URLDecoder.decode(name, "UTF-8");
              }
              catch (UnsupportedEncodingException localUnsupportedEncodingException) {}
            }
            adornment = NLS.bind(Messages.suspend_loading_script, name);
          }
          else if ((breakpoint instanceof JavaScriptExceptionBreakpoint))
          {
            adornment = NLS.bind(Messages.suspended_on_exception, breakpoint.getMarker().getAttribute("org.eclipse.wst.jsdt.debug.core.exception_message"));
          }
          else if ((breakpoint instanceof IJavaScriptLineBreakpoint))
          {
            IJavaScriptLineBreakpoint bp = (IJavaScriptLineBreakpoint)breakpoint;
            adornment = NLS.bind(Messages.suspended_on_line_breakpoint, new String[] { Integer.toString(bp.getLineNumber()), getSourceName(thread) });
          }
          else if ((breakpoint instanceof IJavaScriptFunctionBreakpoint))
          {
            IJavaScriptFunctionBreakpoint bp = (IJavaScriptFunctionBreakpoint)breakpoint;
            adornment = NLS.bind(Messages.suspended_on_func_breakpoint, new String[] { bp.getFunctionName(), getSourceName(thread) });
          }
        }
        catch (CoreException ce)
        {
          JavaScriptDebugPlugin.log(ce);
        }
      } else {
        adornment = Messages.suspended_state;
      }
    }
    else if (thread.isStepping())
    {
      adornment = Messages.stepping_state;
    }
    else if (thread.isTerminated())
    {
      adornment = Messages.terminated_state;
    }
    else
    {
      adornment = Messages.running_state;
    }
    return NLS.bind(Messages.thread_name, new String[] { thread.getName(), adornment });
  }
  
  String getSourceName(IJavaScriptThread thread)
    throws DebugException
  {
    IJavaScriptStackFrame frame = (IJavaScriptStackFrame)thread.getTopStackFrame();
    if (frame != null) {
      try
      {
        String uri = URLDecoder.decode(frame.getSourceName(), "UTF-8");
        return TextUtils.shortenText(uri, 100);
      }
      catch (UnsupportedEncodingException localUnsupportedEncodingException) {}
    }
    return Messages.evald_script;
  }
  
  String getStackframeText(IJavaScriptStackFrame frame)
    throws DebugException
  {
    String fname = frame.getName();
    if ((fname == null) || (fname.trim().length() < 1)) {
      return NLS.bind(Messages.stackframe_name, new String[] {
        frame.getSourceName(), 
        Integer.toString(frame.getLineNumber()) });
    }
    return NLS.bind(Messages.JavaScriptModelPresentation_stackframe_name_with_fname, new String[] {
      frame.getSourceName(), 
      fname, 
      Integer.toString(frame.getLineNumber()) });
  }
  
  String getScriptText(IScript script)
  {
    try
    {
      String uri = URLDecoder.decode(script.sourceURI().toString(), "UTF-8");
      return TextUtils.shortenText(uri, 100);
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException) {}
    return Messages.unknown;
  }
  
  String getLineBreakpointText(IJavaScriptLineBreakpoint breakpoint)
    throws CoreException
  {
    String path = getElementPath(breakpoint.getScriptPath());
    StringBuffer buffer = new StringBuffer(path);
    buffer.append(NLS.bind(Messages.bp_line_number, new String[] { Integer.toString(breakpoint.getLineNumber()) }));
    int hitcount = breakpoint.getHitCount();
    if (hitcount > 0) {
      buffer.append(NLS.bind(Messages.bp_hit_count, new String[] { Integer.toString(hitcount) }));
    }
    if (breakpoint.isConditionEnabled()) {
      buffer.append(Messages.bp_conditonal);
    }
    if (breakpoint.getSuspendPolicy() == 2) {
      buffer.append(Messages.bp_suspend_vm);
    }
    return buffer.toString();
  }
  
  String getFunctionBreakpointText(IJavaScriptFunctionBreakpoint breakpoint)
    throws CoreException
  {
    String path = getElementPath(breakpoint.getScriptPath());
    StringBuffer buffer = new StringBuffer(path);
    if (breakpoint.isEntry())
    {
      if (breakpoint.isExit()) {
        buffer.append(Messages.bp_entry_and_exit);
      } else {
        buffer.append(Messages.bp_entry_only);
      }
    }
    else if (breakpoint.isExit()) {
      buffer.append(Messages.bp_exit_only);
    }
    int hitcount = breakpoint.getHitCount();
    if (hitcount > 0) {
      buffer.append(NLS.bind(Messages.bp_hit_count, new String[] { Integer.toString(hitcount) }));
    }
    if (breakpoint.isConditionEnabled()) {
      buffer.append(Messages.bp_conditional);
    }
    if (breakpoint.getSuspendPolicy() == 2) {
      buffer.append(Messages.bp_suspend_vm);
    }
    String method = Signature.toString(breakpoint.getSignature(), breakpoint.getFunctionName(), null, false, false);
    buffer.append(" - ").append(method);
    return buffer.toString();
  }
  
  String getScriptLoadBreakpointText(IJavaScriptLoadBreakpoint breakpoint)
    throws CoreException
  {
    String path = getElementPath(breakpoint.getScriptPath());
    StringBuffer buffer = new StringBuffer(path);
    int hitcount = breakpoint.getHitCount();
    if (hitcount > 0) {
      buffer.append(NLS.bind(Messages.bp_hit_count, new String[] { Integer.toString(hitcount) }));
    }
    if (breakpoint.getSuspendPolicy() == 2) {
      buffer.append(Messages.bp_suspend_vm);
    }
    return buffer.toString();
  }
  
  String getElementPath(String path)
  {
    if (!showQualifiedNames()) {
      try
      {
        return URIUtil.lastSegment(URIUtil.fromString(path));
      }
      catch (URISyntaxException urise)
      {
        JavaScriptDebugUIPlugin.log(urise);
      }
    }
    return path;
  }
  
  public Image getImage(Object element)
  {
    try
    {
      if ((element instanceof IVariable))
      {
        IVariable var = (IVariable)element;
        return getImageFromType(var);
      }
      if (((element instanceof IJavaScriptLineBreakpoint)) || ((element instanceof IJavaScriptFunctionBreakpoint)))
      {
        IJavaScriptBreakpoint breakpoint = (IJavaScriptBreakpoint)element;
        int flags = computeBreakpointAdornmentFlags(breakpoint);
        if (breakpoint.isEnabled()) {
          return JavaScriptImageRegistry.getImage(new JavaScriptImageDescriptor(JavaScriptImageRegistry.getSharedImage("IMG_BRKP"), flags));
        }
        return JavaScriptImageRegistry.getImage(new JavaScriptImageDescriptor(JavaScriptImageRegistry.getSharedImage("IMG_BRKP_DISABLED"), flags));
      }
      if ((element instanceof IScript)) {
        return JavaScriptImageRegistry.getImage(new JavaScriptImageDescriptor(JavaScriptImageRegistry.getSharedImage("IMG_SCRIPT"), 0));
      }
      if ((element instanceof IScriptGroup)) {
        return JavaScriptImageRegistry.getImage(new JavaScriptImageDescriptor(JavaScriptImageRegistry.getSharedImage("IMG_SCRIPT_GRP"), 0));
      }
    }
    catch (DebugException de)
    {
      JavaScriptDebugUIPlugin.log(de);
    }
    catch (CoreException ce)
    {
      JavaScriptDebugUIPlugin.log(ce);
    }
    return null;
  }
  
  int computeBreakpointAdornmentFlags(IJavaScriptBreakpoint breakpoint)
  {
    int flags = 0;
    try
    {
      if (breakpoint.isEnabled()) {
        flags |= 0x8;
      }
      if (breakpoint.isInstalled()) {
        flags |= 0x1;
      }
      if (((breakpoint instanceof IJavaScriptLineBreakpoint)) && 
        (((IJavaScriptLineBreakpoint)breakpoint).isConditionEnabled())) {
        flags |= 0x10;
      }
      if ((breakpoint instanceof IJavaScriptFunctionBreakpoint))
      {
        IJavaScriptFunctionBreakpoint mBreakpoint = (IJavaScriptFunctionBreakpoint)breakpoint;
        if (mBreakpoint.isEntry()) {
          flags |= 0x2;
        }
        if (mBreakpoint.isExit()) {
          flags |= 0x4;
        }
      }
    }
    catch (CoreException localCoreException) {}
    return flags;
  }
  
  Image getImageFromType(IVariable variable)
    throws DebugException
  {
    String name = variable.getName();
    if ("this".equals(name)) {
      return JavaScriptImageRegistry.getImage(new JavaScriptImageDescriptor(JavaScriptImageRegistry.getSharedImage("IMG_THIS_VAR"), 0));
    }
    if ("[proto]".equals(name)) {
      return JavaScriptImageRegistry.getImage(new JavaScriptImageDescriptor(JavaScriptImageRegistry.getSharedImage("IMG_PROTO_VAR"), 0));
    }
    return JavaScriptImageRegistry.getSharedImage("IMG_LOCAL_VAR");
  }
  
  public String getEditorId(IEditorInput input, Object element)
  {
    try
    {
      IEditorDescriptor descriptor = IDE.getEditorDescriptor(input.getName());
      return descriptor.getId();
    }
    catch (PartInitException localPartInitException) {}
    return null;
  }
  
  public IEditorInput getEditorInput(Object element)
  {
    if ((element instanceof LocalFileStorage)) {
      return getEditorInput(((LocalFileStorage)element).getFile());
    }
    if ((element instanceof File)) {
      return new FileStoreEditorInput(EFS.getLocalFileSystem().fromLocalFile((File)element));
    }
    if ((element instanceof IFile)) {
      return new FileEditorInput((IFile)element);
    }
    if ((element instanceof IJavaScriptLoadBreakpoint)) {
      try
      {
        IJavaScriptLoadBreakpoint bp = (IJavaScriptLoadBreakpoint)element;
        IPath path = new Path(bp.getScriptPath());
        IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
        if ((resource != null) && (resource.getType() == 1)) {
          return new FileEditorInput((IFile)resource);
        }
      }
      catch (CoreException ce)
      {
        JavaScriptDebugUIPlugin.log(ce);
      }
    }
    if ((element instanceof IJavaScriptBreakpoint))
    {
      IResource resource = ((IJavaScriptBreakpoint)element).getMarker().getResource();
      if (resource.getType() == 1) {
        return new FileEditorInput((IFile)resource);
      }
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.JavaScriptModelPresentation
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.wst.jsdt.debug.internal.ui.messages";
  public static String add_script_load_bp;
  public static String bp_conditional;
  public static String bp_conditonal;
  public static String bp_entry_and_exit;
  public static String bp_entry_only;
  public static String bp_exit_only;
  public static String bp_hit_count;
  public static String bp_line_number;
  public static String bp_suspend_vm;
  public static String breakpoint_configuration;
  public static String connect;
  public static String connector;
  public static String connector_properties;
  public static String creating_script_load_bp;
  public static String disconnected;
  public static String enable_hit_count;
  public static String enter_new_hit_count;
  public static String evald_script;
  public static String exception_occurred_setting_bp_properties;
  public static String hit_count_must_be_positive;
  public static String JavaScriptModelPresentation_stackframe_name_with_fname;
  public static String no_description_provided;
  public static String opening_source__0;
  public static String running_state;
  public static String scripts;
  public static String select_javascript_file;
  public static String set_bp_hit_count;
  public static String stackframe_name;
  public static String stepping_state;
  public static String suspend_loading_script;
  public static String suspend_target;
  public static String suspend_thread;
  public static String suspended_on_exception;
  public static String suspended_on_func_breakpoint;
  public static String suspended_on_line_breakpoint;
  public static String suspended_state;
  public static String terminated;
  public static String terminated_state;
  public static String the_argument_0_is_not_valid;
  public static String thread_name;
  public static String unknown;
  public static String unknown_state;
  
  static
  {
    NLS.initializeMessages("org.eclipse.wst.jsdt.debug.internal.ui.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.Messages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;

public class PreferencesManager
  implements IPropertyChangeListener
{
  public static final String PREF_SHOW_LOADED_SCRIPTS = "org.eclipse.wst.jsdt.debug.ui.show_loaded_scripts";
  private static PreferencesManager fgManager = null;
  
  public static synchronized PreferencesManager getManager()
  {
    if (fgManager == null) {
      fgManager = new PreferencesManager();
    }
    return fgManager;
  }
  
  public boolean showLoadedScripts()
  {
    return JavaScriptDebugUIPlugin.getDefault().getPreferenceStore().getBoolean("org.eclipse.wst.jsdt.debug.ui.show_loaded_scripts");
  }
  
  public void showLoadedScripts(boolean show)
  {
    JavaScriptDebugUIPlugin.getDefault().getPreferenceStore().setValue("org.eclipse.wst.jsdt.debug.ui.show_loaded_scripts", show);
  }
  
  public void propertyChange(PropertyChangeEvent event) {}
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.ui.PreferencesManager
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.ui;

import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.layout.PixelConverter;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
imp
1 2 3 4 5 6 7 8 9 10

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