org.eclipse.wst.jsdt.debug.rhino.ui_1.0.1.v201201112313

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

public abstract interface IHelpConstants
{
  public static final String MAIN_TAB_CONTEXT = "org.eclipse.wst.jsdt.debug.rhino.ui.rhino_main_tab_context";
  public static final String INCLUDE_TAB_CONTEXT = "org.eclipse.wst.jsdt.debug.rhino.ui.rhino_include_tab_context";
  public static final String SOURCE_TAB_CONTEXT = "org.eclipse.wst.jsdt.debug.rhino.ui.rhino_source_tab_context";
  public static final String COMMON_TAB_CONTEXT = "org.eclipse.wst.jsdt.debug.rhino.ui.rhino_common_tab_context";
  public static final String RHINO_PREFERENCE_PAGE = "org.eclipse.wst.jsdt.debug.rhino.ui.rhino_preference_page";
}

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

public abstract interface ILaunchConstants
{
  public static final String ATTR_SCRIPT = "script";
  public static final String ATTR_LOG_INTERPRETER_EXCEPTIONS = "logexceptions";
  public static final String ATTR_ECMA_VERSION = "ecmaversion";
  public static final String ATTR_OPT_LEVEL = "optlevel";
  public static final String ATTR_STRICT_MODE = "strictmode";
  public static final String ATTR_INCLUDE_PATH = "includepath";
  public static final String LAUNCH_CONFIG_TYPE = "org.eclipse.wst.jsdt.debug.rhino.ui.launch.config.type";
  public static final String EMPTY_STRING = "";
  public static final String ECMA_170 = "170";
}

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

public abstract interface ISharedImages
{
  public static final String IMG_SCRIPT = "IMG_SCRIPT";
  public static final String IMG_RHINO = "IMG_RHINO";
  public static final String IMG_MAIN_TAB = "IMG_MAIN_TAB";
  public static final String IMG_LIBRARY = "IMG_LIBRARY";
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.rhino.ui.ISharedImages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.rhino.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.rhino.ui.ImageDescriptorRegistry.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.rhino.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.rhino.ui.ImageDescriptorRegistry.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.rhino.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.rhino.ui.ImageDescriptorRegistry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.rhino.ui;

import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.ui.model.IWorkbenchAdapter;

public class RhinoAdapterFactory
  implements IAdapterFactory
{
  static WorkbenchAdapter wsAdapter = null;
  
  public synchronized Object getAdapter(Object adaptableObject, Class adapterType)
  {
    if (adapterType.equals(IWorkbenchAdapter.class))
    {
      if (wsAdapter == null) {
        wsAdapter = new WorkbenchAdapter();
      }
      return wsAdapter;
    }
    return null;
  }
  
  public Class[] getAdapterList()
  {
    return new Class[] { IWorkbenchAdapter.class };
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.rhino.ui.RhinoAdapterFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.rhino.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 RhinoImageRegistry
{
  private static ImageRegistry imageRegistry;
  private static ImageDescriptorRegistry descRegistry;
  private static String ICONS_PATH = "$nl$/icons/";
  static final String ELCL = ICONS_PATH + "elcl16/";
  static final String OVR = ICONS_PATH + "ovr16/";
  static final String DLCL = ICONS_PATH + "dlcl16/";
  
  private static void declareImages()
  {
    declareRegistryImage("IMG_SCRIPT", ELCL + "script.gif");
    declareRegistryImage("IMG_RHINO", ELCL + "rhino.gif");
    declareRegistryImage("IMG_MAIN_TAB", ELCL + "main_tab.gif");
    declareRegistryImage("IMG_LIBRARY", ELCL + "library.gif");
  }
  
  private static final void declareRegistryImage(String key, String path)
  {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle("org.eclipse.wst.jsdt.debug.rhino.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.rhino.ui.RhinoImageRegistry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.rhino.ui;

import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;

public class RhinoPropertyTester
  extends PropertyTester
{
  static final String IS_SCRIPT = "isScript";
  
  public boolean test(Object receiver, String property, Object[] args, Object expectedValue)
  {
    if ((receiver instanceof IAdaptable))
    {
      IAdaptable adaptable = (IAdaptable)receiver;
      if ("isScript".equals(property)) {
        return isScript(adaptable);
      }
    }
    return false;
  }
  
  boolean isScript(IAdaptable element)
  {
    IJavaScriptElement jselement = (IJavaScriptElement)element.getAdapter(IJavaScriptElement.class);
    if (jselement != null)
    {
      int type = jselement.getElementType();
      return type == 5;
    }
    IFile file = (IFile)element.getAdapter(IFile.class);
    if (file != null) {
      return "js".equals(file.getFileExtension());
    }
    return false;
  }
}

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

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.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleContext;

public class RhinoUIPlugin
  extends AbstractUIPlugin
{
  public static final int INTERNAL_ERROR = 120;
  public static final String PLUGIN_ID = "org.eclipse.wst.jsdt.debug.rhino.ui";
  private static RhinoUIPlugin plugin;
  private static IPreferenceStore corestore = new ScopedPreferenceStore(new InstanceScope(), "org.eclipse.wst.jsdt.debug.rhino");
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static RhinoUIPlugin 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 Rhino Debug: ", t));
  }
  
  public static void logErrorMessage(String message)
  {
    log(newErrorStatus("Internal message logged from Rhino Debug: " + message, null));
  }
  
  public static IStatus newErrorStatus(String message, Throwable exception)
  {
    return new Status(4, "org.eclipse.wst.jsdt.debug.rhino.ui", 120, message, exception);
  }
  
  public static IWorkbenchWindow getActiveWorkbenchWindow()
  {
    return getDefault().getWorkbench().getActiveWorkbenchWindow();
  }
  
  public static IWorkbenchPage getActivePage()
  {
    IWorkbenchWindow w = getActiveWorkbenchWindow();
    if (w != null) {
      return w.getActivePage();
    }
    return null;
  }
  
  public static IPreferenceStore getCorePreferenceStore()
  {
    return corestore;
  }
}

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

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;

class WorkbenchAdapter
  implements IWorkbenchAdapter
{
  public Object[] getChildren(Object o)
  {
    return null;
  }
  
  public ImageDescriptor getImageDescriptor(Object object)
  {
    return null;
  }
  
  protected ImageDescriptor getImageDescriptor(IJavaScriptElement element)
  {
    IWorkbenchAdapter adapter = (IWorkbenchAdapter)element.getAdapter(IWorkbenchAdapter.class);
    if (adapter != null) {
      return adapter.getImageDescriptor(element);
    }
    return null;
  }
  
  public String getLabel(Object o)
  {
    return null;
  }
  
  public Object getParent(Object o)
  {
    return null;
  }
}

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

public class IncludeEntry
{
  public static final int LOCAL_SCRIPT = 1;
  public static final int EXT_SCRIPT = 2;
  int kind = -1;
  String path = null;
  
  public IncludeEntry(int kind, String path)
  {
    this.kind = kind;
    this.path = path;
  }
  
  public int getKind()
  {
    return kind;
  }
  
  public String getPath()
  {
    return path;
  }
  
  public String string()
  {
    return kind + path;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof IncludeEntry))
    {
      IncludeEntry entry = (IncludeEntry)obj;
      return (kind == kind) && (path.equals(path));
    }
    return false;
  }
  
  public int hashCode()
  {
    return kind + path.hashCode();
  }
}

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

import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;

class IncludeTab$1
  implements ISelectionChangedListener
{
  final IncludeTab this$0;
  
  IncludeTab$1(IncludeTab paramIncludeTab)
  {
    this$0 = paramIncludeTab;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    this$0.updateButtons((IStructuredSelection)event.getSelection());
  }
}

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

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class IncludeTab$2
  extends SelectionAdapter
{
  final IncludeTab this$0;
  
  IncludeTab$2(IncludeTab paramIncludeTab)
  {
    this$0 = paramIncludeTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.up(((IStructuredSelection)IncludeTab.access$0(this$0).getSelection()).getFirstElement());
  }
}

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

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class IncludeTab$3
  extends SelectionAdapter
{
  final IncludeTab this$0;
  
  IncludeTab$3(IncludeTab paramIncludeTab)
  {
    this$0 = paramIncludeTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.down(((IStructuredSelection)IncludeTab.access$0(this$0).getSelection()).getFirstElement());
  }
}

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

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class IncludeTab$4
  extends SelectionAdapter
{
  final IncludeTab this$0;
  
  IncludeTab$4(IncludeTab paramIncludeTab)
  {
    this$0 = paramIncludeTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.remove((IStructuredSelection)IncludeTab.access$0(this$0).getSelection());
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class IncludeTab$5
  extends SelectionAdapter
{
  final IncludeTab this$0;
  
  IncludeTab$5(IncludeTab paramIncludeTab)
  {
    this$0 = paramIncludeTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.addScript();
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class IncludeTab$6
  extends SelectionAdapter
{
  final IncludeTab this$0;
  
  IncludeTab$6(IncludeTab paramIncludeTab)
  {
    this$0 = paramIncludeTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.addExtScript();
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class IncludeTab$7
  extends SelectionAdapter
{
  final IncludeTab this$0;
  
  IncludeTab$7(IncludeTab paramIncludeTab)
  {
    this$0 = paramIncludeTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.defaults();
  }
}

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

import org.eclipse.core.resources.IContainer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

class IncludeTab$ContainerFilter
  extends ViewerFilter
{
  final IncludeTab this$0;
  
  IncludeTab$ContainerFilter(IncludeTab paramIncludeTab)
  {
    this$0 = paramIncludeTab;
  }
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    return ((element instanceof IContainer)) && (((IContainer)element).isAccessible());
  }
}

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

import java.util.Vector;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

class IncludeTab$Contents
  implements ITreeContentProvider
{
  final IncludeTab this$0;
  
  IncludeTab$Contents(IncludeTab paramIncludeTab)
  {
    this$0 = paramIncludeTab;
  }
  
  public Object[] getElements(Object inputElement)
  {
    return ((Vector)inputElement).toArray();
  }
  
  public Object[] getChildren(Object parentElement)
  {
    return null;
  }
  
  public void dispose() {}
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
  
  public Object getParent(Object element)
  {
    return null;
  }
  
  public boolean hasChildren(Object element)
  {
    return false;
  }
}

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

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.jsdt.debug.internal.rhino.ui.RhinoImageRegistry;

class IncludeTab$Labels
  extends LabelProvider
{
  final IncludeTab this$0;
  
  IncludeTab$Labels(IncludeTab paramIncludeTab)
  {
    this$0 = paramIncludeTab;
  }
  
  public Image getImage(Object element)
  {
    IncludeEntry entry = (IncludeEntry)element;
    switch (kind)
    {
    case 1: 
      return RhinoImageRegistry.getSharedImage("IMG_SCRIPT");
    case 2: 
      return PlatformUI.getWorkbench().getSharedImages().getImage("IMG_OBJ_FILE");
    }
    return null;
  }
  
  public String getText(Object element)
  {
    IncludeEntry entry = (IncludeEntry)element;
    return path;
  }
}

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

import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Vector;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.wst.jsdt.debug.internal.rhino.ui.RhinoImageRegistry;
import org.eclipse.wst.jsdt.debug.internal.rhino.ui.refactoring.Refactoring;
import org.eclipse.wst.jsdt.debug.internal.ui.SWTFactory;
import org.eclipse.wst.jsdt.debug.internal.ui.dialogs.ScriptSelectionDialog;

public class IncludeTab
  extends AbstractLaunchConfigurationTab
{
  public static final String TAB_ID = "rhino.include.tab";
  public static final String JS_EXTENSION = "*.js";
  
  class Contents
    implements ITreeContentProvider
  {
    Contents() {}
    
    public Object[] getElements(Object inputElement)
    {
      return ((Vector)inputElement).toArray();
    }
    
    public Object[] getChildren(Object parentElement)
    {
      return null;
    }
    
    public void dispose() {}
    
    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
    
    public Object getParent(Object element)
    {
      return null;
    }
    
    public boolean hasChildren(Object element)
    {
      return false;
    }
  }
  
  class Labels
    extends LabelProvider
  {
    Labels() {}
    
    public Image getImage(Object element)
    {
      IncludeEntry entry = (IncludeEntry)element;
      switch (kind)
      {
      case 1: 
        return RhinoImageRegistry.getSharedImage("IMG_SCRIPT");
      case 2: 
        return PlatformUI.getWorkbench().getSharedImages().getImage("IMG_OBJ_FILE");
      }
      return null;
    }
    
    public String getText(Object element)
    {
      IncludeEntry entry = (IncludeEntry)element;
      return path;
    }
  }
  
  class ContainerFilter
    extends ViewerFilter
  {
    ContainerFilter() {}
    
    public boolean select(Viewer viewer, Object parentElement, Object element)
    {
      return ((element instanceof IContainer)) && (((IContainer)element).isAccessible());
    }
  }
  
  private TreeViewer viewer = null;
  private Button remove = null;
  private Button addexternalscript = null;
  private Button addscript = null;
  private Button defaults = null;
  private Button up = null;
  private Button down = null;
  private Vector includes = new Vector();
  private ILaunchConfiguration backingconfig = null;
  
  public void createControl(Composite parent)
  {
    Composite comp = SWTFactory.createComposite(parent, 2, 1, 768);
    SWTFactory.createWrapLabel(comp, Messages.include_path, 2);
    Tree tree = new Tree(comp, 67586);
    tree.setLayout(new GridLayout(1, true));
    tree.setLayoutData(new GridData(4, 4, true, true));
    viewer = new TreeViewer(tree);
    viewer.setLabelProvider(new Labels());
    viewer.setContentProvider(new Contents());
    viewer.setInput(includes);
    viewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        updateButtons((IStructuredSelection)event.getSelection());
      }
    });
    Composite lhs = SWTFactory.createComposite(comp, comp.getFont(), 1, 1, 1040, 0, 0);
    up = SWTFactory.createPushButton(lhs, Messages.up_button, null);
    up.setEnabled(false);
    up.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        up(((IStructuredSelection)viewer.getSelection()).getFirstElement());
      }
    });
    down = SWTFactory.createPushButton(lhs, Messages.down_button, null);
    down.setEnabled(false);
    down.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        down(((IStructuredSelection)viewer.getSelection()).getFirstElement());
      }
    });
    remove = SWTFactory.createPushButton(lhs, Messages.remove_button, null);
    remove.setEnabled(false);
    remove.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        remove((IStructuredSelection)viewer.getSelection());
      }
    });
    addscript = SWTFactory.createPushButton(lhs, Messages.add_script_button, null);
    addscript.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        addScript();
      }
    });
    addexternalscript = SWTFactory.createPushButton(lhs, Messages.add_ext_script_button, null);
    addexternalscript.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        addExtScript();
      }
    });
    SWTFactory.createHorizontalSpacer(lhs, 1);
    defaults = SWTFactory.createPushButton(lhs, Messages.defaults_button, null);
    defaults.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        defaults();
      }
    });
    PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, "org.eclipse.wst.jsdt.debug.rhino.ui.rhino_include_tab_context");
    setControl(comp);
  }
  
  public String getHelpContextId()
  {
    return "org.eclipse.wst.jsdt.debug.rhino.ui.rhino_include_tab_context";
  }
  
  void updateButtons(IStructuredSelection selection)
  {
    int size = selection.size();
    if (size == 1)
    {
      Object element = selection.getFirstElement();
      int idx = includes.indexOf(element);
      up.setEnabled(idx > 0);
      down.setEnabled(idx < includes.size() - 1);
    }
    else
    {
      if (up != null) {
        up.setEnabled(false);
      }
      if (down != null) {
        down.setEnabled(false);
      }
    }
    remove.setEnabled(size > 0);
  }
  
  void addScript()
  {
    ScriptSelectionDialog dialog = new ScriptSelectionDialog(getShell(), true, ResourcesPlugin.getWorkspace().getRoot());
    if (dialog.open() == 0)
    {
      Object[] scripts = dialog.getResult();
      IncludeEntry newentry = null;
      for (int i = 0; i < scripts.length; i++)
      {
        newentry = new IncludeEntry(1, ((IFile)scripts[i]).getFullPath().makeAbsolute().toString());
        if (!includes.contains(newentry)) {
          includes.add(newentry);
        }
      }
      viewer.refresh();
      updateLaunchConfigurationDialog();
    }
  }
  
  void up(Object element)
  {
    int idx = includes.indexOf(element);
    if (idx < 0) {
      return;
    }
    includes.remove(idx);
    includes.insertElementAt(element, idx - 1);
    viewer.refresh();
    updateLaunchConfigurationDialog();
  }
  
  void down(Object element)
  {
    int idx = includes.indexOf(element);
    if (idx < 0) {
      return;
    }
    includes.remove(idx);
    includes.insertElementAt(element, idx + 1);
    viewer.refresh();
    updateLaunchConfigurationDialog();
  }
  
  void remove(IStructuredSelection selection)
  {
    includes.removeAll(selection.toList());
    viewer.refresh();
    updateLaunchConfigurationDialog();
  }
  
  void defaults()
  {
    includes.clear();
    viewer.refresh();
    
    updateLaunchConfigurationDialog();
  }
  
  void addExtScript()
  {
    FileDialog dialog = new FileDialog(getShell(), 4098);
    dialog.setFilterExtensions(new String[] { "*.js" });
    dialog.setFilterIndex(0);
    dialog.setText(Messages.select_scripts_to_add);
    if (dialog.open() != null)
    {
      String[] names = dialog.getFileNames();
      if ((names != null) && (names.length > 0))
      {
        String path = dialog.getFilterPath();
        if (path != null)
        {
          boolean added = false;
          for (int i = 0; i < names.length; i++)
          {
            File script = new File(path, names[i]);
            if (script.exists())
            {
              includes.add(new IncludeEntry(2, new Path(script.getAbsolutePath()).toString()));
              added = true;
            }
          }
          if (added)
          {
            viewer.refresh();
            updateLaunchConfigurationDialog();
          }
        }
      }
    }
  }
  
  public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {}
  
  public void initializeFrom(ILaunchConfiguration configuration)
  {
    backingconfig = configuration;
    includes.clear();
    IncludeEntry[] entries = Refactoring.getIncludeEntries(backingconfig);
    for (int i = 0; i < entries.length; i++) {
      includes.add(entries[i]);
    }
    viewer.refresh();
  }
  
  public void performApply(ILaunchConfigurationWorkingCopy configuration)
  {
    if (includes.isEmpty())
    {
      configuration.removeAttribute("includepath");
    }
    else
    {
      ArrayList list = new ArrayList(includes.size());
      for (Iterator i = includes.iterator(); i.hasNext();) {
        list.add(((IncludeEntry)i.next()).string());
      }
      configuration.setAttribute("includepath", list);
    }
  }
  
  public String getName()
  {
    return Messages.include_tab_name;
  }
  
  public Image getImage()
  {
    return RhinoImageRegistry.getSharedImage("IMG_LIBRARY");
  }
  
  public String getId()
  {
    return "rhino.include.tab";
  }
}

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

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.messages";
  public static String _script;
  public static String add_ext_script_button;
  public static String add_script_button;
  public static String bro_wse;
  public static String computing_script_scope;
  public static String config_name;
  public static String configuring_rhino_debugger;
  public static String connect_thread;
  public static String creating_js_debug_target;
  public static String creating_rhino_vm;
  public static String defaults_button;
  public static String down_button;
  public static String ecma_version_to_interpret_with;
  public static String failed_to_compute_scope;
  public static String include_path;
  public static String include_tab_name;
  public static String launch_script;
  public static String launching__;
  public static String log_interpreter_exceptions;
  public static String main;
  public static String options_group_name;
  public static String process_label;
  public static String provide_script_for_project;
  public static String remove_button;
  public static String rhino_opt_level;
  public static String script_not_a_file;
  public static String script_not_accessible;
  public static String script_not_in_workspace;
  public static String script_selection;
  public static String select_existing_config;
  public static String select_rhino_config;
  public static String select_scripts_to_add;
  public static String starting_rhino_interpreter;
  public static String starting_rhino_process;
  public static String strict_mode;
  public static String up_button;
  
  static
  {
    NLS.initializeMessages("org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.messages", Messages.class);
  }
}

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

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.ILaunchShortcut2;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;
import org.eclipse.wst.jsdt.debug.internal.rhino.ui.RhinoUIPlugin;

public class RhinoLaunchShortcut
  implements ILaunchShortcut2
{
  public void launch(ISelection selection, String mode)
  {
    launch(getLaunchableResource(selection), mode);
  }
  
  public void launch(IEditorPart editor, String mode)
  {
    launch(getLaunchableResource(editor), mode);
  }
  
  void launch(IResource resource, String mode)
  {
    if (resource != null)
    {
      ILaunchConfiguration config = findConfig(resource);
      if (config == null)
      {
        ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType("org.eclipse.wst.jsdt.debug.rhino.ui.launch.config.type");
        String project = resource.getProject().getName();
        String script = (resource instanceof IFile) ? resource.getFullPath().toString() : null;
        try
        {
          if (script != null)
          {
            ILaunchConfigurationWorkingCopy copy = type.newInstance(null, NLS.bind(Messages.config_name, new String[] { project, resource.getName() }));
            copy.setAttribute("script", script);
            copy.setAttribute("logexceptions", true);
            copy.setAttribute("ecmaversion", "170");
            copy.setAttribute("optlevel", -1);
            copy.setAttribute("strictmode", false);
            copy.setMappedResources(new IResource[] { resource });
            config = copy.doSave();
          }
        }
        catch (CoreException ce)
        {
          RhinoUIPlugin.log(ce);
        }
      }
      if (config != null) {
        DebugUITools.launch(config, mode);
      }
    }
  }
  
  ILaunchConfiguration findConfig(IResource resource)
  {
    List candidates = Collections.EMPTY_LIST;
    try
    {
      ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
      ILaunchConfigurationType type = lm.getLaunchConfigurationType("org.eclipse.wst.jsdt.debug.rhino.ui.launch.config.type");
      ILaunchConfiguration[] configs = lm.getLaunchConfigurations(type);
      candidates = new ArrayList(configs.length);
      for (int i = 0; i < configs.length; i++)
      {
        ILaunchConfiguration config = configs[i];
        if ((config.hasAttribute("script")) && 
          (config.getAttribute("script", "").equals(resource.getFullPath().toString()))) {
          candidates.add(config);
        }
      }
    }
    catch (CoreException e)
    {
      RhinoUIPlugin.log(e);
    }
    int candidateCount = candidates.size();
    if (candidateCount == 1) {
      return (ILaunchConfiguration)candidates.get(0);
    }
    if (candidateCount > 1) {
      return chooseConfiguration(candidates);
    }
    return null;
  }
  
  protected ILaunchConfiguration chooseConfiguration(List configList)
  {
    IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(RhinoUIPlugin.getActiveWorkbenchWindow().getShell(), labelProvider);
    dialog.setElements(configList.toArray());
    dialog.setTitle(Messages.select_rhino_config);
    dialog.setMessage(Messages.select_existing_config);
    dialog.setMultipleSelection(false);
    int result = dialog.open();
    labelProvider.dispose();
    if (result == 0) {
      return (ILaunchConfiguration)dialog.getFirstResult();
    }
    return null;
  }
  
  public ILaunchConfiguration[] getLaunchConfigurations(ISelection selection)
  {
    return null;
  }
  
  public ILaunchConfiguration[] getLaunchConfigurations(IEditorPart editorpart)
  {
    return null;
  }
  
  public IResource getLaunchableResource(ISelection selection)
  {
    if ((selection instanceof IStructuredSelection))
    {
      IStructuredSelection ss = (IStructuredSelection)selection;
      Object obj = ss.getFirstElement();
      if ((obj instanceof IAdaptable)) {
        return getResource((IAdaptable)obj);
      }
    }
    return null;
  }
  
  public IResource getLaunchableResource(IEditorPart editorpart)
  {
    return getResource(editorpart.getEditorInput());
  }
  
  IResource getResource(IAdaptable adaptable)
  {
    IJavaScriptElement element = (IJavaScriptElement)adaptable.getAdapter(IJavaScriptElement.class);
    if (element != null) {
      return element.getResource();
    }
    return (IResource)adaptable.getAdapter(IResource.class);
  }
}

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

import java.util.Map;
import org.eclipse.wst.jsdt.debug.core.jsdi.VirtualMachine;
import 
1 2 3

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