org-netbeans-core-execution

16:39:30.911 INFO  jd.cli.Main - Decompiling org-netbeans-core-execution.jar
package org.netbeans.core.execution;

import java.util.logging.Level;
import java.util.logging.Logger;

final class AccController$1
  implements Runnable
{
  AccController$1(Exception paramException) {}
  
  public void run()
  {
    Logger.getLogger(AccController.class.getName()).log(Level.WARNING, null, val$e);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.AccController.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.lang.reflect.Field;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PermissionCollection;
import java.security.ProtectionDomain;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.SwingUtilities;

class AccController
{
  static Field context;
  
  static void init() {}
  
  static Field getContextField()
    throws Exception
  {
    if (context == null)
    {
      Field localField;
      try
      {
        localField = AccessControlContext.class.getDeclaredField("context");
      }
      catch (NoSuchFieldException localNoSuchFieldException)
      {
        localField = AccessControlContext.class.getDeclaredField("domainsArray");
      }
      localField.setAccessible(true);
      context = localField;
    }
    return context;
  }
  
  static ProtectionDomain[] getDomains(AccessControlContext paramAccessControlContext)
    throws Exception
  {
    Object localObject = getContextField().get(paramAccessControlContext);
    if (localObject.getClass() == Object[].class)
    {
      Object[] arrayOfObject = (Object[])localObject;
      ProtectionDomain[] arrayOfProtectionDomain = new ProtectionDomain[arrayOfObject.length];
      for (int i = 0; i < arrayOfObject.length; i++) {
        arrayOfProtectionDomain[i] = ((ProtectionDomain)arrayOfObject[i]);
      }
      return arrayOfProtectionDomain;
    }
    return (ProtectionDomain[])localObject;
  }
  
  static IOPermissionCollection getIOPermissionCollection()
  {
    return getIOPermissionCollection(AccessController.getContext());
  }
  
  static IOPermissionCollection getIOPermissionCollection(AccessControlContext paramAccessControlContext)
  {
    try
    {
      ProtectionDomain[] arrayOfProtectionDomain = getDomains(paramAccessControlContext);
      for (int i = 0; i < arrayOfProtectionDomain.length; i++)
      {
        PermissionCollection localPermissionCollection = arrayOfProtectionDomain[i].getPermissions();
        if ((localPermissionCollection instanceof IOPermissionCollection)) {
          return (IOPermissionCollection)localPermissionCollection;
        }
      }
      return null;
    }
    catch (Exception localException)
    {
      SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
        {
          Logger.getLogger(AccController.class.getName()).log(Level.WARNING, null, val$e);
        }
      });
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.AccController
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import org.openide.util.Exceptions;

class DefaultSysProcess$1
  implements Runnable
{
  DefaultSysProcess$1(DefaultSysProcess paramDefaultSysProcess) {}
  
  public void run()
  {
    try
    {
      while (DefaultSysProcess.access$000(this$0).activeCount() > 0) {
        Thread.sleep(1000L);
      }
    }
    catch (InterruptedException localInterruptedException)
    {
      Exceptions.printStackTrace(localInterruptedException);
    }
    if (!DefaultSysProcess.access$000(this$0).isDestroyed()) {
      try
      {
        DefaultSysProcess.access$000(this$0).destroy();
      }
      catch (IllegalThreadStateException localIllegalThreadStateException) {}
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.DefaultSysProcess.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.execution.ExecutorTask;
import org.openide.util.Exceptions;
import org.openide.windows.InputOutput;

final class DefaultSysProcess
  extends ExecutorTask
{
  static int processCount;
  private final TaskThreadGroup group;
  private boolean destroyed = false;
  private final InputOutput io;
  private final String name;
  
  public DefaultSysProcess(Runnable paramRunnable, TaskThreadGroup paramTaskThreadGroup, InputOutput paramInputOutput, String paramString)
  {
    super(paramRunnable);
    group = paramTaskThreadGroup;
    io = paramInputOutput;
    name = paramString;
  }
  
  public synchronized void stop()
  {
    if (destroyed) {
      return;
    }
    destroyed = true;
    try
    {
      group.interrupt();
      group.stop();
      group.getRunClassThread().waitForEnd();
    }
    catch (InterruptedException localInterruptedException)
    {
      Logger.getLogger(DefaultSysProcess.class.getName()).log(Level.WARNING, null, localInterruptedException);
    }
    ExecutionEngine.closeGroup(group);
    group.kill();
    notifyFinished();
  }
  
  public int result()
  {
    try
    {
      group.waitFor();
    }
    catch (InterruptedException localInterruptedException)
    {
      return 4;
    }
    notifyFinished();
    return 0;
  }
  
  public InputOutput getInputOutput()
  {
    return io;
  }
  
  public void run() {}
  
  public String getName()
  {
    return name;
  }
  
  void destroyThreadGroup(ThreadGroup paramThreadGroup)
  {
    new Thread(paramThreadGroup, new Runnable()
    {
      public void run()
      {
        try
        {
          while (group.activeCount() > 0) {
            Thread.sleep(1000L);
          }
        }
        catch (InterruptedException localInterruptedException)
        {
          Exceptions.printStackTrace(localInterruptedException);
        }
        if (!group.isDestroyed()) {
          try
          {
            group.destroy();
          }
          catch (IllegalThreadStateException localIllegalThreadStateException) {}
        }
      }
    }).start();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.DefaultSysProcess
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import org.openide.execution.ExecutorTask;
import org.openide.windows.InputOutput;

class ExecutionEngine$1
  extends ExecutorTask
{
  ExecutionEngine$1(ExecutionEngine paramExecutionEngine, Runnable paramRunnable, InputOutput paramInputOutput)
  {
    super(paramRunnable);
  }
  
  public void stop() {}
  
  public int result()
  {
    return 2;
  }
  
  public InputOutput getInputOutput()
  {
    return val$inout;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.ExecutionEngine.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

class ExecutionEngine$SysOut
  extends OutputStream
{
  boolean std;
  
  ExecutionEngine$SysOut(boolean paramBoolean)
  {
    std = paramBoolean;
  }
  
  public void write(int paramInt)
    throws IOException
  {
    if (std) {
      ExecutionEngine.getTaskIOs().getOut().write(paramInt);
    } else {
      ExecutionEngine.getTaskIOs().getErr().write(paramInt);
    }
  }
  
  public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    String str = new String(paramArrayOfByte, paramInt1, paramInt2);
    if (std) {
      ExecutionEngine.getTaskIOs().getOut().write(str.toCharArray(), 0, str.length());
    } else {
      ExecutionEngine.getTaskIOs().getErr().write(str.toCharArray(), 0, str.length());
    }
  }
  
  public void flush()
    throws IOException
  {
    if (std) {
      ExecutionEngine.getTaskIOs().getOut().flush();
    } else {
      ExecutionEngine.getTaskIOs().getErr().flush();
    }
  }
  
  public void close()
    throws IOException
  {
    if (std) {
      ExecutionEngine.getTaskIOs().getOut().close();
    } else {
      ExecutionEngine.getTaskIOs().getErr().close();
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.ExecutionEngine.SysOut
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.awt.Window;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.Writer;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Policy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.netbeans.core.startup.Main;
import org.netbeans.core.startup.ModuleSystem;
import org.openide.execution.ExecutorTask;
import org.openide.execution.NbClassPath;
import org.openide.util.Lookup;
import org.openide.windows.InputOutput;

public final class ExecutionEngine
  extends org.openide.execution.ExecutionEngine
{
  public static final ThreadGroup base = new ThreadGroup("base");
  private int number = 1;
  public static final TaskIO systemIO = new TaskIO();
  private static IOTable taskIOs;
  private static WindowTable wtable = new WindowTable();
  private HashSet<ExecutionListener> executionListeners = new HashSet();
  private List<ExecutorTask> runningTasks = Collections.synchronizedList(new ArrayList(5));
  static final long serialVersionUID = 9072488605180080803L;
  
  static
  {
    systemIOout = new OutputStreamWriter(System.out);
    systemIOerr = new OutputStreamWriter(System.err);
    systemIOin = new InputStreamReader(System.in);
  }
  
  public ExecutionEngine()
  {
    System.setIn(new SysIn());
    System.setOut(createPrintStream(true));
    System.setErr(createPrintStream(false));
  }
  
  public static ExecutionEngine getExecutionEngine()
  {
    ExecutionEngine localExecutionEngine = (ExecutionEngine)Lookup.getDefault().lookup(ExecutionEngine.class);
    if (localExecutionEngine != null) {
      return localExecutionEngine;
    }
    org.openide.execution.ExecutionEngine localExecutionEngine1 = (org.openide.execution.ExecutionEngine)Lookup.getDefault().lookup(org.openide.execution.ExecutionEngine.class);
    if ((localExecutionEngine1 instanceof ExecutionEngine)) {
      return (ExecutionEngine)localExecutionEngine1;
    }
    return null;
  }
  
  public Collection<ExecutorTask> getRunningTasks()
  {
    return Arrays.asList(runningTasks.toArray(new ExecutorTask[0]));
  }
  
  public String getRunningTaskName(ExecutorTask paramExecutorTask)
  {
    if ((!runningTasks.contains(paramExecutorTask)) || (!(paramExecutorTask instanceof DefaultSysProcess))) {
      return null;
    }
    return ((DefaultSysProcess)paramExecutorTask).getName();
  }
  
  public ExecutorTask execute(String paramString, Runnable paramRunnable, final InputOutput paramInputOutput)
  {
    TaskThreadGroup localTaskThreadGroup = new TaskThreadGroup(base, "exec_" + paramString + "_" + number);
    localTaskThreadGroup.setDaemon(true);
    ExecutorTaskImpl localExecutorTaskImpl = new ExecutorTaskImpl();
    synchronized (lock)
    {
      try
      {
        new RunClassThread(localTaskThreadGroup, paramString, number++, paramInputOutput, this, localExecutorTaskImpl, paramRunnable);
        lock.wait();
      }
      catch (InterruptedException localInterruptedException)
      {
        paramInputOutput.closeInputOutput();
        new ExecutorTask(null)
        {
          public void stop() {}
          
          public int result()
          {
            return 2;
          }
          
          public InputOutput getInputOutput()
          {
            return paramInputOutput;
          }
        };
      }
    }
    return localExecutorTaskImpl;
  }
  
  protected NbClassPath createLibraryPath()
  {
    List localList = Main.getModuleSystem().getModuleJars();
    return new NbClassPath((File[])localList.toArray(new File[localList.size()]));
  }
  
  public final void addExecutionListener(ExecutionListener paramExecutionListener)
  {
    synchronized (executionListeners)
    {
      executionListeners.add(paramExecutionListener);
    }
  }
  
  public final void removeExecutionListener(ExecutionListener paramExecutionListener)
  {
    synchronized (executionListeners)
    {
      executionListeners.remove(paramExecutionListener);
    }
  }
  
  protected final PermissionCollection createPermissions(CodeSource paramCodeSource, InputOutput paramInputOutput)
  {
    PermissionCollection localPermissionCollection = Policy.getPolicy().getPermissions(paramCodeSource);
    ThreadGroup localThreadGroup = Thread.currentThread().getThreadGroup();
    return new IOPermissionCollection(paramInputOutput, localPermissionCollection, (localThreadGroup instanceof TaskThreadGroup) ? (TaskThreadGroup)localThreadGroup : null);
  }
  
  protected final void fireExecutionStarted(ExecutionEvent paramExecutionEvent)
  {
    runningTasks.add(paramExecutionEvent.getProcess());
    
    Iterator localIterator = ((HashSet)executionListeners.clone()).iterator();
    while (localIterator.hasNext())
    {
      ExecutionListener localExecutionListener = (ExecutionListener)localIterator.next();
      localExecutionListener.startedExecution(paramExecutionEvent);
    }
  }
  
  protected final void fireExecutionFinished(ExecutionEvent paramExecutionEvent)
  {
    runningTasks.remove(paramExecutionEvent.getProcess());
    
    Iterator localIterator = ((HashSet)executionListeners.clone()).iterator();
    while (localIterator.hasNext())
    {
      ExecutionListener localExecutionListener = (ExecutionListener)localIterator.next();
      localExecutionListener.finishedExecution(paramExecutionEvent);
    }
    paramExecutionEvent.getProcess().destroyThreadGroup(base);
  }
  
  static void putWindow(Window paramWindow, TaskThreadGroup paramTaskThreadGroup)
  {
    wtable.putTaskWindow(paramWindow, paramTaskThreadGroup);
  }
  
  static void closeGroup(ThreadGroup paramThreadGroup)
  {
    wtable.closeGroup(paramThreadGroup);
  }
  
  static boolean hasWindows(ThreadGroup paramThreadGroup)
  {
    return wtable.hasWindows(paramThreadGroup);
  }
  
  static IOTable getTaskIOs()
  {
    if (taskIOs == null) {
      taskIOs = new IOTable(base, systemIO);
    }
    return taskIOs;
  }
  
  public static ThreadGroup findGroup()
  {
    ThreadGroup localThreadGroup1 = Thread.currentThread().getThreadGroup();
    ThreadGroup localThreadGroup2 = null;
    while ((localThreadGroup1 != null) && (localThreadGroup1 != base))
    {
      localThreadGroup2 = localThreadGroup1;
      localThreadGroup1 = localThreadGroup1.getParent();
    }
    return localThreadGroup1 == null ? null : localThreadGroup2;
  }
  
  static class SysOut
    extends OutputStream
  {
    boolean std;
    
    SysOut(boolean paramBoolean)
    {
      std = paramBoolean;
    }
    
    public void write(int paramInt)
      throws IOException
    {
      if (std) {
        ExecutionEngine.getTaskIOs().getOut().write(paramInt);
      } else {
        ExecutionEngine.getTaskIOs().getErr().write(paramInt);
      }
    }
    
    public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
      throws IOException
    {
      String str = new String(paramArrayOfByte, paramInt1, paramInt2);
      if (std) {
        ExecutionEngine.getTaskIOs().getOut().write(str.toCharArray(), 0, str.length());
      } else {
        ExecutionEngine.getTaskIOs().getErr().write(str.toCharArray(), 0, str.length());
      }
    }
    
    public void flush()
      throws IOException
    {
      if (std) {
        ExecutionEngine.getTaskIOs().getOut().flush();
      } else {
        ExecutionEngine.getTaskIOs().getErr().flush();
      }
    }
    
    public void close()
      throws IOException
    {
      if (std) {
        ExecutionEngine.getTaskIOs().getOut().close();
      } else {
        ExecutionEngine.getTaskIOs().getErr().close();
      }
    }
  }
  
  static PrintStream createPrintStream(boolean paramBoolean)
  {
    return new WriterPrintStream(new SysOut(paramBoolean), paramBoolean);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.ExecutionEngine
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.util.EventObject;

public class ExecutionEvent
  extends EventObject
{
  static final long serialVersionUID = -9181112840849353114L;
  private DefaultSysProcess proc;
  
  public ExecutionEvent(Object paramObject, DefaultSysProcess paramDefaultSysProcess)
  {
    super(paramObject);
    proc = paramDefaultSysProcess;
  }
  
  public DefaultSysProcess getProcess()
  {
    return proc;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.ExecutionEvent
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

public abstract interface ExecutionListener
{
  public abstract void startedExecution(ExecutionEvent paramExecutionEvent);
  
  public abstract void finishedExecution(ExecutionEvent paramExecutionEvent);
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.ExecutionListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

class ExecutorTaskImpl$1
  implements Runnable
{
  public void run() {}
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.ExecutorTaskImpl.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import org.openide.execution.ExecutorTask;
import org.openide.windows.InputOutput;

final class ExecutorTaskImpl
  extends ExecutorTask
{
  int result = -1;
  DefaultSysProcess proc;
  Object lock = this;
  
  ExecutorTaskImpl()
  {
    super(new Runnable()
    {
      public void run() {}
    });
  }
  
  public void stop()
  {
    try
    {
      synchronized (lock)
      {
        while (proc == null) {
          lock.wait();
        }
        proc.stop();
      }
    }
    catch (InterruptedException localInterruptedException) {}
  }
  
  public int result()
  {
    waitFinished();
    proc.stop();
    return result;
  }
  
  final void finished()
  {
    notifyFinished();
  }
  
  public void run()
  {
    waitFinished();
  }
  
  public InputOutput getInputOutput()
  {
    return proc.getInputOutput();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.ExecutorTaskImpl
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

class ExitSecurityException
  extends SecurityException
{
  static final long serialVersionUID = -8973677308554045785L;
  
  public ExitSecurityException() {}
  
  public ExitSecurityException(String paramString)
  {
    super(paramString);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.ExitSecurityException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.io.Serializable;
import java.security.Permission;
import java.security.PermissionCollection;
import java.util.Enumeration;
import org.openide.windows.InputOutput;

final class IOPermissionCollection
  extends PermissionCollection
  implements Serializable
{
  private InputOutput io;
  private PermissionCollection delegated;
  final TaskThreadGroup grp;
  static final long serialVersionUID = 2046381622544740109L;
  
  protected IOPermissionCollection(InputOutput paramInputOutput, PermissionCollection paramPermissionCollection, TaskThreadGroup paramTaskThreadGroup)
  {
    io = paramInputOutput;
    delegated = paramPermissionCollection;
    grp = paramTaskThreadGroup;
  }
  
  public boolean implies(Permission paramPermission)
  {
    return delegated.implies(paramPermission);
  }
  
  public Enumeration<Permission> elements()
  {
    return delegated.elements();
  }
  
  public void add(Permission paramPermission)
  {
    delegated.add(paramPermission);
  }
  
  public InputOutput getIO()
  {
    return io;
  }
  
  public void setIO(InputOutput paramInputOutput)
  {
    io = paramInputOutput;
  }
  
  public String toString()
  {
    return delegated.toString();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.IOPermissionCollection
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.HashMap;
import java.util.Hashtable;
import org.openide.windows.InputOutput;
import org.openide.windows.OutputWriter;

final class IOTable
  extends Hashtable<InputOutput, TaskIO>
{
  static final long serialVersionUID = 9096333712401558521L;
  private ThreadGroup base;
  private TaskIO systemIO;
  private HashMap<String, TaskIO> freeTaskIOs;
  
  public IOTable(ThreadGroup paramThreadGroup, TaskIO paramTaskIO)
  {
    base = paramThreadGroup;
    systemIO = paramTaskIO;
    freeTaskIOs = new HashMap(16);
  }
  
  ThreadGroup findGroup()
  {
    ThreadGroup localThreadGroup1 = Thread.currentThread().getThreadGroup();
    ThreadGroup localThreadGroup2 = null;
    while ((localThreadGroup1 != null) && (localThreadGroup1 != base))
    {
      localThreadGroup2 = localThreadGroup1;
      localThreadGroup1 = localThreadGroup1.getParent();
    }
    return localThreadGroup1 == null ? null : localThreadGroup2;
  }
  
  private boolean searchingIO = false;
  
  private synchronized TaskIO getIO()
  {
    if (searchingIO) {
      return systemIO;
    }
    InputOutput localInputOutput = null;
    if ((Thread.currentThread() instanceof IOThreadIfc)) {
      localInputOutput = ((IOThreadIfc)Thread.currentThread()).getInputOutput();
    }
    IOPermissionCollection localIOPermissionCollection = null;
    if (localInputOutput == null)
    {
      try
      {
        searchingIO = true;
        localIOPermissionCollection = AccController.getIOPermissionCollection();
      }
      finally
      {
        searchingIO = false;
      }
      if (localIOPermissionCollection == null) {
        return systemIO;
      }
      localInputOutput = localIOPermissionCollection.getIO();
    }
    TaskIO localTaskIO = (TaskIO)get(localInputOutput);
    if (localTaskIO == null) {
      return new TaskIO(localInputOutput);
    }
    return localTaskIO;
  }
  
  synchronized TaskIO getTaskIO(String paramString)
  {
    TaskIO localTaskIO;
    if ((reuseTaskIO()) && 
      ((localTaskIO = getFreeTaskIO(paramString)) != null)) {
      return localTaskIO;
    }
    return null;
  }
  
  private boolean reuseTaskIO()
  {
    return true;
  }
  
  private boolean clearTaskIO()
  {
    return true;
  }
  
  private TaskIO getFreeTaskIO(String paramString)
  {
    TaskIO localTaskIO = (TaskIO)freeTaskIOs.get(paramString);
    if (localTaskIO == null) {
      return null;
    }
    if (clearTaskIO()) {
      try
      {
        localTaskIO.getInout().getOut().reset();
        localTaskIO.getInout().getErr().reset();
      }
      catch (IOException localIOException) {}
    }
    in = null;
    localTaskIO.getInout().flushReader();
    freeTaskIOs.remove(paramString);
    return localTaskIO;
  }
  
  synchronized void free(ThreadGroup paramThreadGroup, InputOutput paramInputOutput)
  {
    TaskIO localTaskIO = (TaskIO)get(paramInputOutput);
    if (localTaskIO == null) {
      return;
    }
    if (foreign) {
      return;
    }
    if (localTaskIO.getName() != "noname")
    {
      localTaskIO = (TaskIO)freeTaskIOs.put(localTaskIO.getName(), localTaskIO);
      if (localTaskIO != null) {
        localTaskIO.getInout().closeInputOutput();
      }
    }
    remove(paramInputOutput);
  }
  
  public Reader getIn()
  {
    TaskIO localTaskIO = getIO();
    if (in == null) {
      localTaskIO.initIn();
    }
    return in;
  }
  
  public Writer getOut()
  {
    TaskIO localTaskIO = getIO();
    if (out == null) {
      localTaskIO.initOut();
    }
    return out;
  }
  
  public Writer getErr()
  {
    TaskIO localTaskIO = getIO();
    if (err == null) {
      localTaskIO.initErr();
    }
    return err;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.IOTable
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import org.openide.windows.InputOutput;

abstract interface IOThreadIfc
{
  public abstract InputOutput getInputOutput();
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.IOThreadIfc
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.accessibility.AccessibleContext;
import javax.swing.ActionMap;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;
import org.openide.awt.Mnemonics;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.ExplorerManager.Provider;
import org.openide.explorer.ExplorerUtils;
import org.openide.explorer.view.ListView;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;

class Install$EM
  extends JPanel
  implements ExplorerManager.Provider
{
  private ExplorerManager manager = new ExplorerManager();
  private Lookup lookup;
  
  public Install$EM()
  {
    manager = new ExplorerManager();
    ActionMap localActionMap = getActionMap();
    localActionMap.put("copy-to-clipboard", ExplorerUtils.actionCopy(manager));
    localActionMap.put("cut-to-clipboard", ExplorerUtils.actionCut(manager));
    localActionMap.put("paste-from-clipboard", ExplorerUtils.actionPaste(manager));
    localActionMap.put("delete", ExplorerUtils.actionDelete(manager, true));
    
    lookup = ExplorerUtils.createLookup(manager, localActionMap);
    
    initComponent();
  }
  
  private void initComponent()
  {
    setLayout(new GridBagLayout());
    
    GridBagConstraints localGridBagConstraints = new GridBagConstraints();
    gridx = 0;
    gridy = 0;
    weightx = 1.0D;
    fill = 2;
    insets = new Insets(11, 11, 0, 12);
    
    JLabel localJLabel = new JLabel();
    Mnemonics.setLocalizedText(localJLabel, NbBundle.getMessage(Install.class, "LAB_PendingTasks"));
    
    add(localJLabel, localGridBagConstraints);
    
    gridy = 1;
    weighty = 1.0D;
    fill = 1;
    insets = new Insets(2, 11, 0, 12);
    
    ListView localListView = new ListView();
    
    localListView.setBorder(UIManager.getBorder("Nb.ScrollPane.border"));
    localJLabel.setLabelFor(localListView);
    
    add(localListView, localGridBagConstraints);
    
    localListView.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(Install.class, "ACSD_PendingTasks"));
    
    getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(Install.class, "ACSD_PendingTitle"));
    
    Dimension localDimension = getPreferredSize();
    setPreferredSize(new Dimension(width * 5 / 4, height));
  }
  
  public ExplorerManager getExplorerManager()
  {
    return manager;
  }
  
  public Lookup getLookup()
  {
    return lookup;
  }
  
  public void addNotify()
  {
    super.addNotify();
    ExplorerUtils.activateActions(manager, true);
  }
  
  public void removeNotify()
  {
    ExplorerUtils.activateActions(manager, false);
    super.removeNotify();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.Install.EM
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.awt.Image;
import javax.swing.Action;
import javax.swing.Icon;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.util.ImageUtilities;

class Install$NoActionNode
  extends AbstractNode
{
  private Image img;
  
  public Install$NoActionNode(Icon paramIcon, String paramString1, String paramString2)
  {
    super(Children.LEAF);
    if (paramIcon != null) {
      img = ImageUtilities.icon2Image(paramIcon);
    }
    setName(paramString1);
    if (paramString2 != null) {
      setDisplayName(paramString2);
    }
  }
  
  public Action[] getActions(boolean paramBoolean)
  {
    return new Action[0];
  }
  
  public Image getIcon(int paramInt)
  {
    return img == null ? super.getIcon(paramInt) : img;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.Install.NoActionNode
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.util.Collections;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import org.netbeans.modules.progress.spi.Controller;
import org.netbeans.modules.progress.spi.InternalHandle;
import org.netbeans.modules.progress.spi.TaskModel;
import org.openide.awt.Actions;
import org.openide.execution.ExecutorTask;
import org.openide.nodes.Children.Keys;
import org.openide.nodes.Node;
import org.openide.util.NbBundle;
import org.openide.util.actions.SystemAction;

class Install$PendingChildren
  extends Children.Keys<Object>
  implements ExecutionListener, ListDataListener
{
  public Install$PendingChildren()
  {
    ExecutionEngine localExecutionEngine = ExecutionEngine.getExecutionEngine();
    if (localExecutionEngine != null) {
      localExecutionEngine.addExecutionListener(this);
    }
    Controller.getDefault().getModel().addListDataListener(this);
  }
  
  protected Node[] createNodes(Object paramObject)
  {
    Install.NoActionNode localNoActionNode = null;
    if ((paramObject instanceof Action))
    {
      Action localAction = (Action)paramObject;
      Icon localIcon = (localAction instanceof SystemAction) ? ((SystemAction)localAction).getIcon() : null;
      
      String str = (String)localAction.getValue("Name");
      if (str == null) {
        str = "";
      }
      str = Actions.cutAmpersand(str);
      localNoActionNode = new Install.NoActionNode(localIcon, str, NbBundle.getMessage(Install.class, "CTL_ActionInProgress", str));
    }
    else if ((paramObject instanceof ExecutorTask))
    {
      localNoActionNode = new Install.NoActionNode(null, paramObject.toString(), NbBundle.getMessage(Install.class, "CTL_PendingExternalProcess2", ExecutionEngine.getExecutionEngine().getRunningTaskName((ExecutorTask)paramObject)));
    }
    else if ((paramObject instanceof InternalHandle))
    {
      localNoActionNode = new Install.NoActionNode(null, ((InternalHandle)paramObject).getDisplayName(), null);
    }
    return new Node[] { localNoActionNode == null ? null : localNoActionNode };
  }
  
  protected void addNotify()
  {
    setKeys(Install.getPendingTasks());
    super.addNotify();
  }
  
  protected void removeNotify()
  {
    setKeys(Collections.emptySet());
    super.removeNotify();
    ExecutionEngine localExecutionEngine = ExecutionEngine.getExecutionEngine();
    if (localExecutionEngine != null) {
      localExecutionEngine.removeExecutionListener(this);
    }
    Controller.getDefault().getModel().removeListDataListener(this);
  }
  
  public void startedExecution(ExecutionEvent paramExecutionEvent)
  {
    setKeys(Install.getPendingTasks());
  }
  
  public void finishedExecution(ExecutionEvent paramExecutionEvent)
  {
    setKeys(Install.getPendingTasks());
  }
  
  public void intervalAdded(ListDataEvent paramListDataEvent)
  {
    setKeys(Install.getPendingTasks());
  }
  
  public void intervalRemoved(ListDataEvent paramListDataEvent)
  {
    setKeys(Install.getPendingTasks());
  }
  
  public void contentsChanged(ListDataEvent paramListDataEvent)
  {
    setKeys(Install.getPendingTasks());
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.Install.PendingChildren
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.awt.Dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Collection;
import org.openide.nodes.NodeEvent;
import org.openide.nodes.NodeListener;
import org.openide.nodes.NodeMemberEvent;
import org.openide.nodes.NodeReorderEvent;
import org.openide.util.Mutex;

class Install$PendingDialogCloser
  extends WindowAdapter
  implements Runnable, PropertyChangeListener, ActionListener, NodeListener
{
  private Dialog[] dialogHolder;
  private Object exitOption;
  
  Install$PendingDialogCloser(Dialog[] paramArrayOfDialog, Object paramObject)
  {
    dialogHolder = paramArrayOfDialog;
    exitOption = paramObject;
  }
  
  public void run()
  {
    dialogHolder[0].setVisible(false);
  }
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    if ("exploredContext".equals(paramPropertyChangeEvent.getPropertyName())) {
      checkClose();
    }
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    if (paramActionEvent.getSource() == exitOption)
    {
      Install.access$000();
      Mutex.EVENT.readAccess(this);
    }
  }
  
  public void childrenRemoved(NodeMemberEvent paramNodeMemberEvent)
  {
    checkClose();
  }
  
  public void windowOpened(WindowEvent paramWindowEvent)
  {
    checkClose();
  }
  
  private void checkClose()
  {
    if ((dialogHolder[0] != null) && (Install.getPendingTasks().isEmpty())) {
      Mutex.EVENT.readAccess(this);
    }
  }
  
  public void childrenAdded(NodeMemberEvent paramNodeMemberEvent) {}
  
  public void childrenReordered(NodeReorderEvent paramNodeReorderEvent) {}
  
  public void nodeDestroyed(NodeEvent paramNodeEvent) {}
}

/* Location:
 * Qualified Name:     org.netbeans.core.execution.Install.PendingDialogCloser
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.execution;

import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.Introspector;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyEditorManager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import javax.accessibility.AccessibleContext;
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import org.netbeans.TopSecurityManager;
import org.netbeans.core.ModuleActions;
import org.netbeans.modules.progress.spi.Controller;
import org.netbeans.modules.progress.spi.InternalHandle;
import org.netbeans.modules.progress.spi.TaskModel;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.awt.Actions;
import org.openide.awt.Mnemonics;
import org.openide.execution.ExecutorTask;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.ExplorerManager.Provider;
import org.openide.explorer.ExplorerUtils;
import org.openide.explorer.view.ListView;
import org.openide.modules.ModuleInstall;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Children.Keys;
import org.openide.nodes.Node;
import org.openide.nodes.NodeEvent;
import org.openide.nodes.NodeListener;
import org.openide.nodes.NodeMemberEvent;
import org.openide.nodes.NodeReorderEvent;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.Mutex;
import org.openide.util.NbBundle;
import org.openide.util.actions.SystemAction;

public class Install
  extends ModuleInstall
{
  private static final String BEANINFO_PATH = "org.netbeans.core.execution.beaninfo";
  private static final String EDITOR_PATH = "org.netbeans.core.execution.beaninfo.editors";
  
  public void restored()
  {
    TopSecurityManager.register(SecMan.DEFAULT);
    
    String[] arrayOfString = Introspector.getBeanInfoSearchPath();
    Object localObject = Arrays.asList(arrayOfString);
    if (!((List)localObject).contains("org.netbeans.core.execution.beaninfo"))
    {
      localObject = new ArrayList((Collection)localObject);
      ((List)localObject).add("org.netbeans.core.execution.beaninfo");
      Introspector.setBeanInfoSearchPath((String[])((List)localObject).toArray(new String[0]));
    }
    arrayOfString = PropertyEditorManager.getEditorSearchPath();
    localObject = Arrays.asList(arrayOfString);
    if (!((List)localObject).contains("org.netbeans.core.execution.beaninfo.editors"))
    {
      localObject = new ArrayList((Collection)localObject);
      ((List)localObject).add("org.netbeans.core.execution.beaninfo.editors");
      PropertyEditorManager.setEditorSearchPath((String[])((List)localObject).toArray(new String[0]));
    }
  }
  
  public void uninstalled()
  {
    showPendingTasks();
    
    TopSecurityManager.unregister(SecMan.DEFAULT);
    
    String[] arrayOfString = Introspector.getBeanInfoSearchPath();
    Object localObject = Arrays.asList(arrayOfString);
    if (((List)localObject).contains("org.netbeans.core.execution.beaninfo"))
    {
      localObject = new ArrayList((Collection)localObject);
      ((List)localObject).remove("org.netbeans.core.execution.beaninfo");
      Introspector.setBeanInfoSearchPath((String[])((List)localObject).toArray(new String[0]));
    }
    arrayOfString = PropertyEditorManager.getEditorSearchPath();
    localObject = Arrays.asList(arrayOfString);
    if (((List)localObject).contains("org.netbeans.core.execution.beaninfo.editors"))
    {
      localObject = new ArrayList((Collection)localObject);
      ((List)localObject).remove("org.netbeans.core.execution.beaninfo.editors");
      PropertyEditorManager.setEditorSearchPath((String[])((List)localObject).toArray(new String[0]));
    }
  }
  
  public boolean closing()
  {
    return showPendingTasks();
  }
  
  private static class PendingDialogCloser
    extends WindowAdapter
    implements Runnable, PropertyChangeListener, ActionListener, NodeListener
  {
    private Dialog[] dialogHolder;
    private Object exitOption;
    
    PendingDialogCloser(Dialog[] paramArrayOfDialog, Object paramObject)
    {
      dialogHolder = paramArrayOfDialog;
      exitOption = paramObject;
    }
    
    public void run()
    {
      dialogHolder[0].setVisible(false);
    }
    
    public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
    {
      if ("exploredContext".equals(paramPropertyChangeEvent.getPropertyName())) {
        checkClose();
      }
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      if (paramActionEvent.getSource() == exitOption)
      {
        Install.access$000();
        Mutex.EVENT.readAccess(this);
      }
    }
    
    public void childrenRemoved(NodeMemberEvent paramNodeMemberEvent)
    {
      checkClose();
    }
    
    public void windowOpened(WindowEvent paramWindowEvent)
    {
      checkClose();
    }
    
    private void checkClose()
    {
      if ((dialogHolder[0] != null) && (Install.getPendingTasks().isEmpty())) {
        Mutex.EVENT.readAccess(this);
      }
    }
    
    public void childrenAdded(NodeMemberEvent paramNodeMemberEvent) {}
    
    public void childrenReordered(NodeReorderEvent paramNodeReorderEvent) {}
    
    public void nodeDestroyed(NodeEvent paramNodeEv
1 2 3

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd