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

IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.TreeViewer;

class LocalHistoryTableProvider$1
  implements IPropertyChangeListener
{
  final LocalHistoryTableProvider.LocalHistoryLabelProvider this$1;
  
  LocalHistoryTableProvider$1(LocalHistoryTableProvider.LocalHistoryLabelProvider paramLocalHistoryLabelProvider)
  {
    this$1 = paramLocalHistoryLabelProvider;
  }
  
  public void propertyChange(PropertyChangeEvent event)
  {
    access$0this$1).viewer.refresh();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.history.LocalHistoryTableProvider.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.TreeViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;

class LocalHistoryTableProvider$2
  extends SelectionAdapter
{
  final LocalHistoryTableProvider this$0;
  
  LocalHistoryTableProvider$2(LocalHistoryTableProvider paramLocalHistoryTableProvider)
  {
    this$0 = paramLocalHistoryTableProvider;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    int column = this$0.viewer.getTree().indexOf((TreeColumn)widget);
    LocalHistoryTableProvider.HistoryComparator oldSorter = (LocalHistoryTableProvider.HistoryComparator)this$0.viewer.getComparator();
    if ((oldSorter != null) && (column == oldSorter.getColumnNumber()))
    {
      oldSorter.setReversed(!oldSorter.isReversed());
      this$0.viewer.refresh();
    }
    else
    {
      this$0.viewer.setComparator(new LocalHistoryTableProvider.HistoryComparator(this$0, column));
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.history.LocalHistoryTableProvider.2
 * 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.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;

class LocalHistoryTableProvider$HistoryComparator
  extends ViewerComparator
{
  private boolean reversed;
  private int columnNumber;
  private int[][] SORT_ORDERS_BY_COLUMN;
  final LocalHistoryTableProvider this$0;
  
  public LocalHistoryTableProvider$HistoryComparator(LocalHistoryTableProvider paramLocalHistoryTableProvider, int columnNumber)
  {
    this$0 = paramLocalHistoryTableProvider;reversed = false;SORT_ORDERS_BY_COLUMN = new int[][] { new int[1] };
    this.columnNumber = columnNumber;
  }
  
  public int compare(Viewer compareViewer, Object o1, Object o2)
  {
    long date1 = this$0.getModificationDate(o1);
    long date2 = this$0.getModificationDate(o2);
    int result = 0;
    if ((date1 == -1L) || (date2 == -1L))
    {
      result = super.compare(compareViewer, o1, o2);
    }
    else
    {
      int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
      for (int i = 0; i < columnSortOrder.length; i++)
      {
        result = compareColumnValue(columnSortOrder[i], date1, date2);
        if (result != 0) {
          break;
        }
      }
    }
    if (reversed) {
      result = -result;
    }
    return result;
  }
  
  int compareColumnValue(int columnNumber, long date1, long date2)
  {
    switch (columnNumber)
    {
    case 0: 
      if (date1 == date2) {
        return 0;
      }
      return date1 > date2 ? -1 : 1;
    }
    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.LocalHistoryTableProvider.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.ColorRegistry;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.IPropertyChangeListener;
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.TreeViewer;
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.Tree;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.themes.ITheme;
import org.eclipse.ui.themes.IThemeManager;

class LocalHistoryTableProvider$LocalHistoryLabelProvider
  extends LabelProvider
  implements ITableLabelProvider, IColorProvider, IFontProvider
{
  private Image dateImage;
  private Font currentRevisionFont;
  private IPropertyChangeListener themeListener;
  final LocalHistoryTableProvider this$0;
  
  public LocalHistoryTableProvider$LocalHistoryLabelProvider(LocalHistoryTableProvider paramLocalHistoryTableProvider)
  {
    this$0 = paramLocalHistoryTableProvider;dateImage = null;currentRevisionFont = null;themeListener = new LocalHistoryTableProvider.1(this);
    PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(themeListener);
  }
  
  public void dispose()
  {
    if (dateImage != null)
    {
      dateImage.dispose();
      dateImage = null;
    }
    if (LocalHistoryTableProvider.access$0(this$0) != null)
    {
      LocalHistoryTableProvider.access$0(this$0).dispose();
      LocalHistoryTableProvider.access$1(this$0, null);
    }
    if (themeListener != null) {
      PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(themeListener);
    }
    if (currentRevisionFont != null) {
      currentRevisionFont.dispose();
    }
  }
  
  public Image getColumnImage(Object element, int columnIndex)
  {
    if (columnIndex == 0)
    {
      if ((element instanceof DateHistoryCategory))
      {
        if (dateImage == null)
        {
          ImageDescriptor dateDesc = TeamUIPlugin.getImageDescriptor("obj/dates.gif");
          dateImage = dateDesc.createImage();
        }
        return dateImage;
      }
      if (this$0.getModificationDate(element) != -1L) {
        return this$0.getRevisionImage();
      }
    }
    return null;
  }
  
  public String getColumnText(Object element, int columnIndex)
  {
    if (columnIndex == 0)
    {
      if ((element instanceof AbstractHistoryCategory)) {
        return ((AbstractHistoryCategory)element).getName();
      }
      long date = this$0.getModificationDate(element);
      if (date != -1L)
      {
        Date dateFromLong = new Date(date);
        return this$0.getDateFormat().format(dateFromLong);
      }
    }
    return "";
  }
  
  public Color getForeground(Object element)
  {
    if ((element instanceof AbstractHistoryCategory))
    {
      ITheme current = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
      return current.getColorRegistry().get("org.eclipse.team.cvs.ui.fontsandcolors.cvshistorypagecategories");
    }
    if (this$0.isDeletedEdition(element)) {
      return Display.getCurrent().getSystemColor(18);
    }
    return null;
  }
  
  public Color getBackground(Object element)
  {
    return null;
  }
  
  public Font getFont(Object element)
  {
    if ((element instanceof AbstractHistoryCategory)) {
      return getCurrentRevisionFont();
    }
    if (this$0.isCurrentEdition(element)) {
      return getCurrentRevisionFont();
    }
    return null;
  }
  
  private Font getCurrentRevisionFont()
  {
    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(this$0.viewer.getTree().getDisplay(), data);
    }
    return currentRevisionFont;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.history.LocalHistoryTableProvider.LocalHistoryLabelProvider
 * 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.compare.IModificationDate;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFileState;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.IPropertyChangeListener;
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.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
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.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.themes.ITheme;
import org.eclipse.ui.themes.IThemeManager;

public class LocalHistoryTableProvider
{
  static final int COL_DATE = 0;
  TreeViewer viewer;
  private Image localRevImage = null;
  private DateFormat dateFormat;
  
  private class LocalHistoryLabelProvider
    extends LabelProvider
    implements ITableLabelProvider, IColorProvider, IFontProvider
  {
    private Image dateImage = null;
    private Font currentRevisionFont = null;
    private IPropertyChangeListener themeListener = new LocalHistoryTableProvider.1(this);
    
    public LocalHistoryLabelProvider()
    {
      PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(themeListener);
    }
    
    public void dispose()
    {
      if (dateImage != null)
      {
        dateImage.dispose();
        dateImage = null;
      }
      if (localRevImage != null)
      {
        localRevImage.dispose();
        localRevImage = null;
      }
      if (themeListener != null) {
        PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(themeListener);
      }
      if (currentRevisionFont != null) {
        currentRevisionFont.dispose();
      }
    }
    
    public Image getColumnImage(Object element, int columnIndex)
    {
      if (columnIndex == 0)
      {
        if ((element instanceof DateHistoryCategory))
        {
          if (dateImage == null)
          {
            ImageDescriptor dateDesc = TeamUIPlugin.getImageDescriptor("obj/dates.gif");
            dateImage = dateDesc.createImage();
          }
          return dateImage;
        }
        if (getModificationDate(element) != -1L) {
          return getRevisionImage();
        }
      }
      return null;
    }
    
    public String getColumnText(Object element, int columnIndex)
    {
      if (columnIndex == 0)
      {
        if ((element instanceof AbstractHistoryCategory)) {
          return ((AbstractHistoryCategory)element).getName();
        }
        long date = getModificationDate(element);
        if (date != -1L)
        {
          Date dateFromLong = new Date(date);
          return getDateFormat().format(dateFromLong);
        }
      }
      return "";
    }
    
    public Color getForeground(Object element)
    {
      if ((element instanceof AbstractHistoryCategory))
      {
        ITheme current = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
        return current.getColorRegistry().get("org.eclipse.team.cvs.ui.fontsandcolors.cvshistorypagecategories");
      }
      if (isDeletedEdition(element)) {
        return Display.getCurrent().getSystemColor(18);
      }
      return null;
    }
    
    public Color getBackground(Object element)
    {
      return null;
    }
    
    public Font getFont(Object element)
    {
      if ((element instanceof AbstractHistoryCategory)) {
        return getCurrentRevisionFont();
      }
      if (isCurrentEdition(element)) {
        return getCurrentRevisionFont();
      }
      return null;
    }
    
    private Font getCurrentRevisionFont()
    {
      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.getTree().getDisplay(), data);
      }
      return currentRevisionFont;
    }
  }
  
  private class HistoryComparator
    extends ViewerComparator
  {
    private boolean reversed = false;
    private int columnNumber;
    private int[][] SORT_ORDERS_BY_COLUMN = {
      new int[1] };
    
    public HistoryComparator(int columnNumber)
    {
      this.columnNumber = columnNumber;
    }
    
    public int compare(Viewer compareViewer, Object o1, Object o2)
    {
      long date1 = getModificationDate(o1);
      long date2 = getModificationDate(o2);
      int result = 0;
      if ((date1 == -1L) || (date2 == -1L))
      {
        result = super.compare(compareViewer, o1, o2);
      }
      else
      {
        int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
        for (int i = 0; i < columnSortOrder.length; i++)
        {
          result = compareColumnValue(columnSortOrder[i], date1, date2);
          if (result != 0) {
            break;
          }
        }
      }
      if (reversed) {
        result = -result;
      }
      return result;
    }
    
    int compareColumnValue(int columnNumber, long date1, long date2)
    {
      switch (columnNumber)
      {
      case 0: 
        if (date1 == date2) {
          return 0;
        }
        return date1 > date2 ? -1 : 1;
      }
      return 0;
    }
    
    public int getColumnNumber()
    {
      return columnNumber;
    }
    
    public boolean isReversed()
    {
      return reversed;
    }
    
    public void setReversed(boolean newReversed)
    {
      reversed = newReversed;
    }
  }
  
  private void createColumns(Tree tree, TableLayout layout)
  {
    SelectionListener headerListener = new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        int column = viewer.getTree().indexOf((TreeColumn)widget);
        LocalHistoryTableProvider.HistoryComparator oldSorter = (LocalHistoryTableProvider.HistoryComparator)viewer.getComparator();
        if ((oldSorter != null) && (column == oldSorter.getColumnNumber()))
        {
          oldSorter.setReversed(!oldSorter.isReversed());
          viewer.refresh();
        }
        else
        {
          viewer.setComparator(new LocalHistoryTableProvider.HistoryComparator(LocalHistoryTableProvider.this, column));
        }
      }
    };
    TreeColumn col = new TreeColumn(tree, 0);
    col.setResizable(true);
    col.setText(TeamUIMessages.GenericHistoryTableProvider_RevisionTime);
    col.addSelectionListener(headerListener);
    layout.addColumnData(new ColumnWeightData(20, true));
  }
  
  public TreeViewer createTree(Composite parent)
  {
    Tree tree = new Tree(parent, 66306);
    tree.setHeaderVisible(true);
    tree.setLinesVisible(false);
    
    GridData data = new GridData(1808);
    tree.setLayoutData(data);
    
    TableLayout layout = new TableLayout();
    tree.setLayout(layout);
    
    viewer = new TreeViewer(tree);
    
    createColumns(tree, layout);
    
    viewer.setLabelProvider(new LocalHistoryLabelProvider());
    
    HistoryComparator sorter = new HistoryComparator(0);
    sorter.setReversed(false);
    viewer.setComparator(sorter);
    
    return viewer;
  }
  
  protected long getModificationDate(Object element)
  {
    IModificationDate md = (IModificationDate)Utils.getAdapter(element, IModificationDate.class);
    if (md != null) {
      return md.getModificationDate();
    }
    if ((element instanceof IFileState))
    {
      IFileState fs = (IFileState)element;
      return fs.getModificationTime();
    }
    if ((element instanceof IFile))
    {
      IFile f = (IFile)element;
      return f.getLocalTimeStamp();
    }
    return -1L;
  }
  
  protected boolean isCurrentEdition(Object element)
  {
    if ((element instanceof IFile)) {
      return true;
    }
    if ((element instanceof IFileState)) {
      return false;
    }
    return false;
  }
  
  protected boolean isDeletedEdition(Object element)
  {
    if ((element instanceof IFile))
    {
      IFile f = (IFile)element;
      return !f.exists();
    }
    return false;
  }
  
  public Image getRevisionImage()
  {
    if (localRevImage == null)
    {
      ImageDescriptor localRevDesc = TeamUIPlugin.getImageDescriptor("obj/local_entry_tbl.gif");
      localRevImage = localRevDesc.createImage();
    }
    return localRevImage;
  }
  
  public synchronized DateFormat getDateFormat()
  {
    if (dateFormat == null) {
      dateFormat = DateFormat.getInstance();
    }
    return dateFormat;
  }
}

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

import org.eclipse.team.core.history.IFileRevision;

public class MessageHistoryCategory
  extends AbstractHistoryCategory
{
  private String message;
  
  public MessageHistoryCategory(String message)
  {
    this.message = message;
  }
  
  public String getName()
  {
    return message;
  }
  
  public boolean collectFileRevisions(IFileRevision[] fileRevisions, boolean shouldRemove)
  {
    return false;
  }
  
  public IFileRevision[] getRevisions()
  {
    return new IFileRevision[0];
  }
  
  public boolean hasRevisions()
  {
    return false;
  }
}

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

import java.io.IOException;
import java.io.InputStream;
import org.eclipse.core.resources.IFileState;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public class OpenLocalFileAction
  extends BaseSelectionListenerAction
{
  protected OpenLocalFileAction(String text)
  {
    super(text);
  }
  
  public void run()
  {
    try
    {
      IStructuredSelection structSel = getStructuredSelection();
      
      Object[] objArray = structSel.toArray();
      for (int i = 0; i < objArray.length; i++)
      {
        IFileState state = (IFileState)objArray[i];
        if (!state.exists())
        {
          MessageDialog.openError(TeamUIPlugin.getActivePage().getActivePart().getSite().getShell(), TeamUIMessages.OpenRevisionAction_DeletedRevisionTitle, TeamUIMessages.OpenRevisionAction_DeletedRevisionMessage);
        }
        else
        {
          String id = getEditorID(state.getName(), state.getContents());
          IWorkbenchPage page = TeamUIPlugin.getActivePage();
          if (page != null) {
            page.openEditor(new FileRevisionEditorInput(state), id);
          }
        }
      }
    }
    catch (Exception localException) {}
  }
  
  String getEditorID(String fileName, InputStream contents)
  {
    IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench();
    IEditorRegistry registry = workbench.getEditorRegistry();
    
    IContentType type = null;
    if (contents != null) {
      try
      {
        type = Platform.getContentTypeManager().findContentTypeFor(contents, fileName);
      }
      catch (IOException localIOException) {}
    }
    if (type == null) {
      type = Platform.getContentTypeManager().findContentTypeFor(fileName);
    }
    IEditorDescriptor descriptor = registry.getDefaultEditor(fileName, type);
    String id;
    String id;
    if (descriptor == null) {
      id = "org.eclipse.ui.DefaultTextEditor";
    } else {
      id = descriptor.getId();
    }
    return id;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.history.OpenLocalFileAction
 * 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.IFile;

class ReplaceLocalHistory$1
  implements Runnable
{
  final ReplaceLocalHistory this$0;
  private final IFile val$file;
  
  ReplaceLocalHistory$1(ReplaceLocalHistory paramReplaceLocalHistory, IFile paramIFile)
  {
    this$0 = paramReplaceLocalHistory;val$file = paramIFile;
  }
  
  public void run()
  {
    ReplaceLocalHistory.access$0(this$0, this$0.getShell(), val$file);
  }
}

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

import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.history.HistoryPageCompareEditorInput;
import org.eclipse.team.ui.history.IHistoryPageSource;

class ReplaceLocalHistory$2
  extends HistoryPageCompareEditorInput
{
  final ReplaceLocalHistory this$0;
  
  ReplaceLocalHistory$2(ReplaceLocalHistory paramReplaceLocalHistory, CompareConfiguration $anonymous0, IHistoryPageSource $anonymous1, Object $anonymous2)
  {
    super($anonymous0, $anonymous1, $anonymous2);this$0 = paramReplaceLocalHistory;
  }
  
  public boolean isEditionSelectionDialog()
  {
    return true;
  }
  
  public String getOKButtonLabel()
  {
    return TeamUIMessages.ReplaceLocalHistory_0;
  }
  
  public boolean okPressed()
  {
    try
    {
      Object o = getSelectedEdition();
      FileRevisionTypedElement right = (FileRevisionTypedElement)((ICompareInput)o).getRight();
      IFile file = (IFile)getCompareResult();
      file.setContents(right.getContents(), false, true, null);
    }
    catch (CoreException e)
    {
      Utils.handle(e);
      return false;
    }
    return true;
  }
}

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

import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareUI;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFileState;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.history.HistoryPageCompareEditorInput;
import org.eclipse.team.ui.history.IHistoryPageSource;

public class ReplaceLocalHistory
  extends ShowLocalHistory
{
  public void run(IAction action)
  {
    IFile file = (IFile)getSelection().getFirstElement();
    IFileState[] states = getLocalHistory();
    if ((states == null) || (states.length == 0)) {
      return;
    }
    Runnable r = new Runnable()
    {
      private final IFile val$file;
      
      public void run()
      {
        ReplaceLocalHistory.this.showCompareInDialog(getShell(), val$file);
      }
    };
    TeamUIPlugin.getStandardDisplay().asyncExec(r);
  }
  
  private void showCompareInDialog(Shell shell, Object object)
  {
    IHistoryPageSource pageSource = LocalHistoryPageSource.getInstance();
    if ((pageSource != null) && (pageSource.canShowHistoryFor(object)))
    {
      CompareConfiguration cc = new CompareConfiguration();
      cc.setLeftEditable(false);
      cc.setRightEditable(false);
      HistoryPageCompareEditorInput input = new HistoryPageCompareEditorInput(cc, pageSource, object)
      {
        public boolean isEditionSelectionDialog()
        {
          return true;
        }
        
        public String getOKButtonLabel()
        {
          return TeamUIMessages.ReplaceLocalHistory_0;
        }
        
        public boolean okPressed()
        {
          try
          {
            Object o = getSelectedEdition();
            FileRevisionTypedElement right = (FileRevisionTypedElement)((ICompareInput)o).getRight();
            IFile file = (IFile)getCompareResult();
            file.setContents(right.getContents(), false, true, null);
          }
          catch (CoreException e)
          {
            Utils.handle(e);
            return false;
          }
          return true;
        }
      };
      CompareUI.openCompareDialog(input);
    }
  }
  
  protected String getPromptTitle()
  {
    return TeamUIMessages.ReplaceLocalHistory_1;
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.internal.ui.TeamUIPlugin;

class ShowLocalHistory$1
  implements IRunnableWithProgress
{
  final ShowLocalHistory this$0;
  
  ShowLocalHistory$1(ShowLocalHistory paramShowLocalHistory)
  {
    this$0 = paramShowLocalHistory;
  }
  
  public void run(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {
    IResource resource = (IResource)ShowLocalHistory.access$0(this$0).getFirstElement();
    Runnable r = new ShowLocalHistory.2(this, resource);
    
    TeamUIPlugin.getStandardDisplay().asyncExec(r);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.history.ShowLocalHistory.1
 * 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.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.history.IHistoryPage;
import org.eclipse.team.ui.history.IHistoryView;

class ShowLocalHistory$2
  implements Runnable
{
  final ShowLocalHistory.1 this$1;
  private final IResource val$resource;
  
  ShowLocalHistory$2(ShowLocalHistory.1 param1, IResource paramIResource)
  {
    this$1 = param1;val$resource = paramIResource;
  }
  
  public void run()
  {
    IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), val$resource, LocalHistoryPageSource.getInstance());
    IHistoryPage page = view.getHistoryPage();
    if ((page instanceof LocalHistoryPage))
    {
      LocalHistoryPage historyPage = (LocalHistoryPage)page;
      historyPage.setClickAction(ShowLocalHistory.1.access$0(this$1).isCompare());
    }
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFileState;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionDelegate;
import org.eclipse.ui.progress.IProgressService;

public class ShowLocalHistory
  extends ActionDelegate
  implements IObjectActionDelegate
{
  private IStructuredSelection fSelection;
  private IWorkbenchPart targetPart;
  
  public void run(IAction action)
  {
    IFileState[] states = getLocalHistory();
    if ((states == null) || (states.length == 0)) {
      return;
    }
    try
    {
      PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress()
      {
        public void run(IProgressMonitor monitor)
          throws InvocationTargetException, InterruptedException
        {
          IResource resource = (IResource)fSelection.getFirstElement();
          Runnable r = new ShowLocalHistory.2(this, resource);
          
          TeamUIPlugin.getStandardDisplay().asyncExec(r);
        }
      });
    }
    catch (InvocationTargetException exception)
    {
      ErrorDialog.openError(getShell(), null, null, new Status(4, "org.eclipse.team.ui", 4, TeamUIMessages.ShowLocalHistory_1, exception.getTargetException()));
    }
    catch (InterruptedException localInterruptedException) {}
  }
  
  public void selectionChanged(IAction action, ISelection sel)
  {
    if ((sel instanceof IStructuredSelection)) {
      fSelection = ((IStructuredSelection)sel);
    }
  }
  
  public void setActivePart(IAction action, IWorkbenchPart targetPart)
  {
    this.targetPart = targetPart;
  }
  
  protected Shell getShell()
  {
    if (targetPart != null) {
      return targetPart.getSite().getShell();
    }
    return TeamUIPlugin.getActivePage().getActivePart().getSite().getShell();
  }
  
  protected boolean isCompare()
  {
    return false;
  }
  
  public IStructuredSelection getSelection()
  {
    return fSelection;
  }
  
  protected IFileState[] getLocalHistory()
  {
    IFile file = (IFile)getSelection().getFirstElement();
    try
    {
      states = file.getHistory(null);
    }
    catch (CoreException ex)
    {
      IFileState[] states;
      MessageDialog.openError(getShell(), getPromptTitle(), ex.getMessage());
      return null;
    }
    IFileState[] states;
    if ((states == null) || (states.length <= 0))
    {
      MessageDialog.openInformation(getShell(), getPromptTitle(), TeamUIMessages.ShowLocalHistory_0);
      return states;
    }
    return states;
  }
  
  protected String getPromptTitle()
  {
    return TeamUIMessages.ShowLocalHistory_2;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.history.ShowLocalHistory
 * 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.IToolBarManager;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.ui.history.IHistoryPageSite;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.part.IPageSite;

public class WorkbenchHistoryPageSite
  implements IHistoryPageSite
{
  GenericHistoryView part;
  IPageSite site;
  
  public WorkbenchHistoryPageSite(GenericHistoryView part, IPageSite site)
  {
    this.part = part;
    this.site = site;
  }
  
  public IPageSite getWorkbenchPageSite()
  {
    return site;
  }
  
  public IWorkbenchPart getPart()
  {
    return part;
  }
  
  public Shell getShell()
  {
    return site.getShell();
  }
  
  public ISelectionProvider getSelectionProvider()
  {
    return site.getSelectionProvider();
  }
  
  public void setSelectionProvider(ISelectionProvider provider)
  {
    site.setSelectionProvider(provider);
  }
  
  public void setFocus() {}
  
  public boolean isModal()
  {
    return false;
  }
  
  public IToolBarManager getToolBarManager()
  {
    return site.getActionBars().getToolBarManager();
  }
}

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

import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener;
import org.eclipse.core.runtime.ISafeRunnable;

class AbstractCompareInput$1
  implements ISafeRunnable
{
  final AbstractCompareInput this$0;
  private final ICompareInputChangeListener val$listener;
  
  AbstractCompareInput$1(AbstractCompareInput paramAbstractCompareInput, ICompareInputChangeListener paramICompareInputChangeListener)
  {
    this$0 = paramAbstractCompareInput;val$listener = paramICompareInputChangeListener;
  }
  
  public void run()
    throws Exception
  {
    val$listener.compareInputChanged(this$0);
  }
  
  public void handleException(Throwable exception) {}
}

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

import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.swt.graphics.Image;

public abstract class AbstractCompareInput
  implements ICompareInput
{
  private ITypedElement ancestor;
  private ITypedElement left;
  private ITypedElement right;
  private int kind;
  private final ListenerList listeners = new ListenerList(1);
  
  public AbstractCompareInput(int kind, ITypedElement ancestor, ITypedElement left, ITypedElement right)
  {
    this.kind = kind;
    this.ancestor = ancestor;
    this.left = left;
    this.right = right;
  }
  
  public void addCompareInputChangeListener(ICompareInputChangeListener listener)
  {
    if (!containsListener(listener))
    {
      listeners.add(listener);
      getChangeNotifier().connect(this);
    }
  }
  
  public void removeCompareInputChangeListener(ICompareInputChangeListener listener)
  {
    if (containsListener(listener))
    {
      listeners.remove(listener);
      getChangeNotifier().disconnect(this);
    }
  }
  
  protected void fireChange()
  {
    if (!listeners.isEmpty())
    {
      Object[] allListeners = listeners.getListeners();
      for (int i = 0; i < allListeners.length; i++)
      {
        ICompareInputChangeListener listener = (ICompareInputChangeListener)allListeners[i];
        SafeRunner.run(new ISafeRunnable()
        {
          private final ICompareInputChangeListener val$listener;
          
          public void run()
            throws Exception
          {
            val$listener.compareInputChanged(AbstractCompareInput.this);
          }
          
          public void handleException(Throwable exception) {}
        });
      }
    }
  }
  
  private boolean containsListener(ICompareInputChangeListener listener)
  {
    if (listeners.isEmpty()) {
      return false;
    }
    Object[] allListeners = listeners.getListeners();
    for (int i = 0; i < allListeners.length; i++)
    {
      Object object = allListeners[i];
      if (object == listener) {
        return true;
      }
    }
    return false;
  }
  
  public void copy(boolean leftToRight)
  {
    Assert.isTrue(false, "Copy is not support by this type of compare input");
  }
  
  public ITypedElement getAncestor()
  {
    return ancestor;
  }
  
  public Image getImage()
  {
    return getMainElement().getImage();
  }
  
  private ITypedElement getMainElement()
  {
    if (left != null) {
      return left;
    }
    if (right != null) {
      return right;
    }
    return ancestor;
  }
  
  public int getKind()
  {
    return kind;
  }
  
  public void setKind(int kind)
  {
    this.kind = kind;
  }
  
  public ITypedElement getLeft()
  {
    return left;
  }
  
  public String getName()
  {
    return getMainElement().getName();
  }
  
  public ITypedElement getRight()
  {
    return right;
  }
  
  protected abstract CompareInputChangeNotifier getChangeNotifier();
  
  public void setAncestor(ITypedElement ancestor)
  {
    this.ancestor = ancestor;
  }
  
  public void setLeft(ITypedElement left)
  {
    this.left = left;
  }
  
  public void setRight(ITypedElement right)
  {
    this.right = right;
  }
  
  public abstract void update();
  
  public abstract boolean needsUpdate();
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
import org.eclipse.team.ui.synchronize.ModelOperation;
import org.eclipse.ui.IWorkbenchPart;

public class BuildScopeOperation
  extends ModelOperation
{
  public BuildScopeOperation(IWorkbenchPart part, ISynchronizationScopeManager manager)
  {
    super(part, manager);
  }
  
  protected void execute(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {}
}

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

import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.commands.IHandler;
import org.eclipse.jface.action.MenuManager;

public class CommonMenuManager
  extends MenuManager
{
  private Map handlers = new HashMap();
  
  public CommonMenuManager(String id)
  {
    super(id);
  }
  
  public void clearHandlers()
  {
    handlers.clear();
  }
  
  public void registerHandler(String actionId, IHandler handler)
  {
    handlers.put(actionId, handler);
  }
  
  public IHandler getHandler(String actionId)
  {
    return (IHandler)handlers.get(actionId);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.mapping.CommonMenuManager
 * Java Class Versio
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