org.eclipse.linuxtools.binutils_4.0.0.201310101546

16:46:03.419 INFO  jd.cli.Main - Decompiling org.eclipse.linuxtools.binutils_4.0.0.201310101546.jar
package org.eclipse.linuxtools.binutils;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.linuxtools.binutils";
  private static Activator plugin;
  
  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 Activator getDefault()
  {
    return plugin;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.Activator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.link2source;

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

class STCSourceNotFoundEditor$1
  extends SelectionAdapter
{
  STCSourceNotFoundEditor$1(STCSourceNotFoundEditor paramSTCSourceNotFoundEditor) {}
  
  public void widgetSelected(SelectionEvent evt)
  {
    this$0.locateFile();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditor.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.link2source;

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

class STCSourceNotFoundEditor$2
  extends SelectionAdapter
{
  STCSourceNotFoundEditor$2(STCSourceNotFoundEditor paramSTCSourceNotFoundEditor) {}
  
  public void widgetSelected(SelectionEvent evt)
  {
    this$0.editSourceLookupPath();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditor.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.link2source;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.dialogs.PreferencesUtil;

public class STCSourceNotFoundEditor
  extends CommonSourceNotFoundEditor
{
  private static final String foundMappingsContainerName = "Found Mappings";
  private Button locateFileButton;
  private Button editLookupButton;
  
  public void createPartControl(Composite parent)
  {
    super.createPartControl(parent);
  }
  
  private IPath getMissingFile()
  {
    IEditorInput i = getEditorInput();
    if ((i instanceof STCSourceNotFoundEditorInput))
    {
      STCSourceNotFoundEditorInput input = (STCSourceNotFoundEditorInput)i;
      return input.getSourcePath();
    }
    return null;
  }
  
  private int getLineNumber()
  {
    IEditorInput i = getEditorInput();
    if ((i instanceof STCSourceNotFoundEditorInput))
    {
      STCSourceNotFoundEditorInput input = (STCSourceNotFoundEditorInput)i;
      return input.getLineNumber();
    }
    return -1;
  }
  
  private IProject getProject()
  {
    IEditorInput i = getEditorInput();
    if ((i instanceof STCSourceNotFoundEditorInput))
    {
      STCSourceNotFoundEditorInput input = (STCSourceNotFoundEditorInput)i;
      return input.getProject();
    }
    return null;
  }
  
  public void setInput(IEditorInput input)
  {
    super.setInput(input);
    syncButtons();
  }
  
  private boolean isValidMissingFile()
  {
    IPath p = getMissingFile();
    boolean v = (p != null) && (p.toString().length() > 0);
    return v;
  }
  
  private void syncButtons()
  {
    boolean v = isValidMissingFile();
    if (locateFileButton != null) {
      locateFileButton.setVisible(v);
    }
    if (editLookupButton != null) {
      editLookupButton.setVisible(v);
    }
  }
  
  protected String getText()
  {
    boolean v = isValidMissingFile();
    if (v) {
      return 
      
        "Can't find a source file at \"" + getMissingFile() + "\" \n";
    }
    return "No source available for \"\"";
  }
  
  protected void createButtons(Composite parent)
  {
    locateFileButton = new Button(parent, 8);
    GridData data = new GridData();
    grabExcessHorizontalSpace = false;
    grabExcessVerticalSpace = false;
    locateFileButton.setLayoutData(data);
    locateFileButton.setText("Locate File...");
    locateFileButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent evt)
      {
        locateFile();
      }
    });
    editLookupButton = new Button(parent, 8);
    GridData data = new GridData();
    grabExcessHorizontalSpace = false;
    grabExcessVerticalSpace = false;
    editLookupButton.setLayoutData(data);
    editLookupButton.setText("Edit Source Lookup Path...");
    editLookupButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent evt)
      {
        editSourceLookupPath();
      }
    });
    syncButtons();
  }
  
  protected void editSourceLookupPath()
  {
    PreferenceDialog d = PreferencesUtil.createPreferenceDialogOn(null, "org.eclipse.cdt.debug.ui.SourcePreferencePage", null, null);
    if (d.open() == 0)
    {
      closeEditor();
      openSourceFileAtLocation(getProject(), getMissingFile(), getLineNumber());
    }
  }
  
  private void addSourceMappingToDirector(IPath missingPath, IPath newSourcePath, AbstractSourceLookupDirector director)
    throws CoreException
  {
    ArrayList<ISourceContainer> containerList = new ArrayList(Arrays.asList(
      director.getSourceContainers()));
    
    boolean hasFoundMappings = false;
    MappingSourceContainer foundMappings = null;
    for (Iterator<ISourceContainer> iter = containerList.iterator(); (iter.hasNext()) && (!hasFoundMappings);)
    {
      ISourceContainer container = (ISourceContainer)iter.next();
      if ((container instanceof MappingSourceContainer))
      {
        hasFoundMappings = container.getName().equals("Found Mappings");
        if (hasFoundMappings) {
          foundMappings = (MappingSourceContainer)container;
        }
      }
    }
    if (!hasFoundMappings)
    {
      foundMappings = new MappingSourceContainer("Found Mappings");
      foundMappings.init(director);
      containerList.add(foundMappings);
    }
    foundMappings.addMapEntry(new MapEntrySourceContainer(missingPath, newSourcePath));
    director.setSourceContainers((ISourceContainer[])containerList.toArray(new ISourceContainer[containerList.size()]));
  }
  
  private void addSourceMappingToCommon(IPath missingPath, IPath newSourcePath)
    throws CoreException
  {
    AbstractSourceLookupDirector director = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector();
    addSourceMappingToDirector(missingPath, newSourcePath, director);
    CDebugCorePlugin.getDefault().savePluginPreferences();
  }
  
  protected void locateFile()
  {
    FileDialog dialog = new FileDialog(getEditorSite().getShell(), 0);
    IPath missingPath = getMissingFile();
    dialog.setFilterNames(new String[] { "Missing Source File" });
    dialog.setFilterExtensions(new String[] { "*." + missingPath.getFileExtension() });
    String res = dialog.open();
    if (res != null)
    {
      Path newPath = new Path(res);
      if (newPath.lastSegment().equalsIgnoreCase(missingPath.lastSegment()))
      {
        if (missingPath.segmentCount() > 1)
        {
          int missingPathSegCount = missingPath.segmentCount() - 2;
          int newPathSegCount = newPath.segmentCount() - 2;
          while ((missingPathSegCount >= 0) && (newPathSegCount >= 0))
          {
            if (!newPath.segment(newPathSegCount).equalsIgnoreCase(missingPath.segment(missingPathSegCount))) {
              break;
            }
            newPathSegCount--;
            missingPathSegCount--;
          }
          IPath compPath = missingPath.removeLastSegments(missingPath.segmentCount() - missingPathSegCount - 1);
          IPath newSourcePath = newPath.removeLastSegments(newPath.segmentCount() - newPathSegCount - 1);
          try
          {
            addSourceMappingToCommon(compPath, newSourcePath);
          }
          catch (CoreException localCoreException) {}
        }
        openSourceFileAtLocation(getProject(), newPath, getLineNumber());
        closeEditor();
      }
    }
  }
  
  protected void openSourceFileAtLocation(IProject project, IPath sourceLoc, int lineNumber)
  {
    STLink2SourceSupport.sharedInstance.openSourceFileAtLocation(project, sourceLoc, lineNumber);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditor
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.link2source;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.linuxtools.binutils.Activator;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;

public class STCSourceNotFoundEditorInput
  implements IEditorInput
{
  private final IProject project;
  private final IPath sourcePath;
  private final int lineNumber;
  
  public STCSourceNotFoundEditorInput(IProject project, IPath sourcePath, int lineNumber)
  {
    this.project = project;
    this.sourcePath = sourcePath;
    this.lineNumber = lineNumber;
  }
  
  public boolean exists()
  {
    return false;
  }
  
  public ImageDescriptor getImageDescriptor()
  {
    return Activator.imageDescriptorFromPlugin("org.eclipse.linuxtools.binutils", "icons/c_file_obj.gif");
  }
  
  public String getName()
  {
    return sourcePath.lastSegment() + ":" + lineNumber;
  }
  
  public IPersistableElement getPersistable()
  {
    return null;
  }
  
  public String getToolTipText()
  {
    return "Source not found";
  }
  
  public Object getAdapter(Class adapter)
  {
    return null;
  }
  
  public IProject getProject()
  {
    return project;
  }
  
  public IPath getSourcePath()
  {
    return sourcePath;
  }
  
  public int getLineNumber()
  {
    return lineNumber;
  }
  
  public int hashCode()
  {
    int result = 1;
    result = 31 * result + (project == null ? 0 : project.hashCode());
    result = 31 * result + (
      sourcePath == null ? 0 : sourcePath.hashCode());
    return result;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    STCSourceNotFoundEditorInput other = (STCSourceNotFoundEditorInput)obj;
    if (project == null)
    {
      if (project != null) {
        return false;
      }
    }
    else if (!project.equals(project)) {
      return false;
    }
    if (sourcePath == null)
    {
      if (sourcePath != null) {
        return false;
      }
    }
    else if (!sourcePath.equals(sourcePath)) {
      return false;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditorInput
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.link2source;

import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IOutputEntry;
import org.eclipse.cdt.core.model.ISourceRoot;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.utils.Addr64;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
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.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.linuxtools.binutils.Activator;
import org.eclipse.linuxtools.binutils.utils.STSymbolManager;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;

public class STLink2SourceSupport
{
  public static final STLink2SourceSupport sharedInstance = new STLink2SourceSupport();
  
  public boolean openSourceFileAtSymbol(IBinaryParser.ISymbol symbol)
  {
    if (symbol == null) {
      return false;
    }
    return openSourceFileAtSymbol(symbol.getBinaryObject(), symbol);
  }
  
  public boolean openSourceFileAtLocation(String binaryLoc, String addr2lineOutput)
    throws IOException
  {
    if (binaryLoc == null) {
      return false;
    }
    return openSourceFileAtLocation(new Path(binaryLoc), addr2lineOutput);
  }
  
  public boolean openSourceFileAtLocation(String binaryLoc, String sourceLoc, String lineNumber)
    throws IOException
  {
    if (binaryLoc == null) {
      return false;
    }
    return openSourceFileAtLocation(new Path(binaryLoc), sourceLoc, lineNumber);
  }
  
  public boolean openSourceFileAtLocation(String binaryLoc, String sourceLoc, int lineNumber)
    throws IOException
  {
    if (binaryLoc == null) {
      return false;
    }
    return openSourceFileAtLocation(new Path(binaryLoc), sourceLoc, lineNumber);
  }
  
  public boolean openSourceFileAtAddress(String binaryLoc, long address)
    throws IOException
  {
    if (binaryLoc == null) {
      return false;
    }
    return openSourceFileAtAddress(new Path(binaryLoc), address);
  }
  
  public boolean openSourceFileAtAddress(String binaryLoc, String address)
    throws IOException
  {
    if (binaryLoc == null) {
      return false;
    }
    return openSourceFileAtAddress(new Path(binaryLoc), address);
  }
  
  public boolean openSourceFileAtLocation(IPath binaryLoc, String addr2lineOutput)
    throws IOException
  {
    String filename = getFileName(addr2lineOutput);
    int lineNumber = getLineNumber(addr2lineOutput);
    return openSourceFileAtLocation(binaryLoc, filename, lineNumber);
  }
  
  public boolean openSourceFileAtLocation(IPath binaryLoc, String sourceLoc, String lineNumber)
    throws IOException
  {
    int _lineNumber = -1;
    try
    {
      _lineNumber = Integer.parseInt(lineNumber);
    }
    catch (Exception localException) {}
    return openSourceFileAtLocation(binaryLoc, sourceLoc, _lineNumber);
  }
  
  public boolean openSourceFileAtLocation(IPath binaryLoc, String sourceLoc, int lineNumber)
    throws IOException
  {
    if (sourceLoc == null) {
      return false;
    }
    IPath p = new Path(sourceLoc);
    return openSourceFileAtLocation(binaryLoc, p, lineNumber);
  }
  
  public boolean openSourceFileAtLocation(IPath binaryLoc, IPath sourceLoc, int lineNumber)
  {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IFile binary = root.getFileForLocation(binaryLoc);
    IProject project = null;
    if (binary != null) {
      project = binary.getProject();
    }
    return openFileImpl(project, sourceLoc, lineNumber);
  }
  
  public boolean openSourceFileAtLocation(IProject project, String sourceLoc, int lineNumber)
    throws IOException
  {
    if (sourceLoc == null) {
      return false;
    }
    IPath p = new Path(sourceLoc);
    return openFileImpl(project, p, lineNumber);
  }
  
  public boolean openSourceFileAtLocation(IProject project, IPath sourceLoc, int lineNumber)
  {
    return openFileImpl(project, sourceLoc, lineNumber);
  }
  
  public boolean openSourceFileAtAddress(IPath binaryLoc, long address)
    throws IOException
  {
    IBinaryParser.IBinaryObject bf = STSymbolManager.sharedInstance.getBinaryObject(binaryLoc);
    if (bf != null) {
      return openSourceFileAtAddress(bf, address);
    }
    return false;
  }
  
  public boolean openSourceFileAtAddress(IPath binaryLoc, String address)
    throws IOException
  {
    IBinaryParser.IBinaryObject bf = STSymbolManager.sharedInstance.getBinaryObject(binaryLoc);
    if (bf != null) {
      return openSourceFileAtAddress(bf, address);
    }
    return false;
  }
  
  private String getFileName(String loc)
  {
    String filename = null;
    int index1;
    if ((loc != null) && ((index1 = loc.lastIndexOf(':')) != -1))
    {
      int index2 = loc.indexOf(':');
      if (index1 == index2) {
        index2 = 0;
      } else {
        index2--;
      }
      filename = loc.substring(index2, index1);
    }
    return filename;
  }
  
  private int getLineNumber(String loc)
  {
    if (loc != null)
    {
      int colon = loc.lastIndexOf(':');
      String number = loc.substring(colon + 1);
      if (!number.startsWith("0")) {
        try
        {
          return Integer.parseInt(number);
        }
        catch (Exception localException)
        {
          return -1;
        }
      }
    }
    return -1;
  }
  
  public boolean openSourceFileAtSymbol(IBinaryParser.IBinaryObject binary, IBinaryParser.ISymbol symbol)
  {
    if (symbol == null) {
      return false;
    }
    String loc = STSymbolManager.sharedInstance.getLine(symbol);
    return openSourceFileAtLocation(binary, loc);
  }
  
  public boolean openSourceFileAtLocation(IBinaryParser.IBinaryObject binary, String addr2lineOutput)
  {
    String filename = getFileName(addr2lineOutput);
    int lineNumber = getLineNumber(addr2lineOutput);
    return openSourceFileAtLocation(binary, filename, lineNumber);
  }
  
  public boolean openSourceFileAtLocation(IBinaryParser.IBinaryObject binary, String sourceLoc, String lineNumber)
  {
    int i = -1;
    try
    {
      i = Integer.parseInt(lineNumber);
    }
    catch (Exception localException) {}
    return openSourceFileAtLocation(binary, sourceLoc, i);
  }
  
  public boolean openSourceFileAtLocation(IBinaryParser.IBinaryObject binary, String sourceLoc, int lineNumber)
  {
    if (sourceLoc == null) {
      return false;
    }
    IPath p = new Path(sourceLoc);
    return openSourceFileAtLocation(binary.getPath(), p, lineNumber);
  }
  
  public boolean openSourceFileAtAddress(IBinaryParser.IBinaryObject binary, IAddress address)
  {
    if (binary == null) {
      return false;
    }
    String loc = STSymbolManager.sharedInstance.getLine(binary, address);
    return openSourceFileAtLocation(binary, loc);
  }
  
  public boolean openSourceFileAtAddress(IBinaryParser.IBinaryObject binary, long address)
  {
    String addr = Long.toString(address);
    return openSourceFileAtAddress(binary, addr);
  }
  
  public boolean openSourceFileAtAddress(IBinaryParser.IBinaryObject binary, String address)
  {
    if (binary == null) {
      return false;
    }
    IAddressFactory factory = binary.getAddressFactory();
    IAddress addr;
    IAddress addr;
    if (factory == null) {
      addr = new Addr64(address);
    } else {
      addr = factory.createAddress(address);
    }
    return openSourceFileAtAddress(binary, addr);
  }
  
  private boolean openFileImpl(IProject project, IPath sourceLoc, int lineNumber)
  {
    if ((sourceLoc == null) || ("??".equals(sourceLoc.toString()))) {
      return false;
    }
    try
    {
      IEditorInput editorInput = getEditorInput(sourceLoc, project);
      IWorkbenchPage p = CUIPlugin.getActivePage();
      if (p != null) {
        if (editorInput == null)
        {
          p.openEditor(
            new STCSourceNotFoundEditorInput(project, sourceLoc, lineNumber), 
            "org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditor", 
            true);
        }
        else
        {
          IEditorPart editor = p.openEditor(editorInput, "org.eclipse.cdt.ui.editor.CEditor", true);
          if ((lineNumber > 0) && ((editor instanceof ITextEditor)))
          {
            IDocumentProvider provider = ((ITextEditor)editor).getDocumentProvider();
            IDocument document = provider.getDocument(editor.getEditorInput());
            try
            {
              int start = document.getLineOffset(lineNumber - 1);
              ((ITextEditor)editor).selectAndReveal(start, 0);
              IWorkbenchPage page = editor.getSite().getPage();
              page.activate(editor);
              return true;
            }
            catch (BadLocationException localBadLocationException) {}
          }
        }
      }
      return false;
    }
    catch (Exception localException) {}
  }
  
  public IEditorInput getEditorInput(IPath p, IProject project)
  {
    IFile f = getFileForPath(p, project);
    if ((f != null) && (f.exists())) {
      return new FileEditorInput(f);
    }
    if (p.isAbsolute())
    {
      File file = p.toFile();
      if (file.exists()) {
        try
        {
          IFileStore ifs = EFS.getStore(file.toURI());
          return new FileStoreEditorInput(ifs);
        }
        catch (CoreException _)
        {
          Activator.getDefault().getLog().log(_.getStatus());
        }
      }
    }
    return findFileInCommonSourceLookup(p);
  }
  
  private IEditorInput findFileInCommonSourceLookup(IPath path)
  {
    try
    {
      AbstractSourceLookupDirector director = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector();
      ISourceContainer[] c = director.getSourceContainers();
      ISourceContainer[] arrayOfISourceContainer1;
      int j = (arrayOfISourceContainer1 = c).length;
      for (int i = 0; i < j; i++)
      {
        ISourceContainer sourceContainer = arrayOfISourceContainer1[i];
        Object[] o = sourceContainer.findSourceElements(path.toOSString());
        Object[] arrayOfObject1;
        int m = (arrayOfObject1 = o).length;
        for (int k = 0; k < m; k++)
        {
          Object object = arrayOfObject1[k];
          if ((object instanceof IFile)) {
            return new FileEditorInput((IFile)object);
          }
          if ((object instanceof LocalFileStorage))
          {
            LocalFileStorage storage = (LocalFileStorage)object;
            IFileStore ifs = EFS.getStore(storage.getFile().toURI());
            return new FileStoreEditorInput(ifs);
          }
        }
      }
    }
    catch (Exception localException) {}
    return null;
  }
  
  private IFile getFileForPath(IPath path, IProject project)
  {
    IFile f = getFileForPathImpl(path, project);
    if (f == null)
    {
      Set<IProject> allProjects = new HashSet();
      try
      {
        getAllReferencedProjects(allProjects, project);
      }
      catch (CoreException _)
      {
        Activator.getDefault().getLog().log(_.getStatus());
      }
      if (allProjects != null) {
        for (IProject project2 : allProjects)
        {
          f = getFileForPathImpl(path, project2);
          if (f != null) {
            break;
          }
        }
      }
    }
    return f;
  }
  
  private IFile getFileForPathImpl(IPath path, IProject project)
  {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    if (path.isAbsolute())
    {
      IFile c = root.getFileForLocation(path);
      return c;
    }
    if ((project != null) && (project.exists()))
    {
      ICProject cproject = CoreModel.getDefault().create(project);
      if (cproject != null) {
        try
        {
          ISourceRoot[] roots = cproject.getAllSourceRoots();
          ISourceRoot[] arrayOfISourceRoot1;
          int j = (arrayOfISourceRoot1 = roots).length;
          IResource r;
          for (int i = 0; i < j; i++)
          {
            ISourceRoot sourceRoot = arrayOfISourceRoot1[i];
            r = sourceRoot.getResource();
            if ((r instanceof IContainer))
            {
              IContainer parent = (IContainer)r;
              IResource res = parent.findMember(path);
              if ((res != null) && (res.exists()) && ((res instanceof IFile))) {
                return (IFile)res;
              }
            }
          }
          IOutputEntry[] entries = cproject.getOutputEntries();
          int k = (r = entries).length;
          for (j = 0; j < k; j++)
          {
            IOutputEntry pathEntry = r[j];
            IPath p = pathEntry.getPath();
            IResource r = root.findMember(p);
            if ((r instanceof IContainer))
            {
              IContainer parent = (IContainer)r;
              IResource res = parent.findMember(path);
              if ((res != null) && (res.exists()) && ((res instanceof IFile))) {
                return (IFile)res;
              }
            }
          }
        }
        catch (CModelException _)
        {
          Activator.getDefault().getLog().log(_.getStatus());
        }
      }
    }
    return null;
  }
  
  private void getAllReferencedProjects(Set<IProject> all, IProject project)
    throws CoreException
  {
    if (project != null)
    {
      IProject[] refs = project.getReferencedProjects();
      for (int i = 0; i < refs.length; i++) {
        if ((!all.contains(refs[i])) && (refs[i].exists()) && (refs[i].isOpen()))
        {
          all.add(refs[i]);
          getAllReferencedProjects(all, refs[i]);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.link2source.STLink2SourceSupport
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import java.io.IOException;
import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.CPPFilt;

public class DefaultBinutilsFactory
  implements ISTBinutilsFactory
{
  public Addr2line getAddr2line(String path)
    throws IOException
  {
    return new Addr2line(path);
  }
  
  public CPPFilt getCPPFilt()
    throws IOException
  {
    return new CPPFilt();
  }
  
  public STNM getNM(String path, STNMSymbolsHandler handler)
    throws IOException
  {
    return new STNM("nm", null, path, handler);
  }
  
  public boolean testAvailability()
  {
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.DefaultBinutilsFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import java.io.IOException;
import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.CPPFilt;

public abstract interface ISTBinutilsFactory
{
  public abstract Addr2line getAddr2line(String paramString)
    throws IOException;
  
  public abstract CPPFilt getCPPFilt()
    throws IOException;
  
  public abstract STNM getNM(String paramString, STNMSymbolsHandler paramSTNMSymbolsHandler)
    throws IOException;
  
  public abstract boolean testAvailability();
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.ISTBinutilsFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import java.io.IOException;
import org.eclipse.cdt.utils.Addr2line;

public class STAddr2LineFactory
{
  public static Addr2line getAddr2line(String cpuType, String programPath)
    throws IOException
  {
    ISTBinutilsFactory factory = STBinutilsFactoryManager.sharedInstance.getBinutilsFactory(cpuType);
    return factory.getAddr2line(programPath);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.STAddr2LineFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import java.io.IOException;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.utils.Addr2line;

public class STAddr2line
  extends Addr2line
{
  public STAddr2line(String cmd, String file)
    throws IOException
  {
    super(cmd, file);
  }
  
  public String getLine(IAddress address)
    throws IOException
  {
    String s = super.getLine(address);
    int index1 = s.lastIndexOf(':');
    int index2 = s.indexOf(':');
    if ((index1 != index2) && (index2 != 2)) {
      s = s.substring(index2 + 1);
    }
    return s;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.STAddr2line
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Platform;
import org.eclipse.linuxtools.binutils.Activator;

public class STBinutilsFactoryManager
{
  public static final STBinutilsFactoryManager sharedInstance = new STBinutilsFactoryManager();
  private final Map<String, ISTBinutilsFactory> map = new HashMap();
  private DefaultBinutilsFactory defaultFactory;
  
  private ISTBinutilsFactory getBinutilsFactoryImpl(String cpu)
  {
    try
    {
      IExtensionRegistry reg = Platform.getExtensionRegistry();
      IExtensionPoint ep = reg.getExtensionPoint("org.eclipse.linuxtools.binutils.crossCompilerBinutils");
      IExtension[] exts = ep.getExtensions();
      IExtension[] arrayOfIExtension1;
      int j = (arrayOfIExtension1 = exts).length;
      for (int i = 0; i < j; i++)
      {
        IExtension extension = arrayOfIExtension1[i];
        IConfigurationElement[] elems = extension.getConfigurationElements();
        IConfigurationElement[] arrayOfIConfigurationElement1;
        int m = (arrayOfIConfigurationElement1 = elems).length;
        for (int k = 0; k < m; k++)
        {
          IConfigurationElement configurationElement = arrayOfIConfigurationElement1[k];
          String s = configurationElement.getAttribute("CPU");
          if (cpu.equals(s))
          {
            ISTBinutilsFactory factory = (ISTBinutilsFactory)configurationElement.createExecutableExtension("binutilsFactory");
            if (factory.testAvailability()) {
              return factory;
            }
          }
        }
      }
    }
    catch (CoreException e)
    {
      Activator.getDefault().getLog().log(e.getStatus());
    }
    if (defaultFactory == null) {
      defaultFactory = new DefaultBinutilsFactory();
    }
    return defaultFactory;
  }
  
  public ISTBinutilsFactory getBinutilsFactory(String cpu)
  {
    ISTBinutilsFactory factory = (ISTBinutilsFactory)map.get(cpu);
    if (factory == null)
    {
      factory = getBinutilsFactoryImpl(cpu);
      map.put(cpu, factory);
    }
    return factory;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.STBinutilsFactoryManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import java.io.IOException;
import org.eclipse.cdt.utils.CPPFilt;

public class STCPPFiltFactory
{
  public static CPPFilt getCPPFilt(String cpuType)
    throws IOException
  {
    ISTBinutilsFactory factory = STBinutilsFactoryManager.sharedInstance.getBinutilsFactory(cpuType);
    return factory.getCPPFilt();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.STCPPFiltFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.cdt.utils.spawner.ProcessFactory;

public class STNM
{
  private static Pattern undef_pattern = null;
  private static Pattern normal_pattern = null;
  private final STNMSymbolsHandler handler;
  
  public STNM(String command, String[] params, String file, STNMSymbolsHandler handler)
    throws IOException
  {
    this.handler = handler;
    if (handler != null) {
      init(command, params, file);
    }
  }
  
  private void init(String command, String[] params, String file)
    throws IOException
  {
    String[] args = (String[])null;
    if ((params == null) || (params.length == 0))
    {
      args = new String[] { command, file };
    }
    else
    {
      args = new String[params.length + 2];
      args[0] = command;
      args[(params.length + 1)] = file;
      System.arraycopy(params, 0, args, 1, params.length);
    }
    Process process = ProcessFactory.getFactory().exec(args);
    parseOutput(process.getInputStream());
    process.destroy();
  }
  
  private void parseOutput(InputStream stream)
    throws IOException
  {
    BufferedReader reader = new BufferedReader(
      new InputStreamReader(stream));
    if (undef_pattern == null) {
      undef_pattern = Pattern.compile("^\\s+U\\s+(\\S+)");
    }
    if (normal_pattern == null) {
      normal_pattern = Pattern.compile("^(\\S+)\\s+([AaTtBbDd])\\s+(\\S+)");
    }
    String line;
    while ((line = reader.readLine()) != null)
    {
      String line;
      Matcher undef_matcher = undef_pattern.matcher(line);
      Matcher normal_matcher = normal_pattern.matcher(line);
      try
      {
        if (undef_matcher.matches())
        {
          handler.foundUndefSymbol(undef_matcher.group(1));
        }
        else if (normal_matcher.matches())
        {
          char type = normal_matcher.group(2).charAt(0);
          String name = normal_matcher.group(3);
          String address = normal_matcher.group(1);
          switch (type)
          {
          case 'T': 
          case 't': 
            handler.foundTextSymbol(name, address);
            break;
          case 'B': 
          case 'b': 
            handler.foundBssSymbol(name, address);
            break;
          case 'D': 
          case 'd': 
            handler.foundDataSymbol(name, address);
          }
        }
      }
      catch (NumberFormatException localNumberFormatException) {}catch (IndexOutOfBoundsException localIndexOutOfBoundsException) {}
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.STNM
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import java.io.IOException;

public class STNMFactory
{
  public static STNM getNM(String cpuType, String programPath, STNMSymbolsHandler handler)
    throws IOException
  {
    ISTBinutilsFactory factory = STBinutilsFactoryManager.sharedInstance.getBinutilsFactory(cpuType);
    return factory.getNM(programPath, handler);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.STNMFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

public abstract interface STNMSymbolsHandler
{
  public abstract void foundUndefSymbol(String paramString);
  
  public abstract void foundTextSymbol(String paramString1, String paramString2);
  
  public abstract void foundBssSymbol(String paramString1, String paramString2);
  
  public abstract void foundDataSymbol(String paramString1, String paramString2);
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.STNMSymbolsHandler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Status;
import org.eclipse.linuxtools.binutils.Activator;

class STSymbolManager$1
  implements Runnable
{
  STSymbolManager$1(STSymbolManager paramSTSymbolManager) {}
  
  public void run()
  {
    try
    {
      for (;;)
      {
        try
        {
          Thread.sleep(30000L);
        }
        catch (InterruptedException localInterruptedException)
        {
          break;
        }
        STSymbolManager.access$0(this$0);
      }
    }
    catch (Exception _)
    {
      Status s = new Status(4, "org.eclipse.linuxtools.binutils", _.getMessage(), _);
      Activator.getDefault().getLog().log(s);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.STSymbolManager.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import org.eclipse.cdt.utils.Addr2line;

final class STSymbolManager$AutoDisposeAddr2line
{
  private Addr2line addr2line;
  private long startTime;
  
  private STSymbolManager$AutoDisposeAddr2line(STSymbolManager paramSTSymbolManager) {}
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.STSymbolManager.AutoDisposeAddr2line
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import org.eclipse.cdt.utils.CPPFilt;

final class STSymbolManager$AutoDisposeCPPFilt
{
  private CPPFilt cppfilt;
  private long startTime;
  
  private STSymbolManager$AutoDisposeCPPFilt(STSymbolManager paramSTSymbolManager) {}
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.binutils.utils.STSymbolManager.AutoDisposeCPPFilt
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.binutils.utils;

import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.CoreModelUtil;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.IBinaryContainer;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.CPPFilt;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.r
1 2

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