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

tentDescriptors()
  {
    ModelSynchronizeParticipant participant = (ModelSynchronizeParticipant)getConfiguration().getParticipant();
    ModelProvider[] providers = participant.getEnabledModelProviders();
    Set result = new HashSet();
    for (int i = 0; i < providers.length; i++)
    {
      ModelProvider provider = providers[i];
      ITeamContentProviderDescriptor desc = TeamUI.getTeamContentProviderManager().getDescriptor(provider.getId());
      if ((desc != null) && (desc.isEnabled())) {
        result.add(desc);
      }
    }
    return (ITeamContentProviderDescriptor[])result.toArray(new ITeamContentProviderDescriptor[result.size()]);
  }
  
  private Composite getInitializationPane(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setBackground(getListBackgroundColor());
    GridLayout layout = new GridLayout();
    numColumns = 2;
    composite.setLayout(layout);
    GridData data = new GridData(1808);
    grabExcessVerticalSpace = true;
    composite.setLayoutData(data);
    
    createDescriptionLabel(composite, NLS.bind(TeamUIMessages.DiffTreeChangesSection_3, new String[] { Utils.shortenText(100, getConfiguration().getParticipant().getName()) }));
    
    boolean[] remember = new boolean[1];
    PreferenceStore store = (PreferenceStore)getConfiguration()
      .getProperty("org.eclipse.team.ui.startupPreferences");
    Hyperlink link = getForms().createHyperlink(composite, TeamUIMessages.DiffTreeChangesSection_4, 64);
    link.addHyperlinkListener(new HyperlinkAdapter()
    {
      private final boolean[] val$remember;
      private final PreferenceStore val$store;
      
      public void linkActivated(HyperlinkEvent e)
      {
        if ((val$remember[0] != 0) && (val$store != null)) {
          val$store.putValue("startupAction", "populate");
        }
        DiffTreeChangesSection.this.getHandler().initializeIfNeeded();
      }
    });
    getForms().getHyperlinkGroup().add(link);
    
    link = getForms().createHyperlink(composite, TeamUIMessages.DiffTreeChangesSection_5, 64);
    link.addHyperlinkListener(new HyperlinkAdapter()
    {
      private final boolean[] val$remember;
      private final PreferenceStore val$store;
      
      public void linkActivated(HyperlinkEvent e)
      {
        if ((val$remember[0] != 0) && (val$store != null)) {
          val$store.putValue("startupAction", "synchronize");
        }
        getConfiguration().getParticipant().run(getConfiguration().getSite().getPart());
      }
    });
    getForms().getHyperlinkGroup().add(link);
    if (store != null)
    {
      Button rememberButton = getForms().createButton(composite, TeamUIMessages.DiffTreeChangesSection_14, 32);
      rememberButton.setToolTipText(TeamUIMessages.DiffTreeChangesSection_14);
      data = new GridData(768);
      horizontalSpan = 2;
      horizontalIndent = 5;
      verticalIndent = 5;
      widthHint = 100;
      rememberButton.setLayoutData(data);
      rememberButton.addSelectionListener(new SelectionListener()
      {
        private final boolean[] val$remember;
        private final Button val$rememberButton;
        
        public void widgetSelected(SelectionEvent e)
        {
          val$remember[0] = val$rememberButton.getSelection();
        }
        
        public void widgetDefaultSelected(SelectionEvent e) {}
      });
    }
    return composite;
  }
  
  private Composite getInitializingMessagePane(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setBackground(getListBackgroundColor());
    GridLayout layout = new GridLayout();
    numColumns = 2;
    composite.setLayout(layout);
    GridData data = new GridData(1808);
    grabExcessVerticalSpace = true;
    composite.setLayoutData(data);
    if (isRefreshRunning()) {
      createDescriptionLabel(composite, NLS.bind(TeamUIMessages.DiffTreeChangesSection_6, new String[] { Utils.shortenText(100, getConfiguration().getParticipant().getName()) }));
    } else {
      createDescriptionLabel(composite, NLS.bind(TeamUIMessages.DiffTreeChangesSection_7, new String[] { Utils.shortenText(100, getConfiguration().getParticipant().getName()) }));
    }
    return composite;
  }
  
  private boolean isRefreshRunning()
  {
    return Job.getJobManager().find(getConfiguration().getParticipant()).length > 0;
  }
  
  private SubscriberDiffTreeEventHandler getHandler()
  {
    return (SubscriberDiffTreeEventHandler)Utils.getAdapter(context, SubscriberDiffTreeEventHandler.class);
  }
  
  private Composite getPointerToModel(Composite parent, ModelProvider provider, String oldId)
  {
    Composite composite = new Composite(parent, 0);
    composite.setBackground(getListBackgroundColor());
    GridLayout layout = new GridLayout();
    numColumns = 2;
    composite.setLayout(layout);
    GridData data = new GridData(1808);
    grabExcessVerticalSpace = true;
    composite.setLayoutData(data);
    
    IModelProviderDescriptor oldDesc = ModelProvider.getModelProviderDescriptor(oldId);
    
    String modeToString = Utils.modeToString(getConfiguration().getMode());
    String message = NLS.bind(TeamUIMessages.DiffTreeChangesSection_0, new String[] {
      provider.getDescriptor().getLabel(), 
      modeToString });
    message = NLS.bind(TeamUIMessages.DiffTreeChangesSection_1, new String[] { modeToString, oldDesc.getLabel(), message });
    
    createDescriptionLabel(composite, message);
    
    Label warning = new Label(composite, 0);
    warning.setImage(TeamUIPlugin.getPlugin().getImage("ovr/warning_co.gif"));
    
    Hyperlink link = getForms().createHyperlink(composite, NLS.bind(TeamUIMessages.DiffTreeChangesSection_2, new String[] { provider.getDescriptor().getLabel() }), 64);
    link.addHyperlinkListener(new HyperlinkAdapter()
    {
      private final ModelProvider val$provider;
      
      public void linkActivated(HyperlinkEvent e)
      {
        getConfiguration().setProperty("org.eclipse.team.ui.activeModelProvider", val$provider.getDescriptor().getId());
      }
    });
    getForms().getHyperlinkGroup().add(link);
    
    new Label(composite, 0);
    Hyperlink link2 = getForms().createHyperlink(composite, TeamUIMessages.DiffTreeChangesSection_13, 64);
    link2.addHyperlinkListener(new HyperlinkAdapter()
    {
      public void linkActivated(HyperlinkEvent e)
      {
        getConfiguration().setProperty("org.eclipse.team.ui.activeModelProvider", "org.eclipse.team.ui.activeModelProvider");
      }
    });
    getForms().getHyperlinkGroup().add(link2);
    
    return composite;
  }
  
  public void treeEmpty(TreeViewer viewer)
  {
    handleEmptyViewer();
  }
  
  private void handleEmptyViewer()
  {
    TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable()
    {
      public void run()
      {
        if (!getContainer().isDisposed()) {
          updatePage(getEmptyChangesComposite(getContainer()));
        }
      }
    });
  }
  
  protected void calculateDescription()
  {
    if ((errors != null) && (errors.length > 0))
    {
      if (!showingError) {
        TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable()
        {
          public void run()
          {
            updatePage(DiffTreeChangesSection.access$4(DiffTreeChangesSection.this, getContainer()));
            showingError = true;
          }
        });
      }
      return;
    }
    showingError = false;
    if (isViewerEmpty()) {
      handleEmptyViewer();
    } else {
      super.calculateDescription();
    }
  }
  
  private boolean isViewerEmpty()
  {
    Viewer v = getPage().getViewer();
    if ((v instanceof CommonViewerAdvisor.NavigableCommonViewer))
    {
      CommonViewerAdvisor.NavigableCommonViewer cv = (CommonViewerAdvisor.NavigableCommonViewer)v;
      return cv.isEmpty();
    }
    return false;
  }
  
  public void notEmpty(TreeViewer viewer)
  {
    calculateDescription();
  }
  
  private Composite getErrorComposite(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setBackground(getListBackgroundColor());
    GridLayout layout = new GridLayout();
    numColumns = 2;
    composite.setLayout(layout);
    GridData data = new GridData(1808);
    grabExcessVerticalSpace = true;
    composite.setLayoutData(data);
    
    createDescriptionLabel(composite, NLS.bind(TeamUIMessages.ChangesSection_10, new String[] { Utils.shortenText(100, getConfiguration().getParticipant().getName()) }));
    
    Hyperlink link = getForms().createHyperlink(composite, TeamUIMessages.ChangesSection_8, 64);
    link.addHyperlinkListener(new HyperlinkAdapter()
    {
      public void linkActivated(HyperlinkEvent e)
      {
        showErrors();
      }
    });
    getForms().getHyperlinkGroup().add(link);
    
    link = getForms().createHyperlink(composite, TeamUIMessages.ChangesSection_9, 64);
    link.addHyperlinkListener(new HyperlinkAdapter()
    {
      public void linkActivated(HyperlinkEvent e)
      {
        errors = null;
        calculateDescription();
        SubscriberDiffTreeEventHandler handler = DiffTreeChangesSection.this.getHandler();
        if (handler != null) {
          handler.initializeIfNeeded();
        } else {
          getConfiguration().getParticipant().run(getConfiguration().getSite().getPart());
        }
      }
    });
    getForms().getHyperlinkGroup().add(link);
    
    return composite;
  }
  
  void showErrors()
  {
    if (errors != null)
    {
      IStatus[] status = errors;
      String title = TeamUIMessages.ChangesSection_11;
      if (status.length == 1)
      {
        ErrorDialog.openError(getShell(), title, status[0].getMessage(), status[0]);
      }
      else
      {
        MultiStatus multi = new MultiStatus("org.eclipse.team.ui", 0, status, TeamUIMessages.ChangesSection_12, null);
        ErrorDialog.openError(getShell(), title, null, multi);
      }
    }
  }
  
  public static abstract interface ITraversalFactory
  {
    public abstract ResourceTraversal[] getTraversals(ISynchronizationScope paramISynchronizationScope);
  }
}

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

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.diff.IDiffChangeEvent;
import org.eclipse.team.core.diff.IDiffChangeListener;
import org.eclipse.team.core.diff.IDiffTree;
import org.eclipse.team.core.mapping.IResourceDiffTree;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.internal.ui.synchronize.actions.StatusLineContributionGroup;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;

public class DiffTreeStatusLineContributionGroup
  extends StatusLineContributionGroup
  implements IDiffChangeListener
{
  public DiffTreeStatusLineContributionGroup(Shell shell, ISynchronizePageConfiguration configuration)
  {
    super(shell, configuration);
    getSynchronizationContext().getDiffTree().addDiffChangeListener(this);
  }
  
  public void dispose()
  {
    getSynchronizationContext().getDiffTree().removeDiffChangeListener(this);
    super.dispose();
  }
  
  protected int getChangeCount()
  {
    return getSynchronizationContext().getDiffTree().size();
  }
  
  private ISynchronizationContext getSynchronizationContext()
  {
    return (ISynchronizationContext)getConfiguration().getProperty("org.eclipse.team.ui.synchronizationContext");
  }
  
  protected int countFor(int state)
  {
    switch (state)
    {
    case 4: 
      state = 256;
      break;
    case 8: 
      state = 512;
      break;
    case 12: 
      state = 768;
    }
    return (int)getSynchronizationContext().getDiffTree().countFor(state, 768);
  }
  
  public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor)
  {
    updateCounts();
  }
  
  public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {}
}

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

import org.eclipse.compare.internal.patch.WorkspacePatcher;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler;
import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchModelSynchronizeParticipant;
import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchSubscriber;
import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchSubscriberMergeContext;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;

public class FuzzFactorAction
  extends Action
{
  private ISynchronizePageConfiguration configuration;
  private ApplyPatchModelSynchronizeParticipant participant;
  private ApplyPatchSubscriberMergeContext context;
  private ApplyPatchSubscriber subscriber;
  
  public FuzzFactorAction(ISynchronizePageConfiguration configuration)
  {
    this.configuration = configuration;
    participant = 
      ((ApplyPatchModelSynchronizeParticipant)configuration.getParticipant());
    context = ((ApplyPatchSubscriberMergeContext)participant.getContext());
    subscriber = ((ApplyPatchSubscriber)context.getSubscriber());
  }
  
  public void run()
  {
    FuzzFactorDialog dialog = new FuzzFactorDialog(Display.getCurrent()
      .getActiveShell(), subscriber.getPatcher());
    if (dialog.open() == 0)
    {
      int oldValue = subscriber.getPatcher().getFuzz();
      int newValue = dialog.getFuzzFactor();
      if (newValue != oldValue)
      {
        SubscriberDiffTreeEventHandler handler = (SubscriberDiffTreeEventHandler)context
          .getAdapter(SubscriberDiffTreeEventHandler.class);
        handler.reset();
        subscriber.getPatcher().setFuzz(newValue);
        participant.refresh(configuration.getSite().getWorkbenchSite(), 
          context.getScope().getMappings());
      }
    }
  }
}

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

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

class FuzzFactorDialog$1
  implements ModifyListener
{
  final FuzzFactorDialog this$0;
  
  FuzzFactorDialog$1(FuzzFactorDialog paramFuzzFactorDialog)
  {
    this$0 = paramFuzzFactorDialog;
  }
  
  public void modifyText(ModifyEvent e)
  {
    FuzzFactorDialog.access$0(this$0);
  }
}

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

import org.eclipse.compare.internal.patch.WorkspacePatcher;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Text;

class FuzzFactorDialog$2
  extends SelectionAdapter
{
  final FuzzFactorDialog this$0;
  
  FuzzFactorDialog$2(FuzzFactorDialog paramFuzzFactorDialog)
  {
    this$0 = paramFuzzFactorDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    FuzzFactorDialog.access$1(this$0).setFuzz(-1);
    int fuzz = FuzzFactorDialog.access$2(this$0);
    if (fuzz >= 0)
    {
      String value = new Integer(fuzz).toString();
      FuzzFactorDialog.access$3(this$0).setText(value);
    }
  }
}

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

import org.eclipse.compare.internal.patch.WorkspacePatcher;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;

class FuzzFactorDialog$3
  implements IRunnableWithProgress
{
  final FuzzFactorDialog this$0;
  private final int[] val$result;
  
  FuzzFactorDialog$3(FuzzFactorDialog paramFuzzFactorDialog, int[] paramArrayOfInt)
  {
    this$0 = paramFuzzFactorDialog;val$result = paramArrayOfInt;
  }
  
  public void run(IProgressMonitor monitor)
  {
    val$result[0] = FuzzFactorDialog.access$1(this$0).guessFuzzFactor(monitor);
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.internal.patch.WorkspacePatcher;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.StringConverter;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;

public class FuzzFactorDialog
  extends Dialog
{
  private Text valueText;
  private Text errorMessageText;
  private WorkspacePatcher patcher;
  private int fuzzFactor;
  
  public FuzzFactorDialog(Shell parentShell, WorkspacePatcher patcher)
  {
    super(parentShell);
    this.patcher = patcher;
  }
  
  public int getFuzzFactor()
  {
    return fuzzFactor;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    GridLayout layout = new GridLayout(2, false);
    marginHeight = convertVerticalDLUsToPixels(7);
    marginWidth = convertHorizontalDLUsToPixels(7);
    verticalSpacing = convertVerticalDLUsToPixels(4);
    horizontalSpacing = convertHorizontalDLUsToPixels(4);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(1808));
    applyDialogFont(composite);
    
    Label label = new Label(composite, 64);
    label.setText(TeamUIMessages.FuzzFactorDialog_message);
    GridData data = new GridData();
    horizontalSpan = 2;
    label.setLayoutData(data);
    label.setFont(parent.getFont());
    
    valueText = new Text(composite, 2052);
    data = new GridData(768);
    
    widthHint = convertHorizontalDLUsToPixels(300);
    valueText.setLayoutData(data);
    valueText.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        FuzzFactorDialog.this.validateInput();
      }
    });
    fuzzFactor = patcher.getFuzz();
    if (fuzzFactor >= 0) {
      valueText.setText(new Integer(fuzzFactor).toString());
    }
    Button guessButton = new Button(composite, 0);
    guessButton.setText(TeamUIMessages.FuzzFactorDialog_guess);
    data = new GridData();
    int widthHint = convertHorizontalDLUsToPixels(61);
    Point minSize = guessButton.computeSize(-1, -1, true);
    widthHint = Math.max(widthHint, x);
    guessButton.setLayoutData(data);
    guessButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        patcher.setFuzz(-1);
        int fuzz = FuzzFactorDialog.this.guessFuzzFactor();
        if (fuzz >= 0)
        {
          String value = new Integer(fuzz).toString();
          valueText.setText(value);
        }
      }
    });
    errorMessageText = new Text(composite, 72);
    errorMessageText.setLayoutData(new GridData(768));
    
    errorMessageText.setBackground(errorMessageText.getDisplay()
      .getSystemColor(22));
    
    validateInput();
    
    applyDialogFont(composite);
    return composite;
  }
  
  private void validateInput()
  {
    String message = null;
    String value = valueText.getText();
    try
    {
      fuzzFactor = Integer.parseInt(value);
      if (fuzzFactor < 0) {
        message = TeamUIMessages.FuzzFactorDialog_numberOutOfRange;
      }
    }
    catch (NumberFormatException localNumberFormatException)
    {
      message = TeamUIMessages.FuzzFactorDialog_notANumber;
    }
    setErrorMessage(message);
  }
  
  private void setErrorMessage(String errorMessage)
  {
    if ((errorMessageText != null) && (!errorMessageText.isDisposed()))
    {
      errorMessageText.setText(errorMessage == null ? " \n " : 
        errorMessage);
      if (errorMessage != null) {}
      boolean hasError = 
        StringConverter.removeWhiteSpaces(errorMessage)
        .length() > 0;
      errorMessageText.setEnabled(hasError);
      errorMessageText.setVisible(hasError);
      errorMessageText.getParent().update();
      Control button = getButton(0);
      if (button != null) {
        button.setEnabled(errorMessage == null);
      }
    }
  }
  
  protected void configureShell(Shell shell)
  {
    super.configureShell(shell);
    shell.setText(TeamUIMessages.FuzzFactorDialog_title);
  }
  
  private int guessFuzzFactor()
  {
    int[] result = { -1 };
    try
    {
      PlatformUI.getWorkbench().getProgressService().run(true, true, 
        new IRunnableWithProgress()
        {
          private final int[] val$result;
          
          public void run(IProgressMonitor monitor)
          {
            val$result[0] = patcher.guessFuzzFactor(monitor);
          }
        });
    }
    catch (InvocationTargetException localInvocationTargetException) {}catch (InterruptedException localInterruptedException) {}
    return result[0];
  }
}

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

import org.eclipse.compare.internal.patch.WorkspacePatcher;
import org.eclipse.jface.action.Action;
import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchModelSynchronizeParticipant;
import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchSubscriber;
import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchSubscriberMergeContext;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;

public class GererateRejFileAction
  extends Action
{
  private ApplyPatchSubscriber subscriber;
  
  public GererateRejFileAction(ISynchronizePageConfiguration configuration)
  {
    super("", 2);
    ApplyPatchModelSynchronizeParticipant participant = (ApplyPatchModelSynchronizeParticipant)configuration
      .getParticipant();
    ApplyPatchSubscriberMergeContext context = (ApplyPatchSubscriberMergeContext)participant
      .getContext();
    subscriber = ((ApplyPatchSubscriber)context.getSubscriber());
  }
  
  public boolean isChecked()
  {
    return subscriber.getPatcher().isGenerateRejectFile();
  }
  
  public void run()
  {
    boolean oldValue = subscriber.getPatcher().isGenerateRejectFile();
    subscriber.getPatcher().setGenerateRejectFile(!oldValue);
    
    firePropertyChange("checked", new Boolean(oldValue), new Boolean(
      !oldValue));
  }
}

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

import org.eclipse.jface.viewers.TreeViewer;

public abstract interface IEmptyTreeListener
{
  public abstract void treeEmpty(TreeViewer paramTreeViewer);
  
  public abstract void notEmpty(TreeViewer paramTreeViewer);
}

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

import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.team.internal.ui.TeamUIMessages;

class IgnoreLeadingPathSegmentsAction$1
  implements IInputValidator
{
  final IgnoreLeadingPathSegmentsAction this$0;
  
  IgnoreLeadingPathSegmentsAction$1(IgnoreLeadingPathSegmentsAction paramIgnoreLeadingPathSegmentsAction)
  {
    this$0 = paramIgnoreLeadingPathSegmentsAction;
  }
  
  public String isValid(String input)
  {
    try
    {
      int i = Integer.parseInt(input);
      if ((i < 0) || (i > IgnoreLeadingPathSegmentsAction.access$0(this$0))) {
        return TeamUIMessages.IgnoreLeadingPathSegmentsDialog_numberOutOfRange;
      }
    }
    catch (NumberFormatException localNumberFormatException)
    {
      return TeamUIMessages.IgnoreLeadingPathSegmentsDialog_notANumber;
    }
    return null;
  }
}

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

import org.eclipse.compare.internal.patch.WorkspacePatcher;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.diff.provider.DiffTree;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchModelSynchronizeParticipant;
import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchSubscriber;
import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchSubscriberMergeContext;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;

public class IgnoreLeadingPathSegmentsAction
  extends Action
{
  private ISynchronizePageConfiguration configuration;
  private ApplyPatchModelSynchronizeParticipant participant;
  private ApplyPatchSubscriberMergeContext context;
  private ApplyPatchSubscriber subscriber;
  private int maxValue;
  
  public IgnoreLeadingPathSegmentsAction(ISynchronizePageConfiguration configuration)
  {
    this.configuration = configuration;
    participant = 
      ((ApplyPatchModelSynchronizeParticipant)configuration.getParticipant());
    context = ((ApplyPatchSubscriberMergeContext)participant.getContext());
    subscriber = ((ApplyPatchSubscriber)context.getSubscriber());
  }
  
  public boolean isEnabled()
  {
    return !subscriber.getPatcher().isWorkspacePatch();
  }
  
  public void run()
  {
    int oldValue = subscriber.getPatcher().getStripPrefixSegments();
    maxValue = (subscriber.getPatcher().calculatePrefixSegmentCount() - 1);
    
    InputDialog dlg = new InputDialog(
      Display.getCurrent().getActiveShell(), 
      TeamUIMessages.IgnoreLeadingPathSegmentsDialog_title, NLS.bind(
      TeamUIMessages.IgnoreLeadingPathSegmentsDialog_message, 
      new Integer(maxValue)), new Integer(oldValue)
      .toString(), new IInputValidator()
      {
        public String isValid(String input)
        {
          try
          {
            int i = Integer.parseInt(input);
            if ((i < 0) || (i > maxValue)) {
              return TeamUIMessages.IgnoreLeadingPathSegmentsDialog_numberOutOfRange;
            }
          }
          catch (NumberFormatException localNumberFormatException)
          {
            return TeamUIMessages.IgnoreLeadingPathSegmentsDialog_notANumber;
          }
          return null;
        }
      });
    if (dlg.open() == 0)
    {
      String input = dlg.getValue();
      int newValue = Integer.parseInt(input);
      if (newValue != oldValue)
      {
        DiffTree tree = (DiffTree)context.getDiffTree();
        tree.clear();
        SubscriberDiffTreeEventHandler handler = (SubscriberDiffTreeEventHandler)context
          .getAdapter(SubscriberDiffTreeEventHandler.class);
        handler.reset();
        subscriber.getPatcher().setStripPrefixSegments(newValue);
        participant.refresh(configuration.getSite().getWorkbenchSite(), 
          context.getScope().getMappings());
      }
    }
  }
}

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

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

class LineComparator$TrailingLineFeedDetector
  extends FilterInputStream
{
  boolean trailingLF = false;
  
  protected LineComparator$TrailingLineFeedDetector(InputStream in)
  {
    super(in);
  }
  
  public int read()
    throws IOException
  {
    int c = super.read();
    trailingLF = isLineFeed(c);
    return c;
  }
  
  public int read(byte[] buffer, int off, int len)
    throws IOException
  {
    int length = super.read(buffer, off, len);
    if (length != -1)
    {
      int index = off + length - 1;
      if (index >= buffer.length) {
        index = buffer.length - 1;
      }
      trailingLF = isLineFeed(buffer[index]);
    }
    return length;
  }
  
  private boolean isLineFeed(int c)
  {
    return (c != -1) && (c == 10);
  }
  
  public boolean hadTrailingLineFeed()
  {
    return trailingLF;
  }
}

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

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import org.eclipse.compare.rangedifferencer.IRangeComparator;
import org.eclipse.core.resources.IEncodedStorage;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;

class LineComparator
  implements IRangeComparator
{
  private String[] fLines;
  
  private static class TrailingLineFeedDetector
    extends FilterInputStream
  {
    boolean trailingLF = false;
    
    protected TrailingLineFeedDetector(InputStream in)
    {
      super();
    }
    
    public int read()
      throws IOException
    {
      int c = super.read();
      trailingLF = isLineFeed(c);
      return c;
    }
    
    public int read(byte[] buffer, int off, int len)
      throws IOException
    {
      int length = super.read(buffer, off, len);
      if (length != -1)
      {
        int index = off + length - 1;
        if (index >= buffer.length) {
          index = buffer.length - 1;
        }
        trailingLF = isLineFeed(buffer[index]);
      }
      return length;
    }
    
    private boolean isLineFeed(int c)
    {
      return (c != -1) && (c == 10);
    }
    
    public boolean hadTrailingLineFeed()
    {
      return trailingLF;
    }
  }
  
  public static LineComparator create(IStorage storage, String outputEncoding)
    throws CoreException, IOException
  {
    InputStream is = new BufferedInputStream(storage.getContents());
    try
    {
      String encoding = getEncoding(storage, outputEncoding);
      return new LineComparator(is, encoding);
    }
    finally
    {
      try
      {
        is.close();
      }
      catch (IOException localIOException2) {}
    }
  }
  
  private static String getEncoding(IStorage storage, String outputEncoding)
    throws CoreException
  {
    if ((storage instanceof IEncodedStorage))
    {
      IEncodedStorage es = (IEncodedStorage)storage;
      String charset = es.getCharset();
      if (charset != null) {
        return charset;
      }
    }
    return outputEncoding;
  }
  
  public LineComparator(InputStream is, String encoding)
    throws IOException
  {
    TrailingLineFeedDetector trailingLineFeedDetector = new TrailingLineFeedDetector(is);
    BufferedReader br = new BufferedReader(new InputStreamReader(trailingLineFeedDetector, encoding));
    
    ArrayList ar = new ArrayList();
    String line;
    while ((line = br.readLine()) != null)
    {
      String line;
      ar.add(line);
    }
    if (trailingLineFeedDetector.hadTrailingLineFeed()) {
      ar.add("");
    }
    fLines = ((String[])ar.toArray(new String[ar.size()]));
  }
  
  String getLine(int ix)
  {
    return fLines[ix];
  }
  
  public int getRangeCount()
  {
    return fLines.length;
  }
  
  public boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex)
  {
    String s1 = fLines[thisIndex];
    String s2 = fLines[otherIndex];
    return s1.equals(s2);
  }
  
  public boolean skipRangeComparison(int length, int maxLength, IRangeComparator other)
  {
    return false;
  }
}

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

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

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

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

import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.runtime.Assert;
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.jface.action.Action;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Event;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.mapping.MergeActionHandler;
import org.eclipse.team.ui.mapping.SaveableComparison;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.team.ui.synchronize.ModelParticipantAction;
import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;

public class MergeAction
  extends Action
{
  private final String handlerId;
  private final CommonMenuManager manager;
  private final ISynchronizePageConfiguration configuration;
  private IHandler defaultHandler;
  
  public MergeAction(String handlerId, CommonMenuManager manager, ISynchronizePageConfiguration configuration)
  {
    Assert.isNotNull(handlerId);
    Assert.isNotNull(manager);
    Assert.isNotNull(configuration);
    this.handlerId = handlerId;
    this.manager = manager;
    this.configuration = configuration;
  }
  
  public void runWithEvent(Event event)
  {
    IHandler handler = getHandler();
    if ((handler != null) && (handler.isEnabled()))
    {
      SaveableComparison currentBuffer = ((ModelSynchronizeParticipant)configuration.getParticipant()).getActiveSaveable();
      if ((currentBuffer != null) && (currentBuffer.isDirty()))
      {
        SaveableComparison targetBuffer = null;
        if ((handler instanceof MergeActionHandler))
        {
          MergeActionHandler mah = (MergeActionHandler)handler;
          targetBuffer = mah.getSaveable();
        }
        SaveableComparison target = targetBuffer;
        try
        {
          PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress()
          {
            private final SaveableComparison val$target;
            private final SaveableComparison val$currentBuffer;
            
            public void run(IProgressMonitor monitor)
              throws InvocationTargetException, InterruptedException
            {
              try
              {
                ModelParticipantAction.handleTargetSaveableChange(configuration.getSite().getShell(), val$target, val$currentBuffer, true, monitor);
              }
              catch (CoreException e)
              {
                throw new InvocationTargetException(e);
              }
            }
          });
        }
        catch (InvocationTargetException e)
        {
          Utils.handle(e);
          return;
        }
        catch (InterruptedException localInterruptedException)
        {
          return;
        }
        ((ModelSynchronizeParticipant)configuration.getParticipant()).setActiveSaveable(targetBuffer);
      }
      try
      {
        handler.execute(new ExecutionEvent(null, Collections.EMPTY_MAP, event, null));
      }
      catch (ExecutionException e)
      {
        handle(e);
      }
    }
  }
  
  protected void handle(Throwable exception)
  {
    if ((exception instanceof ExecutionException))
    {
      ExecutionException ee = (ExecutionException)exception;
      if (ee.getCause() != null) {
        handle(exception.getCause());
      }
    }
    IStatus status;
    IStatus status;
    if ((exception instanceof CoreException))
    {
      CoreException ce = (CoreException)exception;
      status = ce.getStatus();
    }
    else
    {
      status = new Status(4, "org.eclipse.team.ui", 0, TeamUIMessages.exception, exception);
    }
    ErrorDialog.openError(configuration.getSite().getShell(), null, null, status);
  }
  
  private IHandler getHandler()
  {
    IHandler handler = manager.getHandler(handlerId);
    if (handler == null)
    {
      if (defaultHandler == null) {
        defaultHandler = getDefaultHandler();
      }
      return defaultHandler;
    }
    return handler;
  }
  
  private IHandler getDefaultHandler()
  {
    return MergeActionHandler.getDefaultHandler(handlerId, configuration);
  }
  
  private boolean calculateEnablement()
  {
    IHandler handler = getHandler();
    return (handler != null) && (handler.isEnabled());
  }
  
  public void dispose()
  {
    if (defaultHandler != null) {
      defaultHandler.dispose();
    }
  }
  
  public void update()
  {
    setEnabled(calculateEnablement());
  }
}

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