org.eclipse.team.ui_3.6.101.R37x_v20111109-0800

 == localEdition) {
      return localFileElement;
    }
    for (Iterator iterator = editions.keySet().iterator(); iterator.hasNext();)
    {
      IFileRevision revision = (IFileRevision)iterator.next();
      if (editions.get(revision) == object) {
        return revision;
      }
    }
    return null;
  }
  
  public String getName()
  {
    if (name != null) {
      return name;
    }
    return super.getName();
  }
  
  public String getDescription()
  {
    if (name != null) {
      return NLS.bind(TeamUIMessages.EditionHistoryPage_2, name);
    }
    return super.getDescription();
  }
  
  protected CompareRevisionAction createCompareAction()
  {
    return new CompareEditionAction(this);
  }
}

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

import java.io.InputStream;
import org.eclipse.core.resources.IFileState;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;

class FileRevisionEditorInput$1
  implements IFileState
{
  private final IStorage val$storage;
  private final String val$charset;
  
  FileRevisionEditorInput$1(IStorage paramIStorage, String paramString)
  {
    val$storage = paramIStorage;val$charset = paramString;
  }
  
  public Object getAdapter(Class adapter)
  {
    return val$storage.getAdapter(adapter);
  }
  
  public boolean isReadOnly()
  {
    return val$storage.isReadOnly();
  }
  
  public String getName()
  {
    return val$storage.getName();
  }
  
  public IPath getFullPath()
  {
    return val$storage.getFullPath();
  }
  
  public InputStream getContents()
    throws CoreException
  {
    return val$storage.getContents();
  }
  
  public String getCharset()
    throws CoreException
  {
    return val$charset;
  }
  
  public boolean exists()
  {
    return ((IFileState)val$storage).exists();
  }
  
  public long getModificationTime()
  {
    return ((IFileState)val$storage).getModificationTime();
  }
}

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

import java.io.InputStream;
import org.eclipse.core.resources.IEncodedStorage;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;

class FileRevisionEditorInput$2
  implements IEncodedStorage
{
  private final IStorage val$storage;
  private final String val$charset;
  
  FileRevisionEditorInput$2(IStorage paramIStorage, String paramString)
  {
    val$storage = paramIStorage;val$charset = paramString;
  }
  
  public Object getAdapter(Class adapter)
  {
    return val$storage.getAdapter(adapter);
  }
  
  public boolean isReadOnly()
  {
    return val$storage.isReadOnly();
  }
  
  public String getName()
  {
    return val$storage.getName();
  }
  
  public IPath getFullPath()
  {
    return val$storage.getFullPath();
  }
  
  public InputStream getContents()
    throws CoreException
  {
    return val$storage.getContents();
  }
  
  public String getCharset()
    throws CoreException
  {
    return val$charset;
  }
}

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

import com.ibm.icu.text.DateFormat;
import java.io.InputStream;
import java.net.URI;
import java.util.Date;
import org.eclipse.core.resources.IEncodedStorage;
import org.eclipse.core.resources.IFileState;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.model.IWorkbenchAdapter;

public class FileRevisionEditorInput
  extends PlatformObject
  implements IWorkbenchAdapter, IStorageEditorInput
{
  private final Object fileRevision;
  private final IStorage storage;
  
  public static FileRevisionEditorInput createEditorInputFor(IFileRevision revision, IProgressMonitor monitor)
    throws CoreException
  {
    IStorage storage = revision.getStorage(monitor);
    return new FileRevisionEditorInput(revision, storage);
  }
  
  private static IStorage wrapStorage(IStorage storage, String charset)
  {
    if (charset == null) {
      return storage;
    }
    if ((storage instanceof IFileState)) {
      new IFileState()
      {
        private final String val$charset;
        
        public Object getAdapter(Class adapter)
        {
          return FileRevisionEditorInput.this.getAdapter(adapter);
        }
        
        public boolean isReadOnly()
        {
          return FileRevisionEditorInput.this.isReadOnly();
        }
        
        public String getName()
        {
          return FileRevisionEditorInput.this.getName();
        }
        
        public IPath getFullPath()
        {
          return FileRevisionEditorInput.this.getFullPath();
        }
        
        public InputStream getContents()
          throws CoreException
        {
          return FileRevisionEditorInput.this.getContents();
        }
        
        public String getCharset()
          throws CoreException
        {
          return val$charset;
        }
        
        public boolean exists()
        {
          return ((IFileState)FileRevisionEditorInput.this).exists();
        }
        
        public long getModificationTime()
        {
          return ((IFileState)FileRevisionEditorInput.this).getModificationTime();
        }
      };
    }
    new IEncodedStorage()
    {
      private final String val$charset;
      
      public Object getAdapter(Class adapter)
      {
        return FileRevisionEditorInput.this.getAdapter(adapter);
      }
      
      public boolean isReadOnly()
      {
        return FileRevisionEditorInput.this.isReadOnly();
      }
      
      public String getName()
      {
        return FileRevisionEditorInput.this.getName();
      }
      
      public IPath getFullPath()
      {
        return FileRevisionEditorInput.this.getFullPath();
      }
      
      public InputStream getContents()
        throws CoreException
      {
        return FileRevisionEditorInput.this.getContents();
      }
      
      public String getCharset()
        throws CoreException
      {
        return val$charset;
      }
    };
  }
  
  public FileRevisionEditorInput(Object revision, IStorage storage)
  {
    Assert.isNotNull(revision);
    Assert.isNotNull(storage);
    fileRevision = revision;
    this.storage = storage;
  }
  
  public FileRevisionEditorInput(IFileState state)
  {
    this(state, state);
  }
  
  public FileRevisionEditorInput(Object revision, IStorage storage, String charset)
  {
    this(revision, wrapStorage(storage, charset));
  }
  
  public IStorage getStorage()
    throws CoreException
  {
    return storage;
  }
  
  public boolean exists()
  {
    return true;
  }
  
  public ImageDescriptor getImageDescriptor()
  {
    return null;
  }
  
  public String getName()
  {
    IFileRevision rev = (IFileRevision)getAdapter(IFileRevision.class);
    if (rev != null) {
      return NLS.bind(TeamUIMessages.nameAndRevision, new String[] { rev.getName(), rev.getContentIdentifier() });
    }
    IFileState state = (IFileState)getAdapter(IFileState.class);
    if (state != null) {
      return state.getName() + " " + DateFormat.getInstance().format(new Date(state.getModificationTime()));
    }
    return storage.getName();
  }
  
  public IPersistableElement getPersistable()
  {
    return null;
  }
  
  public String getToolTipText()
  {
    return storage.getFullPath().toString();
  }
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == IWorkbenchAdapter.class) {
      return this;
    }
    if (adapter == IStorage.class) {
      return storage;
    }
    Object object = super.getAdapter(adapter);
    if (object != null) {
      return object;
    }
    return Utils.getAdapter(fileRevision, adapter);
  }
  
  public Object[] getChildren(Object o)
  {
    return new Object[0];
  }
  
  public ImageDescriptor getImageDescriptor(Object object)
  {
    return null;
  }
  
  public String getLabel(Object o)
  {
    IFileRevision rev = (IFileRevision)getAdapter(IFileRevision.class);
    if (rev != null) {
      return rev.getName();
    }
    return storage.getName();
  }
  
  public Object getParent(Object o)
  {
    return null;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof FileRevisionEditorInput))
    {
      FileRevisionEditorInput other = (FileRevisionEditorInput)obj;
      return fileRevision.equals(fileRevision);
    }
    return false;
  }
  
  public int hashCode()
  {
    return fileRevision.hashCode();
  }
  
  public IFileRevision getFileRevision()
  {
    if ((fileRevision instanceof IFileRevision)) {
      return (IFileRevision)fileRevision;
    }
    return null;
  }
  
  public URI getURI()
  {
    if ((fileRevision instanceof IFileRevision))
    {
      IFileRevision fr = (IFileRevision)fileRevision;
      return fr.getURI();
    }
    return null;
  }
}

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

import com.ibm.icu.text.DateFormat;
import java.net.URI;
import java.util.Date;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.internal.ui.StorageTypedElement;
import org.eclipse.ui.IEditorInput;

public class FileRevisionTypedElement
  extends StorageTypedElement
{
  private IFileRevision fileRevision;
  private String author;
  
  public FileRevisionTypedElement(IFileRevision fileRevision)
  {
    this(fileRevision, null);
  }
  
  public FileRevisionTypedElement(IFileRevision fileRevision, String localEncoding)
  {
    super(localEncoding);
    Assert.isNotNull(fileRevision);
    this.fileRevision = fileRevision;
  }
  
  public String getName()
  {
    return fileRevision.getName();
  }
  
  protected IStorage fetchContents(IProgressMonitor monitor)
    throws CoreException
  {
    return fileRevision.getStorage(monitor);
  }
  
  public String getContentIdentifier()
  {
    return fileRevision.getContentIdentifier();
  }
  
  public String getTimestamp()
  {
    long date = fileRevision.getTimestamp();
    Date dateFromLong = new Date(date);
    return DateFormat.getDateTimeInstance().format(dateFromLong);
  }
  
  public IFileRevision getFileRevision()
  {
    return fileRevision;
  }
  
  public String getPath()
  {
    URI uri = fileRevision.getURI();
    if (uri != null) {
      return uri.getPath();
    }
    return getName();
  }
  
  public IEditorInput getDocumentKey(Object element)
  {
    if ((element == this) && (getBufferedStorage() != null)) {
      return new FileRevisionEditorInput(fileRevision, getBufferedStorage(), getLocalEncoding());
    }
    return null;
  }
  
  public int hashCode()
  {
    return fileRevision.hashCode();
  }
  
  public boolean equals(Object obj)
  {
    if (obj == this) {
      return true;
    }
    if ((obj instanceof FileRevisionTypedElement))
    {
      FileRevisionTypedElement other = (FileRevisionTypedElement)obj;
      return other.getFileRevision().equals(getFileRevision());
    }
    return false;
  }
  
  public String getAuthor()
  {
    if (author == null) {
      author = fileRevision.getAuthor();
    }
    return author;
  }
  
  public void setAuthor(String author)
  {
    this.author = author;
  }
  
  public void fetchAuthor(IProgressMonitor monitor)
    throws CoreException
  {
    if ((getAuthor() == null) && (fileRevision.isPropertyMissing()))
    {
      IFileRevision other = fileRevision.withAllProperties(monitor);
      author = other.getAuthor();
    }
  }
  
  public IFileRevision getRevision()
  {
    return fileRevision;
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.ui.part.PluginDropAdapter;
import org.eclipse.ui.part.ResourceTransfer;

public class GenericHistoryDropAdapter
  extends PluginDropAdapter
{
  private GenericHistoryView view;
  
  public GenericHistoryDropAdapter(GenericHistoryView view)
  {
    super(null);
    this.view = view;
  }
  
  public void dragOver(DropTargetEvent event)
  {
    if ((operations & 0x4) == 4) {
      detail = 4;
    }
    super.dragOver(event);
  }
  
  public void drop(DropTargetEvent event)
  {
    super.drop(event);
    detail = 4;
  }
  
  public boolean performDrop(Object data)
  {
    if (data == null) {
      return false;
    }
    if ((data instanceof IResource[]))
    {
      IResource[] sources = (IResource[])data;
      if (sources.length == 0) {
        return false;
      }
      IResource resource = sources[0];
      
      view.showHistoryPageFor(resource, true, true, null);
      
      return true;
    }
    return false;
  }
  
  public boolean validateDrop(Object target, int operation, TransferData transferType)
  {
    if ((transferType != null) && (ResourceTransfer.getInstance().isSupportedType(transferType))) {
      return true;
    }
    return super.validateDrop(target, operation, transferType);
  }
  
  protected Object getCurrentTarget()
  {
    return view;
  }
}

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

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Font;

class GenericHistoryTableProvider$1
  implements DisposeListener
{
  final GenericHistoryTableProvider this$0;
  
  GenericHistoryTableProvider$1(GenericHistoryTableProvider paramGenericHistoryTableProvider)
  {
    this$0 = paramGenericHistoryTableProvider;
  }
  
  public void widgetDisposed(DisposeEvent e)
  {
    if (GenericHistoryTableProvider.access$0(this$0) != null) {
      GenericHistoryTableProvider.access$0(this$0).dispose();
    }
  }
}

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

import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;

class GenericHistoryTableProvider$2
  extends SelectionAdapter
{
  final GenericHistoryTableProvider this$0;
  private final TableViewer val$tableViewer;
  
  GenericHistoryTableProvider$2(GenericHistoryTableProvider paramGenericHistoryTableProvider, TableViewer paramTableViewer)
  {
    this$0 = paramGenericHistoryTableProvider;val$tableViewer = paramTableViewer;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    int column = val$tableViewer.getTable().indexOf((TableColumn)widget);
    GenericHistoryTableProvider.HistoryComparator oldSorter = (GenericHistoryTableProvider.HistoryComparator)val$tableViewer.getComparator();
    if ((oldSorter != null) && (column == oldSorter.getColumnNumber()))
    {
      oldSorter.setReversed(!oldSorter.isReversed());
      val$tableViewer.refresh();
    }
    else
    {
      val$tableViewer.setComparator(new GenericHistoryTableProvider.HistoryComparator(this$0, column));
    }
  }
}

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

import java.util.Comparator;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.team.core.history.IFileRevision;

class GenericHistoryTableProvider$HistoryComparator
  extends ViewerComparator
{
  private boolean reversed;
  private int columnNumber;
  private int[][] SORT_ORDERS_BY_COLUMN;
  final GenericHistoryTableProvider this$0;
  
  public GenericHistoryTableProvider$HistoryComparator(GenericHistoryTableProvider paramGenericHistoryTableProvider, int columnNumber)
  {
    this$0 = paramGenericHistoryTableProvider;reversed = false;SORT_ORDERS_BY_COLUMN = new int[][] { { 0, 1, 2, 3 }, { 0, 1, 2, 3 }, { 1, 0, 2, 3 }, { 2, 0, 1, 3 }, { 3, 0, 1, 2 } };
    this.columnNumber = columnNumber;
  }
  
  public int compare(Viewer viewer, Object o1, Object o2)
  {
    IFileRevision e1 = this$0.adaptToFileRevision(o1);
    IFileRevision e2 = this$0.adaptToFileRevision(o2);
    int result = 0;
    if ((e1 == null) || (e2 == null))
    {
      result = super.compare(viewer, o1, o2);
    }
    else
    {
      int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
      for (int i = 0; i < columnSortOrder.length; i++)
      {
        result = compareColumnValue(columnSortOrder[i], e1, e2);
        if (result != 0) {
          break;
        }
      }
    }
    if (reversed) {
      result = -result;
    }
    return result;
  }
  
  int compareColumnValue(int columnNumber, IFileRevision e1, IFileRevision e2)
  {
    switch (columnNumber)
    {
    case 0: 
      return e1.getContentIdentifier().compareTo(e2.getContentIdentifier());
    case 1: 
      long date1 = e1.getTimestamp();
      long date2 = e2.getTimestamp();
      if (date1 == date2) {
        return 0;
      }
      return date1 > date2 ? -1 : 1;
    case 2: 
      return getComparator().compare(e1.getAuthor(), e2.getAuthor());
    case 3: 
      return getComparator().compare(e1.getComment(), e2.getComment());
    }
    return 0;
  }
  
  public int getColumnNumber()
  {
    return columnNumber;
  }
  
  public boolean isReversed()
  {
    return reversed;
  }
  
  public void setReversed(boolean newReversed)
  {
    reversed = newReversed;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.history.GenericHistoryTableProvider.HistoryComparator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.history;

import com.ibm.icu.text.DateFormat;
import java.util.Date;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Table;
import org.eclipse.team.core.history.IFileRevision;

class GenericHistoryTableProvider$HistoryLabelProvider
  extends LabelProvider
  implements ITableLabelProvider, IColorProvider, IFontProvider
{
  private DateFormat dateFormat;
  final GenericHistoryTableProvider this$0;
  
  GenericHistoryTableProvider$HistoryLabelProvider(GenericHistoryTableProvider paramGenericHistoryTableProvider)
  {
    this$0 = paramGenericHistoryTableProvider;
  }
  
  public Image getColumnImage(Object element, int columnIndex)
  {
    return null;
  }
  
  public String getColumnText(Object element, int columnIndex)
  {
    IFileRevision entry = this$0.adaptToFileRevision(element);
    if (entry == null) {
      return "";
    }
    switch (columnIndex)
    {
    case 0: 
      String revision = entry.getContentIdentifier();
      return revision;
    case 1: 
      long date = entry.getTimestamp();
      Date dateFromLong = new Date(date);
      return getDateFormat().format(dateFromLong);
    case 2: 
      return entry.getAuthor();
    case 3: 
      String comment = entry.getComment();
      return comment;
    }
    return "";
  }
  
  private synchronized DateFormat getDateFormat()
  {
    if (dateFormat == null) {
      dateFormat = DateFormat.getInstance();
    }
    return dateFormat;
  }
  
  public Color getForeground(Object element)
  {
    IFileRevision entry = this$0.adaptToFileRevision(element);
    if (!entry.exists()) {
      return Display.getCurrent().getSystemColor(18);
    }
    return null;
  }
  
  public Color getBackground(Object element)
  {
    return null;
  }
  
  public Font getFont(Object element)
  {
    IFileRevision entry = this$0.adaptToFileRevision(element);
    if (entry == null) {
      return null;
    }
    String revision = entry.getContentIdentifier();
    String tempCurrentRevision = this$0.getCurrentRevision();
    if ((tempCurrentRevision != null) && (tempCurrentRevision.equals(revision)))
    {
      if (GenericHistoryTableProvider.access$0(this$0) == null)
      {
        Font defaultFont = JFaceResources.getDefaultFont();
        FontData[] data = defaultFont.getFontData();
        for (int i = 0; i < data.length; i++) {
          data[i].setStyle(1);
        }
        GenericHistoryTableProvider.access$2(this$0, new Font(GenericHistoryTableProvider.access$1(this$0).getTable().getDisplay(), data));
      }
      return GenericHistoryTableProvider.access$0(this$0);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.history.GenericHistoryTableProvider.HistoryLabelProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.history;

import com.ibm.icu.text.DateFormat;
import java.util.Comparator;
import java.util.Date;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.history.IFileHistory;
import org.eclipse.team.core.history.IFileHistoryProvider;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.internal.ui.TeamUIMessages;

public class GenericHistoryTableProvider
{
  private IFileHistory currentFileHistory;
  private IFile currentFile;
  private String currentRevision;
  private TableViewer viewer;
  private Font currentRevisionFont;
  private static final int COL_REVISIONID = 0;
  private static final int COL_DATE = 1;
  private static final int COL_AUTHOR = 2;
  private static final int COL_COMMENT = 3;
  
  class HistoryLabelProvider
    extends LabelProvider
    implements ITableLabelProvider, IColorProvider, IFontProvider
  {
    private DateFormat dateFormat;
    
    HistoryLabelProvider() {}
    
    public Image getColumnImage(Object element, int columnIndex)
    {
      return null;
    }
    
    public String getColumnText(Object element, int columnIndex)
    {
      IFileRevision entry = adaptToFileRevision(element);
      if (entry == null) {
        return "";
      }
      switch (columnIndex)
      {
      case 0: 
        String revision = entry.getContentIdentifier();
        return revision;
      case 1: 
        long date = entry.getTimestamp();
        Date dateFromLong = new Date(date);
        return getDateFormat().format(dateFromLong);
      case 2: 
        return entry.getAuthor();
      case 3: 
        String comment = entry.getComment();
        return comment;
      }
      return "";
    }
    
    private synchronized DateFormat getDateFormat()
    {
      if (dateFormat == null) {
        dateFormat = DateFormat.getInstance();
      }
      return dateFormat;
    }
    
    public Color getForeground(Object element)
    {
      IFileRevision entry = adaptToFileRevision(element);
      if (!entry.exists()) {
        return Display.getCurrent().getSystemColor(18);
      }
      return null;
    }
    
    public Color getBackground(Object element)
    {
      return null;
    }
    
    public Font getFont(Object element)
    {
      IFileRevision entry = adaptToFileRevision(element);
      if (entry == null) {
        return null;
      }
      String revision = entry.getContentIdentifier();
      String tempCurrentRevision = getCurrentRevision();
      if ((tempCurrentRevision != null) && (tempCurrentRevision.equals(revision)))
      {
        if (currentRevisionFont == null)
        {
          Font defaultFont = JFaceResources.getDefaultFont();
          FontData[] data = defaultFont.getFontData();
          for (int i = 0; i < data.length; i++) {
            data[i].setStyle(1);
          }
          currentRevisionFont = new Font(viewer.getTable().getDisplay(), data);
        }
        return currentRevisionFont;
      }
      return null;
    }
  }
  
  class HistoryComparator
    extends ViewerComparator
  {
    private boolean reversed = false;
    private int columnNumber;
    private int[][] SORT_ORDERS_BY_COLUMN = {
      { 0, 1, 2, 3 }, 
      { 0, 1, 2, 3 }, 
      { 1, 0, 2, 3 }, 
      { 2, 0, 1, 3 }, 
      { 3, 0, 1, 2 } };
    
    public HistoryComparator(int columnNumber)
    {
      this.columnNumber = columnNumber;
    }
    
    public int compare(Viewer viewer, Object o1, Object o2)
    {
      IFileRevision e1 = adaptToFileRevision(o1);
      IFileRevision e2 = adaptToFileRevision(o2);
      int result = 0;
      if ((e1 == null) || (e2 == null))
      {
        result = super.compare(viewer, o1, o2);
      }
      else
      {
        int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
        for (int i = 0; i < columnSortOrder.length; i++)
        {
          result = compareColumnValue(columnSortOrder[i], e1, e2);
          if (result != 0) {
            break;
          }
        }
      }
      if (reversed) {
        result = -result;
      }
      return result;
    }
    
    int compareColumnValue(int columnNumber, IFileRevision e1, IFileRevision e2)
    {
      switch (columnNumber)
      {
      case 0: 
        return e1.getContentIdentifier().compareTo(e2.getContentIdentifier());
      case 1: 
        long date1 = e1.getTimestamp();
        long date2 = e2.getTimestamp();
        if (date1 == date2) {
          return 0;
        }
        return date1 > date2 ? -1 : 1;
      case 2: 
        return getComparator().compare(e1.getAuthor(), e2.getAuthor());
      case 3: 
        return getComparator().compare(e1.getComment(), e2.getComment());
      }
      return 0;
    }
    
    public int getColumnNumber()
    {
      return columnNumber;
    }
    
    public boolean isReversed()
    {
      return reversed;
    }
    
    public void setReversed(boolean newReversed)
    {
      reversed = newReversed;
    }
  }
  
  protected IFileRevision adaptToFileRevision(Object element)
  {
    IFileRevision entry = null;
    if ((element instanceof IFileRevision)) {
      entry = (IFileRevision)element;
    } else if ((element instanceof IAdaptable)) {
      entry = (IFileRevision)((IAdaptable)element).getAdapter(IFileRevision.class);
    }
    return entry;
  }
  
  public TableViewer createTable(Composite parent)
  {
    Table table = new Table(parent, 66306);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    GridData data = new GridData(1808);
    table.setLayoutData(data);
    
    TableLayout layout = new TableLayout();
    table.setLayout(layout);
    
    TableViewer viewer = new TableViewer(table);
    
    createColumns(table, layout, viewer);
    
    viewer.setLabelProvider(new HistoryLabelProvider());
    
    HistoryComparator sorter = new HistoryComparator(0);
    sorter.setReversed(true);
    viewer.setComparator(sorter);
    
    table.addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent e)
      {
        if (currentRevisionFont != null) {
          currentRevisionFont.dispose();
        }
      }
    });
    this.viewer = viewer;
    return viewer;
  }
  
  private void createColumns(Table table, TableLayout layout, TableViewer viewer)
  {
    SelectionListener headerListener = getColumnListener(viewer);
    
    TableColumn col = new TableColumn(table, 0);
    col.setResizable(true);
    col.setText(TeamUIMessages.GenericHistoryTableProvider_Revision);
    col.addSelectionListener(headerListener);
    layout.addColumnData(new ColumnWeightData(20, true));
    
    col = new TableColumn(table, 0);
    col.setResizable(true);
    col.setText(TeamUIMessages.GenericHistoryTableProvider_RevisionTime);
    col.addSelectionListener(headerListener);
    layout.addColumnData(new ColumnWeightData(20, true));
    
    col = new TableColumn(table, 0);
    col.setResizable(true);
    col.setText(TeamUIMessages.GenericHistoryTableProvider_Author);
    col.addSelectionListener(headerListener);
    layout.addColumnData(new ColumnWeightData(20, true));
    
    col = new TableColumn(table, 0);
    col.setResizable(true);
    col.setText(TeamUIMessages.GenericHistoryTableProvider_Comment);
    col.addSelectionListener(headerListener);
    layout.addColumnData(new ColumnWeightData(50, true));
  }
  
  private SelectionListener getColumnListener(TableViewer tableViewer)
  {
    new SelectionAdapter()
    {
      private final TableViewer val$tableViewer;
      
      public void widgetSelected(SelectionEvent e)
      {
        int column = val$tableViewer.getTable().indexOf((TableColumn)widget);
        GenericHistoryTableProvider.HistoryComparator oldSorter = (GenericHistoryTableProvider.HistoryComparator)val$tableViewer.getComparator();
        if ((oldSorter != null) && (column == oldSorter.getColumnNumber()))
        {
          oldSorter.setReversed(!oldSorter.isReversed());
          val$tableViewer.refresh();
        }
        else
        {
          val$tableViewer.setComparator(new GenericHistoryTableProvider.HistoryComparator(GenericHistoryTableProvider.this, column));
        }
      }
    };
  }
  
  public void setFile(IFileHistory fileHistory, IFile file)
  {
    currentFileHistory = fileHistory;
    currentFile = file;
    currentRevision = findCurrentRevision();
  }
  
  private String findCurrentRevision()
  {
    RepositoryProvider teamProvider = RepositoryProvider.getProvider(currentFile.getProject());
    IFileRevision fileRevision = teamProvider.getFileHistoryProvider().getWorkspaceFileRevision(currentFile);
    if (fileRevision != null) {
      return fileRevision.getContentIdentifier();
    }
    return null;
  }
  
  public IFileHistory getIFileHistory()
  {
    return currentFileHistory;
  }
  
  public String getCurrentRevision()
  {
    return currentRevision;
  }
}

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

import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;

class GenericHistoryView$1
  implements IPartListener
{
  final GenericHistoryView this$0;
  
  GenericHistoryView$1(GenericHistoryView paramGenericHistoryView)
  {
    this$0 = paramGenericHistoryView;
  }
  
  public void partActivated(IWorkbenchPart part)
  {
    if ((part instanceof IEditorPart)) {
      this$0.editorActivated((IEditorPart)part);
    }
  }
  
  public void partBroughtToTop(IWorkbenchPart part)
  {
    if (part == this$0) {
      this$0.editorActivated(this$0.getViewSite().getPage().getActiveEditor());
    }
  }
  
  public void partOpened(IWorkbenchPart part)
  {
    if (part == this$0) {
      this$0.editorActivated(this$0.getViewSite().getPage().getActiveEditor());
    }
  }
  
  public void partClosed(IWorkbenchPart part) {}
  
  public void partDeactivated(IWorkbenchPart part) {}
}

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

import org.eclipse.ui.IPartListener2;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartReference;

class GenericHistoryView$2
  implements IPartListener2
{
  final GenericHistoryView this$0;
  
  GenericHistoryView$2(GenericHistoryView paramGenericHistoryView)
  {
    this$0 = paramGenericHistoryView;
  }
  
  public void partActivated(IWorkbenchPartReference ref) {}
  
  public void partBroughtToTop(IWorkbenchPartReference ref) {}
  
  public void partClosed(IWorkbenchPartReference ref) {}
  
  public void partDeactivated(IWorkbenchPartReference ref) {}
  
  public void partOpened(IWorkbenchPartReference ref) {}
  
  public void partHidden(IWorkbenchPartReference ref) {}
  
  public void partVisible(IWorkbenchPartReference ref)
  {
    if (ref.getPart(true) == this$0) {
      this$0.editorActivated(this$0.getViewSite().getPage().getActiveEditor());
    }
  }
  
  public void partInputChanged(IWorkbenchPartReference ref) {}
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;

class GenericHistoryView$3
  implements ISelectionListener
{
  final GenericHistoryView this$0;
  
  GenericHistoryView$3(GenericHistoryView paramGenericHistoryView)
  {
    this$0 = paramGenericHistoryView;
  }
  
  public void selectionChanged(IWorkbenchPart part, ISelection selection)
  {
    if ((selection instanceof IStructuredSelection))
    {
      IStructuredSelection structSelection = (IStructuredSelection)selection;
      
      GenericHistoryView.access$0(this$0, structSelection.getFirstElement());
      if ((!this$0.isLinkingEnabled()) || (!GenericHistoryView.access$1(this$0))) {
        return;
      }
      if (GenericHistoryView.access$2(this$0) != null)
      {
        Object resource;
        Object resource;
        if ((GenericHistoryView.access$2(this$0) instanceof SyncInfoModelElement))
        {
          SyncInfoModelElement syncInfoModelElement = (SyncInfoModelElement)GenericHistoryView.access$2(this$0);
          resource = syncInfoModelElement.getSyncInfo().getLocal();
        }
        else
        {
          Class tmp104_101 = GenericHistoryView.class$0;
          if (tmp104_101 == null)
          {
            tmp104_101;
            try
            {
              tmpTernaryOp = (GenericHistoryView.class$0 = Class.forName("org.eclipse.core.resources.IResource"));
            }
            catch (ClassNotFoundException localClassNotFoundException)
            {
              throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
            }
          }
          resource = Utils.getAdapter(GenericHistoryView.access$2(this$0), tmp104_101);
        }
        if (resource != null) {
          GenericHistoryView.access$3(this$0, (IResource)resource);
        } else {
          GenericHistoryView.access$3(this$0, GenericHistoryView.access$2(this$0));
        }
        GenericHistoryView.access$0(this$0, null);
      }
    }
  }
}

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

import org.eclipse.jface.action.IAction;

class GenericHistoryView$4
  extends GenericHistoryView.MenuCreator
{
  final GenericHistoryView.NavigationHistoryAction this$1;
  
  GenericHistoryView$4(GenericHistoryView.NavigationHistoryAction paramNavigationHistoryAction, GenericHistoryView paramGenericHistoryView)
  {
    super(paramGenericHistoryView);this$1 = paramNavigationHistoryAction;
  }
  
  protected IAction[] getDropDownActions()
  {
    return GenericHistoryView.NavigationHistoryAction.access$0(this$1);
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;

class GenericHistoryView$5
  extends Action
{
  final GenericHistoryView this$0;
  
  GenericHistoryView$5(GenericHistoryView paramGenericHistoryView, String $anonymous0, ImageDescriptor $anonymous1)
  {
    super($anonymous0, $anonymous1);this$0 = paramGenericHistoryView;
  }
  
  public void run()
  {
    if (isChecked())
    {
      GenericHistoryView.access$6(this$0).setChecked(false);
      this$0.setLinkingEnabled(false);
    }
    this$0.setViewPinned(isChecked());
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.ui.history.IHistoryPage;

class GenericHistoryView$6
  extends Action
{
  final GenericHistoryView this$0;
  
  GenericHistoryView$6(GenericHistoryView paramGenericHistoryView, String $anonymous0, ImageDescriptor $anonymous1)
  {
    super($anonymous0, $anonymous1);this$0 = paramGenericHistoryView;
  }
  
  public void run()
  {
    ((IHistoryPage)this$0.currentPageContainer.getPage()).refresh();
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;

class GenericHistory
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

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