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

eption;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.ISynchronizeManager;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.Saveable;
import org.eclipse.ui.dialogs.ListSelectionDialog;
import org.eclipse.ui.model.WorkbenchPartLabelProvider;
import org.eclipse.ui.progress.IProgressService;

public class RemoveSynchronizeParticipantAction
  extends Action
{
  private final ISynchronizeView view;
  private boolean removeAll;
  
  public RemoveSynchronizeParticipantAction(ISynchronizeView view, boolean removeAll)
  {
    this.view = view;
    this.removeAll = removeAll;
    if (removeAll) {
      Utils.initAction(this, "action.removeAllPage.");
    } else {
      Utils.initAction(this, "action.removePage.");
    }
  }
  
  public void run()
  {
    try
    {
      PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress()
      {
        public void run(IProgressMonitor monitor)
          throws InvocationTargetException, InterruptedException
        {
          if (removeAll) {
            RemoveSynchronizeParticipantAction.this.removeAll();
          } else {
            RemoveSynchronizeParticipantAction.this.removeCurrent();
          }
        }
      });
    }
    catch (InvocationTargetException e)
    {
      Utils.handle(e);
    }
    catch (InterruptedException localInterruptedException) {}
  }
  
  private void removeCurrent()
  {
    ISynchronizeParticipant participant = view.getParticipant();
    if (participant != null)
    {
      List dirtyModels = getDirtyModels(new ISynchronizeParticipant[] { participant });
      if ((participant.isPinned()) || (!dirtyModels.isEmpty()))
      {
        boolean[] keepGoing = new boolean[1];
        Display.getDefault().syncExec(new Runnable()
        {
          private final List val$dirtyModels;
          private final boolean[] val$keepGoing;
          
          public void run()
          {
            if (!val$dirtyModels.isEmpty()) {
              val$keepGoing[0] = RemoveSynchronizeParticipantAction.this.promptToSave(val$dirtyModels);
            } else {
              val$keepGoing[0] = MessageDialog.openQuestion(
                view.getSite().getShell(), 
                TeamUIMessages.RemoveSynchronizeParticipantAction_0, 
                TeamUIMessages.RemoveSynchronizeParticipantAction_1);
            }
          }
        });
        if (keepGoing[0] == 0) {
          return;
        }
      }
      TeamUI.getSynchronizeManager().removeSynchronizeParticipants(new ISynchronizeParticipant[] { participant });
    }
  }
  
  private void removeAll()
  {
    ISynchronizeManager manager = TeamUI.getSynchronizeManager();
    ISynchronizeParticipantReference[] refs = manager.getSynchronizeParticipants();
    ArrayList removals = new ArrayList();
    for (int i = 0; i < refs.length; i++)
    {
      ISynchronizeParticipantReference reference = refs[i];
      try
      {
        ISynchronizeParticipant p = reference.getParticipant();
        if (!p.isPinned()) {
          removals.add(p);
        }
      }
      catch (TeamException localTeamException) {}
    }
    ISynchronizeParticipant[] toRemove = (ISynchronizeParticipant[])removals.toArray(new ISynchronizeParticipant[removals.size()]);
    List dirtyModels = getDirtyModels(toRemove);
    if (!dirtyModels.isEmpty())
    {
      boolean[] keepGoing = new boolean[1];
      Display.getDefault().syncExec(new Runnable()
      {
        private final List val$dirtyModels;
        private final boolean[] val$keepGoing;
        
        public void run()
        {
          if (!val$dirtyModels.isEmpty()) {
            val$keepGoing[0] = RemoveSynchronizeParticipantAction.this.promptToSave(val$dirtyModels);
          }
        }
      });
      if (keepGoing[0] == 0) {
        return;
      }
    }
    manager.removeSynchronizeParticipants(toRemove);
  }
  
  private boolean promptToSave(List dirtyModels)
  {
    if (dirtyModels.size() == 1)
    {
      Saveable model = (Saveable)dirtyModels.get(0);
      String message = NLS.bind(TeamUIMessages.RemoveSynchronizeParticipantAction_2, model.getName());
      
      String[] buttons = { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
      MessageDialog d = new MessageDialog(
        view.getSite().getShell(), TeamUIMessages.RemoveSynchronizeParticipantAction_3, 
        null, message, 3, buttons, 0);
      
      int choice = d.open();
      switch (choice)
      {
      case 0: 
        break;
      case 1: 
        return true;
      case 2: 
      default: 
        return false;break;
      }
    }
    else
    {
      ListSelectionDialog dlg = new ListSelectionDialog(
        view.getSite().getShell(), dirtyModels, 
        new ArrayContentProvider(), 
        new WorkbenchPartLabelProvider(), TeamUIMessages.RemoveSynchronizeParticipantAction_4);
      dlg.setInitialSelections(dirtyModels.toArray());
      dlg.setTitle(TeamUIMessages.RemoveSynchronizeParticipantAction_5);
      
      int result = dlg.open();
      if (result == 1) {
        return false;
      }
      dirtyModels = Arrays.asList(dlg.getResult());
    }
    if (dirtyModels.isEmpty()) {
      return true;
    }
    List finalModels = dirtyModels;
    IRunnableWithProgress progressOp = new IRunnableWithProgress()
    {
      private final List val$finalModels;
      
      public void run(IProgressMonitor monitor)
      {
        monitor.beginTask(null, val$finalModels.size());
        for (Iterator i = val$finalModels.iterator(); i.hasNext();)
        {
          Saveable model = (Saveable)i.next();
          if (model.isDirty()) {
            try
            {
              model.doSave(new SubProgressMonitor(monitor, 1));
            }
            catch (CoreException e)
            {
              ErrorDialog.openError(view.getSite().getShell(), null, e.getMessage(), e.getStatus());
            }
          }
          if (monitor.isCanceled()) {
            break;
          }
        }
        monitor.done();
      }
    };
    try
    {
      PlatformUI.getWorkbench().getProgressService().run(true, true, progressOp);
    }
    catch (InvocationTargetException e)
    {
      Utils.handleError(view.getSite().getShell(), e, null, null);
      return false;
    }
    catch (InterruptedException localInterruptedException) {}
    return true;
  }
  
  private List getDirtyModels(ISynchronizeParticipant[] participants)
  {
    List result = new ArrayList();
    for (int i = 0; i < participants.length; i++)
    {
      ISynchronizeParticipant participant = participants[i];
      if ((participant instanceof ModelSynchronizeParticipant))
      {
        ModelSynchronizeParticipant msp = (ModelSynchronizeParticipant)participant;
        Saveable s = msp.getActiveSaveable();
        if ((s != null) && (s.isDirty())) {
          result.add(s);
        }
      }
    }
    return result;
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.core.subscribers.WorkingSetFilteredSyncInfoCollector;
import org.eclipse.team.internal.ui.synchronize.SubscriberParticipantPage;
import org.eclipse.team.ui.synchronize.ISynchronizePage;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;

class RestoreRemovedItemsAction$1
  extends SynchronizeModelOperation
{
  final RestoreRemovedItemsAction this$0;
  
  RestoreRemovedItemsAction$1(RestoreRemovedItemsAction paramRestoreRemovedItemsAction, ISynchronizePageConfiguration $anonymous0, IDiffElement[] $anonymous1)
  {
    super($anonymous0, $anonymous1);this$0 = paramRestoreRemovedItemsAction;
  }
  
  public void run(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {
    restoreRemovedItems();
  }
  
  protected boolean canRunAsJob()
  {
    return false;
  }
  
  private void restoreRemovedItems()
  {
    ISynchronizePage page = this$0.getConfiguration().getPage();
    if ((page instanceof SubscriberParticipantPage))
    {
      WorkingSetFilteredSyncInfoCollector collector = ((SubscriberParticipantPage)page).getCollector();
      collector.reset();
    }
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.core.subscribers.WorkingSetFilteredSyncInfoCollector;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.SubscriberParticipantPage;
import org.eclipse.team.ui.synchronize.ISynchronizePage;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.SynchronizeModelAction;
import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;

public class RestoreRemovedItemsAction
  extends SynchronizeModelAction
{
  public RestoreRemovedItemsAction(ISynchronizePageConfiguration configuration)
  {
    super(null, configuration);
    Utils.initAction(this, "action.restoreRemovedFromView.");
  }
  
  protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements)
  {
    new SynchronizeModelOperation(configuration, elements)
    {
      public void run(IProgressMonitor monitor)
        throws InvocationTargetException, InterruptedException
      {
        restoreRemovedItems();
      }
      
      protected boolean canRunAsJob()
      {
        return false;
      }
      
      private void restoreRemovedItems()
      {
        ISynchronizePage page = getConfiguration().getPage();
        if ((page instanceof SubscriberParticipantPage))
        {
          WorkingSetFilteredSyncInfoCollector collector = ((SubscriberParticipantPage)page).getCollector();
          collector.reset();
        }
      }
    };
  }
  
  public boolean isEnabled()
  {
    return true;
  }
  
  protected boolean needsToSaveDirtyEditors()
  {
    return false;
  }
}

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

import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.SubscriberRefreshSchedule;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
import org.eclipse.team.ui.synchronize.SubscriberParticipant;

final class ShowSynchronizeParticipantAction$ParticipantOverlay
  extends CompositeImageDescriptor
{
  private ImageData pinnedData = TeamUIPlugin.getImageDescriptor("ovr/pinned_ovr.gif").getImageData();
  private ImageData scheduledData = TeamUIPlugin.getImageDescriptor("ovr/waiting_ovr.gif").getImageData();
  private ImageData imageData;
  private ISynchronizeParticipant participant;
  
  ShowSynchronizeParticipantAction$ParticipantOverlay(ISynchronizeParticipantReference paramISynchronizeParticipantReference, ParticipantOverlay paramParticipantOverlay)
  {
    this(paramISynchronizeParticipantReference);
  }
  
  private ShowSynchronizeParticipantAction$ParticipantOverlay(ISynchronizeParticipantReference ref)
  {
    try
    {
      participant = ref.getParticipant();
      imageData = ref.getDescriptor().getImageDescriptor().getImageData();
    }
    catch (TeamException ex)
    {
      TeamUIPlugin.log(ex);
    }
  }
  
  protected void drawCompositeImage(int width, int height)
  {
    drawImage(imageData, 0, 0);
    if (this.participant.isPinned()) {
      drawImage(pinnedData, imageData.width - pinnedData.width, 0);
    }
    if ((this.participant instanceof SubscriberParticipant))
    {
      SubscriberParticipant participant = (SubscriberParticipant)this.participant;
      SubscriberRefreshSchedule schedule = participant.getRefreshSchedule();
      if ((schedule != null) && (schedule.isEnabled())) {
        drawImage(scheduledData, 0, 0);
      }
    }
    else
    {
      Class tmp103_100 = ShowSynchronizeParticipantAction.class$0;
      if (tmp103_100 == null)
      {
        tmp103_100;
        try
        {
          tmpTernaryOp = (ShowSynchronizeParticipantAction.class$0 = Class.forName("org.eclipse.team.internal.ui.synchronize.SubscriberRefreshSchedule"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      SubscriberRefreshSchedule schedule = (SubscriberRefreshSchedule)Utils.getAdapter(this.participant, tmp103_100);
      if ((schedule != null) && (schedule.isEnabled())) {
        drawImage(scheduledData, 0, 0);
      }
    }
  }
  
  protected Point getSize()
  {
    return new Point(imageData.width, imageData.height);
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.SubscriberRefreshSchedule;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.SubscriberParticipant;

public class ShowSynchronizeParticipantAction
  extends Action
  implements IPropertyChangeListener
{
  private ISynchronizeParticipantReference fPage;
  private ISynchronizeView fView;
  static Class class$0;
  
  public void run()
  {
    try
    {
      if (!fPage.equals(fView.getParticipant())) {
        fView.display(fPage.getParticipant());
      }
    }
    catch (TeamException e)
    {
      Utils.handle(e);
    }
  }
  
  public ShowSynchronizeParticipantAction(ISynchronizeView view, ISynchronizeParticipantReference ref)
  {
    super(Utils.shortenText(100, ref.getDisplayName()), 8);
    fPage = ref;
    fView = view;
    setImageDescriptor(new ParticipantOverlay(ref, null));
    try
    {
      fPage.getParticipant().addPropertyChangeListener(this);
    }
    catch (TeamException e)
    {
      Utils.handle(e);
    }
  }
  
  public void propertyChange(PropertyChangeEvent event)
  {
    String property = event.getProperty();
    if (("org.eclipse.team.pinned".equals(property)) || 
      ("org.eclipse.team.schedule".equals(property))) {
      setImageDescriptor(new ParticipantOverlay(fPage, null));
    }
  }
  
  private static final class ParticipantOverlay
    extends CompositeImageDescriptor
  {
    private ImageData pinnedData = TeamUIPlugin.getImageDescriptor("ovr/pinned_ovr.gif").getImageData();
    private ImageData scheduledData = TeamUIPlugin.getImageDescriptor("ovr/waiting_ovr.gif").getImageData();
    private ImageData imageData;
    private ISynchronizeParticipant participant;
    
    ParticipantOverlay(ISynchronizeParticipantReference paramISynchronizeParticipantReference, ParticipantOverlay paramParticipantOverlay)
    {
      this(paramISynchronizeParticipantReference);
    }
    
    private ParticipantOverlay(ISynchronizeParticipantReference ref)
    {
      try
      {
        participant = ref.getParticipant();
        imageData = ref.getDescriptor().getImageDescriptor().getImageData();
      }
      catch (TeamException ex)
      {
        TeamUIPlugin.log(ex);
      }
    }
    
    protected void drawCompositeImage(int width, int height)
    {
      drawImage(imageData, 0, 0);
      if (this.participant.isPinned()) {
        drawImage(pinnedData, imageData.width - pinnedData.width, 0);
      }
      if ((this.participant instanceof SubscriberParticipant))
      {
        SubscriberParticipant participant = (SubscriberParticipant)this.participant;
        SubscriberRefreshSchedule schedule = participant.getRefreshSchedule();
        if ((schedule != null) && (schedule.isEnabled())) {
          drawImage(scheduledData, 0, 0);
        }
      }
      else
      {
        Class tmp103_100 = ShowSynchronizeParticipantAction.class$0;
        if (tmp103_100 == null)
        {
          tmp103_100;
          try
          {
            tmpTernaryOp = (ShowSynchronizeParticipantAction.class$0 = Class.forName("org.eclipse.team.internal.ui.synchronize.SubscriberRefreshSchedule"));
          }
          catch (ClassNotFoundException localClassNotFoundException)
          {
            throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
          }
        }
        SubscriberRefreshSchedule schedule = (SubscriberRefreshSchedule)Utils.getAdapter(this.participant, tmp103_100);
        if ((schedule != null) && (schedule.isEnabled())) {
          drawImage(scheduledData, 0, 0);
        }
      }
    }
    
    protected Point getSize()
    {
      return new Point(imageData.width, imageData.height);
    }
  }
}

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

import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.StatusLineLayoutData;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;

public class StatusLineCLabelContribution
  extends ContributionItem
{
  public static final int DEFAULT_CHAR_WIDTH = 40;
  private int charWidth;
  private CLabel label;
  private Image image;
  private String text = "";
  private int widthHint = -1;
  private int heightHint = -1;
  private Listener listener;
  private int eventType;
  private String tooltip;
  
  public StatusLineCLabelContribution(String id, int charWidth)
  {
    super(id);
    this.charWidth = charWidth;
    setVisible(false);
  }
  
  public void fill(Composite parent)
  {
    Label sep = new Label(parent, 2);
    label = new CLabel(parent, 32);
    StatusLineLayoutData statusLineLayoutData = new StatusLineLayoutData();
    if (widthHint < 0)
    {
      GC gc = new GC(parent);
      gc.setFont(parent.getFont());
      FontMetrics fm = gc.getFontMetrics();
      widthHint = (fm.getAverageCharWidth() * charWidth);
      heightHint = fm.getHeight();
      gc.dispose();
    }
    widthHint = widthHint;
    label.setLayoutData(statusLineLayoutData);
    label.setText(text);
    label.setImage(image);
    if (listener != null) {
      label.addListener(eventType, listener);
    }
    if (tooltip != null) {
      label.setToolTipText(tooltip);
    }
    statusLineLayoutData = new StatusLineLayoutData();
    heightHint = heightHint;
    sep.setLayoutData(statusLineLayoutData);
  }
  
  public void addListener(int eventType, Listener listener)
  {
    this.eventType = eventType;
    this.listener = listener;
  }
  
  public void setText(String text)
  {
    if (text == null) {
      throw new NullPointerException();
    }
    this.text = text;
    if ((label != null) && (!label.isDisposed())) {
      label.setText(this.text);
    }
    if (this.text.length() == 0)
    {
      if (isVisible())
      {
        setVisible(false);
        IContributionManager contributionManager = getParent();
        if (contributionManager != null) {
          contributionManager.update(true);
        }
      }
    }
    else if (!isVisible())
    {
      setVisible(true);
      IContributionManager contributionManager = getParent();
      if (contributionManager != null) {
        contributionManager.update(true);
      }
    }
  }
  
  public void setTooltip(String tooltip)
  {
    if (tooltip == null) {
      throw new NullPointerException();
    }
    this.tooltip = tooltip;
    if ((label != null) && (!label.isDisposed())) {
      label.setToolTipText(this.tooltip);
    }
  }
  
  public void setImage(Image image)
  {
    if (image == null) {
      throw new NullPointerException();
    }
    this.image = image;
    if ((label != null) && (!label.isDisposed())) {
      label.setImage(this.image);
    }
    if (!isVisible())
    {
      setVisible(true);
      IContributionManager contributionManager = getParent();
      if (contributionManager != null) {
        contributionManager.update(true);
      }
    }
  }
}

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

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;

class StatusLineContributionGroup$1
  implements Listener
{
  final StatusLineContributionGroup this$0;
  private final int val$mode;
  
  StatusLineContributionGroup$1(StatusLineContributionGroup paramStatusLineContributionGroup, int paramInt)
  {
    this$0 = paramStatusLineContributionGroup;val$mode = paramInt;
  }
  
  public void handleEvent(Event event)
  {
    StatusLineContributionGroup.access$0(this$0).setMode(val$mode);
  }
}

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

import org.eclipse.osgi.util.NLS;
import org.eclipse.team.internal.ui.TeamUIMessages;

class StatusLineContributionGroup$2
  implements Runnable
{
  final StatusLineContributionGroup this$0;
  private final int val$workspaceConflicting;
  private final int val$workspaceIncoming;
  private final int val$workspaceOutgoing;
  private final int val$total;
  
  StatusLineContributionGroup$2(StatusLineContributionGroup paramStatusLineContributionGroup, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    this$0 = paramStatusLineContributionGroup;val$workspaceConflicting = paramInt1;val$workspaceIncoming = paramInt2;val$workspaceOutgoing = paramInt3;val$total = paramInt4;
  }
  
  public void run()
  {
    if (StatusLineContributionGroup.access$1(this$0))
    {
      StatusLineContributionGroup.access$2(this$0).setText(new Integer(val$workspaceConflicting).toString());
      StatusLineContributionGroup.access$3(this$0).setText(new Integer(val$workspaceIncoming).toString());
      StatusLineContributionGroup.access$4(this$0).setText(new Integer(val$workspaceOutgoing).toString());
      
      StatusLineContributionGroup.access$2(this$0).setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_conflicting }));
      StatusLineContributionGroup.access$4(this$0).setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_outgoing }));
      StatusLineContributionGroup.access$3(this$0).setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_incoming }));
    }
    else if (val$total == 1)
    {
      StatusLineContributionGroup.access$5(this$0).setText(NLS.bind(TeamUIMessages.StatisticsPanel_numberTotalSingular, new String[] { Integer.toString(val$total) }));
    }
    else
    {
      StatusLineContributionGroup.access$5(this$0).setText(NLS.bind(TeamUIMessages.StatisticsPanel_numberTotalPlural, new String[] { Integer.toString(val$total) }));
    }
  }
}

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

import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.actions.ActionGroup;

public abstract class StatusLineContributionGroup
  extends ActionGroup
{
  private static final String INCOMING_ID = "org.eclipse.team.uiorg.eclipse.team.iu.statusline.incoming";
  private static final String OUTGOING_ID = "org.eclipse.team.uiorg.eclipse.team.iu.statusline.outgoing";
  private static final String CONFLICTING_ID = "org.eclipse.team.uiorg.eclipse.team.iu.statusline.conflicting";
  private static final String TOTALS_ID = "org.eclipse.team.uiorg.eclipse.team.iu.statusline.totals";
  private static final int TEXT_FIELD_MAX_SIZE = 25;
  private StatusLineCLabelContribution incoming;
  private StatusLineCLabelContribution outgoing;
  private StatusLineCLabelContribution conflicting;
  private StatusLineCLabelContribution totalChanges;
  private Image incomingImage = TeamUIPlugin.getImageDescriptor("elcl16/incom_synch.gif").createImage();
  private Image outgoingImage = TeamUIPlugin.getImageDescriptor("elcl16/outgo_synch.gif").createImage();
  private Image conflictingImage = TeamUIPlugin.getImageDescriptor("elcl16/conflict_synch.gif").createImage();
  private ISynchronizePageConfiguration configuration;
  
  public StatusLineContributionGroup(Shell shell, ISynchronizePageConfiguration configuration)
  {
    this.configuration = configuration;
    if (isThreeWay())
    {
      incoming = createStatusLineContribution("org.eclipse.team.uiorg.eclipse.team.iu.statusline.incoming", 1, "0", incomingImage);
      outgoing = createStatusLineContribution("org.eclipse.team.uiorg.eclipse.team.iu.statusline.outgoing", 2, "0", outgoingImage);
      conflicting = createStatusLineContribution("org.eclipse.team.uiorg.eclipse.team.iu.statusline.conflicting", 8, "0", conflictingImage);
    }
    else
    {
      totalChanges = new StatusLineCLabelContribution("org.eclipse.team.uiorg.eclipse.team.iu.statusline.totals", 25);
    }
    updateCounts();
  }
  
  private boolean isThreeWay()
  {
    return configuration.getComparisonType() == "three-way";
  }
  
  private StatusLineCLabelContribution createStatusLineContribution(String id, int mode, String label, Image image)
  {
    StatusLineCLabelContribution item = new StatusLineCLabelContribution(id, 15);
    item.addListener(3, new Listener()
    {
      private final int val$mode;
      
      public void handleEvent(Event event)
      {
        configuration.setMode(val$mode);
      }
    });
    item.setText(label);
    item.setImage(image);
    return item;
  }
  
  public void dispose()
  {
    if (isThreeWay())
    {
      incomingImage.dispose();
      outgoingImage.dispose();
      conflictingImage.dispose();
    }
  }
  
  protected void updateCounts()
  {
    int total = getChangeCount();
    int supportedModes = configuration.getSupportedModes();
    
    int workspaceConflicting = (supportedModes & 0x8) != 0 ? countFor(12) : 0;
    int workspaceOutgoing = (supportedModes & 0x2) != 0 ? countFor(4) : 0;
    int workspaceIncoming = (supportedModes & 0x1) != 0 ? countFor(8) : 0;
    
    TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable()
    {
      private final int val$workspaceConflicting;
      private final int val$workspaceIncoming;
      private final int val$workspaceOutgoing;
      private final int val$total;
      
      public void run()
      {
        if (StatusLineContributionGroup.this.isThreeWay())
        {
          conflicting.setText(new Integer(val$workspaceConflicting).toString());
          incoming.setText(new Integer(val$workspaceIncoming).toString());
          outgoing.setText(new Integer(val$workspaceOutgoing).toString());
          
          conflicting.setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_conflicting }));
          outgoing.setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_outgoing }));
          incoming.setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_incoming }));
        }
        else if (val$total == 1)
        {
          totalChanges.setText(NLS.bind(TeamUIMessages.StatisticsPanel_numberTotalSingular, new String[] { Integer.toString(val$total) }));
        }
        else
        {
          totalChanges.setText(NLS.bind(TeamUIMessages.StatisticsPanel_numberTotalPlural, new String[] { Integer.toString(val$total) }));
        }
      }
    });
  }
  
  protected abstract int getChangeCount();
  
  protected abstract int countFor(int paramInt);
  
  public void fillActionBars(IActionBars actionBars)
  {
    IStatusLineManager mgr = actionBars.getStatusLineManager();
    if (isThreeWay())
    {
      mgr.add(incoming);
      mgr.add(outgoing);
      mgr.add(conflicting);
    }
    else
    {
      mgr.add(totalChanges);
    }
  }
  
  public ISynchronizePageConfiguration getConfiguration()
  {
    return configuration;
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.team.ui.synchronize.SubscriberParticipant;

class SubscriberActionContribution$1
  extends Action
{
  final SubscriberActionContribution this$0;
  private final ISynchronizePageSite val$site;
  private final SubscriberParticipant val$participant;
  
  SubscriberActionContribution$1(SubscriberActionContribution paramSubscriberActionContribution, ISynchronizePageSite paramISynchronizePageSite, SubscriberParticipant paramSubscriberParticipant)
  {
    this$0 = paramSubscriberActionContribution;val$site = paramISynchronizePageSite;val$participant = paramSubscriberParticipant;
  }
  
  public void run()
  {
    IStructuredSelection selection = (IStructuredSelection)val$site.getSelectionProvider().getSelection();
    IResource[] resources = Utils.getResources(selection.toArray());
    if (resources.length == 0) {
      resources = val$participant.getResources();
    }
    val$participant.refresh(resources, null, null, val$site.getWorkbenchSite());
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.team.internal.ui.synchronize.ConfigureRefreshScheduleDialog;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.team.ui.synchronize.SubscriberParticipant;

class SubscriberActionContribution$2
  extends Action
{
  final SubscriberActionContribution this$0;
  private final ISynchronizePageSite val$site;
  private final SubscriberParticipant val$participant;
  
  SubscriberActionContribution$2(SubscriberActionContribution paramSubscriberActionContribution, ISynchronizePageSite paramISynchronizePageSite, SubscriberParticipant paramSubscriberParticipant)
  {
    this$0 = paramSubscriberActionContribution;val$site = paramISynchronizePageSite;val$participant = paramSubscriberParticipant;
  }
  
  public void run()
  {
    ConfigureRefreshScheduleDialog d = new ConfigureRefreshScheduleDialog(
      val$site.getShell(), val$participant.getRefreshSchedule());
    d.setBlockOnOpen(false);
    d.open();
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.ConfigureRefreshScheduleDialog;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.team.ui.synchronize.SubscriberParticipant;
import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
import org.eclipse.ui.IActionBars;

public final class SubscriberActionContribution
  extends SynchronizePageActionGroup
{
  private Action configureSchedule;
  private Action refreshSelectionAction;
  private RemoveFromViewAction removeFromViewAction;
  private RestoreRemovedItemsAction restoreRemovedItemsAction;
  
  public void initialize(ISynchronizePageConfiguration configuration)
  {
    super.initialize(configuration);
    SubscriberParticipant participant = (SubscriberParticipant)configuration.getParticipant();
    ISynchronizePageSite site = configuration.getSite();
    if (participant.doesSupportSynchronize())
    {
      refreshSelectionAction = new Action()
      {
        private final ISynchronizePageSite val$site;
        private final SubscriberParticipant val$participant;
        
        public void run()
        {
          IStructuredSelection selection = (IStructuredSelection)val$site.getSelectionProvider().getSelection();
          IResource[] resources = Utils.getResources(selection.toArray());
          if (resources.length == 0) {
            resources = val$participant.getResources();
          }
          val$participant.refresh(resources, null, null, val$site.getWorkbenchSite());
        }
      };
      Utils.initAction(refreshSelectionAction, "action.refreshWithRemote.");
      refreshSelectionAction.setActionDefinitionId("org.eclipse.team.ui.synchronizeLast");
      refreshSelectionAction.setId("org.eclipse.team.ui.synchronizeLast");
      
      configureSchedule = new Action()
      {
        private final ISynchronizePageSite val$site;
        private final SubscriberParticipant val$participant;
        
        public void run()
        {
          ConfigureRefreshScheduleDialog d = new ConfigureRefreshScheduleDialog(
            val$site.getShell(), val$participant.getRefreshSchedule());
          d.setBlockOnOpen(false);
          d.open();
        }
      };
      Utils.initAction(configureSchedule, "action.configureSchedulel.");
    }
    removeFromViewAction = new RemoveFromViewAction(configuration);
    restoreRemovedItemsAction = new RestoreRemovedItemsAction(configuration);
    appendToGroup("org.eclipse.team.ui.P_VIEW_MENU", "synchronize", restoreRemovedItemsAction);
  }
  
  public void fillContextMenu(IMenuManager manager)
  {
    if ((findGroup(manager, "synchronize") != null) && 
      (findGroup(manager, "navigate") != null))
    {
      appendToGroup(manager, "navigate", refreshSelectionAction);
      appendToGroup(manager, "navigate", removeFromViewAction);
    }
    else
    {
      appendToGroup(manager, "synchronize", refreshSelectionAction);
      appendToGroup(manager, "synchronize", removeFromViewAction);
    }
  }
  
  public void fillActionBars(IActionBars actionBars)
  {
    super.fillActionBars(actionBars);
    if (actionBars != null)
    {
      IMenuManager menu = actionBars.getMenuManager();
      if ((findGroup(menu, "synchronize") != null) && 
        (findGroup(menu, "preferences") != null)) {
        appendToGroup(menu, "preferences", configureSchedule);
      } else {
        appendToGroup(menu, "synchronize", configureSchedule);
      }
    }
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.widgets.Shell;
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.ui.synchronize.ISynchronizePageConfiguration;

public class SyncInfoSetStatusLineContributionGroup
  extends StatusLineContributionGroup
  implements ISyncInfoSetChangeListener
{
  public SyncInfoSetStatusLineContributionGroup(Shell shell, ISynchronizePageConfiguration configuration)
  {
    super(shell, configuration);
    
    SyncInfoSet set = getSyncInfoSet();
    set.addSyncSetChangedListener(this);
  }
  
  public void dispose()
  {
    getSyncInfoSet().removeSyncSetChangedListener(this);
    super.dispose();
  }
  
  public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor)
  {
    updateCounts();
  }
  
  public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor)
  {
    updateCounts();
  }
  
  public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {}
  
  private SyncInfoSet getSyncInfoSet()
  {
    return (SyncInfoSet)getConfiguration().getProperty("org.eclipse.team.ui.P_WORKING_SET_SYNC_INFO_SET");
  }
  
  protected int getChangeCount()
  {
    return getSyncInfoSet().size();
  }
  
  protected int countFor(int state)
  {
    return (int)getSyncInfoSet().countFor(stat
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