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

.length; i++)
        {
          ModelProvider provider = inputModelProviders[i];
          String id = provider.getDescriptor().getId();
          ResourceMapping[] inputMappings = inputScope.getMappings(id);
          ResourceMapping[] scopeMappings = getScope().getMappings(id);
          if (inputMappings.length != scopeMappings.length) {
            for (int j = 0; j < scopeMappings.length; j++)
            {
              ResourceMapping mapping = scopeMappings[j];
              ResourceTraversal[] inputTraversals = inputScope.getTraversals(mapping);
              if (inputTraversals == null)
              {
                ResourceTraversal[] scopeTraversals = getScope().getTraversals(mapping);
                ResourceTraversal[] inputModelTraversals = getTraversals(inputScope, inputMappings);
                if (overlaps(scopeTraversals, inputModelTraversals))
                {
                  prompt = true;
                  break;
                }
              }
            }
          }
        }
      }
      if (prompt)
      {
        String previewMessage = getPreviewRequestMessage();
        previewRequested = promptForInputChange(previewMessage, monitor);
      }
    }
  }
  
  protected String getPreviewRequestMessage()
  {
    return null;
  }
  
  private boolean hasAdditionalMappingsFromIndependantModel(ModelProvider[] inputModelProviders, ModelProvider[] modelProviders)
  {
    ModelProvider[] additionalProviders = getAdditionalProviders(inputModelProviders, modelProviders);
    for (int i = 0; i < additionalProviders.length; i++)
    {
      ModelProvider additionalProvider = additionalProviders[i];
      boolean independant = true;
      for (int j = 0; j < inputModelProviders.length; j++)
      {
        ModelProvider inputProvider = inputModelProviders[j];
        if (!isIndependantModel(additionalProvider.getDescriptor().getId(), inputProvider.getDescriptor().getId())) {
          independant = false;
        }
      }
      if (independant) {
        return true;
      }
    }
    return false;
  }
  
  private ModelProvider[] getAdditionalProviders(ModelProvider[] inputModelProviders, ModelProvider[] modelProviders)
  {
    Set input = new HashSet();
    List result = new ArrayList();
    input.addAll(Arrays.asList(inputModelProviders));
    for (int i = 0; i < modelProviders.length; i++)
    {
      ModelProvider provider = modelProviders[i];
      if (!input.contains(provider)) {
        result.add(provider);
      }
    }
    return (ModelProvider[])result.toArray(new ModelProvider[result.size()]);
  }
  
  private boolean overlaps(ResourceTraversal[] scopeTraversals, ResourceTraversal[] inputModelTraversals)
  {
    for (int i = 0; i < inputModelTraversals.length; i++)
    {
      ResourceTraversal inputTraversal = inputModelTraversals[i];
      for (int j = 0; j < scopeTraversals.length; j++)
      {
        ResourceTraversal scopeTraversal = scopeTraversals[j];
        if (overlaps(inputTraversal, scopeTraversal)) {
          return true;
        }
      }
    }
    return false;
  }
  
  private boolean overlaps(ResourceTraversal inputTraversal, ResourceTraversal scopeTraversal)
  {
    IResource[] inputRoots = inputTraversal.getResources();
    IResource[] scopeRoots = scopeTraversal.getResources();
    for (int i = 0; i < scopeRoots.length; i++)
    {
      IResource scopeResource = scopeRoots[i];
      for (int j = 0; j < inputRoots.length; j++)
      {
        IResource inputResource = inputRoots[j];
        if (overlaps(scopeResource, scopeTraversal.getDepth(), inputResource, inputTraversal.getDepth())) {
          return true;
        }
      }
    }
    return false;
  }
  
  private boolean overlaps(IResource scopeResource, int scopeDepth, IResource inputResource, int inputDepth)
  {
    if (scopeResource.equals(inputResource)) {
      return true;
    }
    if ((scopeDepth == 2) && (scopeResource.getFullPath().isPrefixOf(inputResource.getFullPath()))) {
      return true;
    }
    if ((scopeDepth == 1) && (scopeResource.equals(inputResource.getParent()))) {
      return true;
    }
    if ((inputDepth == 2) && (inputResource.getFullPath().isPrefixOf(scopeResource.getFullPath()))) {
      return true;
    }
    if ((inputDepth == 1) && (inputResource.equals(scopeResource.getParent()))) {
      return true;
    }
    return false;
  }
  
  private ResourceTraversal[] getTraversals(ISynchronizationScope inputScope, ResourceMapping[] inputMappings)
  {
    CompoundResourceTraversal result = new CompoundResourceTraversal();
    for (int i = 0; i < inputMappings.length; i++)
    {
      ResourceMapping mapping = inputMappings[i];
      result.addTraversals(inputScope.getTraversals(mapping));
    }
    return result.asTraversals();
  }
  
  private boolean isIndependantModel(String modelProviderId, String id)
  {
    if (id.equals(modelProviderId)) {
      return false;
    }
    IModelProviderDescriptor desc1 = ModelProvider.getModelProviderDescriptor(modelProviderId);
    IModelProviderDescriptor desc2 = ModelProvider.getModelProviderDescriptor(id);
    return (!isExtension(desc1, desc2)) && (!isExtension(desc2, desc1));
  }
  
  private boolean isExtension(IModelProviderDescriptor desc1, IModelProviderDescriptor desc2)
  {
    String[] ids = desc1.getExtendedModels();
    for (int i = 0; i < ids.length; i++)
    {
      String id = ids[i];
      if (id.equals(desc2.getId())) {
        return true;
      }
    }
    for (int i = 0; i < ids.length; i++)
    {
      String id = ids[i];
      IModelProviderDescriptor desc3 = ModelProvider.getModelProviderDescriptor(id);
      if (isExtension(desc3, desc2)) {
        return true;
      }
    }
    return false;
  }
  
  protected boolean promptForInputChange(String requestPreviewMessage, IProgressMonitor monitor)
  {
    return showAllMappings(requestPreviewMessage);
  }
  
  private boolean showAllMappings(String requestPreviewMessage)
  {
    boolean[] canceled = new boolean[1];
    boolean[] forcePreview = new boolean[1];
    Display.getDefault().syncExec(new Runnable()
    {
      private final String val$requestPreviewMessage;
      private final boolean[] val$canceled;
      private final boolean[] val$forcePreview;
      
      public void run()
      {
        AdditionalMappingsDialog dialog = new AdditionalMappingsDialog(getShell(), TeamUIMessages.ResourceMappingOperation_0, getScope(), getContext());
        dialog.setPreviewMessage(val$requestPreviewMessage);
        int result = dialog.open();
        val$canceled[0] = (result != 0 ? 1 : false);
        if (val$requestPreviewMessage != null) {
          val$forcePreview[0] = dialog.isForcePreview();
        }
      }
    });
    if (canceled[0] != 0) {
      throw new OperationCanceledException();
    }
    return forcePreview[0];
  }
  
  protected ISynchronizationContext getContext()
  {
    return null;
  }
  
  protected abstract void execute(IProgressMonitor paramIProgressMonitor)
    throws InvocationTargetException, InterruptedException;
  
  public ISynchronizationScope getScope()
  {
    return manager.getScope();
  }
  
  public boolean isPreviewRequested()
  {
    return previewRequested;
  }
  
  protected ISynchronizationScopeManager getScopeManager()
  {
    return manager;
  }
}

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

import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;

class ModelParticipantAction$1
  implements DisposeListener
{
  final ModelParticipantAction this$0;
  
  ModelParticipantAction$1(ModelParticipantAction paramModelParticipantAction)
  {
    this$0 = paramModelParticipantAction;
  }
  
  public void widgetDisposed(DisposeEvent e)
  {
    this$0.getConfiguration().getSite().getSelectionProvider().removeSelectionChangedListener(this$0);
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.ui.mapping.SaveableComparison;

class ModelParticipantAction$2
  implements IRunnableWithProgress
{
  final ModelParticipantAction this$0;
  private final SaveableComparison val$targetSaveable;
  private final SaveableComparison val$activeSaveable;
  
  ModelParticipantAction$2(ModelParticipantAction paramModelParticipantAction, SaveableComparison paramSaveableComparison1, SaveableComparison paramSaveableComparison2)
  {
    this$0 = paramModelParticipantAction;val$targetSaveable = paramSaveableComparison1;val$activeSaveable = paramSaveableComparison2;
  }
  
  public void run(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {
    try
    {
      ModelParticipantAction.handleTargetSaveableChange(ModelParticipantAction.access$0(this$0).getSite().getShell(), val$targetSaveable, val$activeSaveable, true, monitor);
    }
    catch (CoreException e)
    {
      throw new InvocationTargetException(e);
    }
  }
}

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

import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.ui.mapping.SaveableComparison;

class ModelParticipantAction$3
  implements Runnable
{
  private final boolean val$allowCancel;
  private final Shell val$shell;
  private final SaveableComparison val$saveable;
  private final int[] val$result;
  
  ModelParticipantAction$3(boolean paramBoolean, Shell paramShell, SaveableComparison paramSaveableComparison, int[] paramArrayOfInt)
  {
    val$allowCancel = paramBoolean;val$shell = paramShell;val$saveable = paramSaveableComparison;val$result = paramArrayOfInt;
  }
  
  public void run()
  {
    String[] options;
    String[] options;
    if (val$allowCancel) {
      options = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
    } else {
      options = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
    }
    MessageDialog dialog = new MessageDialog(
      val$shell, 
      TeamUIMessages.ModelParticipantAction_0, null, 
      NLS.bind(TeamUIMessages.ModelParticipantAction_1, val$saveable.getName()), 
      3, 
      options, 
      val$result[0]);
    val$result[0] = dialog.open();
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.diff.IDiff;
import org.eclipse.team.core.diff.IThreeWayDiff;
import org.eclipse.team.core.diff.ITwoWayDiff;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.ui.mapping.SaveableComparison;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BaseSelectionListenerAction;
import org.eclipse.ui.progress.IProgressService;

public abstract class ModelParticipantAction
  extends BaseSelectionListenerAction
{
  private final ISynchronizePageConfiguration configuration;
  
  public ModelParticipantAction(String text, ISynchronizePageConfiguration configuration)
  {
    super(text);
    this.configuration = configuration;
    initialize(configuration);
  }
  
  private void initialize(ISynchronizePageConfiguration configuration)
  {
    configuration.getSite().getSelectionProvider().addSelectionChangedListener(this);
    configuration.getPage().getViewer().getControl().addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent e)
      {
        getConfiguration().getSite().getSelectionProvider().removeSelectionChangedListener(ModelParticipantAction.this);
      }
    });
  }
  
  protected ISynchronizePageConfiguration getConfiguration()
  {
    return configuration;
  }
  
  public void selectionChanged(ISelection selection)
  {
    if ((selection instanceof IStructuredSelection)) {
      super.selectionChanged((IStructuredSelection)selection);
    } else {
      super.selectionChanged(StructuredSelection.EMPTY);
    }
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    super.updateSelection(selection);
    return isEnabledForSelection(selection);
  }
  
  protected abstract boolean isEnabledForSelection(IStructuredSelection paramIStructuredSelection);
  
  protected ISynchronizationContext getSynchronizationContext()
  {
    return (ISynchronizationContext)getConfiguration().getProperty("org.eclipse.team.ui.synchronizationContext");
  }
  
  protected boolean isVisible(IDiff node)
  {
    ISynchronizePageConfiguration configuration = getConfiguration();
    IThreeWayDiff twd;
    int mode;
    if ((configuration.getComparisonType() == "three-way") && 
      ((node instanceof IThreeWayDiff)))
    {
      twd = (IThreeWayDiff)node;
      mode = configuration.getMode();
    }
    switch (mode)
    {
    case 1: 
      if ((twd.getDirection() == 768) || (twd.getDirection() == 512)) {
        return true;
      }
      break;
    case 2: 
      if ((twd.getDirection() == 768) || (twd.getDirection() == 256)) {
        return true;
      }
      break;
    case 8: 
      if (twd.getDirection() == 768) {
        return true;
      }
      break;
    case 4: 
      return true;
    case 3: 
    case 5: 
    case 6: 
    case 7: 
    default: 
      break;
      if ((configuration.getComparisonType() == "two-way") && 
        ((node instanceof ITwoWayDiff))) {
        return true;
      }
      break;
    }
    return false;
  }
  
  protected void handleTargetSaveableChange()
    throws InvocationTargetException, InterruptedException
  {
    SaveableComparison targetSaveable = getTargetSaveable();
    SaveableComparison activeSaveable = getActiveSaveable();
    if ((activeSaveable != null) && (activeSaveable.isDirty())) {
      PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress()
      {
        private final SaveableComparison val$targetSaveable;
        private final SaveableComparison val$activeSaveable;
        
        public void run(IProgressMonitor monitor)
          throws InvocationTargetException, InterruptedException
        {
          try
          {
            ModelParticipantAction.handleTargetSaveableChange(configuration.getSite().getShell(), val$targetSaveable, val$activeSaveable, true, monitor);
          }
          catch (CoreException e)
          {
            throw new InvocationTargetException(e);
          }
        }
      });
    }
    setActiveSaveable(targetSaveable);
  }
  
  public static void handleTargetSaveableChange(Shell shell, SaveableComparison targetSaveable, SaveableComparison activeSaveable, boolean allowCancel, IProgressMonitor monitor)
    throws CoreException, InterruptedException
  {
    if ((activeSaveable != null) && (targetSaveable != activeSaveable) && 
      (activeSaveable.isDirty())) {
      if (promptToSaveChanges(shell, activeSaveable, allowCancel)) {
        activeSaveable.doSave(monitor);
      } else {
        activeSaveable.doRevert(monitor);
      }
    }
  }
  
  public static boolean promptToSaveChanges(Shell shell, SaveableComparison saveable, boolean allowCancel)
    throws InterruptedException
  {
    int[] result = new int[1];
    Runnable runnable = new Runnable()
    {
      private final boolean val$allowCancel;
      private final Shell val$shell;
      private final SaveableComparison val$saveable;
      private final int[] val$result;
      
      public void run()
      {
        String[] options;
        String[] options;
        if (val$allowCancel) {
          options = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
        } else {
          options = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
        }
        MessageDialog dialog = new MessageDialog(
          val$shell, 
          TeamUIMessages.ModelParticipantAction_0, null, 
          NLS.bind(TeamUIMessages.ModelParticipantAction_1, val$saveable.getName()), 
          3, 
          options, 
          val$result[0]);
        val$result[0] = dialog.open();
      }
    };
    shell.getDisplay().syncExec(runnable);
    if (result[0] == 2) {
      throw new InterruptedException();
    }
    return result[0] == 0;
  }
  
  protected SaveableComparison getActiveSaveable()
  {
    return ((ModelSynchronizeParticipant)configuration.getParticipant()).getActiveSaveable();
  }
  
  protected void setActiveSaveable(SaveableComparison saveable)
  {
    ((ModelSynchronizeParticipant)configuration.getParticipant()).setActiveSaveable(saveable);
  }
  
  protected SaveableComparison getTargetSaveable()
  {
    return null;
  }
  
  public void updateEnablement()
  {
    setEnabled(isEnabledForSelection(getStructuredSelection()));
  }
}

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

import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareUI;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
import org.eclipse.ui.progress.WorkbenchJob;

class ModelParticipantMergeOperation$1
  extends WorkbenchJob
{
  final ModelParticipantMergeOperation this$0;
  
  ModelParticipantMergeOperation$1(ModelParticipantMergeOperation paramModelParticipantMergeOperation, String $anonymous0)
  {
    super($anonymous0);this$0 = paramModelParticipantMergeOperation;
  }
  
  public IStatus runInUIThread(IProgressMonitor monitor)
  {
    if (this$0.isPreviewInDialog())
    {
      CompareConfiguration cc = new CompareConfiguration();
      ISynchronizePageConfiguration pageConfiguration = ModelParticipantMergeOperation.access$0(this$0).createPageConfiguration();
      if (pageConfiguration.getComparisonType() == "three-way")
      {
        pageConfiguration.setSupportedModes(9);
        pageConfiguration.setMode(1);
      }
      ParticipantPageCompareEditorInput input = new ParticipantPageCompareEditorInput(cc, pageConfiguration, ModelParticipantMergeOperation.access$0(this$0));
      CompareUI.openCompareDialog(input);
    }
    else
    {
      ISynchronizeManager mgr = TeamUI.getSynchronizeManager();
      ISynchronizeView view = mgr.showSynchronizeViewInActivePage();
      mgr.addSynchronizeParticipants(new ISynchronizeParticipant[] { ModelParticipantMergeOperation.access$0(this$0) });
      view.display(ModelParticipantMergeOperation.access$0(this$0)); Class 
        tmp134_131 = ModelParticipantMergeOperation.class$0;
      if (tmp134_131 == null)
      {
        tmp134_131;
        try
        {
          tmpTernaryOp = (ModelParticipantMergeOperation.class$0 = Class.forName("org.eclipse.ui.progress.IWorkbenchSiteProgressService"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      Object adapted = view.getSite().getAdapter(tmp134_131);
      if ((adapted instanceof IWorkbenchSiteProgressService))
      {
        IWorkbenchSiteProgressService siteProgress = (IWorkbenchSiteProgressService)adapted;
        siteProgress.showBusyForFamily(ModelParticipantMergeOperation.access$1());
      }
    }
    return Status.OK_STATUS;
  }
}

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

import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.team.ui.TeamUI;

class ModelParticipantMergeOperation$2
  extends JobChangeAdapter
{
  final ModelParticipantMergeOperation this$0;
  
  ModelParticipantMergeOperation$2(ModelParticipantMergeOperation paramModelParticipantMergeOperation)
  {
    this$0 = paramModelParticipantMergeOperation;
  }
  
  public void done(IJobChangeEvent event)
  {
    if (TeamUI.getSynchronizeManager().get(ModelParticipantMergeOperation.access$0(this$0).getId(), ModelParticipantMergeOperation.access$0(this$0).getSecondaryId()) == null) {
      ModelParticipantMergeOperation.access$0(this$0).dispose();
    }
  }
}

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

import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareUI;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
import org.eclipse.team.core.mapping.provider.SynchronizationContext;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
import org.eclipse.ui.progress.WorkbenchJob;

public abstract class ModelParticipantMergeOperation
  extends ModelMergeOperation
{
  public static final int REQUEST_PREVIEW = 1024;
  private ModelSynchronizeParticipant participant;
  private boolean ownsParticipant = true;
  private boolean sentToSyncView;
  private static final Object PARTICIPANT_MERGE_FAMILY = new Object();
  static Class class$0;
  
  protected ModelParticipantMergeOperation(IWorkbenchPart part, ISynchronizationScopeManager manager)
  {
    super(part, manager);
  }
  
  protected void initializeContext(IProgressMonitor monitor)
    throws CoreException
  {
    if (participant == null)
    {
      participant = createParticipant();
      if ((isPreviewRequested()) && (!isPreviewInDialog()))
      {
        handlePreviewRequest();
        sentToSyncView = true;
      }
      participant.getContext().refresh(getScope().getTraversals(), 
        1, monitor);
      if (!sentToSyncView) {
        try
        {
          Job.getJobManager().join(participant.getContext(), monitor);
        }
        catch (InterruptedException localInterruptedException) {}
      }
    }
  }
  
  /* Error */
  protected void execute(IProgressMonitor monitor)
    throws java.lang.reflect.InvocationTargetException, InterruptedException
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: invokespecial 139	org/eclipse/team/ui/synchronize/ModelMergeOperation:execute	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   5: goto +27 -> 32
    //   8: astore_2
    //   9: aload_0
    //   10: getfield 129	org/eclipse/team/ui/synchronize/ModelParticipantMergeOperation:ownsParticipant	Z
    //   13: ifeq +17 -> 30
    //   16: aload_0
    //   17: getfield 132	org/eclipse/team/ui/synchronize/ModelParticipantMergeOperation:participant	Lorg/eclipse/team/ui/synchronize/ModelSynchronizeParticipant;
    //   20: ifnull +10 -> 30
    //   23: aload_0
    //   24: getfield 132	org/eclipse/team/ui/synchronize/ModelParticipantMergeOperation:participant	Lorg/eclipse/team/ui/synchronize/ModelSynchronizeParticipant;
    //   27: invokevirtual 151	org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant:dispose	()V
    //   30: aload_2
    //   31: athrow
    //   32: aload_0
    //   33: getfield 129	org/eclipse/team/ui/synchronize/ModelParticipantMergeOperation:ownsParticipant	Z
    //   36: ifeq +17 -> 53
    //   39: aload_0
    //   40: getfield 132	org/eclipse/team/ui/synchronize/ModelParticipantMergeOperation:participant	Lorg/eclipse/team/ui/synchronize/ModelSynchronizeParticipant;
    //   43: ifnull +10 -> 53
    //   46: aload_0
    //   47: getfield 132	org/eclipse/team/ui/synchronize/ModelParticipantMergeOperation:participant	Lorg/eclipse/team/ui/synchronize/ModelSynchronizeParticipant;
    //   50: invokevirtual 151	org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant:dispose	()V
    //   53: return
    // Line number table:
    //   Java source line #88	-> byte code offset #0
    //   Java source line #89	-> byte code offset #8
    //   Java source line #90	-> byte code offset #9
    //   Java source line #91	-> byte code offset #23
    //   Java source line #92	-> byte code offset #30
    //   Java source line #90	-> byte code offset #32
    //   Java source line #91	-> byte code offset #46
    //   Java source line #93	-> byte code offset #53
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	54	0	this	ModelParticipantMergeOperation
    //   0	54	1	monitor	IProgressMonitor
    //   8	23	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	8	8	finally
  }
  
  protected void executeMerge(IProgressMonitor monitor)
    throws CoreException
  {
    if (!sentToSyncView) {
      super.executeMerge(monitor);
    }
  }
  
  protected void handlePreviewRequest()
  {
    Job job = new WorkbenchJob(getJobName())
    {
      public IStatus runInUIThread(IProgressMonitor monitor)
      {
        if (isPreviewInDialog())
        {
          CompareConfiguration cc = new CompareConfiguration();
          ISynchronizePageConfiguration pageConfiguration = participant.createPageConfiguration();
          if (pageConfiguration.getComparisonType() == "three-way")
          {
            pageConfiguration.setSupportedModes(9);
            pageConfiguration.setMode(1);
          }
          ParticipantPageCompareEditorInput input = new ParticipantPageCompareEditorInput(cc, pageConfiguration, participant);
          CompareUI.openCompareDialog(input);
        }
        else
        {
          ISynchronizeManager mgr = TeamUI.getSynchronizeManager();
          ISynchronizeView view = mgr.showSynchronizeViewInActivePage();
          mgr.addSynchronizeParticipants(new ISynchronizeParticipant[] { participant });
          view.display(participant); Class 
            tmp134_131 = ModelParticipantMergeOperation.class$0;
          if (tmp134_131 == null)
          {
            tmp134_131;
            try
            {
              tmpTernaryOp = (ModelParticipantMergeOperation.class$0 = Class.forName("org.eclipse.ui.progress.IWorkbenchSiteProgressService"));
            }
            catch (ClassNotFoundException localClassNotFoundException)
            {
              throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
            }
          }
          Object adapted = view.getSite().getAdapter(tmp134_131);
          if ((adapted instanceof IWorkbenchSiteProgressService))
          {
            IWorkbenchSiteProgressService siteProgress = (IWorkbenchSiteProgressService)adapted;
            siteProgress.showBusyForFamily(ModelParticipantMergeOperation.PARTICIPANT_MERGE_FAMILY);
          }
        }
        return Status.OK_STATUS;
      }
    };
    job.addJobChangeListener(new JobChangeAdapter()
    {
      public void done(IJobChangeEvent event)
      {
        if (TeamUI.getSynchronizeManager().get(participant.getId(), participant.getSecondaryId()) == null) {
          participant.dispose();
        }
      }
    });
    ownsParticipant = false;
    job.schedule();
  }
  
  public boolean belongsTo(Object family)
  {
    if (family == PARTICIPANT_MERGE_FAMILY) {
      return true;
    }
    if ((participant != null) && (participant == family)) {
      return true;
    }
    return super.belongsTo(family);
  }
  
  protected boolean isPreviewInDialog()
  {
    return true;
  }
  
  protected ISynchronizationContext getContext()
  {
    if (participant != null) {
      return participant.getContext();
    }
    return null;
  }
  
  protected String getPreviewRequestMessage()
  {
    if (!isPreviewRequested()) {
      return TeamUIMessages.ResourceMappingMergeOperation_4;
    }
    return super.getPreviewRequestMessage();
  }
  
  protected ModelSynchronizeParticipant createParticipant()
  {
    return ModelSynchronizeParticipant.createParticipant(createMergeContext(), getJobName());
  }
  
  protected abstract SynchronizationContext createMergeContext();
}

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

import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.team.internal.ui.mapping.ModelElementSelectionPage;
import org.eclipse.team.ui.TeamUI;

public abstract class ModelParticipantWizard
  extends ParticipantSynchronizeWizard
{
  private ModelElementSelectionPage selectionPage;
  
  public ModelParticipantWizard()
  {
    setNeedsProgressMonitor(true);
  }
  
  protected final void createParticipant()
  {
    ISynchronizeParticipant participant = createParticipant(selectionPage.getSelectedMappings());
    TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] { participant });
    
    participant.run(null);
  }
  
  protected final WizardPage createScopeSelectionPage()
  {
    selectionPage = new ModelElementSelectionPage(getRootResources());
    return selectionPage;
  }
  
  protected abstract ISynchronizeParticipant createParticipant(ResourceMapping[] paramArrayOfResourceMapping);
}

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

import java.io.IOException;
import org.eclipse.jface.preference.PreferenceStore;

class ModelSynchronizeParticipant$1
  extends PreferenceStore
{
  final ModelSynchronizeParticipant this$0;
  
  ModelSynchronizeParticipant$1(ModelSynchronizeParticipant paramModelSynchronizeParticipant)
  {
    this$0 = paramModelSynchronizeParticipant;
  }
  
  public void save()
    throws IOException
  {}
}

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

import org.eclipse.team.ui.mapping.SaveableComparison;
import org.eclipse.ui.IPropertyListener;

class ModelSynchronizeParticipant$2
  implements IPropertyListener
{
  final ModelSynchronizeParticipant this$0;
  
  ModelSynchronizeParticipant$2(ModelSynchronizeParticipant paramModelSynchronizeParticipant)
  {
    this$0 = paramModelSynchronizeParticipant;
  }
  
  public void propertyChanged(Object source, int propId)
  {
    if (((source instanceof SaveableComparison)) && (propId == 257))
    {
      SaveableComparison scm = (SaveableComparison)source;
      boolean isDirty = scm.isDirty();
      this$0.firePropertyChange(this$0, "org.eclipse.team.ui.DIRTY", Boolean.valueOf(!isDirty), Boolean.valueOf(isDirty));
    }
  }
}

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

import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.core.mapping.provider.SynchronizationContext;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.synchronize.IRefreshable;
import org.eclipse.team.internal.ui.synchronize.RefreshModelParticipantJob;
import org.eclipse.team.internal.ui.synchronize.RefreshParticipantJob;
import org.eclipse.team.internal.ui.synchronize.RefreshUserNotificationPolicy;
import org.eclipse.team.internal.ui.synchronize.SubscriberRefreshSchedule;

class ModelSynchronizeParticipant$3
  implements IRefreshable
{
  final ModelSynchronizeParticipant this$0;
  
  ModelSynchronizeParticipant$3(ModelSynchronizeParticipant paramModelSynchronizeParticipant)
  {
    this$0 = paramModelSynchronizeParticipant;
  }
  
  public RefreshParticipantJob createJob(String interval)
  {
    String jobName = NLS.bind(TeamUIMessages.RefreshSchedule_15, new String[] { this$0.getName(), interval });
    return new RefreshModelParticipantJob(this$0, 
      jobName, 
      jobName, 
      ModelSynchronizeParticipant.access$0(this$0).getScope().getMappings(), 
      new RefreshUserNotificationPolicy(this$0));
  }
  
  public ISynchronizeParticipant getParticipant()
  {
    return this$0;
  }
  
  public void setRefreshSchedule(SubscriberRefreshSchedule schedule)
  {
    this$0.setRefreshSchedule(schedule);
  }
  
  public SubscriberRefreshSchedule getRefreshSchedule()
  {
    return ModelSynchronizeParticipant.access$1(this$0);
  }
}

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

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.mapping.IModelProviderDescriptor;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceMappingContext;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.mapping.IMergeContext;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
import org.eclipse.team.core.mapping.provider.MergeContext;
import org.eclipse.team.core.mapping.provider.SynchronizationContext;
import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler;
import org.eclipse.team.internal.ui.Policy;
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.mapping.ModelEnablementPreferencePage;
import org.eclipse.team.internal.ui.mapping.ModelSynchronizePage;
import org.eclipse.team.internal.ui.preferences.SyncViewerPreferencePage;
import org.eclipse.team.internal.ui.synchronize.IRefreshSubscriberListener;
import org.eclipse.team.internal.ui.synchronize.IRefreshable;
import org.eclipse.team.internal.ui.synchronize.RefreshModelParticipantJob;
import org.eclipse.team.internal.ui.synchronize.RefreshParticipantJob;
import org.eclipse.team.internal.ui.synchronize.RefreshUserNotificationPolicy;
import org.eclipse.team.internal.ui.synchronize.StartupPreferencePage;
import org.eclipse.team.internal.ui.synchronize.SubscriberRefreshSchedule;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter;
import org.eclipse.team.ui.mapping.ISynchronizationCompareInput;
import org.eclipse.team.ui.mapping.ITeamContentProviderDescriptor;
import org.eclipse.team.ui.mapping.ITeamContentProviderManager;
import org.eclipse.team.ui.mapping.SaveableComparison;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.IPageBookViewPage;
import org.eclipse.ui.progress.IProgressConstants2;

public class ModelSynchronizeParticipant
  extends AbstractSynchronizeParticipant
{
  public static final String P_VISIBLE_MODEL_PROVIDER = "org.eclipse.team.ui.activeModelProvider";
  public static final String ALL_MODEL_PROVIDERS_VISIBLE = "org.eclipse.team.ui.activeModelProvider";
  public static final String PROP_ENABLED_MODEL_PROVIDERS = "org.eclipse.team.ui.ENABLED_MODEL_PROVIDERS";
  public static final String PROP_ACTIVE_SAVEABLE = "org.eclipse.team.ui.ACTIVE_SAVEABLE";
  public static final String PROP_DIRTY = "org.eclipse.team.ui.DIRTY";
  private static final String CTX_PARTICIPANT_SETTINGS = "org.eclipse.team.ui.MODEL_PARTICIPANT_SETTINGS";
  private static final String CTX_REFRESH_SCHEDULE_SETTINGS = "org.eclipse.team.ui.MODEL_PARTICIPANT_REFRESH_SCHEDULE";
  private static final String CTX_DESCRIPTION = "org.eclipse.team.ui.MODEL_PARTICIPANT_DESCRIPTION";
  private static final String CTX_PARTICIPANT_MAPPINGS = "org.eclipse.team.ui.MODEL_PARTICIPANT_MAPPINGS";
  private static final String CTX_MODEL_PROVIDER_ID = "modelProviderId";
  private static final String CTX_MODEL_PROVIDER_MAPPINGS = "mappings";
  private static final String CTX_STARTUP_ACTION = "startupAction";
  private SynchronizationContext context;
  private boolean mergingEnabled = true;
  private SubscriberRefreshSchedule refreshSchedule;
  private String description;
  private SaveableComparison activeSaveable;
  private PreferenceStore preferences = new PreferenceStore()
  {
    public void save()
      throws IOException
    {}
  };
  private IPropertyListener dirtyListener = new IPropertyListener()
  {
    public void propertyChanged(Object source, int propId)
    {
      if (((source instanceof SaveableComparison)) && (propId == 257))
      {
        SaveableComparison scm = (SaveableComparison)source;
        boolean isDirty = scm.isDirty();
        firePropertyChange(ModelSynchronizeParticipant.this, "org.eclipse.team.ui.DIRTY", Boolean.valueOf(!isDirty), Boolean.valueOf(isDirty));
      }
    }
  };
  
  public static
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