org.eclipse.ui.console_3.5.100.v20111007_r372

16:48:05.059 INFO  jd.cli.Main - Decompiling org.eclipse.ui.console_3.5.100.v20111007_r372.jar
package org.eclipse.ui.console;

class AbstractConsole$Lifecycle
  implements IConsoleListener
{
  final AbstractConsole this$0;
  
  AbstractConsole$Lifecycle(AbstractConsole paramAbstractConsole)
  {
    this$0 = paramAbstractConsole;
  }
  
  public void consolesAdded(IConsole[] consoles)
  {
    for (int i = 0; i < consoles.length; i++)
    {
      IConsole console = consoles[i];
      if (console == this$0) {
        this$0.initialize();
      }
    }
  }
  
  public void consolesRemoved(IConsole[] consoles)
  {
    for (int i = 0; i < consoles.length; i++)
    {
      IConsole console = consoles[i];
      if (console == this$0)
      {
        ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
        this$0.destroy();
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.AbstractConsole.Lifecycle
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.internal.console.ConsoleMessages;

class AbstractConsole$PropertyNotifier
  implements ISafeRunnable
{
  private IPropertyChangeListener fListener;
  private PropertyChangeEvent fEvent;
  final AbstractConsole this$0;
  
  AbstractConsole$PropertyNotifier(AbstractConsole paramAbstractConsole)
  {
    this$0 = paramAbstractConsole;
  }
  
  public void handleException(Throwable exception)
  {
    IStatus status = new Status(4, ConsolePlugin.getUniqueIdentifier(), 120, ConsoleMessages.AbstractConsole_0, exception);
    ConsolePlugin.log(status);
  }
  
  public void run()
    throws Exception
  {
    fListener.propertyChange(fEvent);
  }
  
  public void notify(PropertyChangeEvent event)
  {
    if (AbstractConsole.access$0(this$0) == null) {
      return;
    }
    fEvent = event;
    Object[] copiedListeners = AbstractConsole.access$0(this$0).getListeners();
    for (int i = 0; i < copiedListeners.length; i++)
    {
      fListener = ((IPropertyChangeListener)copiedListeners[i]);
      SafeRunner.run(this);
    }
    fListener = null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.AbstractConsole.PropertyNotifier
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.internal.console.ConsoleMessages;

public abstract class AbstractConsole
  implements IConsole
{
  private ListenerList fListeners;
  private String fName = null;
  private ImageDescriptor fImageDescriptor = null;
  private String fType = null;
  
  class Lifecycle
    implements IConsoleListener
  {
    Lifecycle() {}
    
    public void consolesAdded(IConsole[] consoles)
    {
      for (int i = 0; i < consoles.length; i++)
      {
        IConsole console = consoles[i];
        if (console == AbstractConsole.this) {
          initialize();
        }
      }
    }
    
    public void consolesRemoved(IConsole[] consoles)
    {
      for (int i = 0; i < consoles.length; i++)
      {
        IConsole console = consoles[i];
        if (console == AbstractConsole.this)
        {
          ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
          destroy();
        }
      }
    }
  }
  
  class PropertyNotifier
    implements ISafeRunnable
  {
    private IPropertyChangeListener fListener;
    private PropertyChangeEvent fEvent;
    
    PropertyNotifier() {}
    
    public void handleException(Throwable exception)
    {
      IStatus status = new Status(4, ConsolePlugin.getUniqueIdentifier(), 120, ConsoleMessages.AbstractConsole_0, exception);
      ConsolePlugin.log(status);
    }
    
    public void run()
      throws Exception
    {
      fListener.propertyChange(fEvent);
    }
    
    public void notify(PropertyChangeEvent event)
    {
      if (fListeners == null) {
        return;
      }
      fEvent = event;
      Object[] copiedListeners = fListeners.getListeners();
      for (int i = 0; i < copiedListeners.length; i++)
      {
        fListener = ((IPropertyChangeListener)copiedListeners[i]);
        SafeRunner.run(this);
      }
      fListener = null;
    }
  }
  
  public AbstractConsole(String name, ImageDescriptor imageDescriptor, boolean autoLifecycle)
  {
    this(name, null, imageDescriptor, autoLifecycle);
  }
  
  public AbstractConsole(String name, String type, ImageDescriptor imageDescriptor, boolean autoLifecycle)
  {
    setName(name);
    setType(type);
    setImageDescriptor(imageDescriptor);
    if (autoLifecycle) {
      ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(new Lifecycle());
    }
  }
  
  public AbstractConsole(String name, ImageDescriptor imageDescriptor)
  {
    this(name, imageDescriptor, true);
  }
  
  public String getName()
  {
    return fName;
  }
  
  protected void setName(String name)
  {
    if (!name.equals(fName))
    {
      String old = fName;
      fName = name;
      firePropertyChange(this, "org.eclipse.jface.text", old, name);
    }
  }
  
  public ImageDescriptor getImageDescriptor()
  {
    return fImageDescriptor;
  }
  
  protected void setImageDescriptor(ImageDescriptor imageDescriptor)
  {
    ImageDescriptor old = fImageDescriptor;
    fImageDescriptor = imageDescriptor;
    firePropertyChange(this, "org.eclipse.jface.image", old, imageDescriptor);
  }
  
  public void addPropertyChangeListener(IPropertyChangeListener listener)
  {
    if (fListeners == null) {
      fListeners = new ListenerList();
    }
    fListeners.add(listener);
  }
  
  public void removePropertyChangeListener(IPropertyChangeListener listener)
  {
    if (fListeners != null) {
      fListeners.remove(listener);
    }
  }
  
  public void firePropertyChange(Object source, String property, Object oldValue, Object newValue)
  {
    if (fListeners == null) {
      return;
    }
    PropertyNotifier notifier = new PropertyNotifier();
    notifier.notify(new PropertyChangeEvent(source, property, oldValue, newValue));
  }
  
  public final void initialize()
  {
    init();
  }
  
  protected void init() {}
  
  public final void destroy()
  {
    dispose();
  }
  
  protected void dispose() {}
  
  public void activate()
  {
    ConsolePlugin.getDefault().getConsoleManager().showConsoleView(this);
  }
  
  protected void setType(String typeIdentifier)
  {
    fType = typeIdentifier;
  }
  
  public String getType()
  {
    return fType;
  }
  
  public String getHelpContextId()
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.AbstractConsole
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.console.ConsoleManager;
import org.eclipse.ui.internal.console.ConsolePluginImages;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class ConsolePlugin
  extends AbstractUIPlugin
{
  private IConsoleManager fConsoleManager = null;
  private static ConsolePlugin fgPlugin = null;
  private static final String PI_UI_CONSOLE = "org.eclipse.ui.console";
  
  public static ConsolePlugin getDefault()
  {
    return fgPlugin;
  }
  
  public ConsolePlugin()
  {
    fgPlugin = this;
  }
  
  public static String getUniqueIdentifier()
  {
    return "org.eclipse.ui.console";
  }
  
  public static void log(IStatus status)
  {
    getDefault().getLog().log(status);
  }
  
  public static void log(Throwable t)
  {
    if ((t instanceof CoreException)) {
      log(((CoreException)t).getStatus());
    } else {
      log(newErrorStatus("Error logged from Console plug-in: ", t));
    }
  }
  
  public static IStatus newErrorStatus(String message, Throwable exception)
  {
    return new Status(4, getUniqueIdentifier(), 120, message, exception);
  }
  
  public IConsoleManager getConsoleManager()
  {
    if (fConsoleManager == null) {
      fConsoleManager = new ConsoleManager();
    }
    return fConsoleManager;
  }
  
  public static Display getStandardDisplay()
  {
    return PlatformUI.getWorkbench().getDisplay();
  }
  
  public static void errorDialog(Shell shell, String title, String message, Throwable t)
  {
    IStatus status;
    if ((t instanceof CoreException))
    {
      IStatus status = ((CoreException)t).getStatus();
      if ((status != null) && (message.equals(status.getMessage()))) {
        message = null;
      }
    }
    else
    {
      status = new Status(4, getUniqueIdentifier(), 120, "Error within Debug UI: ", t);
      log(status);
    }
    ErrorDialog.openError(shell, title, message, status);
  }
  
  public static Image getImage(String key)
  {
    return ConsolePluginImages.getImage(key);
  }
  
  public static ImageDescriptor getImageDescriptor(String key)
  {
    return ConsolePluginImages.getImageDescriptor(key);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    if (fConsoleManager != null)
    {
      IConsole[] consoles = fConsoleManager.getConsoles();
      if (consoles != null) {
        fConsoleManager.removeConsoles(consoles);
      }
    }
    super.stop(context);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.ConsolePlugin
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.ui.part.IPageBookViewPage;

public abstract interface IConsole
{
  public abstract String getName();
  
  public abstract ImageDescriptor getImageDescriptor();
  
  public abstract IPageBookViewPage createPage(IConsoleView paramIConsoleView);
  
  public abstract void addPropertyChangeListener(IPropertyChangeListener paramIPropertyChangeListener);
  
  public abstract void removePropertyChangeListener(IPropertyChangeListener paramIPropertyChangeListener);
  
  public abstract String getType();
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IConsole
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

public abstract interface IConsoleConstants
{
  public static final String PLUGIN_ID = ;
  public static final String ID_CONSOLE_VIEW = "org.eclipse.ui.console.ConsoleView";
  public static final String MESSAGE_CONSOLE_TYPE = "org.eclipse.ui.MessageConsole";
  /**
   * @deprecated
   */
  public static final String CONSOLE_FONT = "org.eclipse.ui.console.ConsoleFont";
  public static final String LAUNCH_GROUP = "launchGroup";
  public static final String OUTPUT_GROUP = "outputGroup";
  public static final String IMG_VIEW_CONSOLE = "IMG_VIEW_CONSOLE";
  public static final String IMG_LCL_CLEAR = "IMG_LCL_CLEAR";
  public static final int INTERNAL_ERROR = 120;
  public static final String EXTENSION_POINT_CONSOLE_PATTERN_MATCH_LISTENERS = "consolePatternMatchListeners";
  public static final String EXTENSION_POINT_CONSOLE_PAGE_PARTICIPANTS = "consolePageParticipants";
  public static final String EXTENSION_POINT_CONSOLE_FACTORIES = "consoleFactories";
  public static final String P_FONT = ConsolePlugin.getUniqueIdentifier() + ".P_FONT";
  public static final String P_FONT_STYLE = ConsolePlugin.getUniqueIdentifier() + ".P_FONT_STYLE";
  public static final String P_STREAM_COLOR = ConsolePlugin.getUniqueIdentifier() + ".P_STREAM_COLOR";
  public static final String P_TAB_SIZE = ConsolePlugin.getUniqueIdentifier() + ".P_TAB_SIZE";
  public static final String P_CONSOLE_WIDTH = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_WIDTH";
  public static final String P_CONSOLE_OUTPUT_COMPLETE = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_STREAMS_CLOSED";
  public static final String P_BACKGROUND_COLOR = ConsolePlugin.getUniqueIdentifier() + ".P_BACKGROUND_COLOR";
  public static final int DEFAULT_TAB_SIZE = 8;
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IConsoleConstants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.swt.custom.StyleRange;

public abstract interface IConsoleDocumentPartitioner
  extends IDocumentPartitioner
{
  public abstract boolean isReadOnly(int paramInt);
  
  public abstract StyleRange[] getStyleRanges(int paramInt1, int paramInt2);
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IConsoleDocumentPartitioner
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

public abstract interface IConsoleFactory
{
  public abstract void openConsole();
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IConsoleFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

public abstract interface IConsoleListener
{
  public abstract void consolesAdded(IConsole[] paramArrayOfIConsole);
  
  public abstract void consolesRemoved(IConsole[] paramArrayOfIConsole);
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IConsoleListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

public abstract interface IConsoleManager
{
  public abstract void addConsoleListener(IConsoleListener paramIConsoleListener);
  
  public abstract void removeConsoleListener(IConsoleListener paramIConsoleListener);
  
  public abstract void addConsoles(IConsole[] paramArrayOfIConsole);
  
  public abstract void removeConsoles(IConsole[] paramArrayOfIConsole);
  
  public abstract IConsole[] getConsoles();
  
  public abstract void showConsoleView(IConsole paramIConsole);
  
  public abstract void warnOfContentChange(IConsole paramIConsole);
  
  public abstract IPatternMatchListener[] createPatternMatchListeners(IConsole paramIConsole);
  
  public abstract void refresh(IConsole paramIConsole);
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IConsoleManager
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.part.IPageBookViewPage;

public abstract interface IConsolePageParticipant
  extends IAdaptable
{
  public abstract void init(IPageBookViewPage paramIPageBookViewPage, IConsole paramIConsole);
  
  public abstract void dispose();
  
  public abstract void activated();
  
  public abstract void deactivated();
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IConsolePageParticipant
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import org.eclipse.ui.IViewPart;

public abstract interface IConsoleView
  extends IViewPart
{
  public abstract void display(IConsole paramIConsole);
  
  public abstract void setPinned(boolean paramBoolean);
  
  /**
   * @deprecated
   */
  public abstract void pin(IConsole paramIConsole);
  
  public abstract boolean isPinned();
  
  public abstract IConsole getConsole();
  
  public abstract void warnOfContentChange(IConsole paramIConsole);
  
  public abstract void setScrollLock(boolean paramBoolean);
  
  public abstract boolean getScrollLock();
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IConsoleView
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

public abstract interface IHyperlink
{
  public abstract void linkEntered();
  
  public abstract void linkExited();
  
  public abstract void linkActivated();
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IHyperlink
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import org.eclipse.swt.widgets.Event;

public abstract interface IHyperlink2
  extends IHyperlink
{
  public abstract void linkActivated(Event paramEvent);
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IHyperlink2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.WorkbenchEncoding;
import org.eclipse.ui.internal.console.IOConsolePage;
import org.eclipse.ui.internal.console.IOConsolePartitioner;
import org.eclipse.ui.part.IPageBookViewPage;

public class IOConsole
  extends TextConsole
{
  private IOConsolePartitioner partitioner;
  private IOConsoleInputStream inputStream;
  private List openStreams;
  private String fEncoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
  
  public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle)
  {
    this(name, consoleType, imageDescriptor, null, autoLifecycle);
  }
  
  public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor, String encoding, boolean autoLifecycle)
  {
    super(name, consoleType, imageDescriptor, autoLifecycle);
    if (encoding != null) {
      fEncoding = encoding;
    }
    openStreams = new ArrayList();
    inputStream = new IOConsoleInputStream(this);
    synchronized (openStreams)
    {
      openStreams.add(inputStream);
    }
    partitioner = new IOConsolePartitioner(inputStream, this);
    partitioner.connect(getDocument());
  }
  
  public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor)
  {
    this(name, consoleType, imageDescriptor, true);
  }
  
  public IOConsole(String name, ImageDescriptor imageDescriptor)
  {
    this(name, null, imageDescriptor);
  }
  
  public IPageBookViewPage createPage(IConsoleView view)
  {
    return new IOConsolePage(this, view);
  }
  
  public IOConsoleOutputStream newOutputStream()
  {
    IOConsoleOutputStream outputStream = new IOConsoleOutputStream(this);
    outputStream.setEncoding(fEncoding);
    synchronized (openStreams)
    {
      openStreams.add(outputStream);
    }
    return outputStream;
  }
  
  public IOConsoleInputStream getInputStream()
  {
    return inputStream;
  }
  
  protected IConsoleDocumentPartitioner getPartitioner()
  {
    return partitioner;
  }
  
  public int getHighWaterMark()
  {
    return partitioner.getHighWaterMark();
  }
  
  public int getLowWaterMark()
  {
    return partitioner.getLowWaterMark();
  }
  
  public void setWaterMarks(int low, int high)
  {
    if ((low >= 0) && 
      (low >= high)) {
      throw new IllegalArgumentException("High water mark must be greater than low water mark");
    }
    partitioner.setWaterMarks(low, high);
  }
  
  private void checkFinished()
  {
    if (openStreams.isEmpty()) {
      partitioner.streamsClosed();
    }
  }
  
  void streamClosed(IOConsoleOutputStream stream)
  {
    synchronized (openStreams)
    {
      openStreams.remove(stream);
      checkFinished();
    }
  }
  
  void streamClosed(IOConsoleInputStream stream)
  {
    synchronized (openStreams)
    {
      openStreams.remove(stream);
      checkFinished();
    }
  }
  
  public void clearConsole()
  {
    if (partitioner != null) {
      partitioner.clearBuffer();
    }
  }
  
  protected void dispose()
  {
    super.dispose();
    partitioner.disconnect();
    
    Object[] allStreams = openStreams.toArray();
    for (int i = 0; i < allStreams.length; i++)
    {
      Object stream = allStreams[i];
      if ((stream instanceof IOConsoleInputStream))
      {
        IOConsoleInputStream is = (IOConsoleInputStream)stream;
        try
        {
          is.close();
        }
        catch (IOException localIOException1) {}
      }
      else if ((stream instanceof IOConsoleOutputStream))
      {
        IOConsoleOutputStream os = (IOConsoleOutputStream)stream;
        try
        {
          os.close();
        }
        catch (IOException localIOException2) {}
      }
    }
    inputStream = null;
  }
  
  public String getEncoding()
  {
    return fEncoding;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IOConsole
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import org.eclipse.swt.graphics.Color;

public class IOConsoleInputStream
  extends InputStream
{
  private byte[] input = new byte[100];
  private int inPointer = 0;
  private int outPointer = 0;
  private int size = 0;
  private boolean eofSent = false;
  private boolean closed = false;
  private IOConsole console;
  private Color color;
  private int fontStyle = 0;
  
  IOConsoleInputStream(IOConsole console)
  {
    this.console = console;
  }
  
  public synchronized int read(byte[] b, int off, int len)
    throws IOException
  {
    waitForData();
    if (available() == -1) {
      return -1;
    }
    int toCopy = Math.min(len, size);
    if (input.length - outPointer > toCopy)
    {
      System.arraycopy(input, outPointer, b, off, toCopy);
      outPointer += toCopy;
      size -= toCopy;
    }
    else
    {
      int bytesToEnd = input.length - outPointer;
      System.arraycopy(input, outPointer, b, off, bytesToEnd);
      System.arraycopy(input, 0, b, off + bytesToEnd, toCopy - bytesToEnd);
      outPointer = (toCopy - bytesToEnd);
      size -= toCopy;
    }
    return toCopy;
  }
  
  public int read(byte[] b)
    throws IOException
  {
    return read(b, 0, b.length);
  }
  
  public synchronized int read()
    throws IOException
  {
    waitForData();
    if (available() == -1) {
      return -1;
    }
    byte b = input[outPointer];
    outPointer += 1;
    if (outPointer == input.length) {
      outPointer = 0;
    }
    size -= 1;
    return b;
  }
  
  private void waitForData()
  {
    while ((size == 0) && (!closed)) {
      try
      {
        wait();
      }
      catch (InterruptedException localInterruptedException) {}
    }
  }
  
  public synchronized void appendData(String text)
  {
    String encoding = console.getEncoding();
    byte[] newData;
    if (encoding != null)
    {
      byte[] newData;
      try
      {
        newData = text.getBytes(encoding);
      }
      catch (UnsupportedEncodingException localUnsupportedEncodingException)
      {
        byte[] newData;
        newData = text.getBytes();
      }
    }
    else
    {
      newData = text.getBytes();
    }
    while (input.length - size < newData.length) {
      growArray();
    }
    if (size == 0)
    {
      System.arraycopy(newData, 0, input, 0, newData.length);
      inPointer = newData.length;
      size = newData.length;
      outPointer = 0;
    }
    else if ((inPointer < outPointer) || (input.length - inPointer > newData.length))
    {
      System.arraycopy(newData, 0, input, inPointer, newData.length);
      inPointer += newData.length;
      size += newData.length;
    }
    else
    {
      System.arraycopy(newData, 0, input, inPointer, input.length - inPointer);
      System.arraycopy(newData, input.length - inPointer, input, 0, newData.length - (input.length - inPointer));
      inPointer = (newData.length - (input.length - inPointer));
      size += newData.length;
    }
    if (inPointer == input.length) {
      inPointer = 0;
    }
    notifyAll();
  }
  
  private void growArray()
  {
    byte[] newInput = new byte[input.length + 1024];
    if (outPointer < inPointer)
    {
      System.arraycopy(input, outPointer, newInput, 0, size);
    }
    else
    {
      System.arraycopy(input, outPointer, newInput, 0, input.length - outPointer);
      System.arraycopy(input, 0, newInput, input.length - outPointer, inPointer);
    }
    outPointer = 0;
    inPointer = size;
    input = newInput;
    newInput = (byte[])null;
  }
  
  public int getFontStyle()
  {
    return fontStyle;
  }
  
  public void setFontStyle(int newFontStyle)
  {
    if (newFontStyle != fontStyle)
    {
      int old = fontStyle;
      fontStyle = newFontStyle;
      console.firePropertyChange(this, IConsoleConstants.P_FONT_STYLE, new Integer(old), new Integer(fontStyle));
    }
  }
  
  public void setColor(Color newColor)
  {
    Color old = color;
    if ((old == null) || (!old.equals(newColor)))
    {
      color = newColor;
      console.firePropertyChange(this, IConsoleConstants.P_STREAM_COLOR, old, newColor);
    }
  }
  
  public Color getColor()
  {
    return color;
  }
  
  public int available()
    throws IOException
  {
    if ((closed) && (eofSent)) {
      throw new IOException("Input Stream Closed");
    }
    if (size == 0)
    {
      if (!eofSent)
      {
        eofSent = true;
        return -1;
      }
      throw new IOException("Input Stream Closed");
    }
    return size;
  }
  
  public synchronized void close()
    throws IOException
  {
    if (closed) {
      throw new IOException("Input Stream Closed");
    }
    closed = true;
    notifyAll();
    console.streamClosed(this);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IOConsoleInputStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import java.io.IOException;
import java.io.OutputStream;
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.WorkbenchEncoding;
import org.eclipse.ui.internal.console.IOConsolePartitioner;

public class IOConsoleOutputStream
  extends OutputStream
{
  private boolean closed = false;
  private IOConsolePartitioner partitioner;
  private IOConsole console;
  private boolean activateOnWrite = false;
  private Color color;
  private int fontStyle;
  private String fEncoding;
  private String fDefaultEncoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
  private boolean fNeedsEncoding = false;
  private boolean prependCR;
  
  IOConsoleOutputStream(IOConsole console)
  {
    this.console = console;
    partitioner = ((IOConsolePartitioner)console.getPartitioner());
  }
  
  public int getFontStyle()
  {
    return fontStyle;
  }
  
  public void setFontStyle(int newFontStyle)
  {
    if (newFontStyle != fontStyle)
    {
      int old = fontStyle;
      fontStyle = newFontStyle;
      console.firePropertyChange(this, IConsoleConstants.P_FONT_STYLE, new Integer(old), new Integer(fontStyle));
    }
  }
  
  public boolean isActivateOnWrite()
  {
    return activateOnWrite;
  }
  
  public void setActivateOnWrite(boolean activateOnWrite)
  {
    this.activateOnWrite = activateOnWrite;
  }
  
  public void setColor(Color newColor)
  {
    Color old = color;
    if ((old == null) || (!old.equals(newColor)))
    {
      color = newColor;
      console.firePropertyChange(this, IConsoleConstants.P_STREAM_COLOR, old, newColor);
    }
  }
  
  public Color getColor()
  {
    return color;
  }
  
  public synchronized boolean isClosed()
  {
    return closed;
  }
  
  public synchronized void close()
    throws IOException
  {
    if (closed) {
      throw new IOException("Output Stream is closed");
    }
    if (prependCR)
    {
      prependCR = false;
      notifyParitioner("\r");
    }
    console.streamClosed(this);
    closed = true;
    partitioner = null;
  }
  
  public void flush()
    throws IOException
  {
    if (closed) {
      throw new IOException("Output Stream is closed");
    }
  }
  
  public void write(byte[] b, int off, int len)
    throws IOException
  {
    if (fNeedsEncoding) {
      encodedWrite(new String(b, off, len, fEncoding));
    } else {
      encodedWrite(new String(b, off, len));
    }
  }
  
  public void write(byte[] b)
    throws IOException
  {
    write(b, 0, b.length);
  }
  
  public void write(int b)
    throws IOException
  {
    write(new byte[] { (byte)b }, 0, 1);
  }
  
  public synchronized void write(String str)
    throws IOException
  {
    if (fNeedsEncoding)
    {
      byte[] defaultBytes = str.getBytes();
      str = new String(defaultBytes, fEncoding);
    }
    encodedWrite(str);
  }
  
  private void encodedWrite(String encodedString)
    throws IOException
  {
    if (closed) {
      throw new IOException("Output Stream is closed");
    }
    if (prependCR)
    {
      encodedString = "\r" + encodedString;
      prependCR = false;
    }
    if (encodedString.endsWith("\r"))
    {
      prependCR = true;
      encodedString = new String(encodedString.substring(0, encodedString.length() - 1));
    }
    notifyParitioner(encodedString);
  }
  
  private void notifyParitioner(String encodedString)
    throws IOException
  {
    try
    {
      partitioner.streamAppended(this, encodedString);
      if (activateOnWrite) {
        console.activate();
      } else {
        ConsolePlugin.getDefault().getConsoleManager().warnOfContentChange(console);
      }
    }
    catch (IOException e)
    {
      if (!closed) {
        close();
      }
      throw e;
    }
  }
  
  public void setEncoding(String encoding)
  {
    fEncoding = encoding;
    fNeedsEncoding = ((fEncoding != null) && (!fEncoding.equals(fDefaultEncoding)));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IOConsoleOutputStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

public abstract interface IPatternMatchListener
  extends IPatternMatchListenerDelegate
{
  public abstract String getPattern();
  
  public abstract int getCompilerFlags();
  
  public abstract String getLineQualifier();
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IPatternMatchListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

public abstract interface IPatternMatchListenerDelegate
{
  public abstract void connect(TextConsole paramTextConsole);
  
  public abstract void disconnect();
  
  public abstract void matchFound(PatternMatchEvent paramPatternMatchEvent);
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.IPatternMatchListenerDelegate
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.internal.console.IOConsolePage;
import org.eclipse.ui.part.IPageBookViewPage;

public class MessageConsole
  extends IOConsole
{
  /**
   * @deprecated
   */
  public static final String P_FONT = IConsoleConstants.P_FONT;
  /**
   * @deprecated
   */
  public static final String P_STREAM_COLOR = IConsoleConstants.P_STREAM_COLOR;
  /**
   * @deprecated
   */
  public static final String P_TAB_SIZE = IConsoleConstants.P_TAB_SIZE;
  /**
   * @deprecated
   */
  public static final int DEFAULT_TAB_SIZE = 8;
  
  public MessageConsole(String name, ImageDescriptor imageDescriptor)
  {
    this(name, imageDescriptor, true);
  }
  
  public MessageConsole(String name, ImageDescriptor imageDescriptor, boolean autoLifecycle)
  {
    this(name, "org.eclipse.ui.MessageConsole", imageDescriptor, autoLifecycle);
  }
  
  public MessageConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle)
  {
    this(name, consoleType, imageDescriptor, null, autoLifecycle);
  }
  
  public MessageConsole(String name, String consoleType, ImageDescriptor imageDescriptor, String encoding, boolean autoLifecycle)
  {
    super(name, consoleType, imageDescriptor, encoding, autoLifecycle);
  }
  
  public MessageConsoleStream newMessageStream()
  {
    return new MessageConsoleStream(this);
  }
  
  public IPageBookViewPage createPage(IConsoleView view)
  {
    IOConsolePage page = (IOConsolePage)super.createPage(view);
    page.setReadOnly();
    return page;
  }
  
  public IOConsoleInputStream getInputStream()
  {
    throw new UnsupportedOperationException("Message Console does not support user input");
  }
  
  /**
   * @deprecated
   */
  protected void appendToDocument(String text, MessageConsoleStream stream) {}
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.MessageConsole
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import java.io.IOException;

public class MessageConsoleStream
  extends IOConsoleOutputStream
{
  private MessageConsole fMessageConsole;
  
  public MessageConsoleStream(MessageConsole console)
  {
    super(console);
    fMessageConsole = console;
  }
  
  public void print(String message)
  {
    try
    {
      write(message);
    }
    catch (IOException e)
    {
      ConsolePlugin.log(e);
    }
  }
  
  public void println()
  {
    try
    {
      write("\n");
    }
    catch (IOException e)
    {
      ConsolePlugin.log(e);
    }
  }
  
  public void println(String message)
  {
    print(message + "\n");
  }
  
  public MessageConsole getConsole()
  {
    return fMessageConsole;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.MessageConsoleStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import java.util.EventObject;

public class PatternMatchEvent
  extends EventObject
{
  private static final long serialVersionUID = 876890383326854537L;
  private int offset;
  private int length;
  
  public PatternMatchEvent(TextConsole console, int matchOffset, int matchLength)
  {
    super(console);
    offset = matchOffset;
    length = matchLength;
  }
  
  public int getLength()
  {
    return length;
  }
  
  public int getOffset()
  {
    return offset;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.PatternMatchEvent
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

class TextConsole$1
  implements Runnable
{
  final TextConsole this$0;
  private final int val$oldTabWidth;
  
  TextConsole$1(TextConsole paramTextConsole, int paramInt)
  {
    this$0 = paramTextConsole;val$oldTabWidth = paramInt;
  }
  
  public void run()
  {
    this$0.firePropertyChange(this$0, IConsoleConstants.P_TAB_SIZE, new Integer(val$oldTabWidth), new Integer(TextConsole.access$0(this$0)));
  }
}

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

import org.eclipse.core.runtime.jobs.ISchedulingRule;

class TextConsole$MatcherSchedulingRule
  implements ISchedulingRule
{
  final TextConsole this$0;
  
  private TextConsole$MatcherSchedulingRule(TextConsole paramTextConsole)
  {
    this$0 = paramTextConsole;
  }
  
  TextConsole$MatcherSchedulingRule(TextConsole paramTextConsole, MatcherSchedulingRule paramMatcherSchedulingRule)
  {
    this(paramTextConsole);
  }
  
  public boolean contains(ISchedulingRule rule)
  {
    return rule == this;
  }
  
  public boolean isConflicting(ISchedulingRule rule)
  {
    if (contains(rule)) {
      return true;
    }
    if ((rule != this) && ((rule instanceof MatcherSchedulingRule))) {
      return ((MatcherSchedulingRule)rule).getConsole() == this$0;
    }
    return false;
  }
  
  public TextConsole getConsole()
  {
    return this$0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.console.TextConsole.MatcherSchedulingRule
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.console;

import java.util.HashMap;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.internal.console.ConsoleDocument;
import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
import org.eclipse.ui.internal.console.ConsolePatternMatcher;
import org.eclipse.ui.part.IPageBookViewPage;

public abstract class TextConsole
  extends AbstractConsole
{
  private int fConsoleWidth;
  private int fTabWidth;
  private Font fFont;
  private Color fBackground;
  private ConsolePatternMatcher fPatternMatcher;
  private ConsoleDocument fDocument;
  private boolean fPartitionerFinished = false;
  private boolean fMatcherFinished = false;
  private boolean fCompleteFired = false;
  private HashMap fAttributes = new HashMap();
  private IConsoleManager fConsoleManager = ConsolePlugin.getDefault().getConsoleManager();
  
  protected void dispose()
  {
    super.dispose();
    fFont = null;
    synchronized (fAttributes)
    {
      fAttributes.clear();
    }
  }
  
  public TextConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle)
  {
    super(name, consoleType, imageDescriptor, autoLifecycle);
    fDocument = new ConsoleDocument();
    fDocument.addPositionCategory(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
    fPatternMatcher = new ConsolePatternMatcher(this);
    fDocument.addDocumentListener(fPatternMatcher);
    fTabWidth = 8;
  }
  
  public IPageBookViewPage createPage(IConsoleView view)
  {
    return new TextConsolePage(this, view);
  }
  
  public IDocument getDocument()
  {
    return fDocument;
  }
  
  public int getConsoleWidth()
  {
    return fConsoleWidth;
  }
  
  public void setConsoleWidth(int width)
  {
    if (fConsoleWidth != width)
    {
      int old = fConsoleWidth;
      fConsoleWidth = width;
      
      firePropertyChange(this, IConsoleConstants.P_CONSOLE_WIDTH, new Integer(old), new Integer(fConsoleWidth));
    }
  }
  
  public void setTabWidth(int newTabWidth)
  {
    if (fTabWidth != newTabWidth)
    {
      int oldTabWidth = fTabWidth;
      fTabWidth = newTabWidth;
      ConsolePlugin.getStandardDisplay().asyncExec(new Runnable()
      {
        private final int val$oldTabWidth;
        
        public void run()
        {
          firePropertyChange(TextConsole.this, IConsoleConstants.P_TAB_SIZE, new Integer(val$oldTabWidth), new Integer(fTabWidth));
        }
      });
    }
  }
  
  public int getTabWidth()
  {
    return fTabWidth;
  }
  
  public Font getFont()
  {
    if (fFont == null) {
      fFont = getDefaultFont();
    }
    return fFont;
  }
  
  private Font getDefaultFont()
  {
    return JFaceResources.getFont("org.eclipse.jface.textfont");
  }
  
  public void setFont(Font newFont)
  {
    getFont();
    if (newFont == null) {
      newFont = getDefaultFont();
    }
    if (!fFont.equals(newFont))
    {
      Font old = fFont;
      fFont = newFont;
      firePropertyChange(this, IConsoleConstants.P_FONT, old, fFont);
    }
  }
  
  /**
   * @deprecated
   */
  public void setBackgrond(Color background)
  {
    setBackground(background);
  }
  
  public void setBackground(Color background)
  {
    if (fBackground == null)
    {
      if (background != null) {}
    }
    else if (fBackground.equals(background)) {
1 2 3 4 5 6 7

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