com.android.ide.eclipse.traceview_22.6.2.v201403212031-1085508

16:34:19.824 INFO  jd.cli.Main - Decompiling com.android.ide.eclipse.traceview_22.6.2.v201403212031-1085508.jar
package com.android.ide.eclipse.traceview;

import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.ide.IDE;

class TraceviewLauncher$1
  implements Runnable
{
  TraceviewLauncher$1(TraceviewLauncher paramTraceviewLauncher, IWorkbench paramIWorkbench, boolean[] paramArrayOfBoolean, IFileStore paramIFileStore) {}
  
  public void run()
  {
    IWorkbenchWindow window = val$workbench.getActiveWorkbenchWindow();
    IWorkbenchPage page = window.getActivePage();
    if (!page.isEditorAreaVisible())
    {
      IAdaptable input = page.getInput();
      try
      {
        val$workbench.showPerspective("org.eclipse.debug.ui.DebugPerspective", 
          window, input);
      }
      catch (WorkbenchException localWorkbenchException) {}
    }
    try
    {
      val$result[0] = (IDE.openEditorOnFileStore(page, val$fileStore) != null ? 1 : false);
    }
    catch (PartInitException localPartInitException) {}
  }
}

/* Location:
 * Qualified Name:     com.android.ide.eclipse.traceview.TraceviewLauncher.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ide.eclipse.traceview;

import com.android.ide.eclipse.ddms.ITraceviewLauncher;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Path;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.ide.IDE;

public class TraceviewLauncher
  implements ITraceviewLauncher
{
  public boolean openFile(String osPath)
  {
    final IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(osPath));
    if ((!fileStore.fetchInfo().isDirectory()) && (fileStore.fetchInfo().exists()))
    {
      final IWorkbench workbench = PlatformUI.getWorkbench();
      Display display = workbench.getDisplay();
      final boolean[] result = new boolean[1];
      display.syncExec(new Runnable()
      {
        public void run()
        {
          IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
          IWorkbenchPage page = window.getActivePage();
          if (!page.isEditorAreaVisible())
          {
            IAdaptable input = page.getInput();
            try
            {
              workbench.showPerspective("org.eclipse.debug.ui.DebugPerspective", 
                window, input);
            }
            catch (WorkbenchException localWorkbenchException) {}
          }
          try
          {
            result[0] = (IDE.openEditorOnFileStore(page, fileStore) != null ? 1 : false);
          }
          catch (PartInitException localPartInitException) {}
        }
      });
      return result[0];
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     com.android.ide.eclipse.traceview.TraceviewLauncher
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ide.eclipse.traceview;

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

public class TraceviewPlugin
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "com.android.ide.eclipse.traceview";
  private static TraceviewPlugin sPlugin;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    sPlugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    sPlugin = null;
    super.stop(context);
  }
  
  public static TraceviewPlugin getDefault()
  {
    return sPlugin;
  }
}

/* Location:
 * Qualified Name:     com.android.ide.eclipse.traceview.TraceviewPlugin
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ide.eclipse.traceview.editors;

import com.android.ide.eclipse.ddms.JavaSourceRevealer;
import com.android.ide.eclipse.traceview.TraceviewPlugin;
import com.android.traceview.ColorController;
import com.android.traceview.DmTraceReader;
import com.android.traceview.MethodData;
import com.android.traceview.ProfileView;
import com.android.traceview.ProfileView.MethodHandler;
import com.android.traceview.SelectionController;
import com.android.traceview.TimeLineView;
import com.android.traceview.TraceReader;
import com.android.traceview.TraceUnits;
import com.android.traceview.TraceUnits.TimeScale;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.URIUtil;
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.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.dialogs.SaveAsDialog;
import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.part.FileEditorInput;

public class TraceviewEditor
  extends EditorPart
  implements ProfileView.MethodHandler
{
  private Composite mParent;
  private String mFilename;
  private Composite mContents;
  
  public void doSave(IProgressMonitor monitor) {}
  
  private IFile getWorkspaceFile(IFileStore fileStore)
  {
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    IFile[] files = workspaceRoot.findFilesForLocationURI(fileStore.toURI());
    if ((files != null) && (files.length == 1)) {
      return files[0];
    }
    return null;
  }
  
  public void doSaveAs()
  {
    Shell shell = getSite().getShell();
    IEditorInput input = getEditorInput();
    if ((input instanceof FileEditorInput))
    {
      FileEditorInput fileEditorInput = (FileEditorInput)input;
      SaveAsDialog dialog = new SaveAsDialog(shell);
      
      IFile original = fileEditorInput.getFile();
      if (original != null) {
        dialog.setOriginalFile(original);
      }
      dialog.create();
      if ((original != null) && (!original.isAccessible()))
      {
        String message = String.format(
          "The original file ''%s'' has been deleted or is not accessible.", new Object[] {
          original.getName() });
        dialog.setErrorMessage(null);
        dialog.setMessage(message, 2);
      }
      if (dialog.open() == 1) {
        return;
      }
      IPath filePath = dialog.getResult();
      if (filePath == null) {
        return;
      }
      IWorkspace workspace = ResourcesPlugin.getWorkspace();
      IFile file = workspace.getRoot().getFile(filePath);
      if (copy(shell, fileEditorInput.getURI(), file.getLocationURI()) == null) {
        return;
      }
      try
      {
        file.refreshLocal(0, null);
      }
      catch (CoreException e)
      {
        e.printStackTrace();
      }
      IEditorInput newInput = new FileEditorInput(file);
      setInput(newInput);
      setPartName(newInput.getName());
    }
    else if ((input instanceof FileStoreEditorInput))
    {
      FileStoreEditorInput fileStoreEditorInput = (FileStoreEditorInput)input;
      FileDialog dialog = new FileDialog(shell, 8192);
      IPath oldPath = URIUtil.toPath(fileStoreEditorInput.getURI());
      if (oldPath != null)
      {
        dialog.setFileName(oldPath.lastSegment());
        dialog.setFilterPath(oldPath.toOSString());
      }
      String path = dialog.open();
      if (path == null) {
        return;
      }
      File localFile = new File(path);
      if (localFile.exists())
      {
        MessageDialog overwriteDialog = new MessageDialog(
          shell, 
          "Save As", 
          null, 
          String.format(
          "%s already exists.\nDo you want to replace it?", new Object[] {
          path }), 
          4, 
          new String[] {
          IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 
          1);
        if (overwriteDialog.open() != 0) {
          return;
        }
      }
      IFileStore destFileStore = copy(shell, fileStoreEditorInput.getURI(), localFile.toURI());
      if (destFileStore != null)
      {
        IFile file = getWorkspaceFile(destFileStore);
        IEditorInput newInput;
        IEditorInput newInput;
        if (file != null) {
          newInput = new FileEditorInput(file);
        } else {
          newInput = new FileStoreEditorInput(destFileStore);
        }
        setInput(newInput);
        setPartName(newInput.getName());
      }
    }
  }
  
  private IFileStore copy(Shell shell, URI source, URI dest)
  {
    IFileStore destFileStore = null;
    IFileStore sourceFileStore = null;
    try
    {
      destFileStore = EFS.getStore(dest);
      sourceFileStore = EFS.getStore(source);
      sourceFileStore.copy(destFileStore, 2, null);
    }
    catch (CoreException ex)
    {
      String title = "Problems During Save As...";
      String msg = String.format("Save could not be completed. %s", new Object[] {
        ex.getMessage() });
      MessageDialog.openError(shell, title, msg);
      return null;
    }
    return destFileStore;
  }
  
  public void init(IEditorSite site, IEditorInput input)
    throws PartInitException
  {
    if ((input instanceof FileEditorInput))
    {
      FileEditorInput fileEditorInput = (FileEditorInput)input;
      mFilename = fileEditorInput.getPath().toOSString();
      setSite(site);
      setInput(input);
      setPartName(input.getName());
    }
    else if ((input instanceof FileStoreEditorInput))
    {
      FileStoreEditorInput fileStoreEditorInput = (FileStoreEditorInput)input;
      mFilename = fileStoreEditorInput.getURI().getPath();
      setSite(site);
      setInput(input);
      setPartName(input.getName());
    }
    else
    {
      throw new PartInitException("Input is not of type FileEditorInput nor FileStoreEditorInput: " + 
      
        input == null ? "null" : input.toString());
    }
  }
  
  public boolean isDirty()
  {
    return false;
  }
  
  public boolean isSaveAsAllowed()
  {
    return true;
  }
  
  public void createPartControl(Composite parent)
  {
    mParent = parent;
    try
    {
      TraceReader reader = new DmTraceReader(mFilename, false);
      reader.getTraceUnits().setTimeScale(TraceUnits.TimeScale.MilliSeconds);
      
      mContents = new Composite(mParent, 0);
      
      Display display = mContents.getDisplay();
      ColorController.assignMethodColors(display, reader.getMethods());
      SelectionController selectionController = new SelectionController();
      
      GridLayout gridLayout = new GridLayout(1, false);
      marginWidth = 0;
      marginHeight = 0;
      horizontalSpacing = 0;
      verticalSpacing = 0;
      mContents.setLayout(gridLayout);
      
      Color darkGray = display.getSystemColor(16);
      
      SashForm sashForm1 = new SashForm(mContents, 512);
      sashForm1.setBackground(darkGray);
      SASH_WIDTH = 3;
      GridData data = new GridData(1808);
      sashForm1.setLayoutData(data);
      
      new TimeLineView(sashForm1, reader, selectionController);
      
      new ProfileView(sashForm1, reader, selectionController).setMethodHandler(this);
    }
    catch (IOException e)
    {
      Label l = new Label(parent, 0);
      l.setText("Failed to read the stack trace.");
      
      Status status = new Status(4, "com.android.ide.eclipse.traceview", 
        "Failed to read the stack trace.", e);
      TraceviewPlugin.getDefault().getLog().log(status);
    }
    mParent.layout();
  }
  
  public void setFocus()
  {
    mParent.setFocus();
  }
  
  public void handleMethod(MethodData method)
  {
    String methodName = method.getMethodName();
    String className = method.getClassName().replaceAll("/", ".");
    String fqmn = className + "." + methodName;
    
    JavaSourceRevealer.revealMethod(fqmn, null, -1, null);
  }
}

/* Location:
 * Qualified Name:     com.android.ide.eclipse.traceview.editors.TraceviewEditor
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
1

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