org.eclipse.ui.views.log_1.0.200.v20110404

16:48:26.193 INFO  jd.cli.Main - Decompiling org.eclipse.ui.views.log_1.0.200.v20110404.jar
package org.eclipse.ui.internal.views.log;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;

public abstract class AbstractEntry
  extends PlatformObject
  implements IWorkbenchAdapter
{
  private List children = new ArrayList();
  protected Object parent;
  
  public void addChild(AbstractEntry child)
  {
    if (child != null)
    {
      children.add(0, child);
      child.setParent(this);
    }
  }
  
  public Object[] getChildren(Object parent)
  {
    return children.toArray();
  }
  
  public boolean hasChildren()
  {
    return children.size() > 0;
  }
  
  public int size()
  {
    return children.size();
  }
  
  public ImageDescriptor getImageDescriptor(Object object)
  {
    return null;
  }
  
  public String getLabel(Object o)
  {
    return null;
  }
  
  public Object getParent(Object o)
  {
    return parent;
  }
  
  public void setParent(AbstractEntry parent)
  {
    this.parent = parent;
  }
  
  public void removeChildren(List list)
  {
    children.removeAll(list);
  }
  
  public void removeAllChildren()
  {
    children.clear();
  }
  
  public abstract void write(PrintWriter paramPrintWriter);
}

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

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.ui.views.log";
  private static Activator plugin;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static Activator getDefault()
  {
    return plugin;
  }
  
  protected void initializeImageRegistry(ImageRegistry registry)
  {
    registry.put("icons/eview16/event_prev.gif", createImageDescriptor("icons/eview16/event_prev.gif"));
    registry.put("icons/eview16/event_next.gif", createImageDescriptor("icons/eview16/event_next.gif"));
    
    registry.put("icons/obj16/error_st_obj.gif", createImageDescriptor("icons/obj16/error_st_obj.gif"));
    registry.put("icons/obj16/error_stack.gif", createImageDescriptor("icons/obj16/error_stack.gif"));
    registry.put("icons/obj16/info_st_obj.gif", createImageDescriptor("icons/obj16/info_st_obj.gif"));
    registry.put("icons/obj16/ok_st_obj.gif", createImageDescriptor("icons/obj16/ok_st_obj.gif"));
    registry.put("icons/obj16/warning_st_obj.gif", createImageDescriptor("icons/obj16/warning_st_obj.gif"));
    registry.put("icons/obj16/hierarchical.gif", createImageDescriptor("icons/obj16/hierarchical.gif"));
    
    registry.put("icons/elcl16/clear.gif", createImageDescriptor("icons/elcl16/clear.gif"));
    registry.put("icons/dlcl16/clear.gif", createImageDescriptor("icons/dlcl16/clear.gif"));
    registry.put("icons/elcl16/remove.gif", createImageDescriptor("icons/elcl16/remove.gif"));
    registry.put("icons/dlcl16/remove.gif", createImageDescriptor("icons/dlcl16/remove.gif"));
    registry.put("icons/elcl16/export_log.gif", createImageDescriptor("icons/elcl16/export_log.gif"));
    registry.put("icons/dlcl16/export_log.gif", createImageDescriptor("icons/dlcl16/export_log.gif"));
    registry.put("icons/elcl16/filter_ps.gif", createImageDescriptor("icons/elcl16/filter_ps.gif"));
    registry.put("icons/dlcl16/filter_ps.gif", createImageDescriptor("icons/dlcl16/filter_ps.gif"));
    registry.put("icons/elcl16/import_log.gif", createImageDescriptor("icons/elcl16/import_log.gif"));
    registry.put("icons/dlcl16/import_log.gif", createImageDescriptor("icons/dlcl16/import_log.gif"));
    registry.put("icons/elcl16/open_log.gif", createImageDescriptor("icons/elcl16/open_log.gif"));
    registry.put("icons/dlcl16/open_log.gif", createImageDescriptor("icons/dlcl16/open_log.gif"));
    registry.put("icons/elcl16/properties.gif", createImageDescriptor("icons/elcl16/properties.gif"));
    registry.put("icons/dlcl16/properties.gif", createImageDescriptor("icons/dlcl16/properties.gif"));
    registry.put("icons/elcl16/restore_log.gif", createImageDescriptor("icons/elcl16/restore_log.gif"));
    registry.put("icons/dlcl16/restore_log.gif", createImageDescriptor("icons/dlcl16/restore_log.gif"));
  }
  
  private ImageDescriptor createImageDescriptor(String id)
  {
    return imageDescriptorFromPlugin("org.eclipse.ui.views.log", id);
  }
}

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

import java.util.Comparator;
import java.util.Date;

class EventDetailsDialog$1
  implements Comparator
{
  final EventDetailsDialog this$0;
  private final int val$sortOrder;
  
  EventDetailsDialog$1(EventDetailsDialog paramEventDetailsDialog, int paramInt)
  {
    this$0 = paramEventDetailsDialog;val$sortOrder = paramInt;
  }
  
  public int compare(Object e1, Object e2)
  {
    Date date1 = ((LogEntry)e1).getDate();
    Date date2 = ((LogEntry)e2).getDate();
    if (val$sortOrder == LogView.ASCENDING) {
      return date1.getTime() < date2.getTime() ? LogView.DESCENDING : LogView.ASCENDING;
    }
    return date1.getTime() > date2.getTime() ? LogView.DESCENDING : LogView.ASCENDING;
  }
}

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

import java.text.Collator;
import java.util.Comparator;

class EventDetailsDialog$2
  implements Comparator
{
  final EventDetailsDialog this$0;
  private final int val$sortOrder;
  
  EventDetailsDialog$2(EventDetailsDialog paramEventDetailsDialog, int paramInt)
  {
    this$0 = paramEventDetailsDialog;val$sortOrder = paramInt;
  }
  
  public int compare(Object e1, Object e2)
  {
    LogEntry entry1 = (LogEntry)e1;
    LogEntry entry2 = (LogEntry)e2;
    return this$0.collator.compare(entry1.getPluginId(), entry2.getPluginId()) * val$sortOrder;
  }
}

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

import java.text.Collator;
import java.util.Comparator;

class EventDetailsDialog$3
  implements Comparator
{
  final EventDetailsDialog this$0;
  private final int val$sortOrder;
  
  EventDetailsDialog$3(EventDetailsDialog paramEventDetailsDialog, int paramInt)
  {
    this$0 = paramEventDetailsDialog;val$sortOrder = paramInt;
  }
  
  public int compare(Object e1, Object e2)
  {
    LogEntry entry1 = (LogEntry)e1;
    LogEntry entry2 = (LogEntry)e2;
    return this$0.collator.compare(entry1.getMessage(), entry2.getMessage()) * val$sortOrder;
  }
}

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

import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class EventDetailsDialog$4
  extends AccessibleAdapter
{
  final EventDetailsDialog this$0;
  
  EventDetailsDialog$4(EventDetailsDialog paramEventDetailsDialog)
  {
    this$0 = paramEventDetailsDialog;
  }
  
  public void getName(AccessibleEvent e)
  {
    result = Messages.EventDetailsDialog_previous;
  }
}

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

import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class EventDetailsDialog$5
  extends AccessibleAdapter
{
  final EventDetailsDialog this$0;
  
  EventDetailsDialog$5(EventDetailsDialog paramEventDetailsDialog)
  {
    this$0 = paramEventDetailsDialog;
  }
  
  public void getName(AccessibleEvent e)
  {
    result = Messages.EventDetailsDialog_copy;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.views.log.EventDetailsDialog.5
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.views.log;

import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class EventDetailsDialog$6
  extends AccessibleAdapter
{
  final EventDetailsDialog this$0;
  
  EventDetailsDialog$6(EventDetailsDialog paramEventDetailsDialog)
  {
    this$0 = paramEventDetailsDialog;
  }
  
  public void getName(AccessibleEvent e)
  {
    result = Messages.EventDetailsDialog_next;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.views.log.EventDetailsDialog.6
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.views.log;

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

class EventDetailsDialog$7
  extends SelectionAdapter
{
  final EventDetailsDialog this$0;
  
  EventDetailsDialog$7(EventDetailsDialog paramEventDetailsDialog)
  {
    this$0 = paramEventDetailsDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    FilterDialog dialog = new FilterDialog(this$0.getShell(), EventDetailsDialog.access$0(this$0));
    dialog.create();
    dialog.getShell().setText(Messages.EventDetailsDialog_FilterDialog);
    if (dialog.open() == 0) {
      EventDetailsDialog.access$2(this$0, EventDetailsDialog.access$1(this$0));
    }
    this$0.updateProperties();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.views.log.EventDetailsDialog.7
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.views.log;

import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class EventDetailsDialog$8
  extends AccessibleAdapter
{
  final EventDetailsDialog this$0;
  
  EventDetailsDialog$8(EventDetailsDialog paramEventDetailsDialog)
  {
    this$0 = paramEventDetailsDialog;
  }
  
  public void getName(AccessibleEvent e)
  {
    result = Messages.EventDetailsDialog_FilterDialog;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.views.log.EventDetailsDialog.8
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.views.log;

import com.ibm.icu.text.DateFormat;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.accessibility.Accessible;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class EventDetailsDialog
  extends TrayDialog
{
  public static final String FILTER_ENABLED = "detailsStackFilterEnabled";
  public static final String FILTER_LIST = "detailsStackFilterList";
  private IMemento memento;
  private AbstractEntry entry;
  private AbstractEntry parentEntry;
  private AbstractEntry[] entryChildren;
  private LogViewLabelProvider labelProvider;
  private TreeViewer provider;
  private static int COPY_ID = 22;
  private int childIndex = 0;
  private boolean isOpen;
  private boolean isLastChild;
  private boolean isAtEndOfLog;
  private Label dateLabel;
  private Label severityImageLabel;
  private Label severityLabel;
  private Text msgText;
  private Text stackTraceText;
  private Text sessionDataText;
  private Clipboard clipboard;
  private Button copyButton;
  private Button backButton;
  private Button nextButton;
  private SashForm sashForm;
  private Comparator comparator = null;
  Collator collator;
  private String[] stackFilterPatterns = null;
  private Point dialogLocation;
  private Point dialogSize;
  private int[] sashWeights;
  private DateFormat dateFormat = DateFormat.getDateTimeInstance(3, 3);
  
  protected EventDetailsDialog(Shell parentShell, IAdaptable selection, ISelectionProvider provider, Comparator comparator, IMemento memento)
  {
    super(parentShell);
    this.provider = ((TreeViewer)provider);
    labelProvider = ((LogViewLabelProvider)this.provider.getLabelProvider());
    labelProvider.connect(this);
    entry = ((AbstractEntry)selection);
    this.comparator = comparator;
    this.memento = memento;
    setShellStyle(3312);
    clipboard = new Clipboard(parentShell.getDisplay());
    initialize();
    collator = Collator.getInstance();
    readConfiguration();
    isLastChild = false;
    isAtEndOfLog = false;
    stackFilterPatterns = getFilters();
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, "org.eclipse.pde.doc.user.log_eventdetails");
  }
  
  private void initialize()
  {
    parentEntry = ((AbstractEntry)entry.getParent(entry));
    if (isChild(entry)) {
      setEntryChildren(parentEntry);
    } else {
      setEntryChildren();
    }
    resetChildIndex();
    isLastChild = false;
    isAtEndOfLog = false;
  }
  
  private void resetChildIndex()
  {
    if (entryChildren == null) {
      return;
    }
    LogEntry thisEntry = (LogEntry)entry;
    for (int i = 0; i < entryChildren.length; i++) {
      if ((entryChildren[i] instanceof LogEntry))
      {
        LogEntry logEntry = (LogEntry)entryChildren[i];
        if (logEntry == thisEntry)
        {
          childIndex = i;
          return;
        }
      }
    }
    childIndex = 0;
  }
  
  private boolean isChild(AbstractEntry entry)
  {
    return entry.getParent(entry) != null;
  }
  
  public boolean isOpen()
  {
    return isOpen;
  }
  
  public int open()
  {
    isOpen = true;
    if (sashWeights == null)
    {
      int height = getSashFormgetClientAreaheight;
      int a;
      int a;
      int c;
      int b;
      if (height < 250)
      {
        int c;
        int b;
        a = b = c = height / 3;
      }
      else
      {
        a = 100;
        c = 100;
        b = height - a - c;
      }
      sashWeights = new int[] { a, b, c };
    }
    getSashForm().setWeights(sashWeights);
    return super.open();
  }
  
  public boolean close()
  {
    if (clipboard != null)
    {
      clipboard.dispose();
      clipboard = null;
    }
    storeSettings();
    isOpen = false;
    labelProvider.disconnect(this);
    return super.close();
  }
  
  public void create()
  {
    super.create();
    if (dialogLocation != null) {
      getShell().setLocation(dialogLocation);
    }
    if (dialogSize != null) {
      getShell().setSize(dialogSize);
    } else {
      getShell().setSize(500, 550);
    }
    applyDialogFont(buttonBar);
    getButton(0).setFocus();
  }
  
  protected void buttonPressed(int buttonId)
  {
    if (buttonId == 0) {
      okPressed();
    } else if (1 == buttonId) {
      cancelPressed();
    } else if (14 == buttonId) {
      backPressed();
    } else if (15 == buttonId) {
      nextPressed();
    } else if (COPY_ID == buttonId) {
      copyPressed();
    }
  }
  
  protected void backPressed()
  {
    if (childIndex > 0)
    {
      if ((isLastChild) && (isChild(entry)))
      {
        setEntryChildren(parentEntry);
        isLastChild = false;
      }
      childIndex -= 1;
      entry = entryChildren[childIndex];
    }
    else if ((parentEntry instanceof LogEntry))
    {
      entry = parentEntry;
      if (isChild(entry)) {
        setEntryChildren((AbstractEntry)entry.getParent(entry));
      } else {
        setEntryChildren();
      }
      resetChildIndex();
    }
    setEntrySelectionInTable();
  }
  
  protected void nextPressed()
  {
    if (childIndex < entryChildren.length - 1)
    {
      childIndex += 1;
      entry = entryChildren[childIndex];
      isLastChild = (childIndex == entryChildren.length - 1);
    }
    else if ((isChild(entry)) && (isLastChild) && (!isAtEndOfLog))
    {
      findNextSelectedChild(entry);
    }
    else
    {
      setEntryChildren(entry);
      entry = entryChildren[0];
      isAtEndOfLog = (entryChildren.length == 0);
      isLastChild = (entryChildren.length == 0);
    }
    setEntrySelectionInTable();
  }
  
  protected void copyPressed()
  {
    StringWriter writer = new StringWriter();
    PrintWriter pwriter = new PrintWriter(writer);
    
    entry.write(pwriter);
    pwriter.flush();
    String textVersion = writer.toString();
    try
    {
      pwriter.close();
      writer.close();
    }
    catch (IOException localIOException) {}
    clipboard.setContents(new Object[] { textVersion }, new Transfer[] { TextTransfer.getInstance() });
  }
  
  public void setComparator(Comparator comparator)
  {
    this.comparator = comparator;
    updateProperties();
  }
  
  private void setComparator(byte sortType, int sortOrder)
  {
    if (sortType == 2) {
      comparator = new Comparator()
      {
        private final int val$sortOrder;
        
        public int compare(Object e1, Object e2)
        {
          Date date1 = ((LogEntry)e1).getDate();
          Date date2 = ((LogEntry)e2).getDate();
          if (val$sortOrder == LogView.ASCENDING) {
            return date1.getTime() < date2.getTime() ? LogView.DESCENDING : LogView.ASCENDING;
          }
          return date1.getTime() > date2.getTime() ? LogView.DESCENDING : LogView.ASCENDING;
        }
      };
    } else if (sortType == 1) {
      comparator = new Comparator()
      {
        private final int val$sortOrder;
        
        public int compare(Object e1, Object e2)
        {
          LogEntry entry1 = (LogEntry)e1;
          LogEntry entry2 = (LogEntry)e2;
          return collator.compare(entry1.getPluginId(), entry2.getPluginId()) * val$sortOrder;
        }
      };
    } else {
      comparator = new Comparator()
      {
        private final int val$sortOrder;
        
        public int compare(Object e1, Object e2)
        {
          LogEntry entry1 = (LogEntry)e1;
          LogEntry entry2 = (LogEntry)e2;
          return collator.compare(entry1.getMessage(), entry2.getMessage()) * val$sortOrder;
        }
      };
    }
  }
  
  public void resetSelection(IAdaptable selectedEntry, byte sortType, int sortOrder)
  {
    setComparator(sortType, sortOrder);
    resetSelection(selectedEntry);
  }
  
  public void resetSelection(IAdaptable selectedEntry)
  {
    if (entry.equals(selectedEntry))
    {
      updateProperties();
      return;
    }
    if ((selectedEntry instanceof AbstractEntry))
    {
      entry = ((AbstractEntry)selectedEntry);
      initialize();
      updateProperties();
    }
  }
  
  public void resetButtons()
  {
    backButton.setEnabled(false);
    nextButton.setEnabled(false);
  }
  
  private void setEntrySelectionInTable()
  {
    ISelection selection = new StructuredSelection(entry);
    provider.setSelection(selection);
  }
  
  public void updateProperties()
  {
    if (isChild(entry))
    {
      parentEntry = ((AbstractEntry)entry.getParent(entry));
      setEntryChildren(parentEntry);
      resetChildIndex();
      if (childIndex == entryChildren.length - 1) {
        isLastChild = true;
      }
    }
    if ((entry instanceof LogEntry))
    {
      LogEntry logEntry = (LogEntry)entry;
      
      String strDate = dateFormat.format(logEntry.getDate());
      dateLabel.setText(strDate);
      severityImageLabel.setImage(labelProvider.getColumnImage(entry, 0));
      severityLabel.setText(logEntry.getSeverityText());
      msgText.setText(logEntry.getMessage() != null ? logEntry.getMessage() : "");
      String stack = logEntry.getStack();
      if (stack != null)
      {
        stack = filterStack(stack);
        stackTraceText.setText(stack);
      }
      else
      {
        stackTraceText.setText(Messages.EventDetailsDialog_noStack);
      }
      if (logEntry.getSession() != null)
      {
        String session = logEntry.getSession().getSessionData();
        if (session != null) {
          sessionDataText.setText(session);
        }
      }
    }
    else
    {
      dateLabel.setText("");
      severityImageLabel.setImage(null);
      severityLabel.setText("");
      msgText.setText("");
      stackTraceText.setText("");
      sessionDataText.setText("");
    }
    updateButtons();
  }
  
  private void updateButtons()
  {
    boolean isAtEnd = childIndex == entryChildren.length - 1;
    if (isChild(entry))
    {
      boolean canGoToParent = entry.getParent(entry) instanceof LogEntry;
      backButton.setEnabled((childIndex > 0) || (canGoToParent));
      nextButton.setEnabled((nextChildExists(entry, parentEntry, entryChildren)) || (entry.hasChildren()) || (!isLastChild) || (!isAtEnd));
    }
    else
    {
      backButton.setEnabled(childIndex != 0);
      nextButton.setEnabled((!isAtEnd) || (entry.hasChildren()));
    }
  }
  
  private void findNextSelectedChild(AbstractEntry originalEntry)
  {
    if (isChild(parentEntry))
    {
      entry = parentEntry;
      setEntryChildren((AbstractEntry)parentEntry.getParent(parentEntry));
      parentEntry = ((AbstractEntry)parentEntry.getParent(parentEntry));
      resetChildIndex();
      isLastChild = (childIndex == entryChildren.length - 1);
      if (isLastChild) {
        findNextSelectedChild(originalEntry);
      } else {
        nextPressed();
      }
    }
    else if ((parentEntry instanceof LogEntry))
    {
      entry = parentEntry;
      setEntryChildren();
      resetChildIndex();
      isLastChild = (childIndex == entryChildren.length - 1);
      if (isLastChild)
      {
        if (isChild(entry))
        {
          findNextSelectedChild(originalEntry);
        }
        else
        {
          entry = originalEntry;
          isAtEndOfLog = true;
          nextPressed();
        }
      }
      else {
        nextPressed();
      }
    }
    else
    {
      entry = originalEntry;
      isAtEndOfLog = true;
      nextPressed();
    }
  }
  
  private boolean nextChildExists(AbstractEntry originalEntry, AbstractEntry originalParent, AbstractEntry[] originalEntries)
  {
    if (isChild(parentEntry))
    {
      entry = parentEntry;
      parentEntry = ((AbstractEntry)entry.getParent(entry));
      setEntryChildren(parentEntry);
      resetChildIndex();
      if (childIndex == entryChildren.length - 1) {
        return nextChildExists(originalEntry, originalParent, originalEntries);
      }
      entry = originalEntry;
      parentEntry = originalParent;
      entryChildren = originalEntries;
      resetChildIndex();
      return true;
    }
    if ((parentEntry instanceof LogEntry))
    {
      entry = parentEntry;
      setEntryChildren();
      childIndex = -1;
      resetChildIndex();
      if ((childIndex != -1) && (childIndex < entryChildren.length - 1))
      {
        entry = originalEntry;
        parentEntry = originalParent;
        entryChildren = originalEntries;
        resetChildIndex();
        return true;
      }
    }
    entry = originalEntry;
    parentEntry = originalParent;
    entryChildren = originalEntries;
    resetChildIndex();
    return false;
  }
  
  private void setEntryChildren()
  {
    AbstractEntry[] children = getElements();
    if (comparator != null) {
      Arrays.sort(children, comparator);
    }
    entryChildren = new AbstractEntry[children.length];
    
    System.arraycopy(children, 0, entryChildren, 0, children.length);
  }
  
  private void setEntryChildren(AbstractEntry entry)
  {
    Object[] children = entry.getChildren(entry);
    if (comparator != null) {
      Arrays.sort(children, comparator);
    }
    List result = new ArrayList();
    for (int i = 0; i < children.length; i++) {
      if ((children[i] instanceof AbstractEntry)) {
        result.add(children[i]);
      }
    }
    entryChildren = ((AbstractEntry[])result.toArray(new AbstractEntry[result.size()]));
  }
  
  public SashForm getSashForm()
  {
    return sashForm;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite container = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 1;
    container.setLayout(layout);
    GridData gd = new GridData(1808);
    container.setLayoutData(gd);
    
    createSashForm(container);
    createDetailsSection(getSashForm());
    createStackSection(getSashForm());
    createSessionSection(getSashForm());
    
    updateProperties();
    Dialog.applyDialogFont(container);
    return container;
  }
  
  private void createSashForm(Composite parent)
  {
    sashForm = new SashForm(parent, 512);
    GridLayout layout = new GridLayout();
    marginHeight = (marginWidth = 0);
    sashForm.setLayout(layout);
    sashForm.setLayoutData(new GridData(1808));
    sashForm.setSashWidth(10);
  }
  
  private void createToolbarButtonBar(Composite parent)
  {
    Composite comp = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    marginWidth = (marginHeight = 0);
    
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(1040));
    getLayoutDataverticalAlignment = 1024;
    
    Composite container = new Composite(comp, 0);
    layout = new GridLayout();
    marginWidth = 0;
    marginHeight = 0;
    container.setLayout(layout);
    container.setLayoutData(new GridData(1808));
    
    backButton = createButton(container, 14, "", false);
    GridData gd = new GridData(768);
    backButton.setLayoutData(gd);
    backButton.setToolTipText(Messages.EventDetailsDialog_previous);
    backButton.setImage(SharedImages.getImage("icons/eview16/event_prev.gif"));
    backButton.getAccessible().addAccessibleListener(new AccessibleAdapter()
    {
      public void getName(AccessibleEvent e)
      {
        result = Messages.EventDetailsDialog_previous;
      }
    });
    copyButton = createButton(container, COPY_ID, "", false);
    gd = new GridData();
    copyButton.setLayoutData(gd);
    copyButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage("IMG_TOOL_COPY"));
    copyButton.setToolTipText(Messages.EventDetailsDialog_copy);
    copyButton.getAccessible().addAccessibleListener(new AccessibleAdapter()
    {
      public void getName(AccessibleEvent e)
      {
        result = Messages.EventDetailsDialog_copy;
      }
    });
    nextButton = createButton(container, 15, "", false);
    gd = new GridData();
    nextButton.setLayoutData(gd);
    nextButton.setToolTipText(Messages.EventDetailsDialog_next);
    nextButton.setImage(SharedImages.getImage("icons/eview16/event_next.gif"));
    nextButton.getAccessible().addAccessibleListener(new AccessibleAdapter()
    {
      public void getName(AccessibleEvent e)
      {
        result = Messages.EventDetailsDialog_next;
      }
    });
    Button button = new Button(container, 0);
    button.setToolTipText(Messages.EventDetailsDialog_ShowFilterDialog);
    button.setImage(SharedImages.getImage("icons/elcl16/filter_ps.gif"));
    gd = new GridData();
    horizontalAlignment = 131072;
    button.setLayoutData(gd);
    button.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        FilterDialog dialog = new FilterDialog(getShell(), memento);
        dialog.create();
        dialog.getShell().setText(Messages.EventDetailsDialog_FilterDialog);
        if (dialog.open() == 0) {
          stackFilterPatterns = EventDetailsDialog.this.getFilters();
        }
        updateProperties();
      }
    });
    button.getAccessible().addAccessibleListener(new AccessibleAdapter()
    {
      public void getName(AccessibleEvent e)
      {
        result = Messages.EventDetailsDialog_FilterDialog;
      }
    });
    numColumns = 2;
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    createButton(parent, 0, IDialogConstants.OK_LABEL, true);
  }
  
  private void createDetailsSection(Composite parent)
  {
    Composite container = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    marginWidth = (marginHeight = 0);
    numColumns = 2;
    container.setLayout(layout);
    GridData data = new GridData(768);
    heightHint = 200;
    container.setLayoutData(data);
    
    createTextSection(container);
    createToolbarButtonBar(container);
  }
  
  private void createTextSection(Composite parent)
  {
    Composite textContainer = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 3;
    marginHeight = (marginWidth = 0);
    textContainer.setLayout(layout);
    textContainer.setLayoutData(new GridData(1808));
    
    Label label = new Label(textContainer, 0);
    label.setText(Messages.EventDetailsDialog_date);
    dateLabel = new Label(textContainer, 0);
    GridData gd = new GridData(768);
    horizontalSpan = 2;
    dateLabel.setLayoutData(gd);
    
    label = new Label(textContainer, 0);
    label.setText(Messages.EventDetailsDialog_severity);
    severityImageLabel = new Label(textContainer, 0);
    severityLabel = new Label(textContainer, 0);
    gd = new GridData(768);
    severityLabel.setLayoutData(gd);
    
    label = new Label(textContainer, 0);
    label.setText(Messages.EventDetailsDialog_message);
    gd = new GridData(2);
    label.setLayoutData(gd);
    msgText = new Text(textContainer, 2626);
    msgText.setEditable(false);
    gd = new GridData(1810);
    horizontalSpan = 2;
    grabExcessVerticalSpace = true;
    msgText.setLayoutData(gd);
  }
  
  private void createStackSection(Composite parent)
  {
    Composite container = new Composite(parent, 0);
    GridLayout layout = new GridLayout(2, false);
    marginHeight = 0;
    marginWidth = 0;
    container.setLayout(layout);
    GridData gd = new GridData(1808);
    heightHint = 200;
    container.setLayoutData(gd);
    
    Label label = new Label(container, 0);
    label.setText(Messages.EventDetailsDialog_exception);
    gd = new GridData();
    verticalAlignment = 1024;
    label.setLayoutData(gd);
    
    stackTraceText = new Text(container, 2818);
    gd = new GridData(1808);
    grabExcessHorizontalSpace = true;
    horizontalSpan = 2;
    stackTraceText.setLayoutData(gd);
    stackTraceText.setEditable(false);
  }
  
  private void createSessionSection(Composite parent)
  {
    Composite container = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    marginHeight = 0;
    marginWidth = 0;
    container.setLayout(layout);
    GridData gd = new GridData(768);
    heightHint = 100;
    container.setLayoutData(gd);
    
    Label label = new Label(container, 0);
    label.setText(Messages.EventDetailsDialog_session);
    gd = new GridData(768);
    label.setLayoutData(gd);
    sessionDataText = new Text(container, 2816);
    gd = new GridData(1808);
    grabExcessHorizontalSpace = true;
    sessionDataText.setLayoutData(gd);
    sessionDataText.setEditable(false);
  }
  
  private String[] getFilters()
  {
    Boolean filterEnabled = memento.getBoolean("detailsStackFilterEnabled");
    
    String filtersString = memento.getString("detailsStackFilterList");
    if ((filterEnabled == null) || (!filterEnabled.booleanValue()) || (filtersString == null)) {
      return new String[0];
    }
    StringTokenizer st = new StringTokenizer(filtersString, ";");
    List filters = new ArrayList();
    while (st.hasMoreElements())
    {
      String filter = st.nextToken();
      filters.add(filter);
    }
    return (String[])filters.toArray(new String[filters.size()]);
  }
  
  private String filterStack(String stack)
  {
    if (stackFilterPatterns.length == 0) {
      return stack;
    }
    StringTokenizer st = new StringTokenizer(stack, "\n");
    StringBuffer result = new StringBuffer();
    while (st.hasMoreTokens())
    {
      String stackElement = st.nextToken();
      
      boolean filtered = false;
      int i = 0;
      while ((!filtered) && (i < stackFilterPatterns.length))
      {
        filtered = stackElement.indexOf(stackFilterPatterns[i]) >= 0;
        i++;
      }
      if (!filtered) {
        result.append(stackElement).append("\n");
      }
    }
    return result.toString();
  }
  
  private void storeSettings()
  {
    writeConfiguration();
  }
  
  private IDialogSettings getDialogSettings()
  {
    IDialogSettings settings = Activator.getDefault().getDialogSettings();
    IDialogSettings dialogSettings = settings.getSection(getClass().getName());
    if (dialogSettings == null) {
      dialogSettings = settings.addNewSection(getClass().getName());
    }
    return dialogSettings;
  }
  
  private void readConfiguration()
  {
    IDialogSettings s = getDialogSettings();
    try
    {
      int x = s.getInt("x");
      int y = s.getInt("y");
      dialogLocation = new Point(x, y);
      
      x = s.getInt("width");
      y = s.getInt("height");
      dialogSize = new Point(x, y);
      
      sashWeights = new int[3];
      sashWeights[0] = s.getInt("sashWidth1");
      sashWeights[1] = s.getInt("sashWidth2");
      sashWeights[2] = s.getInt("sashWidth3");
    }
    catch (NumberFormatException localNumberFormatException)
    {
      dialogLocation = null;
      dialogSize = null;
      sashWeights = null;
    }
  }
  
  private void writeConfiguration()
  {
    IDialogSettings s = getDialogSettings();
    Point location = getShell().getLocation();
    s.put("x", x);
    s.put("y", y);
    
    Point size = getShell().getSize();
    s.put("width", x);
    s.put("height", y);
    
    sashWeights = getSashForm().getWeights();
    s.put("sashWidth1", sashWeights[0]);
    s.put("sashWidth2", sashWeights[1]);
    s.put("sashWidth3", sashWeights[2]);
  }
  
  private AbstractEntry[] getElements()
  {
    return (AbstractEntry[])((ITreeContentProvider)provider.getContentProvider()).getElements(null);
  }
}

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

import java.util.Comparator;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.actions.SelectionProviderAction;

public class EventDetailsDialogAction
  extends SelectionProviderAction
{
  private Control control;
  private ISelectionProvider provider;
  private EventDetailsDialog propertyDialog;
  private Comparator comparator;
  private IMemento memento;
  
  public EventDetailsDialogAction(Control control, ISelectionProvider provider, IMemento memento)
  {
    super(provider, Messages.EventDetailsDialog_title);
    Assert.isNotNull(control);
    this.control = control;
    this.provider = provider;
    this.memento = memento;
  }
  
  public boolean resetSelection(byte sortType, int sortOrder)
  {
    IAdaptable element = (IAdaptable)getStructuredSelection().getFirstElement();
    if (element == null) {
      return false;
    }
    if ((propertyDialog != null) && (propertyDialog.isOpen()))
    {
      propertyDialog.resetSelection(element, sortType, sortOrder);
      return true;
    }
    return false;
  }
  
  public void resetSelection()
  {
    IAdaptable element = (IAdaptable)getStructuredSelection().getFirstElement();
    if ((element == null) || (!(element instanceof LogEntry))) {
      return;
    }
    if ((propertyDialog != null) && (propertyDialog.isOpen())) {
      propertyDialog.resetSelection(element);
    }
  }
  
  public void resetDialogButtons()
  {
    if ((propertyDialog != null) && (propertyDialog.isOpen())) {
      propertyDialog.resetButtons();
    }
  }
  
  public void setComparator(Comparator comparator)
  {
    this.comparator = comparator;
    if ((propertyDialog != null) && (propertyDialog.isOpen())) {
      propertyDialog.setComparator(comparator);
    }
  }
  
  public void run()
  {
    if ((propertyDialog != null) && (propertyDialog.isOpen()))
    {
      resetSelection();
      return;
    }
    IAdaptable element = (IAdaptable)getStructuredSelection().getFirstElement();
    if ((element == null) || (!(element instanceof LogEntry))) {
      return;
    }
    propertyDialog = new EventDetailsDialog(control.getShell(), element, provider, comparator, memento);
    propertyDialog.create();
    propertyDialog.getShell().setText(Messages.EventDetailsDialog_title);
    propertyDialog.open();
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;

class FilterDialog$1
  extends SelectionAdapter
{
  final FilterDialog this$0;
  
  FilterDialog$1(FilterDialog paramFilterDialog)
  {
    this$0 = paramFilterDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.limitText.setEnabled(((Button)e.getSource()).getSelection());
  }
}

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

import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;

class FilterDialog$2
  implements VerifyListener
{
  final FilterDialog this$0;
  
  FilterDialog$2(FilterDialog paramFilterDialog)
  {
    this$0 = paramFilterDialog;
  }
  
  public void verifyText(VerifyEvent e)
  {
    if (Character.isLetter(character)) {
      doit = false;
    }
  }
}

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

import org.eclipse.swt.events.ModifyEvent;
import org.eclips
1 2 3 4 5 6

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