org.eclipse.ui.ide.application_1.0.400.v20120523-1955

16:48:13.023 INFO  jd.cli.Main - Decompiling org.eclipse.ui.ide.application_1.0.400.v20120523-1955.jar
package org.eclipse.ui.internal.ide.application;

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.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
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.ide.IDE;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;

class DelayedEventsProcessor$1
  implements Runnable
{
  final DelayedEventsProcessor this$0;
  private final String val$path;
  
  DelayedEventsProcessor$1(DelayedEventsProcessor paramDelayedEventsProcessor, String paramString)
  {
    this$0 = paramDelayedEventsProcessor;val$path = paramString;
  }
  
  public void run()
  {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
      return;
    }
    IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(val$path));
    IFileInfo fetchInfo = fileStore.fetchInfo();
    if ((!fetchInfo.isDirectory()) && (fetchInfo.exists()))
    {
      IWorkbenchPage page = window.getActivePage();
      if (page == null)
      {
        String msg = NLS.bind(IDEWorkbenchMessages.OpenDelayedFileAction_message_noWindow, val$path);
        MessageDialog.open(1, window.getShell(), 
          IDEWorkbenchMessages.OpenDelayedFileAction_title, 
          msg, 268435456);
      }
      try
      {
        IDE.openInternalEditorOnFileStore(page, fileStore);
        Shell shell = window.getShell();
        if (shell == null) {
          return;
        }
        if (shell.getMinimized()) {
          shell.setMinimized(false);
        }
        shell.forceActive();
      }
      catch (PartInitException e)
      {
        String msg = NLS.bind(IDEWorkbenchMessages.OpenDelayedFileAction_message_errorOnOpen, 
          fileStore.getName());
        CoreException eLog = new PartInitException(e.getMessage());
        IDEWorkbenchPlugin.log(msg, new Status(4, "org.eclipse.ui.ide.application", msg, eLog));
        MessageDialog.open(1, window.getShell(), 
          IDEWorkbenchMessages.OpenDelayedFileAction_title, 
          msg, 268435456);
      }
    }
    else
    {
      String msg = NLS.bind(IDEWorkbenchMessages.OpenDelayedFileAction_message_fileNotFound, val$path);
      MessageDialog.open(1, window.getShell(), 
        IDEWorkbenchMessages.OpenDelayedFileAction_title, 
        msg, 268435456);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.DelayedEventsProcessor.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import java.util.ArrayList;
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.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
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.ide.IDE;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;

public class DelayedEventsProcessor
  implements Listener
{
  private ArrayList filesToOpen = new ArrayList(1);
  
  public DelayedEventsProcessor(Display display)
  {
    display.addListener(46, this);
  }
  
  public void handleEvent(Event event)
  {
    String path = text;
    if (path == null) {
      return;
    }
    filesToOpen.add(path);
  }
  
  public void catchUp(Display display)
  {
    if (filesToOpen.isEmpty()) {
      return;
    }
    String[] filePaths = new String[filesToOpen.size()];
    filesToOpen.toArray(filePaths);
    filesToOpen.clear();
    for (int i = 0; i < filePaths.length; i++) {
      openFile(display, filePaths[i]);
    }
  }
  
  private void openFile(Display display, String path)
  {
    display.asyncExec(new Runnable()
    {
      private final String val$path;
      
      public void run()
      {
        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (window == null) {
          return;
        }
        IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(val$path));
        IFileInfo fetchInfo = fileStore.fetchInfo();
        if ((!fetchInfo.isDirectory()) && (fetchInfo.exists()))
        {
          IWorkbenchPage page = window.getActivePage();
          if (page == null)
          {
            String msg = NLS.bind(IDEWorkbenchMessages.OpenDelayedFileAction_message_noWindow, val$path);
            MessageDialog.open(1, window.getShell(), 
              IDEWorkbenchMessages.OpenDelayedFileAction_title, 
              msg, 268435456);
          }
          try
          {
            IDE.openInternalEditorOnFileStore(page, fileStore);
            Shell shell = window.getShell();
            if (shell == null) {
              return;
            }
            if (shell.getMinimized()) {
              shell.setMinimized(false);
            }
            shell.forceActive();
          }
          catch (PartInitException e)
          {
            String msg = NLS.bind(IDEWorkbenchMessages.OpenDelayedFileAction_message_errorOnOpen, 
              fileStore.getName());
            CoreException eLog = new PartInitException(e.getMessage());
            IDEWorkbenchPlugin.log(msg, new Status(4, "org.eclipse.ui.ide.application", msg, eLog));
            MessageDialog.open(1, window.getShell(), 
              IDEWorkbenchMessages.OpenDelayedFileAction_title, 
              msg, 268435456);
          }
        }
        else
        {
          String msg = NLS.bind(IDEWorkbenchMessages.OpenDelayedFileAction_message_fileNotFound, val$path);
          MessageDialog.open(1, window.getShell(), 
            IDEWorkbenchMessages.OpenDelayedFileAction_title, 
            msg, 268435456);
        }
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.DelayedEventsProcessor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;

class IDEApplication$1
  implements Runnable
{
  final IDEApplication this$0;
  private final Display val$display;
  private final IWorkbench val$workbench;
  
  IDEApplication$1(IDEApplication paramIDEApplication, Display paramDisplay, IWorkbench paramIWorkbench)
  {
    this$0 = paramIDEApplication;val$display = paramDisplay;val$workbench = paramIWorkbench;
  }
  
  public void run()
  {
    if (!val$display.isDisposed()) {
      val$workbench.close();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEApplication.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.core.runtime.Platform;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.ide.ChooseWorkspaceData;
import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;

public class IDEApplication
  implements IApplication, IExecutableExtension
{
  public static final String METADATA_FOLDER = ".metadata";
  private static final String VERSION_FILENAME = "version.ini";
  private static final String WORKSPACE_VERSION_KEY = "org.eclipse.core.runtime";
  private static final String WORKSPACE_VERSION_VALUE = "1";
  private static final String PROP_EXIT_CODE = "eclipse.exitcode";
  private static final Integer EXIT_RELAUNCH = new Integer(24);
  private static final Integer EXIT_WORKSPACE_LOCKED = new Integer(15);
  public static final String PLUGIN_ID = "org.eclipse.ui.ide.application";
  
  public Object start(IApplicationContext appContext)
    throws Exception
  {
    Display display = createDisplay();
    
    DelayedEventsProcessor processor = new DelayedEventsProcessor(display);
    try
    {
      Shell shell = WorkbenchPlugin.getSplashShell(display);
      if (shell != null)
      {
        shell.setText(ChooseWorkspaceDialog.getWindowTitle());
        shell.setImages(Dialog.getDefaultImages());
      }
      Object instanceLocationCheck = checkInstanceLocation(shell, appContext.getArguments());
      Object localObject2;
      if (instanceLocationCheck != null)
      {
        WorkbenchPlugin.unsetSplashShell(display);
        Platform.endSplash();
        Location instanceLoc;
        return instanceLocationCheck;
      }
      Object instanceLocationCheck;
      Shell shell;
      int returnCode = PlatformUI.createAndRunWorkbench(display, 
        new IDEWorkbenchAdvisor(processor));
      if (returnCode != 1)
      {
        Location instanceLoc;
        return EXIT_OK;
      }
      int returnCode;
      Object instanceLocationCheck;
      Shell shell;
      Location instanceLoc;
      return EXIT_RELAUNCH.equals(Integer.getInteger("eclipse.exitcode")) ? EXIT_RELAUNCH : 
        EXIT_RESTART;
    }
    finally
    {
      if (display != null) {
        display.dispose();
      }
      Location instanceLoc = Platform.getInstanceLocation();
      if (instanceLoc != null) {
        instanceLoc.release();
      }
    }
  }
  
  protected Display createDisplay()
  {
    return PlatformUI.createDisplay();
  }
  
  public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {}
  
  private Object checkInstanceLocation(Shell shell, Map applicationArguments)
  {
    Location instanceLoc = Platform.getInstanceLocation();
    if (instanceLoc == null)
    {
      MessageDialog.openError(
        shell, 
        IDEWorkbenchMessages.IDEApplication_workspaceMandatoryTitle, 
        IDEWorkbenchMessages.IDEApplication_workspaceMandatoryMessage);
      return EXIT_OK;
    }
    if (instanceLoc.isSet())
    {
      if (!checkValidWorkspace(shell, instanceLoc.getURL())) {
        return EXIT_OK;
      }
      try
      {
        if (instanceLoc.lock())
        {
          writeWorkspaceVersion();
          return null;
        }
        File workspaceDirectory = new File(instanceLoc.getURL().getFile());
        if (workspaceDirectory.exists())
        {
          if (isDevLaunchMode(applicationArguments)) {
            return EXIT_WORKSPACE_LOCKED;
          }
          MessageDialog.openError(
            shell, 
            IDEWorkbenchMessages.IDEApplication_workspaceCannotLockTitle, 
            NLS.bind(IDEWorkbenchMessages.IDEApplication_workspaceCannotLockMessage, workspaceDirectory.getAbsolutePath()));
        }
        else
        {
          MessageDialog.openError(
            shell, 
            IDEWorkbenchMessages.IDEApplication_workspaceCannotBeSetTitle, 
            IDEWorkbenchMessages.IDEApplication_workspaceCannotBeSetMessage);
        }
      }
      catch (IOException e)
      {
        IDEWorkbenchPlugin.log("Could not obtain lock for workspace location", 
          e);
        
        MessageDialog.openError(
          shell, 
          IDEWorkbenchMessages.InternalError, 
          e.getMessage());
      }
      return EXIT_OK;
    }
    ChooseWorkspaceData launchData = new ChooseWorkspaceData(instanceLoc
      .getDefault());
    
    boolean force = false;
    for (;;)
    {
      URL workspaceUrl = promptForWorkspace(shell, launchData, force);
      if (workspaceUrl == null) {
        return EXIT_OK;
      }
      force = true;
      try
      {
        if (instanceLoc.setURL(workspaceUrl, true))
        {
          launchData.writePersistedData();
          writeWorkspaceVersion();
          return null;
        }
      }
      catch (IllegalStateException localIllegalStateException)
      {
        MessageDialog.openError(
          shell, 
          IDEWorkbenchMessages.IDEApplication_workspaceCannotBeSetTitle, 
          IDEWorkbenchMessages.IDEApplication_workspaceCannotBeSetMessage);
        return EXIT_OK;
      }
      MessageDialog.openError(shell, IDEWorkbenchMessages.IDEApplication_workspaceInUseTitle, 
        NLS.bind(IDEWorkbenchMessages.IDEApplication_workspaceInUseMessage, workspaceUrl.getFile()));
    }
  }
  
  private static boolean isDevLaunchMode(Map args)
  {
    if (Boolean.getBoolean("eclipse.pde.launch")) {
      return true;
    }
    return args.containsKey("-pdelaunch");
  }
  
  private URL promptForWorkspace(Shell shell, ChooseWorkspaceData launchData, boolean force)
  {
    URL url = null;
    do
    {
      new ChooseWorkspaceDialog(shell, launchData, false, true).prompt(force);
      String instancePath = launchData.getSelection();
      if (instancePath == null) {
        return null;
      }
      force = true;
      if (instancePath.length() <= 0)
      {
        MessageDialog.openError(
          shell, 
          IDEWorkbenchMessages.IDEApplication_workspaceEmptyTitle, 
          IDEWorkbenchMessages.IDEApplication_workspaceEmptyMessage);
      }
      else
      {
        File workspace = new File(instancePath);
        if (!workspace.exists()) {
          workspace.mkdir();
        }
        try
        {
          String path = workspace.getAbsolutePath().replace(
            File.separatorChar, '/');
          url = new URL("file", null, path);
        }
        catch (MalformedURLException localMalformedURLException)
        {
          MessageDialog.openError(
            shell, 
            IDEWorkbenchMessages.IDEApplication_workspaceInvalidTitle, 
            IDEWorkbenchMessages.IDEApplication_workspaceInvalidMessage);
        }
      }
    } while (!
    
      checkValidWorkspace(shell, url));
    return url;
  }
  
  private boolean checkValidWorkspace(Shell shell, URL url)
  {
    if (url == null) {
      return false;
    }
    String version = readWorkspaceVersion(url);
    if (version == null) {
      return true;
    }
    int ide_version = Integer.parseInt("1");
    int workspace_version = Integer.parseInt(version);
    if (workspace_version == ide_version) {
      return true;
    }
    String title = IDEWorkbenchMessages.IDEApplication_versionTitle;
    String message = NLS.bind(IDEWorkbenchMessages.IDEApplication_versionMessage, url.getFile());
    
    MessageBox mbox = new MessageBox(shell, 65832);
    
    mbox.setText(title);
    mbox.setMessage(message);
    return mbox.open() == 32;
  }
  
  /* Error */
  private static String readWorkspaceVersion(URL workspace)
  {
    // Byte code:
    //   0: aload_0
    //   1: iconst_0
    //   2: invokestatic 482	org/eclipse/ui/internal/ide/application/IDEApplication:getVersionFile	(Ljava/net/URL;Z)Ljava/io/File;
    //   5: astore_1
    //   6: aload_1
    //   7: ifnull +10 -> 17
    //   10: aload_1
    //   11: invokevirtual 423	java/io/File:exists	()Z
    //   14: ifne +5 -> 19
    //   17: aconst_null
    //   18: areturn
    //   19: new 220	java/util/Properties
    //   22: dup
    //   23: invokespecial 447	java/util/Properties:<init>	()V
    //   26: astore_2
    //   27: new 207	java/io/FileInputStream
    //   30: dup
    //   31: aload_1
    //   32: invokespecial 430	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   35: astore_3
    //   36: aload_2
    //   37: aload_3
    //   38: invokevirtual 448	java/util/Properties:load	(Ljava/io/InputStream;)V
    //   41: goto +12 -> 53
    //   44: astore 4
    //   46: aload_3
    //   47: invokevirtual 429	java/io/FileInputStream:close	()V
    //   50: aload 4
    //   52: athrow
    //   53: aload_3
    //   54: invokevirtual 429	java/io/FileInputStream:close	()V
    //   57: aload_2
    //   58: ldc 5
    //   60: invokevirtual 449	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   63: areturn
    //   64: astore_2
    //   65: ldc_w 198
    //   68: new 223	org/eclipse/core/runtime/Status
    //   71: dup
    //   72: iconst_4
    //   73: ldc_w 204
    //   76: iconst_4
    //   77: aload_2
    //   78: invokevirtual 432	java/io/IOException:getMessage	()Ljava/lang/String;
    //   81: ifnonnull +9 -> 90
    //   84: ldc_w 196
    //   87: goto +7 -> 94
    //   90: aload_2
    //   91: invokevirtual 432	java/io/IOException:getMessage	()Ljava/lang/String;
    //   94: aload_2
    //   95: invokespecial 452	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
    //   98: invokestatic 476	org/eclipse/ui/internal/ide/IDEWorkbenchPlugin:log	(Ljava/lang/String;Lorg/eclipse/core/runtime/IStatus;)V
    //   101: aconst_null
    //   102: areturn
    // Line number table:
    //   Java source line #394	-> byte code offset #0
    //   Java source line #395	-> byte code offset #6
    //   Java source line #396	-> byte code offset #17
    //   Java source line #403	-> byte code offset #19
    //   Java source line #404	-> byte code offset #27
    //   Java source line #406	-> byte code offset #36
    //   Java source line #407	-> byte code offset #44
    //   Java source line #408	-> byte code offset #46
    //   Java source line #409	-> byte code offset #50
    //   Java source line #408	-> byte code offset #53
    //   Java source line #411	-> byte code offset #57
    //   Java source line #412	-> byte code offset #64
    //   Java source line #413	-> byte code offset #65
    //   Java source line #414	-> byte code offset #72
    //   Java source line #415	-> byte code offset #76
    //   Java source line #416	-> byte code offset #77
    //   Java source line #417	-> byte code offset #94
    //   Java source line #413	-> byte code offset #98
    //   Java source line #418	-> byte code offset #101
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	103	0	workspace	URL
    //   5	27	1	versionFile	File
    //   26	32	2	props	java.util.Properties
    //   64	31	2	e	IOException
    //   35	19	3	is	java.io.FileInputStream
    //   44	7	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   36	44	44	finally
    //   19	63	64	java/io/IOException
  }
  
  /* Error */
  private static void writeWorkspaceVersion()
  {
    // Byte code:
    //   0: invokestatic 451	org/eclipse/core/runtime/Platform:getInstanceLocation	()Lorg/eclipse/osgi/service/datalocation/Location;
    //   3: astore_0
    //   4: aload_0
    //   5: ifnull +12 -> 17
    //   8: aload_0
    //   9: invokeinterface 492 1 0
    //   14: ifeq +4 -> 18
    //   17: return
    //   18: aload_0
    //   19: invokeinterface 496 1 0
    //   24: iconst_1
    //   25: invokestatic 482	org/eclipse/ui/internal/ide/application/IDEApplication:getVersionFile	(Ljava/net/URL;Z)Ljava/io/File;
    //   28: astore_1
    //   29: aload_1
    //   30: ifnonnull +4 -> 34
    //   33: return
    //   34: aconst_null
    //   35: astore_2
    //   36: ldc_w 203
    //   39: astore_3
    //   40: new 208	java/io/FileOutputStream
    //   43: dup
    //   44: aload_1
    //   45: invokespecial 431	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   48: astore_2
    //   49: aload_2
    //   50: aload_3
    //   51: ldc_w 200
    //   54: invokevirtual 443	java/lang/String:getBytes	(Ljava/lang/String;)[B
    //   57: invokevirtual 434	java/io/OutputStream:write	([B)V
    //   60: goto +51 -> 111
    //   63: astore_3
    //   64: ldc_w 199
    //   67: iconst_4
    //   68: aload_3
    //   69: invokevirtual 432	java/io/IOException:getMessage	()Ljava/lang/String;
    //   72: aload_3
    //   73: invokestatic 477	org/eclipse/ui/internal/ide/StatusUtil:newStatus	(ILjava/lang/String;Ljava/lang/Throwable;)Lorg/eclipse/core/runtime/IStatus;
    //   76: invokestatic 476	org/eclipse/ui/internal/ide/IDEWorkbenchPlugin:log	(Ljava/lang/String;Lorg/eclipse/core/runtime/IStatus;)V
    //   79: aload_2
    //   80: ifnull +43 -> 123
    //   83: aload_2
    //   84: invokevirtual 433	java/io/OutputStream:close	()V
    //   87: goto +36 -> 123
    //   90: pop
    //   91: goto +32 -> 123
    //   94: astore 4
    //   96: aload_2
    //   97: ifnull +11 -> 108
    //   100: aload_2
    //   101: invokevirtual 433	java/io/OutputStream:close	()V
    //   104: goto +4 -> 108
    //   107: pop
    //   108: aload 4
    //   110: athrow
    //   111: aload_2
    //   112: ifnull +11 -> 123
    //   115: aload_2
    //   116: invokevirtual 433	java/io/OutputStream:close	()V
    //   119: goto +4 -> 123
    //   122: pop
    //   123: return
    // Line number table:
    //   Java source line #428	-> byte code offset #0
    //   Java source line #429	-> byte code offset #4
    //   Java source line #430	-> byte code offset #17
    //   Java source line #433	-> byte code offset #18
    //   Java source line #434	-> byte code offset #29
    //   Java source line #435	-> byte code offset #33
    //   Java source line #438	-> byte code offset #34
    //   Java source line #440	-> byte code offset #36
    //   Java source line #443	-> byte code offset #40
    //   Java source line #444	-> byte code offset #49
    //   Java source line #445	-> byte code offset #63
    //   Java source line #446	-> byte code offset #64
    //   Java source line #447	-> byte code offset #67
    //   Java source line #446	-> byte code offset #76
    //   Java source line #450	-> byte code offset #79
    //   Java source line #451	-> byte code offset #83
    //   Java source line #453	-> byte code offset #90
    //   Java source line #448	-> byte code offset #94
    //   Java source line #450	-> byte code offset #96
    //   Java source line #451	-> byte code offset #100
    //   Java source line #453	-> byte code offset #107
    //   Java source line #456	-> byte code offset #108
    //   Java source line #450	-> byte code offset #111
    //   Java source line #451	-> byte code offset #115
    //   Java source line #453	-> byte code offset #122
    //   Java source line #457	-> byte code offset #123
    // Local variable table:
    //   start	length	slot	name	signature
    //   3	16	0	instanceLoc	Location
    //   28	17	1	versionFile	File
    //   35	81	2	output	java.io.OutputStream
    //   39	12	3	versionLine	String
    //   63	10	3	e	IOException
    //   94	15	4	localObject	Object
    //   90	1	6	localIOException1	IOException
    //   107	1	7	localIOException2	IOException
    //   122	1	8	localIOException3	IOException
    // Exception table:
    //   from	to	target	type
    //   36	60	63	java/io/IOException
    //   79	87	90	java/io/IOException
    //   36	79	94	finally
    //   96	104	107	java/io/IOException
    //   111	119	122	java/io/IOException
  }
  
  private static File getVersionFile(URL workspaceUrl, boolean create)
  {
    if (workspaceUrl == null) {
      return null;
    }
    try
    {
      File metaDir = new File(workspaceUrl.getPath(), ".metadata");
      if ((!metaDir.exists()) && ((!create) || (!metaDir.mkdir()))) {
        return null;
      }
      File versionFile = new File(metaDir, "version.ini");
      if ((!versionFile.exists()) && (
        (!create) || (!versionFile.createNewFile()))) {
        return null;
      }
      return versionFile;
    }
    catch (IOException localIOException) {}
    return null;
  }
  
  public void stop()
  {
    IWorkbench workbench = PlatformUI.getWorkbench();
    if (workbench == null) {
      return;
    }
    Display display = workbench.getDisplay();
    display.syncExec(new Runnable()
    {
      private final Display val$display;
      private final IWorkbench val$workbench;
      
      public void run()
      {
        if (!val$display.isDisposed()) {
          val$workbench.close();
        }
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEApplication
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.application.IWorkbenchConfigurer;

class IDEIdleHelper$1
  implements Runnable
{
  final IDEIdleHelper this$0;
  private final Display val$display;
  
  IDEIdleHelper$1(IDEIdleHelper paramIDEIdleHelper, Display paramDisplay)
  {
    this$0 = paramIDEIdleHelper;val$display = paramDisplay;
  }
  
  public void run()
  {
    if ((!val$display.isDisposed()) && (!this$0.configurer.getWorkbench().isClosing()))
    {
      long start = System.currentTimeMillis();
      int nextInterval;
      int nextInterval;
      if (!Job.getJobManager().isIdle())
      {
        nextInterval = 5000;
      }
      else
      {
        int nextInterval;
        if (start - IDEIdleHelper.access$0(this$0) < IDEIdleHelper.access$1(this$0))
        {
          nextInterval = IDEIdleHelper.access$1(this$0) - (int)(start - IDEIdleHelper.access$0(this$0));
        }
        else
        {
          IDEIdleHelper.access$2(this$0).schedule();
          nextInterval = IDEIdleHelper.access$3(this$0);
        }
      }
      val$display.timerExec(nextInterval, this);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEIdleHelper.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class IDEIdleHelper$2
  implements Listener
{
  final IDEIdleHelper this$0;
  private final Display val$display;
  
  IDEIdleHelper$2(IDEIdleHelper paramIDEIdleHelper, Display paramDisplay)
  {
    this$0 = paramIDEIdleHelper;val$display = paramDisplay;
  }
  
  public void handleEvent(Event event)
  {
    val$display.timerExec(5000, IDEIdleHelper.access$4(this$0));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEIdleHelper.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import java.io.PrintStream;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.application.IWorkbenchConfigurer;
import org.eclipse.ui.internal.ide.Policy;

class IDEIdleHelper$3
  extends Job
{
  final IDEIdleHelper this$0;
  
  IDEIdleHelper$3(IDEIdleHelper paramIDEIdleHelper, String $anonymous0)
  {
    super($anonymous0);this$0 = paramIDEIdleHelper;
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    Display display = this$0.configurer.getWorkbench().getDisplay();
    if ((display != null) && (!display.isDisposed()))
    {
      long start = System.currentTimeMillis();
      System.gc();
      System.runFinalization();
      IDEIdleHelper.access$5(this$0, start);
      int duration = (int)(System.currentTimeMillis() - start);
      if (Policy.DEBUG_GC) {
        System.out.println("Explicit GC took: " + duration);
      }
      if (duration > IDEIdleHelper.access$6(this$0))
      {
        if (Policy.DEBUG_GC) {
          System.out.println("Further explicit GCs disabled due to long GC");
        }
        this$0.shutdown();
      }
      else
      {
        IDEIdleHelper.access$7(this$0, Math.max(IDEIdleHelper.access$3(this$0), 60 * duration));
        if (Policy.DEBUG_GC) {
          System.out.println("Next GC to run in: " + IDEIdleHelper.access$1(this$0));
        }
      }
    }
    return Status.OK_STATUS;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEIdleHelper.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import org.eclipse.swt.widgets.Display;

class IDEIdleHelper$4
  implements Runnable
{
  final IDEIdleHelper this$0;
  private final Display val$display;
  
  IDEIdleHelper$4(IDEIdleHelper paramIDEIdleHelper, Display paramDisplay)
  {
    this$0 = paramIDEIdleHelper;val$display = paramDisplay;
  }
  
  public void run()
  {
    val$display.timerExec(-1, IDEIdleHelper.access$4(this$0));
    val$display.removeFilter(2, IDEIdleHelper.access$8(this$0));
    val$display.removeFilter(4, IDEIdleHelper.access$8(this$0));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEIdleHelper.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import java.io.PrintStream;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.IWorkbenchConfigurer;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.internal.ide.Policy;
import org.eclipse.ui.testing.TestableObject;

class IDEIdleHelper
{
  private static final int DEFAULT_GC_INTERVAL = 60000;
  private static final int DEFAULT_GC_MAX = 8000;
  private static final int GC_DELAY_MULTIPLIER = 60;
  private static final int IDLE_INTERVAL = 5000;
  private static final String PROP_GC = "ide.gc";
  private static final String PROP_GC_INTERVAL = "ide.gc.interval";
  private static final String PROP_GC_MAX = "ide.gc.max";
  protected IWorkbenchConfigurer configurer;
  private Listener idleListener;
  private long lastGC = System.currentTimeMillis();
  private int maxGC = 8000;
  private int minGCInterval = 60000;
  private int nextGCInterval = 60000;
  private Job gcJob;
  private Runnable handler;
  
  IDEIdleHelper(IWorkbenchConfigurer aConfigurer)
  {
    configurer = aConfigurer;
    if (PlatformUI.getTestableObject().getTestHarness() != null) {
      return;
    }
    String enabled = System.getProperty("ide.gc");
    if ((enabled != null) && (enabled.equalsIgnoreCase(Boolean.FALSE.toString()))) {
      return;
    }
    Integer prop = Integer.getInteger("ide.gc.interval");
    if ((prop != null) && (prop.intValue() >= 0)) {
      minGCInterval = (nextGCInterval = prop.intValue());
    }
    prop = Integer.getInteger("ide.gc.max");
    if (prop != null) {
      maxGC = prop.intValue();
    }
    createGarbageCollectionJob();
    
    Display display = configurer.getWorkbench().getDisplay();
    handler = new Runnable()
    {
      private final Display val$display;
      
      public void run()
      {
        if ((!val$display.isDisposed()) && (!configurer.getWorkbench().isClosing()))
        {
          long start = System.currentTimeMillis();
          int nextInterval;
          int nextInterval;
          if (!Job.getJobManager().isIdle())
          {
            nextInterval = 5000;
          }
          else
          {
            int nextInterval;
            if (start - lastGC < nextGCInterval)
            {
              nextInterval = nextGCInterval - (int)(start - lastGC);
            }
            else
            {
              gcJob.schedule();
              nextInterval = minGCInterval;
            }
          }
          val$display.timerExec(nextInterval, this);
        }
      }
    };
    idleListener = new Listener()
    {
      private final Display val$display;
      
      public void handleEvent(Event event)
      {
        val$display.timerExec(5000, handler);
      }
    };
    display.addFilter(2, idleListener);
    display.addFilter(4, idleListener);
  }
  
  private void createGarbageCollectionJob()
  {
    gcJob = new Job(IDEWorkbenchMessages.IDEIdleHelper_backgroundGC)
    {
      protected IStatus run(IProgressMonitor monitor)
      {
        Display display = configurer.getWorkbench().getDisplay();
        if ((display != null) && (!display.isDisposed()))
        {
          long start = System.currentTimeMillis();
          System.gc();
          System.runFinalization();
          lastGC = start;
          int duration = (int)(System.currentTimeMillis() - start);
          if (Policy.DEBUG_GC) {
            System.out.println("Explicit GC took: " + duration);
          }
          if (duration > maxGC)
          {
            if (Policy.DEBUG_GC) {
              System.out.println("Further explicit GCs disabled due to long GC");
            }
            shutdown();
          }
          else
          {
            nextGCInterval = Math.max(minGCInterval, 60 * duration);
            if (Policy.DEBUG_GC) {
              System.out.println("Next GC to run in: " + nextGCInterval);
            }
          }
        }
        return Status.OK_STATUS;
      }
    };
    gcJob.setSystem(true);
  }
  
  void shutdown()
  {
    if (idleListener == null) {
      return;
    }
    Display display = configurer.getWorkbench().getDisplay();
    if ((display != null) && (!display.isDisposed())) {
      try
      {
        display.asyncExec(new Runnable()
        {
          private final Display val$display;
          
          public void run()
          {
            val$display.timerExec(-1, handler);
            val$display.removeFilter(2, idleListener);
            val$display.removeFilter(4, idleListener);
          }
        });
      }
      catch (SWTException localSWTException) {}
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEIdleHelper
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

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

class IDEWorkbenchAdvisor$1
  extends SelectionAdapter
{
  final IDEWorkbenchAdvisor.CancelableProgressMonitorJobsDialog this$1;
  
  IDEWorkbenchAdvisor$1(IDEWorkbenchAdvisor.CancelableProgressMonitorJobsDialog paramCancelableProgressMonitorJobsDialog)
  {
    this$1 = paramCancelableProgressMonitorJobsDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    IDEWorkbenchAdvisor.CancelableProgressMonitorJobsDialog.access$0(this$1).setText("");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class IDEWorkbenchAdvisor$2
  implements Listener
{
  final IDEWorkbenchAdvisor this$0;
  
  IDEWorkbenchAdvisor$2(IDEWorkbenchAdvisor paramIDEWorkbenchAdvisor)
  {
    this$0 = paramIDEWorkbenchAdvisor;
  }
  
  public void handleEvent(Event event)
  {
    boolean doExit = IDEWorkbenchWindowAdvisor.promptOnExit(null);
    doit = doExit;
    if (!doExit) {
      type = 0;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;

class IDEWorkbenchAdvisor$3
  implements Listener
{
  boolean currentHighContrast;
  final IDEWorkbenchAdvisor this$0;
  
  IDEWorkbenchAdvisor$3(IDEWorkbenchAdvisor paramIDEWorkbenchAdvisor)
  {
    this$0 = paramIDEWorkbenchAdvisor;
    
    currentHighContrast = Display.getCurrent().getHighContrast();
  }
  
  public void handleEvent(Event event)
  {
    if (Display.getCurrent().getHighContrast() == currentHighContrast) {
      return;
    }
    currentHighContrast = (!currentHighContrast);
    if (new MessageDialog(null, 
      IDEWorkbenchMessages.SystemSettingsChange_title, null, 
      IDEWorkbenchMessages.SystemSettingsChange_message, 
      3, new String[] {
      IDEWorkbenchMessages.SystemSettingsChange_yes, 
      IDEWorkbenchMessages.SystemSettingsChange_no }, 
      1).open() == 0) {
      PlatformUI.getWorkbench().restart();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;

class IDEWorkbenchAdvisor$4
  extends WorkspaceJob
{
  final IDEWorkbenchAdvisor this$0;
  private final IContainer val$root;
  
  IDEWorkbenchAdvisor$4(IDEWorkbenchAdvisor paramIDEWorkbenchAdvisor, String $anonymous0, IContainer paramIContainer)
  {
    super($anonymous0);this$0 = paramIDEWorkbenchAdvisor;val$root = paramIContainer;
  }
  
  public IStatus runInWorkspace(IProgressMonitor monitor)
    throws CoreException
  {
    val$root.refreshLocal(2, monitor);
    return Status.OK_STATUS;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.ide.application;

import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog;

class IDEWorkbenchAdvisor$5
  implements IRunnableWithProgress
{
  final IDEWorkbenchAdvisor this$0;
  private final boolean val$applyPolicy;
  private final ProgressMonitorJobsDialog val$p;
  private final MultiStatus val$status;
  
  IDEWorkbenchAdvisor$5(IDEWorkbenchAdvisor paramIDEWorkbenchAdvisor, boolean paramBoolean, ProgressMonitorJobsDialog paramProgressMonitorJobsDialog, MultiStatus paramMultiStatus)
  {
    this$0 = paramIDEWorkbenchAdvisor;val$applyPolicy = param
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