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

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

import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchOperation;
import org.eclipse.ui.IWorkbenchPart;

class PasteAction$1
  extends ApplyPatchOperation
{
  final PasteAction this$0;
  
  PasteAction$1(PasteAction paramPasteAction, IWorkbenchPart $anonymous0, IStorage $anonymous1, IResource $anonymous2, CompareConfiguration $anonymous3)
  {
    super($anonymous0, $anonymous1, $anonymous2, $anonymous3);this$0 = paramPasteAction;
  }
  
  protected boolean isApplyPatchInSynchronizeView()
  {
    return true;
  }
}

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

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import org.eclipse.core.resources.IEncodedStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Status;

class PasteAction$2
  implements IEncodedStorage
{
  final PasteAction this$0;
  private final String val$text;
  
  PasteAction$2(PasteAction paramPasteAction, String paramString)
  {
    this$0 = paramPasteAction;val$text = paramString;
  }
  
  public Object getAdapter(Class adapter)
  {
    return null;
  }
  
  public boolean isReadOnly()
  {
    return false;
  }
  
  public String getName()
  {
    return null;
  }
  
  public IPath getFullPath()
  {
    return null;
  }
  
  public InputStream getContents()
    throws CoreException
  {
    try
    {
      return new ByteArrayInputStream(val$text.getBytes(getCharset()));
    }
    catch (UnsupportedEncodingException e)
    {
      throw new CoreException(new Status(4, 
        "org.eclipse.team.ui", 4, e.getMessage(), e));
    }
  }
  
  public String getCharset()
    throws CoreException
  {
    return "UTF-8";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.PasteAction.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.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.Transfer;

class PasteAction$3
  implements Runnable
{
  private final Object[] val$result;
  private final Clipboard val$clipboard;
  private final Transfer val$transfer;
  
  PasteAction$3(Object[] paramArrayOfObject, Clipboard paramClipboard, Transfer paramTransfer)
  {
    val$result = paramArrayOfObject;val$clipboard = paramClipboard;val$transfer = paramTransfer;
  }
  
  public void run()
  {
    val$result[0] = val$clipboard.getContents(val$transfer);
  }
}

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

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.resources.IEncodedStorage;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
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.synchronize.patch.ApplyPatchOperation;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.SelectionListenerAction;

public class PasteAction
  extends SelectionListenerAction
{
  private static final String ID = "org.eclipse.team.ui.synchronize.action.paste";
  private Shell fShell;
  private Clipboard fClipboard;
  
  public PasteAction(IWorkbenchPart part)
  {
    super(TeamUIMessages.PasteAction_1);
    
    ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
    setActionDefinitionId("org.eclipse.ui.edit.paste");
    setImageDescriptor(images.getImageDescriptor("IMG_TOOL_PASTE"));
    setDisabledImageDescriptor(images.getImageDescriptor("IMG_TOOL_PASTE_DISABLED"));
    
    fShell = part.getSite().getShell();
    Assert.isNotNull(fShell);
    fClipboard = new Clipboard(fShell.getDisplay());
    setToolTipText(TeamUIMessages.PasteAction_2);
    setId("org.eclipse.team.ui.synchronize.action.paste");
  }
  
  public void run()
  {
    IStorage patchStorage = getPatchStorage();
    if (patchStorage != null)
    {
      IResource resource = null;
      IResource[] resources = (IResource[])getSelectedResources()
        .toArray(new IResource[0]);
      if (resources.length > 0) {
        resource = resources[0];
      }
      ApplyPatchOperation operation = new ApplyPatchOperation(null, 
        patchStorage, resource, new CompareConfiguration())
        {
          protected boolean isApplyPatchInSynchronizeView()
          {
            return true;
          }
        };
        operation.openWizard();
      }
      else
      {
        MessageDialog.openError(fShell, TeamUIMessages.PasteAction_3, 
          TeamUIMessages.PasteAction_4);
      }
    }
    
    private IStorage getPatchStorage()
    {
      String text = getClipboardText();
      if (text == null) {
        return null;
      }
      IStorage storage = new IEncodedStorage()
      {
        private final String val$text;
        
        public Object getAdapter(Class adapter)
        {
          return null;
        }
        
        public boolean isReadOnly()
        {
          return false;
        }
        
        public String getName()
        {
          return null;
        }
        
        public IPath getFullPath()
        {
          return null;
        }
        
        public InputStream getContents()
          throws CoreException
        {
          try
          {
            return new ByteArrayInputStream(val$text.getBytes(getCharset()));
          }
          catch (UnsupportedEncodingException e)
          {
            throw new CoreException(new Status(4, 
              "org.eclipse.team.ui", 4, e.getMessage(), e));
          }
        }
        
        public String getCharset()
          throws CoreException
        {
          return "UTF-8";
        }
      };
      try
      {
        if (ApplyPatchOperation.isPatch(storage)) {
          return storage;
        }
      }
      catch (CoreException localCoreException) {}
      return null;
    }
    
    private String getClipboardText()
    {
      Transfer transfer = TextTransfer.getInstance();
      if (isAvailable(transfer, fClipboard.getAvailableTypes())) {
        return (String)getContents(fClipboard, transfer, fShell);
      }
      return null;
    }
    
    private static boolean isAvailable(Transfer transfer, TransferData[] availableDataTypes)
    {
      for (int i = 0; i < availableDataTypes.length; i++) {
        if (transfer.isSupportedType(availableDataTypes[i])) {
          return true;
        }
      }
      return false;
    }
    
    private static Object getContents(Clipboard clipboard, Transfer transfer, Shell shell)
    {
      Object[] result = new Object[1];
      shell.getDisplay().syncExec(new Runnable()
      {
        private final Clipboard val$clipboard;
        private final Transfer val$transfer;
        
        public void run()
        {
          PasteAction.this[0] = val$clipboard.getContents(val$transfer);
        }
      });
      return result[0];
    }
    
    public void dispose()
    {
      fClipboard.dispose();
    }
  }

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.PasteAction
 * 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.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;

class PinParticipantAction$1
  implements IRunnableWithProgress
{
  final PinParticipantAction this$0;
  
  PinParticipantAction$1(PinParticipantAction paramPinParticipantAction)
  {
    this$0 = paramPinParticipantAction;
  }
  
  public void run(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {
    PinParticipantAction.access$0(this$0).setPinned(!PinParticipantAction.access$0(this$0).isPinned());
    PinParticipantAction.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.PinParticipantAction.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.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;

public class PinParticipantAction
  extends Action
  implements IPropertyChangeListener
{
  private ISynchronizeParticipant participant;
  
  public PinParticipantAction()
  {
    Utils.initAction(this, "action.pinParticipant.");
  }
  
  public void setParticipant(ISynchronizeParticipant participant)
  {
    if (this.participant != null) {
      this.participant.removePropertyChangeListener(this);
    }
    this.participant = participant;
    setEnabled(participant != null);
    if (participant != null) {
      participant.addPropertyChangeListener(this);
    }
    updateState();
  }
  
  private void updateState()
  {
    setChecked((participant != null) && (participant.isPinned()));
  }
  
  public void run()
  {
    if (participant != null) {
      try
      {
        PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress()
        {
          public void run(IProgressMonitor monitor)
            throws InvocationTargetException, InterruptedException
          {
            participant.setPinned(!participant.isPinned());
            PinParticipantAction.this.updateState();
          }
        });
      }
      catch (InvocationTargetException e)
      {
        Utils.handle(e);
      }
      catch (InterruptedException localInterruptedException) {}
    }
  }
  
  public void propertyChange(PropertyChangeEvent event)
  {
    if (event.getSource() == participant) {
      updateState();
    }
  }
  
  public void dispose()
  {
    if (participant != null) {
      participant.removePropertyChangeListener(this);
    }
  }
}

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

import java.util.List;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.actions.DeleteResourceAction;

class RefactorActionGroup$1
  extends DeleteResourceAction
{
  final RefactorActionGroup this$0;
  
  RefactorActionGroup$1(RefactorActionGroup paramRefactorActionGroup, Shell $anonymous0)
  {
    super($anonymous0);this$0 = paramRefactorActionGroup;
  }
  
  protected List getSelectedResources()
  {
    return RefactorActionGroup.access$0(this$0).toList();
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    return (super.updateSelection(selection)) && (RefactorActionGroup.access$1(this$0, selection, 7));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.RefactorActionGroup.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.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.actions.MoveResourceAction;

class RefactorActionGroup$2
  extends MoveResourceAction
{
  final RefactorActionGroup this$0;
  
  RefactorActionGroup$2(RefactorActionGroup paramRefactorActionGroup, Shell $anonymous0)
  {
    super($anonymous0);this$0 = paramRefactorActionGroup;
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    return (super.updateSelection(selection)) && (RefactorActionGroup.access$1(this$0, selection, 7));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.RefactorActionGroup.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.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.actions.RenameResourceAction;

class RefactorActionGroup$3
  extends RenameResourceAction
{
  final RefactorActionGroup this$0;
  
  RefactorActionGroup$3(RefactorActionGroup paramRefactorActionGroup, Shell $anonymous0)
  {
    super($anonymous0);this$0 = paramRefactorActionGroup;
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    return (super.updateSelection(selection)) && (RefactorActionGroup.access$1(this$0, selection, 7));
  }
}

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

import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.SynchronizeView;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.actions.DeleteResourceAction;
import org.eclipse.ui.actions.MoveResourceAction;
import org.eclipse.ui.actions.RenameResourceAction;
import org.eclipse.ui.navigator.INavigatorContentService;

public class RefactorActionGroup
  extends ActionGroup
{
  private CopyToClipboardAction copyAction;
  private MoveResourceAction moveAction;
  private RenameResourceAction renameAction;
  private ISynchronizePageSite site;
  private DeleteResourceAction deleteAction;
  private final INavigatorContentService navigatorContentService;
  
  public RefactorActionGroup(ISynchronizePageSite site)
  {
    this(site, null);
  }
  
  public RefactorActionGroup(ISynchronizePageSite site, INavigatorContentService navigatorContentService)
  {
    this.site = site;
    this.navigatorContentService = navigatorContentService;
    makeActions();
  }
  
  public void fillContextMenu(IMenuManager parentMenu, String groupId)
  {
    parentMenu.appendToGroup(groupId, copyAction);
    
    IWorkbenchPart part = site.getPart();
    if ((part instanceof SynchronizeView))
    {
      SynchronizeView sv = (SynchronizeView)part;
      IAction pasteAction = sv.getPastePatchAction();
      parentMenu.appendToGroup(groupId, pasteAction);
    }
    parentMenu.appendToGroup(groupId, deleteAction);
    parentMenu.appendToGroup(groupId, moveAction);
    parentMenu.appendToGroup(groupId, renameAction);
  }
  
  public void fillActionBars(IActionBars actionBars)
  {
    actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
    actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
    actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
    actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), moveAction);
  }
  
  public void updateActionBars()
  {
    copyAction.selectionChanged(getObjectSelection());
    deleteAction.selectionChanged(getObjectSelection());
    moveAction.selectionChanged(getObjectSelection());
    renameAction.selectionChanged(getObjectSelection());
  }
  
  protected void makeActions()
  {
    Shell shell = site.getShell();
    ISharedImages images = PlatformUI.getWorkbench()
      .getSharedImages();
    
    copyAction = new CopyToClipboardAction(shell, navigatorContentService);
    copyAction.setActionDefinitionId("org.eclipse.ui.edit.copy");
    copyAction.setImageDescriptor(images
      .getImageDescriptor("IMG_TOOL_COPY"));
    copyAction.setDisabledImageDescriptor(images
      .getImageDescriptor("IMG_TOOL_COPY_DISABLED"));
    
    deleteAction = new DeleteResourceAction(shell)
    {
      protected List getSelectedResources()
      {
        return RefactorActionGroup.this.getSelection().toList();
      }
      
      protected boolean updateSelection(IStructuredSelection selection)
      {
        return (super.updateSelection(selection)) && (RefactorActionGroup.this.allResourcesAreOfType(selection, 7));
      }
    };deleteAction
      .setActionDefinitionId("org.eclipse.ui.edit.delete");
    deleteAction.setImageDescriptor(images
      .getImageDescriptor("IMG_TOOL_DELETE"));
    deleteAction.setDisabledImageDescriptor(images
      .getImageDescriptor("IMG_TOOL_DELETE_DISABLED"));
    
    moveAction = new MoveResourceAction(shell)
    {
      protected boolean updateSelection(IStructuredSelection selection)
      {
        return (super.updateSelection(selection)) && (RefactorActionGroup.this.allResourcesAreOfType(selection, 7));
      }
    };
    moveAction.setActionDefinitionId("org.eclipse.ui.edit.move");
    
    renameAction = new RenameResourceAction(shell)
    {
      protected boolean updateSelection(IStructuredSelection selection)
      {
        return (super.updateSelection(selection)) && (RefactorActionGroup.this.allResourcesAreOfType(selection, 7));
      }
    };renameAction
      .setActionDefinitionId("org.eclipse.ui.edit.rename");
  }
  
  private IStructuredSelection getSelection()
  {
    ISelection selection = getContext().getSelection();
    if (!(selection instanceof IStructuredSelection)) {
      return new StructuredSelection();
    }
    return new StructuredSelection(Utils.getResources(((IStructuredSelection)selection).toArray()));
  }
  
  private IStructuredSelection getObjectSelection()
  {
    ISelection selection = getContext().getSelection();
    if (!(selection instanceof IStructuredSelection)) {
      return new StructuredSelection();
    }
    return (IStructuredSelection)selection;
  }
  
  private boolean allResourcesAreOfType(IStructuredSelection selection, int resourceMask)
  {
    Iterator resources = selection.iterator();
    while (resources.hasNext())
    {
      Object next = resources.next();
      IResource resource = null;
      if ((next instanceof IResource))
      {
        resource = (IResource)next;
      }
      else if ((next instanceof IAdaptable))
      {
        IAdaptable adaptable = (IAdaptable)next;
        resource = (IResource)adaptable.getAdapter(IResource.class);
      }
      if (resource == null)
      {
        IResource[] r = Utils.getResources(new Object[] { next });
        if (r.length == 1) {
          resource = r[0];
        }
      }
      if ((resource == null) || ((resource.getType() & resourceMask) == 0)) {
        return false;
      }
    }
    return true;
  }
  
  public void dispose()
  {
    super.dispose();
    copyAction.dispose();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.RefactorActionGroup
 * 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.mapping.ResourceMapping;
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.ModelSynchronizeParticipant;

class RefreshActionContribution$1
  extends Action
{
  final RefreshActionContribution this$0;
  private final ISynchronizePageSite val$site;
  private final ModelSynchronizeParticipant val$participant;
  
  RefreshActionContribution$1(RefreshActionContribution paramRefreshActionContribution, ISynchronizePageSite paramISynchronizePageSite, ModelSynchronizeParticipant paramModelSynchronizeParticipant)
  {
    this$0 = paramRefreshActionContribution;val$site = paramISynchronizePageSite;val$participant = paramModelSynchronizeParticipant;
  }
  
  public void run()
  {
    IStructuredSelection selection = (IStructuredSelection)val$site.getSelectionProvider().getSelection();
    ResourceMapping[] mappings = Utils.getResourceMappings(selection.toArray());
    val$participant.refresh(val$site.getWorkbenchSite(), mappings);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.RefreshActionContribution.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.internal.ui.synchronize.IRefreshable;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;

class RefreshActionContribution$2
  extends Action
{
  final RefreshActionContribution this$0;
  private final ISynchronizePageSite val$site;
  private final IRefreshable val$refreshable;
  
  RefreshActionContribution$2(RefreshActionContribution paramRefreshActionContribution, ISynchronizePageSite paramISynchronizePageSite, IRefreshable paramIRefreshable)
  {
    this$0 = paramRefreshActionContribution;val$site = paramISynchronizePageSite;val$refreshable = paramIRefreshable;
  }
  
  public void run()
  {
    ConfigureRefreshScheduleDialog d = new ConfigureRefreshScheduleDialog(
      val$site.getShell(), val$refreshable.getRefreshSchedule());
    d.setBlockOnOpen(false);
    d.open();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.RefreshActionContribution.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.mapping.ResourceMapping;
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.mapping.RemoveFromViewAction;
import org.eclipse.team.internal.ui.mapping.RestoreRemovedItemsAction;
import org.eclipse.team.internal.ui.synchronize.ConfigureRefreshScheduleDialog;
import org.eclipse.team.internal.ui.synchronize.IRefreshable;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
import org.eclipse.ui.IActionBars;

public class RefreshActionContribution
  extends SynchronizePageActionGroup
{
  private Action configureSchedule;
  private Action refreshSelectionAction;
  private RemoveFromViewAction removeFromViewAction;
  private RestoreRemovedItemsAction restoreRemovedItemsAction;
  
  public void initialize(ISynchronizePageConfiguration configuration)
  {
    super.initialize(configuration);
    ISynchronizePageSite site = configuration.getSite();
    ModelSynchronizeParticipant participant = (ModelSynchronizeParticipant)configuration.getParticipant();
    if (participant.doesSupportSynchronize())
    {
      refreshSelectionAction = new Action()
      {
        private final ISynchronizePageSite val$site;
        private final ModelSynchronizeParticipant val$participant;
        
        public void run()
        {
          IStructuredSelection selection = (IStructuredSelection)val$site.getSelectionProvider().getSelection();
          ResourceMapping[] mappings = Utils.getResourceMappings(selection.toArray());
          val$participant.refresh(val$site.getWorkbenchSite(), mappings);
        }
      };
      Utils.initAction(refreshSelectionAction, "action.refreshWithRemote.");
      refreshSelectionAction.setActionDefinitionId("org.eclipse.team.ui.synchronizeLast");
      refreshSelectionAction.setId("org.eclipse.team.ui.synchronizeLast");
      
      Object o = participant.getAdapter(IRefreshable.class);
      if ((o instanceof IRefreshable))
      {
        IRefreshable refreshable = (IRefreshable)o;
        configureSchedule = new Action()
        {
          private final ISynchronizePageSite val$site;
          private final IRefreshable val$refreshable;
          
          public void run()
          {
            ConfigureRefreshScheduleDialog d = new ConfigureRefreshScheduleDialog(
              val$site.getShell(), val$refreshable.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.RefreshActionContribution
 * 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.core.synchronize.SyncInfoSet;
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 RemoveFromViewAction$1
  extends SynchronizeModelOperation
{
  final RemoveFromViewAction this$0;
  
  RemoveFromViewAction$1(RemoveFromViewAction paramRemoveFromViewAction, ISynchronizePageConfiguration $anonymous0, IDiffElement[] $anonymous1)
  {
    super($anonymous0, $anonymous1);this$0 = paramRemoveFromViewAction;
  }
  
  public void run(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {
    SyncInfoSet set = getSyncInfoSet();
    removeFromView(set);
  }
  
  protected boolean canRunAsJob()
  {
    return false;
  }
  
  private void removeFromView(SyncInfoSet set)
  {
    ISynchronizePage page = this$0.getConfiguration().getPage();
    if ((page instanceof SubscriberParticipantPage))
    {
      WorkingSetFilteredSyncInfoCollector collector = ((SubscriberParticipantPage)page).getCollector();
      collector.run(new RemoveFromViewAction.2(this, collector, set));
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.RemoveFromViewAction.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.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.core.subscribers.WorkingSetFilteredSyncInfoCollector;

class RemoveFromViewAction$2
  implements IWorkspaceRunnable
{
  final RemoveFromViewAction.1 this$1;
  private final WorkingSetFilteredSyncInfoCollector val$collector;
  private final SyncInfoSet val$set;
  
  RemoveFromViewAction$2(RemoveFromViewAction.1 param1, WorkingSetFilteredSyncInfoCollector paramWorkingSetFilteredSyncInfoCollector, SyncInfoSet paramSyncInfoSet)
  {
    this$1 = param1;val$collector = paramWorkingSetFilteredSyncInfoCollector;val$set = paramSyncInfoSet;
  }
  
  public void run(IProgressMonitor monitor)
    throws CoreException
  {
    val$collector.getWorkingSetSyncInfoSet().removeAll(val$set.getResources());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.RemoveFromViewAction.2
 * 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.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.core.subscribers.WorkingSetFilteredSyncInfoCollector;
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.internal.ui.synchronize.SubscriberParticipantPage;
import org.eclipse.team.ui.synchronize.ISynchronizePage;
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.SynchronizeModelOperation;

public class RemoveFromViewAction
  extends SynchronizeModelAction
{
  public RemoveFromViewAction(ISynchronizePageConfiguration configuration)
  {
    super(null, configuration);
    Utils.initAction(this, "action.removeFromView.");
    setId("org.eclipse.team.internal.ui.RemoveFromView");
  }
  
  public void run()
  {
    if (confirmRemove()) {
      super.run();
    }
  }
  
  protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements)
  {
    new SynchronizeModelOperation(configuration, elements)
    {
      public void run(IProgressMonitor monitor)
        throws InvocationTargetException, InterruptedException
      {
        SyncInfoSet set = getSyncInfoSet();
        removeFromView(set);
      }
      
      protected boolean canRunAsJob()
      {
        return false;
      }
      
      private void removeFromView(SyncInfoSet set)
      {
        ISynchronizePage page = getConfiguration().getPage();
        if ((page instanceof SubscriberParticipantPage))
        {
          WorkingSetFilteredSyncInfoCollector collector = ((SubscriberParticipantPage)page).getCollector();
          collector.run(new RemoveFromViewAction.2(this, collector, set));
        }
      }
    };
  }
  
  protected boolean needsToSaveDirtyEditors()
  {
    return false;
  }
  
  private boolean confirmRemove()
  {
    IPreferenceStore store = TeamUIPlugin.getPlugin().getPreferenceStore();
    if (store.getBoolean("org.eclipse.team.ui.remove_from_view_without_prompt")) {
      return true;
    }
    MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(
      getConfiguration().getSite().getShell(), 
      TeamUIMessages.RemoveFromView_warningTitle, 
      TeamUIMessages.RemoveFromView_warningMessage, 
      TeamUIMessages.RemoveFromView_warningDontShow, 
      false, 
      null, 
      null);
    store.setValue("org.eclipse.team.ui.remove_from_view_without_prompt", dialog.getToggleState());
    return dialog.getReturnCode() == 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.RemoveFromViewAction
 * 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.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;

class RemoveSynchronizeParticipantAction$1
  implements IRunnableWithProgress
{
  final RemoveSynchronizeParticipantAction this$0;
  
  RemoveSynchronizeParticipantAction$1(RemoveSynchronizeParticipantAction paramRemoveSynchronizeParticipantAction)
  {
    this$0 = paramRemoveSynchronizeParticipantAction;
  }
  
  public void run(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {
    if (RemoveSynchronizeParticipantAction.access$0(this$0)) {
      RemoveSynchronizeParticipantAction.access$1(this$0);
    } else {
      RemoveSynchronizeParticipantAction.access$2(this$0);
    }
  }
}

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

import java.util.List;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.ui.IWorkbenchPartSite;

class RemoveSynchronizeParticipantAction$2
  implements Runnable
{
  final RemoveSynchronizeParticipantAction this$0;
  private final List val$dirtyModels;
  private final boolean[] val$keepGoing;
  
  RemoveSynchronizeParticipantAction$2(RemoveSynchronizeParticipantAction paramRemoveSynchronizeParticipantAction, List paramList, boolean[] paramArrayOfBoolean)
  {
    this$0 = paramRemoveSynchronizeParticipantAction;val$dirtyModels = paramList;val$keepGoing = paramArrayOfBoolean;
  }
  
  public void run()
  {
    if (!val$dirtyModels.isEmpty()) {
      val$keepGoing[0] = RemoveSynchronizeParticipantAction.access$3(this$0, val$dirtyModels);
    } else {
      val$keepGoing[0] = MessageDialog.openQuestion(
        RemoveSynchronizeParticipantAction.access$4(this$0).getSite().getShell(), 
        TeamUIMessages.RemoveSynchronizeParticipantAction_0, 
        TeamUIMessages.RemoveSynchronizeParticipantAction_1);
    }
  }
}

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

import java.util.List;

class RemoveSynchronizeParticipantAction$3
  implements Runnable
{
  final RemoveSynchronizeParticipantAction this$0;
  private final List val$dirtyModels;
  private final boolean[] val$keepGoing;
  
  RemoveSynchronizeParticipantAction$3(RemoveSynchronizeParticipantAction paramRemoveSynchronizeParticipantAction, List paramList, boolean[] paramArrayOfBoolean)
  {
    this$0 = paramRemoveSynchronizeParticipantAction;val$dirtyModels = paramList;val$keepGoing = paramArrayOfBoolean;
  }
  
  public void run()
  {
    if (!val$dirtyModels.isEmpty()) {
      val$keepGoing[0] = RemoveSynchronizeParticipantAction.access$3(this$0, val$dirtyModels);
    }
  }
}

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

import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.Saveable;

class RemoveSynchronizeParticipantAction$4
  implements IRunnableWithProgress
{
  final RemoveSynchronizeParticipantAction this$0;
  private final List val$finalModels;
  
  RemoveSynchronizeParticipantAction$4(RemoveSynchronizeParticipantAction paramRemoveSynchronizeParticipantAction, List paramList)
  {
    this$0 = paramRemoveSynchronizeParticipantAction;val$finalModels = paramList;
  }
  
  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(RemoveSynchronizeParticipantAction.access$4(this$0).getSite().getShell(), null, e.getMessage(), e.getStatus());
        }
      }
      if (monitor.isCanceled()) {
        break;
      }
    }
    monitor.done();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.actions.RemoveSynchronizeParticipantAction.4
 * 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 java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.TeamExc
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