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

me:     org.eclipse.wst.jsdt.debug.internal.rhino.ui.refactoring.FolderMoveParticipant
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.debug.internal.rhino.ui.refactoring;

import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;

public class FolderRenameParticipant
  extends RenameParticipant
{
  private IFolder folder = null;
  
  protected boolean initialize(Object element)
  {
    folder = ((IFolder)element);
    return true;
  }
  
  public String getName()
  {
    return Messages.rhino_lc_participant;
  }
  
  public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context)
    throws OperationCanceledException
  {
    return new RefactoringStatus();
  }
  
  public Change createChange(IProgressMonitor pm)
    throws CoreException, OperationCanceledException
  {
    IPath name = folder.getFullPath().makeAbsolute();
    name = name.removeLastSegments(1).append(getArguments().getNewName());
    return Refactoring.createChangesForFolderRename(folder, name.toOSString());
  }
}

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

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.refactoring.messages";
  public static String config_no_longer_exists;
  public static String multi_updates;
  public static String rhino_lc_participant;
  public static String update_attributes;
  
  static
  {
    NLS.initializeMessages("org.eclipse.wst.jsdt.debug.internal.rhino.ui.refactoring.messages", Messages.class);
  }
}

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

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
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.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.ltk.core.refactoring.Change;

public class ProjectChange
  extends RhinoChange
{
  public ProjectChange(ILaunchConfiguration configuration, String oldname, String newname)
  {
    super(configuration, oldname, newname);
  }
  
  public Change perform(IProgressMonitor pm)
    throws CoreException
  {
    ILaunchConfigurationWorkingCopy copy = configuration.getWorkingCopy();
    
    String value = computeNewContainerName(configuration);
    if (value != null)
    {
      IWorkspace workspace = ResourcesPlugin.getWorkspace();
      IWorkspaceRoot root = workspace.getRoot();
      IProject project = root.getProject(newname);
      IContainer cont = (IContainer)project.findMember(value);
      copy.setContainer(cont);
    }
    value = computeNewScriptName(configuration);
    if (value != null) {
      copy.setAttribute("script", value);
    }
    updateIncludeEntries(copy);
    
    value = computeNewConfigurationName(configuration);
    if (value != null) {
      copy.rename(value);
    }
    Refactoring.mapResources(copy);
    if (copy.isDirty())
    {
      configuration = copy.doSave();
      return new ProjectChange(configuration, newname, oldname);
    }
    return null;
  }
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;

public class ProjectRenameParticipant
  extends RenameParticipant
{
  private IProject origproject = null;
  
  protected boolean initialize(Object element)
  {
    origproject = ((IProject)element);
    return true;
  }
  
  public String getName()
  {
    return Messages.rhino_lc_participant;
  }
  
  public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context)
    throws OperationCanceledException
  {
    return new RefactoringStatus();
  }
  
  public Change createChange(IProgressMonitor pm)
    throws CoreException, OperationCanceledException
  {
    return Refactoring.createChangesForProjectRename(origproject, getArguments().getNewName());
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
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.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.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.wst.jsdt.debug.internal.rhino.ui.RhinoUIPlugin;
import org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.IncludeEntry;

public class Refactoring
{
  public static ILaunchConfiguration[] NO_CONFIGS = new ILaunchConfiguration[0];
  public static IncludeEntry[] NO_ENTRIES = new IncludeEntry[0];
  
  public static Change createChangesForProjectRename(IProject project, String newname)
  {
    ILaunchConfiguration[] configs = getConfigurationsScopedTo(project.getFullPath().makeAbsolute().toString());
    if (configs.length < 1) {
      return null;
    }
    ArrayList changes = new ArrayList(configs.length);
    for (int i = 0; i < configs.length; i++) {
      changes.add(new ProjectChange(configs[i], project.getName(), newname));
    }
    return createChangeFromList(changes, Messages.multi_updates);
  }
  
  public static Change createChangesForScriptRename(IFile script, String newname)
  {
    String scriptname = script.getFullPath().makeAbsolute().toString();
    ILaunchConfiguration[] configs = getConfigurationsScopedTo(scriptname);
    if (configs.length < 1) {
      return null;
    }
    ArrayList changes = new ArrayList(configs.length);
    for (int i = 0; i < configs.length; i++) {
      changes.add(new ScriptChange(configs[i], scriptname, newname));
    }
    return createChangeFromList(changes, Messages.multi_updates);
  }
  
  public static Change createChangesForFolderRename(IFolder folder, String newname)
  {
    String foldername = folder.getFullPath().makeAbsolute().toString();
    ILaunchConfiguration[] configs = getConfigurationsScopedTo(foldername);
    if (configs.length < 1) {
      return null;
    }
    ArrayList changes = new ArrayList(configs.length);
    for (int i = 0; i < configs.length; i++) {
      changes.add(new FolderChange(configs[i], foldername, newname));
    }
    return createChangeFromList(changes, Messages.multi_updates);
  }
  
  public static IResource[] getResources(ILaunchConfiguration configuration)
  {
    ArrayList resources = new ArrayList(2);
    try
    {
      IFile script = getScript(configuration);
      if (script != null) {
        resources.add(script);
      }
    }
    catch (CoreException ce)
    {
      RhinoUIPlugin.log(ce);
    }
    return (IResource[])resources.toArray(new IResource[resources.size()]);
  }
  
  public static IFile getScript(ILaunchConfiguration configuration)
    throws CoreException
  {
    String name = configuration.getAttribute("script", "");
    if (!"".equals(name))
    {
      IPath spath = new Path(name);
      IResource script = ResourcesPlugin.getWorkspace().getRoot().findMember(spath);
      if ((script != null) && (script.getType() == 1)) {
        return (IFile)script;
      }
    }
    return null;
  }
  
  public static void mapResources(ILaunchConfigurationWorkingCopy configuration)
  {
    IResource[] resources = getResources(configuration);
    if (resources.length < 1) {
      configuration.setMappedResources(null);
    } else {
      configuration.setMappedResources(resources);
    }
  }
  
  public static Change createChangeFromList(List changes, String changeLabel)
  {
    int count = changes.size();
    if (count == 0) {
      return null;
    }
    if (count == 1) {
      return (Change)changes.get(0);
    }
    return new CompositeChange(changeLabel, (Change[])changes.toArray(new Change[changes.size()]));
  }
  
  public static ILaunchConfiguration[] getRhinoConfigurations()
  {
    ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType type = lm.getLaunchConfigurationType("org.eclipse.wst.jsdt.debug.rhino.ui.launch.config.type");
    if (type != null) {
      try
      {
        return lm.getLaunchConfigurations(type);
      }
      catch (CoreException localCoreException) {}
    }
    return NO_CONFIGS;
  }
  
  public static ILaunchConfiguration[] getConfigurationsScopedTo(String elementpath)
  {
    if (elementpath == null) {
      return NO_CONFIGS;
    }
    ILaunchConfiguration[] configs = getRhinoConfigurations();
    ArrayList scoped = new ArrayList(4);
    List includes = null;
    String script = null;
    for (int i = 0; i < configs.length; i++) {
      try
      {
        script = configs[i].getAttribute("script", "");
        if ((elementpath.equals(script)) || (script.indexOf(elementpath) > -1))
        {
          scoped.add(configs[i]);
        }
        else
        {
          includes = configs[i].getAttribute("includepath", null);
          if ((includes != null) && (hasIncludeEntryFor(includes, elementpath))) {
            scoped.add(configs[i]);
          }
        }
      }
      catch (CoreException localCoreException) {}
    }
    return (ILaunchConfiguration[])scoped.toArray(new ILaunchConfiguration[scoped.size()]);
  }
  
  public static boolean hasIncludeEntryFor(List includes, String elementpath)
  {
    if ((includes == null) || (elementpath == null)) {
      return false;
    }
    String entry = null;
    String path = null;
    for (int i = 0; i < includes.size(); i++)
    {
      entry = (String)includes.get(i);
      path = entry.substring(1);
      if ((elementpath.equals(path)) || (path.indexOf(elementpath) > -1)) {
        return true;
      }
    }
    return false;
  }
  
  public static final IncludeEntry[] findIncludeEntries(List includes, String elementpath)
  {
    if ((includes == null) || (elementpath == null)) {
      return NO_ENTRIES;
    }
    String entry = null;
    String path = null;
    ArrayList list = new ArrayList();
    for (int i = 0; i < includes.size(); i++)
    {
      entry = (String)includes.get(i);
      path = entry.substring(1);
      if ((elementpath.equals(path)) || (path.indexOf(elementpath) > -1)) {
        try
        {
          list.add(new IncludeEntry(Integer.parseInt(entry.substring(0, 1)), path));
        }
        catch (NumberFormatException localNumberFormatException) {}
      }
    }
    return (IncludeEntry[])list.toArray(new IncludeEntry[list.size()]);
  }
  
  public static final IncludeEntry[] getIncludeEntries(ILaunchConfiguration configuration)
  {
    try
    {
      List includes = configuration.getAttribute("includepath", null);
      if (includes != null)
      {
        ArrayList entries = new ArrayList(includes.size());
        String entry = null;
        for (int i = 0; i < includes.size(); i++)
        {
          entry = (String)includes.get(i);
          try
          {
            entries.add(new IncludeEntry(Integer.parseInt(entry.substring(0, 1)), entry.substring(1)));
          }
          catch (NumberFormatException localNumberFormatException) {}
        }
        return (IncludeEntry[])entries.toArray(new IncludeEntry[entries.size()]);
      }
    }
    catch (CoreException localCoreException) {}
    return NO_ENTRIES;
  }
}

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

import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.IncludeEntry;

public abstract class RhinoChange
  extends Change
{
  protected String oldname = null;
  protected String newname = null;
  protected ILaunchConfiguration configuration = null;
  
  public RhinoChange(ILaunchConfiguration configuration, String oldname, String newname)
  {
    this.configuration = configuration;
    this.oldname = oldname;
    this.newname = newname;
  }
  
  public String getName()
  {
    return NLS.bind(Messages.update_attributes, new String[] { configuration.getName(), newname });
  }
  
  public void initializeValidationData(IProgressMonitor pm) {}
  
  public RefactoringStatus isValid(IProgressMonitor pm)
    throws CoreException, OperationCanceledException
  {
    if (!configuration.exists()) {
      return RefactoringStatus.createErrorStatus(NLS.bind(Messages.config_no_longer_exists, configuration.getName()));
    }
    return new RefactoringStatus();
  }
  
  public Object getModifiedElement()
  {
    return configuration;
  }
  
  protected String computeNewContainerName(ILaunchConfiguration configuration)
  {
    IFile file = configuration.getFile();
    if (file != null) {
      return file.getParent().getProjectRelativePath().toString();
    }
    return null;
  }
  
  protected String computeNewConfigurationName(ILaunchConfiguration configuration)
  {
    String name = configuration.getName();
    IPath old = new Path(oldname);
    String nametofind = old.segmentCount() > 1 ? old.lastSegment() : oldname;
    int idx = name.indexOf(nametofind);
    if (idx > -1)
    {
      IPath neww = new Path(newname);
      String replacement = neww.segmentCount() > 1 ? neww.lastSegment() : newname;
      return name.replaceAll(nametofind, replacement);
    }
    return null;
  }
  
  protected String computeNewScriptName(ILaunchConfiguration configuration)
  {
    try
    {
      String attr = configuration.getAttribute("script", "");
      return computeNewName(attr);
    }
    catch (CoreException localCoreException) {}
    return null;
  }
  
  protected void updateIncludeEntries(ILaunchConfigurationWorkingCopy copy)
    throws CoreException
  {
    List includes = copy.getAttribute("includepath", null);
    if (includes != null)
    {
      IncludeEntry[] entries = Refactoring.findIncludeEntries(includes, oldname);
      String sname = null;
      for (int i = 0; i < entries.length; i++)
      {
        sname = computeNewName(entries[i].getPath());
        if ((sname != null) && (!oldname.equals(sname)))
        {
          int idx = includes.indexOf(entries[i].string());
          if (idx > -1)
          {
            includes.remove(idx);
            includes.add(idx, new IncludeEntry(entries[i].getKind(), sname).string());
          }
        }
      }
      copy.setAttribute("includepath", includes);
    }
  }
  
  protected String computeNewName(String name)
  {
    IPath path = new Path(name);
    IPath old = new Path(oldname);
    if (old.isPrefixOf(path))
    {
      path = path.removeFirstSegments(old.segmentCount());
      path = new Path(newname).append(path);
      return path.makeAbsolute().toString();
    }
    return path.toString().replaceAll(oldname, newname);
  }
}

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

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.ltk.core.refactoring.Change;

public class ScriptChange
  extends RhinoChange
{
  public ScriptChange(ILaunchConfiguration configuration, String oldname, String newname)
  {
    super(configuration, oldname, newname);
  }
  
  public Change perform(IProgressMonitor pm)
    throws CoreException
  {
    ILaunchConfigurationWorkingCopy copy = configuration.getWorkingCopy();
    
    String oldscript = copy.getAttribute("script", null);
    if (oldname.equals(oldscript)) {
      copy.setAttribute("script", newname);
    }
    updateIncludeEntries(copy);
    
    String value = computeNewConfigurationName(configuration);
    if (value != null) {
      copy.rename(value);
    }
    Refactoring.mapResources(copy);
    if (copy.isDirty())
    {
      configuration = copy.doSave();
      return new ScriptChange(configuration, newname, oldname);
    }
    return null;
  }
}

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

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;

public class ScriptMoveParticipant
  extends MoveParticipant
{
  private IFile script = null;
  
  protected boolean initialize(Object element)
  {
    script = ((IFile)element);
    return true;
  }
  
  public String getName()
  {
    return Messages.rhino_lc_participant;
  }
  
  public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context)
    throws OperationCanceledException
  {
    return new RefactoringStatus();
  }
  
  public Change createChange(IProgressMonitor pm)
    throws CoreException, OperationCanceledException
  {
    IContainer locale = (IContainer)getArguments().getDestination();
    return Refactoring.createChangesForScriptRename(script, locale.getFullPath().append(script.getName()).makeAbsolute().toOSString());
  }
}

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

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;

public class ScriptRenameParticipant
  extends RenameParticipant
{
  private IFile script = null;
  
  protected boolean initialize(Object element)
  {
    script = ((IFile)element);
    return true;
  }
  
  public String getName()
  {
    return Messages.rhino_lc_participant;
  }
  
  public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context)
    throws OperationCanceledException
  {
    return new RefactoringStatus();
  }
  
  public Change createChange(IProgressMonitor pm)
    throws CoreException, OperationCanceledException
  {
    IPath name = script.getFullPath().makeAbsolute();
    name = name.removeLastSegments(1).append(getArguments().getNewName());
    return Refactoring.createChangesForScriptRename(script, name.toOSString());
  }
}

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

import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;

public class RhinoSourceDirector
  extends AbstractSourceLookupDirector
{
  public void initializeParticipants()
  {
    addParticipants(new ISourceLookupParticipant[] { new RhinoSourceLookupParticipant() });
  }
  
  public boolean isFindDuplicates()
  {
    return true;
  }
}

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

import java.net.URI;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
import org.eclipse.wst.jsdt.debug.internal.core.launching.SourceLookup;

public class RhinoSourceLookupParticipant
  extends AbstractSourceLookupParticipant
{
  public String getSourceName(Object object)
    throws CoreException
  {
    return SourceLookup.getSourceName(object);
  }
  
  public Object[] findSourceElements(Object object)
    throws CoreException
  {
    Object[] source = super.findSourceElements(object);
    if (source.length < 1)
    {
      URI uri = SourceLookup.getSourceURI(object);
      if (uri != null)
      {
        IFile file = SourceLookup.getExternalSource(uri, object);
        if (file != null) {
          return new Object[] { file };
        }
      }
    }
    else
    {
      return source;
    }
    return EMPTY;
  }
  
  public boolean isFindDuplicates()
  {
    return false;
  }
}

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

import java.io.File;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
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.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate;
import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer;
import org.eclipse.wst.jsdt.debug.internal.rhino.ui.refactoring.Refactoring;

public class RhinoSourcePathComputer
  implements ISourcePathComputerDelegate
{
  static final ISourceContainer[] NO_CONTAINERS = new ISourceContainer[0];
  
  public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor)
    throws CoreException
  {
    HashSet containers = new HashSet();
    List includes = configuration.getAttribute("includepath", null);
    if (includes != null)
    {
      String entry = null;String name = null;
      for (Iterator i = includes.iterator(); i.hasNext();)
      {
        entry = (String)i.next();
        int kind = Integer.parseInt(entry.substring(0, 1));
        name = entry.substring(1);
        switch (kind)
        {
        case 1: 
          IFile file = (IFile)ResourcesPlugin.getWorkspace().getRoot().findMember(name);
          if (file != null) {
            containers.add(new FolderSourceContainer(file.getParent(), false));
          }
          break;
        case 2: 
          File file = new File(name);
          if (file.exists()) {
            containers.add(new DirectorySourceContainer(file.getParentFile(), false));
          }
          break;
        }
      }
    }
    IFile script = Refactoring.getScript(configuration);
    if (script != null) {
      containers.add(new FolderSourceContainer(script.getParent(), false));
    }
    return (ISourceContainer[])containers.toArray(new ISourceContainer[containers.size()]);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.debug.internal.rhino.ui.source.RhinoSourcePathComputer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
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-2019. Infinite Loop Ltd