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

ss StructuredViewerAdvisor$5
  implements ISelectionChangedListener
{
  final StructuredViewerAdvisor this$0;
  private final StructuredViewer val$viewer;
  
  StructuredViewerAdvisor$5(StructuredViewerAdvisor paramStructuredViewerAdvisor, StructuredViewer paramStructuredViewer)
  {
    this$0 = paramStructuredViewerAdvisor;val$viewer = paramStructuredViewer;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    this$0.updateActionBars((IStructuredSelection)val$viewer.getSelection());
  }
}

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

import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.StructuredViewer;

class StructuredViewerAdvisor$6
  implements IMenuListener
{
  final StructuredViewerAdvisor this$0;
  private final StructuredViewer val$viewer;
  
  StructuredViewerAdvisor$6(StructuredViewerAdvisor paramStructuredViewerAdvisor, StructuredViewer paramStructuredViewer)
  {
    this$0 = paramStructuredViewerAdvisor;val$viewer = paramStructuredViewer;
  }
  
  public void menuAboutToShow(IMenuManager manager)
  {
    this$0.fillContextMenu(val$viewer, manager);
  }
}

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

import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.MenuListener;
import org.eclipse.team.ui.synchronize.SynchronizeModelAction;

class StructuredViewerAdvisor$7
  implements MenuListener
{
  final StructuredViewerAdvisor this$0;
  private final MenuManager val$menuMgr;
  private final StructuredViewer val$viewer;
  
  StructuredViewerAdvisor$7(StructuredViewerAdvisor paramStructuredViewerAdvisor, MenuManager paramMenuManager, StructuredViewer paramStructuredViewer)
  {
    this$0 = paramStructuredViewerAdvisor;val$menuMgr = paramMenuManager;val$viewer = paramStructuredViewer;
  }
  
  public void menuHidden(MenuEvent e) {}
  
  public void menuShown(MenuEvent e)
  {
    IContributionItem[] items = val$menuMgr.getItems();
    for (int i = 0; i < items.length; i++)
    {
      IContributionItem item = items[i];
      if ((item instanceof ActionContributionItem))
      {
        IAction actionItem = ((ActionContributionItem)item).getAction();
        if ((actionItem instanceof SynchronizeModelAction)) {
          ((SynchronizeModelAction)actionItem).selectionChanged(val$viewer.getSelection());
        }
      }
    }
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.MenuListener;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.mapping.DiffTreeStatusLineContributionGroup;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.team.ui.synchronize.SynchronizeModelAction;
import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.OpenAndLinkWithEditorHelper;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.actions.ActionGroup;

public abstract class StructuredViewerAdvisor
  extends AbstractViewerAdvisor
{
  private IPropertyChangeListener propertyListener = new IPropertyChangeListener()
  {
    public void propertyChange(PropertyChangeEvent event)
    {
      if (event.getProperty().equals("org.eclipse.team.ui.view_syncinfo_in_label"))
      {
        StructuredViewer viewer = getViewer();
        if ((viewer != null) && (!viewer.getControl().isDisposed())) {
          viewer.refresh(true);
        }
      }
    }
  };
  private DiffTreeStatusLineContributionGroup statusLine;
  
  public StructuredViewerAdvisor(ISynchronizePageConfiguration configuration)
  {
    super(configuration);
  }
  
  public void initializeViewer(StructuredViewer viewer)
  {
    super.initializeViewer(viewer);
    initializeListeners(viewer);
    hookContextMenu(viewer);
  }
  
  public void dispose()
  {
    if (getActionGroup() != null) {
      getActionGroup().dispose();
    }
    if (statusLine != null) {
      statusLine.dispose();
    }
    TeamUIPlugin.getPlugin().getPreferenceStore().removePropertyChangeListener(propertyListener);
  }
  
  protected void initializeListeners(StructuredViewer viewer)
  {
    viewer.getControl().addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent e)
      {
        dispose();
      }
    });
    new OpenAndLinkWithEditorHelper(viewer);
    {
      /* Error */
      protected void activate(ISelection selection)
      {
        // Byte code:
        //   0: invokestatic 41	org/eclipse/jface/util/OpenStrategy:getOpenMethod	()I
        //   3: istore_2
        //   4: iconst_0
        //   5: invokestatic 42	org/eclipse/jface/util/OpenStrategy:setOpenMethod	(I)V
        //   8: aload_0
        //   9: getfield 40	org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor$3:this$0	Lorg/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor;
        //   12: invokestatic 43	org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor:access$0	(Lorg/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor;)V
        //   15: goto +10 -> 25
        //   18: astore_3
        //   19: iload_2
        //   20: invokestatic 42	org/eclipse/jface/util/OpenStrategy:setOpenMethod	(I)V
        //   23: aload_3
        //   24: athrow
        //   25: iload_2
        //   26: invokestatic 42	org/eclipse/jface/util/OpenStrategy:setOpenMethod	(I)V
        //   29: return
        // Line number table:
        //   Java source line #132	-> byte code offset #0
        //   Java source line #134	-> byte code offset #4
        //   Java source line #135	-> byte code offset #8
        //   Java source line #136	-> byte code offset #18
        //   Java source line #137	-> byte code offset #19
        //   Java source line #138	-> byte code offset #23
        //   Java source line #137	-> byte code offset #25
        //   Java source line #139	-> byte code offset #29
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	30	0	this	3
        //   0	30	1	selection	ISelection
        //   3	23	2	currentMode	int
        //   18	6	3	localObject	Object
        // Exception table:
        //   from	to	target	type
        //   4	18	18	finally
      }
      
      protected void linkToEditor(ISelection selection) {}
      
      protected void open(ISelection selection, boolean activate)
      {
        StructuredViewerAdvisor.this.handleOpen();
      }
    };
    viewer.addDoubleClickListener(new IDoubleClickListener()
    {
      private final StructuredViewer val$viewer;
      
      public void doubleClick(DoubleClickEvent event)
      {
        handleDoubleClick(val$viewer, event);
      }
    });
    viewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      private final StructuredViewer val$viewer;
      
      public void selectionChanged(SelectionChangedEvent event)
      {
        updateActionBars((IStructuredSelection)val$viewer.getSelection());
      }
    });
    TeamUIPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(propertyListener);
  }
  
  protected boolean handleDoubleClick(StructuredViewer viewer, DoubleClickEvent event)
  {
    IStructuredSelection selection = (IStructuredSelection)event.getSelection();
    Object node = selection.getFirstElement();
    if ((node != null) && ((node instanceof SyncInfoModelElement)))
    {
      SyncInfoModelElement syncNode = (SyncInfoModelElement)node;
      IResource resource = syncNode.getResource();
      if ((syncNode != null) && (resource != null) && (resource.getType() == 1)) {
        return true;
      }
    }
    return false;
  }
  
  private void handleOpen()
  {
    Object o = getConfiguration().getProperty("org.eclipse.team.ui.P_OPEN_ACTION");
    if ((o instanceof IAction))
    {
      IAction action = (IAction)o;
      action.run();
    }
  }
  
  public final void setActionBars(IActionBars actionBars)
  {
    if (actionBars != null)
    {
      IToolBarManager manager = actionBars.getToolBarManager();
      
      Object o = getConfiguration().getProperty("org.eclipse.team.ui.P_TOOLBAR_MENU");
      if (!(o instanceof String[])) {
        o = ISynchronizePageConfiguration.DEFAULT_TOOLBAR_MENU;
      }
      String[] groups = (String[])o;
      for (int i = 0; i < groups.length; i++)
      {
        String group = groups[i];
        
        manager.add(new Separator(getGroupId(group)));
      }
      IMenuManager menu = actionBars.getMenuManager();
      if (menu != null)
      {
        o = getConfiguration().getProperty("org.eclipse.team.ui.P_VIEW_MENU");
        if (!(o instanceof String[])) {
          o = ISynchronizePageConfiguration.DEFAULT_VIEW_MENU;
        }
        groups = (String[])o;
        initializeStatusLine(actionBars);
        for (int i = 0; i < groups.length; i++)
        {
          String group = groups[i];
          
          menu.add(new Separator(getGroupId(group)));
        }
      }
      fillActionBars(actionBars);
    }
  }
  
  protected void initializeStatusLine(IActionBars actionBars)
  {
    statusLine = new DiffTreeStatusLineContributionGroup(
      getConfiguration().getSite().getShell(), 
      getConfiguration());
    IStatusLineManager statusLineMgr = actionBars.getStatusLineManager();
    if ((statusLineMgr != null) && (statusLine != null)) {
      statusLine.fillActionBars(actionBars);
    }
  }
  
  private void hookContextMenu(StructuredViewer viewer)
  {
    String targetID = getContextMenuId(viewer);
    MenuManager menuMgr = createContextMenuManager(targetID);
    
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener()
    {
      private final StructuredViewer val$viewer;
      
      public void menuAboutToShow(IMenuManager manager)
      {
        fillContextMenu(val$viewer, manager);
      }
    });
    Menu menu = menuMgr.createContextMenu(viewer.getControl());
    menu.addMenuListener(new MenuListener()
    {
      private final MenuManager val$menuMgr;
      private final StructuredViewer val$viewer;
      
      public void menuHidden(MenuEvent e) {}
      
      public void menuShown(MenuEvent e)
      {
        IContributionItem[] items = val$menuMgr.getItems();
        for (int i = 0; i < items.length; i++)
        {
          IContributionItem item = items[i];
          if ((item instanceof ActionContributionItem))
          {
            IAction actionItem = ((ActionContributionItem)item).getAction();
            if ((actionItem instanceof SynchronizeModelAction)) {
              ((SynchronizeModelAction)actionItem).selectionChanged(val$viewer.getSelection());
            }
          }
        }
      }
    });
    viewer.getControl().setMenu(menu);
    registerContextMenu(viewer, menuMgr);
  }
  
  protected MenuManager createContextMenuManager(String targetID)
  {
    return new MenuManager(targetID);
  }
  
  protected void registerContextMenu(StructuredViewer viewer, MenuManager menuMgr)
  {
    String targetID = getContextMenuId(viewer);
    if (targetID != null)
    {
      IWorkbenchSite workbenchSite = getConfiguration().getSite().getWorkbenchSite();
      IWorkbenchPartSite ws = null;
      if ((workbenchSite instanceof IWorkbenchPartSite)) {
        ws = (IWorkbenchPartSite)workbenchSite;
      }
      if (ws != null) {
        ws.registerContextMenu(targetID, menuMgr, viewer);
      }
    }
  }
  
  protected String getContextMenuId(StructuredViewer viewer)
  {
    Object o = getConfiguration().getProperty("org.eclipse.team.ui.P_OBJECT_CONTRIBUTION_ID");
    String targetID;
    String targetID;
    if ((o instanceof String)) {
      targetID = (String)o;
    } else {
      targetID = null;
    }
    return targetID;
  }
  
  protected void fillContextMenu(StructuredViewer viewer, IMenuManager manager)
  {
    addContextMenuGroups(manager);
    getActionGroup().setContext(new ActionContext(viewer.getSelection()));
    getActionGroup().fillContextMenu(manager);
  }
  
  protected void addContextMenuGroups(IMenuManager manager)
  {
    Object o = getConfiguration().getProperty("org.eclipse.team.ui.P_CONTEXT_MENU");
    if (!(o instanceof String[])) {
      o = ISynchronizePageConfiguration.DEFAULT_CONTEXT_MENU;
    }
    String[] groups = (String[])o;
    for (int i = 0; i < groups.length; i++)
    {
      String group = groups[i];
      
      manager.add(new Separator(group));
    }
  }
  
  protected void fillActionBars(IActionBars actionBars)
  {
    getActionGroup().fillActionBars(actionBars);
    updateActionBars((IStructuredSelection)getViewer().getSelection());
    Object input = getViewer().getInput();
    if ((input instanceof ISynchronizeModelElement)) {
      getActionGroup().modelChanged((ISynchronizeModelElement)input);
    }
  }
  
  protected void updateActionBars(IStructuredSelection selection)
  {
    ActionGroup group = getActionGroup();
    if (group != null)
    {
      group.setContext(new ActionContext(selection));
      group.updateActionBars();
    }
  }
  
  protected SynchronizePageActionGroup getActionGroup()
  {
    return (SynchronizePageActionGroup)getConfiguration();
  }
  
  private String getGroupId(String group)
  {
    return ((SynchronizePageConfiguration)getConfiguration()).getGroupId(group);
  }
}

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

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter.AndSyncInfoFilter;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
import org.eclipse.team.core.variants.IResourceVariantComparator;
import org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector;
import org.eclipse.team.internal.core.subscribers.WorkingSetFilteredSyncInfoCollector;
import org.eclipse.team.internal.ui.synchronize.actions.DefaultSynchronizePageActions;
import org.eclipse.team.internal.ui.synchronize.actions.SubscriberActionContribution;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.SubscriberParticipant;

public final class SubscriberParticipantPage
  extends AbstractSynchronizePage
  implements IAdaptable
{
  private SubscriberParticipant participant;
  private static final int[] INCOMING_MODE_FILTER = { 12, 8 };
  private static final int[] OUTGOING_MODE_FILTER = { 12, 4 };
  private static final int[] BOTH_MODE_FILTER = { 12, 8, 4 };
  private static final int[] CONFLICTING_MODE_FILTER = { 12 };
  private WorkingSetFilteredSyncInfoCollector collector;
  
  public SubscriberParticipantPage(ISynchronizePageConfiguration configuration, SubscriberSyncInfoCollector subscriberCollector)
  {
    super(configuration);
    participant = ((SubscriberParticipant)configuration.getParticipant());
    configuration.setComparisonType(isThreeWay() ? 
      "three-way" : 
      "two-way");
    configuration.addActionContribution(new DefaultSynchronizePageActions());
    configuration.addActionContribution(new SubscriberActionContribution());
    initializeCollector(configuration, subscriberCollector);
  }
  
  public SubscriberParticipant getParticipant()
  {
    return participant;
  }
  
  protected AbstractViewerAdvisor createViewerAdvisor(Composite parent)
  {
    return new TreeViewerAdvisor(parent, getConfiguration());
  }
  
  protected void updateMode(int mode)
  {
    if ((collector != null) && (isThreeWay()))
    {
      int[] modeFilter = BOTH_MODE_FILTER;
      switch (mode)
      {
      case 1: 
        modeFilter = INCOMING_MODE_FILTER; break;
      case 2: 
        modeFilter = OUTGOING_MODE_FILTER; break;
      case 4: 
        modeFilter = BOTH_MODE_FILTER; break;
      case 8: 
        modeFilter = CONFLICTING_MODE_FILTER;
      }
      collector.setFilter(
        new FastSyncInfoFilter.AndSyncInfoFilter(
        new FastSyncInfoFilter[] {
        new FastSyncInfoFilter.SyncInfoDirectionFilter(modeFilter) }));
    }
  }
  
  private void initializeCollector(ISynchronizePageConfiguration configuration, SubscriberSyncInfoCollector subscriberCollector)
  {
    SubscriberParticipant participant = getParticipant();
    collector = new WorkingSetFilteredSyncInfoCollector(subscriberCollector, participant.getSubscriber().roots());
    updateMode(configuration.getMode());
    collector.reset();
    configuration.setProperty("org.eclipse.team.ui.P_SYNC_INFO_SET", collector.getSyncInfoTree());
    configuration.setProperty("org.eclipse.team.ui.P_WORKING_SET_SYNC_INFO_SET", collector.getWorkingSetSyncInfoSet());
  }
  
  protected boolean isThreeWay()
  {
    return getParticipant().getSubscriber().getResourceComparator().isThreeWay();
  }
  
  public void reset()
  {
    getParticipant().reset();
  }
  
  public WorkingSetFilteredSyncInfoCollector getCollector()
  {
    return collector;
  }
  
  public void dispose()
  {
    super.dispose();
    collector.dispose();
  }
  
  protected ChangesSection createChangesSection(Composite parent)
  {
    return new SyncInfoSetChangesSection(parent, this, getConfiguration());
  }
}

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

import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;

class SubscriberRefreshSchedule$1
  implements IRefreshSubscriberListener
{
  final SubscriberRefreshSchedule this$0;
  
  SubscriberRefreshSchedule$1(SubscriberRefreshSchedule paramSubscriberRefreshSchedule)
  {
    this$0 = paramSubscriberRefreshSchedule;
  }
  
  public void refreshStarted(IRefreshEvent event) {}
  
  public ActionFactory.IWorkbenchAction refreshDone(IRefreshEvent event)
  {
    if (getRefreshable(event.getParticipant()) == SubscriberRefreshSchedule.access$0(this$0))
    {
      SubscriberRefreshSchedule.access$1(this$0, event);
      if ((SubscriberRefreshSchedule.access$2(this$0)) && (event.getRefreshType() == 1))
      {
        RefreshUserNotificationPolicy policy = new RefreshUserNotificationPolicy(SubscriberRefreshSchedule.access$0(this$0).getParticipant());
        policy.refreshDone(event);
      }
    }
    return null;
  }
  
  private IRefreshable getRefreshable(ISynchronizeParticipant participant)
  {
    Class tmp4_1 = SubscriberRefreshSchedule.class$0;
    if (tmp4_1 == null)
    {
      tmp4_1;
      try
      {
        tmpTernaryOp = (SubscriberRefreshSchedule.class$0 = Class.forName("org.eclipse.team.internal.ui.synchronize.IRefreshable"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    return (IRefreshable)Utils.getAdapter(participant, tmp4_1);
  }
}

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

import com.ibm.icu.text.DateFormat;
import com.ibm.icu.util.Calendar;
import java.util.Date;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;

public class SubscriberRefreshSchedule
{
  private long refreshInterval = 3600L;
  private Date refreshStart;
  private boolean runOnce = false;
  private boolean enabled = false;
  private RefreshParticipantJob job;
  private IRefreshable refreshable;
  private IRefreshEvent lastRefreshEvent;
  private static final String CTX_REFRESHSCHEDULE_INTERVAL = "org.eclipse.team.ui.CTX_REFRESHSCHEDULE_INTERVAL";
  private static final String CTX_REFRESHSCHEDULE_ENABLED = "org.eclipse.team.ui.CTX_REFRESHSCHEDULE_ENABLED";
  private static final String CTX_REFRESHSCHEDULE_START = "org.eclipse.team.ui.CTX_REFRESHSCHEDULE_START";
  private static final String CTX_REFRESHSCHEDULE_RUNONCE = "org.eclipse.team.ui.CTX_REFRESHSCHEDULE_RUNONCE";
  private IRefreshSubscriberListener refreshSubscriberListener = new IRefreshSubscriberListener()
  {
    public void refreshStarted(IRefreshEvent event) {}
    
    public ActionFactory.IWorkbenchAction refreshDone(IRefreshEvent event)
    {
      if (getRefreshable(event.getParticipant()) == refreshable)
      {
        lastRefreshEvent = event;
        if ((enabled) && (event.getRefreshType() == 1))
        {
          RefreshUserNotificationPolicy policy = new RefreshUserNotificationPolicy(refreshable.getParticipant());
          policy.refreshDone(event);
        }
      }
      return null;
    }
    
    private IRefreshable getRefreshable(ISynchronizeParticipant participant)
    {
      Class tmp4_1 = SubscriberRefreshSchedule.class$0;
      if (tmp4_1 == null)
      {
        tmp4_1;
        try
        {
          tmpTernaryOp = (SubscriberRefreshSchedule.class$0 = Class.forName("org.eclipse.team.internal.ui.synchronize.IRefreshable"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      return (IRefreshable)Utils.getAdapter(participant, tmp4_1);
    }
  };
  static Class class$0;
  
  public SubscriberRefreshSchedule(IRefreshable refreshable)
  {
    this.refreshable = refreshable;
    RefreshParticipantJob.addRefreshListener(refreshSubscriberListener);
  }
  
  public boolean isEnabled()
  {
    return enabled;
  }
  
  public void setEnabled(boolean enabled, boolean allowedToStart)
  {
    boolean wasEnabled = isEnabled();
    this.enabled = enabled;
    if ((enabled) && (!wasEnabled))
    {
      if (allowedToStart) {
        startJob();
      }
    }
    else {
      stopJob();
    }
  }
  
  public long getRefreshInterval()
  {
    return refreshInterval;
  }
  
  public ISynchronizeParticipant getParticipant()
  {
    return refreshable.getParticipant();
  }
  
  public void setRefreshInterval(long refreshInterval)
  {
    if (refreshInterval != getRefreshInterval())
    {
      stopJob();
      this.refreshInterval = refreshInterval;
      runOnce = false;
      if (isEnabled()) {
        startJob();
      }
    }
  }
  
  public void startJob()
  {
    if (job == null)
    {
      job = refreshable.createJob(getRefreshIntervalAsString());
      job.setUser(false);
    }
    else if (job.getState() != 0)
    {
      stopJob();
    }
    job.setRefreshInterval(getRefreshInterval());
    job.setRestartOnCancel(true);
    job.setReschedule(!runOnce);
    if (refreshStart != null) {
      job.schedule(getJobDelay());
    } else {
      job.schedule();
    }
  }
  
  private long getJobDelay()
  {
    Calendar now = Calendar.getInstance();
    Calendar start = Calendar.getInstance();
    start.setTime(refreshStart);
    while (now.after(start)) {
      start.add(5, 1);
    }
    return start.getTimeInMillis() - now.getTimeInMillis();
  }
  
  protected void stopJob()
  {
    if (job != null)
    {
      job.setRestartOnCancel(false);
      job.setReschedule(false);
      job.cancel();
      job = null;
    }
  }
  
  public void dispose()
  {
    stopJob();
    RefreshParticipantJob.removeRefreshListener(refreshSubscriberListener);
  }
  
  public void saveState(IMemento memento)
  {
    memento.putString("org.eclipse.team.ui.CTX_REFRESHSCHEDULE_ENABLED", Boolean.toString(enabled));
    memento.putInteger("org.eclipse.team.ui.CTX_REFRESHSCHEDULE_INTERVAL", (int)refreshInterval);
    if (refreshStart != null) {
      memento.putString("org.eclipse.team.ui.CTX_REFRESHSCHEDULE_START", Long.toString(refreshStart.getTime()));
    }
    memento.putString("org.eclipse.team.ui.CTX_REFRESHSCHEDULE_RUNONCE", Boolean.toString(runOnce));
  }
  
  public static SubscriberRefreshSchedule init(IMemento memento, IRefreshable refreshable)
  {
    SubscriberRefreshSchedule schedule = new SubscriberRefreshSchedule(refreshable);
    if (memento != null)
    {
      String enabled = memento.getString("org.eclipse.team.ui.CTX_REFRESHSCHEDULE_ENABLED");
      int interval = memento.getInteger("org.eclipse.team.ui.CTX_REFRESHSCHEDULE_INTERVAL").intValue();
      String startString = memento.getString("org.eclipse.team.ui.CTX_REFRESHSCHEDULE_START");
      String runOnce = memento.getString("org.eclipse.team.ui.CTX_REFRESHSCHEDULE_RUNONCE");
      if (startString != null)
      {
        long start = Long.parseLong(startString);
        schedule.setRefreshStartTime(new Date(start));
      }
      schedule.setRefreshInterval(interval);
      schedule.setRunOnce("true".equals(runOnce));
      schedule.setEnabled("true".equals(enabled), false);
    }
    return schedule;
  }
  
  public static String refreshEventAsString(IRefreshEvent event)
  {
    if (event == null) {
      return TeamUIMessages.SyncViewPreferencePage_lastRefreshRunNever;
    }
    long stopMills = event.getStopTime();
    StringBuffer text = new StringBuffer();
    if (stopMills <= 0L)
    {
      text.append(TeamUIMessages.SyncViewPreferencePage_lastRefreshRunNever);
    }
    else
    {
      Date lastTimeRun = new Date(stopMills);
      text.append(DateFormat.getDateTimeInstance(3, 3).format(lastTimeRun));
    }
    int changeCount = event.getChangeDescription().getChangeCount();
    if (changeCount == 0) {
      text.append(TeamUIMessages.RefreshSchedule_7);
    } else if (changeCount == 1) {
      text.append(NLS.bind(TeamUIMessages.RefreshSchedule_changesSingular, new String[] { Integer.toString(changeCount) }));
    } else {
      text.append(NLS.bind(TeamUIMessages.RefreshSchedule_changesPlural, new String[] { Integer.toString(changeCount) }));
    }
    return text.toString();
  }
  
  public IRefreshEvent getLastRefreshEvent()
  {
    return lastRefreshEvent;
  }
  
  private String getRefreshIntervalAsString()
  {
    if (runOnce) {
      return TeamUIMessages.RefreshSchedule_16;
    }
    boolean hours = false;
    long seconds = getRefreshInterval();
    if (seconds <= 60L) {
      seconds = 60L;
    }
    long minutes = seconds / 60L;
    if (minutes >= 60L)
    {
      minutes /= 60L;
      hours = true;
    }
    String unit;
    String unit;
    if (minutes >= 1L) {
      unit = hours ? TeamUIMessages.RefreshSchedule_9 : TeamUIMessages.RefreshSchedule_10;
    } else {
      unit = hours ? TeamUIMessages.RefreshSchedule_11 : TeamUIMessages.RefreshSchedule_12;
    }
    return NLS.bind(TeamUIMessages.RefreshSchedule_13, new String[] { Long.toString(minutes), unit });
  }
  
  public IRefreshable getRefreshable()
  {
    return refreshable;
  }
  
  public Date getRefreshStartTime()
  {
    return refreshStart;
  }
  
  public void setRefreshStartTime(Date refreshStart)
  {
    if ((refreshStart == null) || (refreshStart != getRefreshStartTime()))
    {
      stopJob();
      this.refreshStart = refreshStart;
      if (isEnabled()) {
        startJob();
      }
    }
  }
  
  public boolean getRunOnce()
  {
    return runOnce;
  }
  
  public void setRunOnce(boolean runOnce)
  {
    if (runOnce != getRunOnce())
    {
      stopJob();
      this.runOnce = runOnce;
      if (isEnabled()) {
        startJob();
      }
    }
  }
}

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

import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.core.resources.IEncodedStorage;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.internal.ui.TeamUIPlugin;

public class SyncInfoModelElement
  extends SynchronizeModelElement
{
  private ITypedElement ancestor;
  private SyncInfo info;
  
  public SyncInfoModelElement(IDiffContainer parent, SyncInfo info)
  {
    super(parent);
    
    Assert.isNotNull(info);
    this.info = info;
    
    setKind(info.getKind());
    
    setLeft(createLocalTypeElement(info));
    
    setRight(createRemoteTypeElement(info));
    
    setAncestor(createBaseTypeElement(info));
    
    fireChange();
  }
  
  public void update(SyncInfo info)
  {
    this.info = info;
    
    setKind(info.getKind());
    
    RemoteResourceTypedElement rightEl = (RemoteResourceTypedElement)getRight();
    IResourceVariant remote = info.getRemote();
    if ((rightEl == null) && (remote != null)) {
      setRight(createRemoteTypeElement(info));
    } else if (rightEl != null) {
      if (remote == null) {
        setRight(null);
      } else {
        setRight(createRemoteTypeElement(info));
      }
    }
    RemoteResourceTypedElement ancestorEl = (RemoteResourceTypedElement)getAncestor();
    IResourceVariant base = info.getBase();
    if ((ancestorEl == null) && (base != null)) {
      setAncestor(createBaseTypeElement(info));
    } else if (ancestorEl != null) {
      if (base == null) {
        setAncestor(null);
      } else {
        setAncestor(createBaseTypeElement(info));
      }
    }
    fireChange();
  }
  
  public int getKind()
  {
    SyncInfo info = getSyncInfo();
    if (info != null) {
      return info.getKind();
    }
    return 0;
  }
  
  public void setAncestor(ITypedElement ancestor)
  {
    this.ancestor = ancestor;
  }
  
  public ITypedElement getAncestor()
  {
    return ancestor;
  }
  
  public String getName()
  {
    IResource resource = getResource();
    if (resource != null) {
      return resource.getName();
    }
    return super.getName();
  }
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == SyncInfo.class) {
      return getSyncInfo();
    }
    return super.getAdapter(adapter);
  }
  
  public IResource getResource()
  {
    return info.getLocal();
  }
  
  public String toString()
  {
    return getResource().getFullPath().toString();
  }
  
  /* Error */
  public void cacheContents(org.eclipse.core.runtime.IProgressMonitor monitor)
    throws org.eclipse.team.core.TeamException
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 199	org/eclipse/team/internal/ui/synchronize/SyncInfoModelElement:getAncestor	()Lorg/eclipse/compare/ITypedElement;
    //   4: astore_2
    //   5: aload_0
    //   6: invokevirtual 200	org/eclipse/team/internal/ui/synchronize/SyncInfoModelElement:getRight	()Lorg/eclipse/compare/ITypedElement;
    //   9: astore_3
    //   10: aload_3
    //   11: ifnonnull +7 -> 18
    //   14: iconst_0
    //   15: goto +5 -> 20
    //   18: bipush 50
    //   20: aload_2
    //   21: ifnonnull +7 -> 28
    //   24: iconst_0
    //   25: goto +5 -> 30
    //   28: bipush 50
    //   30: iadd
    //   31: bipush 10
    //   33: invokestatic 183	java/lang/Math:min	(II)I
    //   36: istore 4
    //   38: aload_1
    //   39: aconst_null
    //   40: iload 4
    //   42: invokeinterface 220 3 0
    //   47: aload_2
    //   48: ifnull +23 -> 71
    //   51: aload_2
    //   52: instanceof 98
    //   55: ifeq +16 -> 71
    //   58: aload_2
    //   59: checkcast 98	org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement
    //   62: aload_1
    //   63: bipush 50
    //   65: invokestatic 192	org/eclipse/team/internal/ui/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   68: invokevirtual 195	org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement:cacheContents	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   71: aload_3
    //   72: ifnull +45 -> 117
    //   75: aload_3
    //   76: instanceof 98
    //   79: ifeq +38 -> 117
    //   82: aload_3
    //   83: checkcast 98	org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement
    //   86: aload_1
    //   87: bipush 50
    //   89: invokestatic 192	org/eclipse/team/internal/ui/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   92: invokevirtual 195	org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement:cacheContents	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   95: goto +22 -> 117
    //   98: astore 5
    //   100: aload 5
    //   102: invokestatic 187	org/eclipse/team/core/TeamException:asTeamException	(Lorg/eclipse/core/runtime/CoreException;)Lorg/eclipse/team/core/TeamException;
    //   105: athrow
    //   106: astore 6
    //   108: aload_1
    //   109: invokeinterface 219 1 0
    //   114: aload 6
    //   116: athrow
    //   117: aload_1
    //   118: invokeinterface 219 1 0
    //   123: return
    // Line number table:
    //   Java source line #176	-> byte code offset #0
    //   Java source line #177	-> byte code offset #5
    //   Java source line #178	-> byte code offset #10
    //   Java source line #179	-> byte code offset #38
    //   Java source line #181	-> byte code offset #47
    //   Java source line #182	-> byte code offset #58
    //   Java source line #184	-> byte code offset #71
    //   Java source line #185	-> byte code offset #82
    //   Java source line #187	-> byte code offset #98
    //   Java source line #188	-> byte code offset #100
    //   Java source line #189	-> byte code offset #106
    //   Java source line #190	-> byte code offset #108
    //   Java source line #191	-> byte code offset #114
    //   Java source line #190	-> byte code offset #117
    //   Java source line #192	-> byte code offset #123
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	124	0	this	SyncInfoModelElement
    //   0	124	1	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   4	55	2	base	ITypedElement
    //   9	74	3	remote	ITypedElement
    //   36	5	4	work	int
    //   98	3	5	e	CoreException
    //   106	9	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   47	95	98	org/eclipse/core/runtime/CoreException
    //   47	106	106	finally
  }
  
  public SyncInfo getSyncInfo()
  {
    return info;
  }
  
  private static ITypedElement createTypeElement(IResource resource, int kind)
  {
    if (resource != null) {
      return new LocalResourceTypedElement(resource);
    }
    return null;
  }
  
  protected static ITypedElement createTypeElement(IResourceVariant remoteResource, String encoding)
  {
    return new RemoteResourceTypedElement(remoteResource, encoding);
  }
  
  protected static ITypedElement createRemoteTypeElement(SyncInfo info)
  {
    if ((info != null) && (info.getRemote() != null)) {
      return createTypeElement(info.getRemote(), getEncoding(info.getLocal()));
    }
    return null;
  }
  
  private static String getEncoding(IResource local)
  {
    if ((local instanceof IEncodedStorage))
    {
      IEncodedStorage es = (IEncodedStorage)local;
      try
      {
        return es.getCharset();
      }
      catch (CoreException e)
      {
        TeamUIPlugin.log(e);
      }
    }
    return null;
  }
  
  protected static ITypedElement createLocalTypeElement(SyncInfo info)
  {
    if ((info != null) && (info.getLocal() != null)) {
      return createTypeElement(info.getLocal(), info.getKind());
    }
    return null;
  }
  
  protected static ITypedElement createBaseTypeElement(SyncInfo info)
  {
    if ((info != null) && (info.getBase() != null)) {
      return createTypeElement(info.getBase(), getEncoding(info.getLocal()));
    }
    return null;
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.ITeamStatus;
import org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent;
import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.core.subscribers.ChangeSet;

class SyncInfoSetChangeSetCollector$1
  implements ISyncInfoSetChangeListener
{
  final SyncInfoSetChangeSetCollector this$0;
  
  SyncInfoSetChangeSetCollector$1(SyncInfoSetChangeSetCollector paramSyncInfoSetChangeSetCollector)
  {
    this$0 = paramSyncInfoSetChangeSetCollector;
  }
  
  public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor)
  {
    handleChangeEvent(set);
  }
  
  public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor)
  {
    handleChangeEvent(event.getSet());
  }
  
  public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {}
  
  private void handleChangeEvent(SyncInfoSet set)
  {
    if (set.isEmpty())
    {
      ChangeSet changeSet = this$0.getChangeSet(set);
      if (changeSet != null) {
        this$0.remove(changeSet);
      }
    }
  }
}

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

import java.util.
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