org.eclipse.team.cvs.ui_3.3.401.v20120126-1227

16:47:56.584 INFO  jd.cli.Main - Decompiling org.eclipse.team.cvs.ui_3.3.401.v20120126-1227.jar
package org.eclipse.team.internal.ccvs.ui;

import org.eclipse.core.resources.IContainer;
import org.eclipse.ui.model.WorkbenchContentProvider;

class AdaptableHierarchicalResourceList$1
  extends WorkbenchContentProvider
{
  final AdaptableHierarchicalResourceList this$0;
  
  AdaptableHierarchicalResourceList$1(AdaptableHierarchicalResourceList paramAdaptableHierarchicalResourceList)
  {
    this$0 = paramAdaptableHierarchicalResourceList;
  }
  
  public Object[] getChildren(Object o)
  {
    if ((o instanceof IContainer)) {
      return AdaptableHierarchicalResourceList.access$0(this$0, (IContainer)o);
    }
    return super.getChildren(o);
  }
}

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

import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.ui.model.WorkbenchContentProvider;

public class AdaptableHierarchicalResourceList
  extends AdaptableResourceList
{
  private IContainer root;
  
  public AdaptableHierarchicalResourceList(IContainer root, IResource[] resources)
  {
    super(resources);
    this.root = root;
  }
  
  public Object[] getChildren(Object o)
  {
    return getChildenFor(root);
  }
  
  private IResource[] getChildenFor(IContainer parent)
  {
    Set children = new HashSet();
    IPath parentPath = parent.getFullPath();
    for (int i = 0; i < resources.length; i++)
    {
      IResource resource = resources[i];
      IPath resourcePath = resource.getFullPath();
      if ((parent instanceof IWorkspaceRoot))
      {
        children.add(((IWorkspaceRoot)parent).getProject(resourcePath.segment(0)));
      }
      else if (parentPath.isPrefixOf(resourcePath))
      {
        IPath parentRelativePath = resourcePath.removeFirstSegments(parentPath.segmentCount());
        if (parentRelativePath.segmentCount() == 1) {
          children.add(resource);
        } else if (parentRelativePath.segmentCount() > 1) {
          children.add(parent.getFolder(new Path(null, parentRelativePath.segment(0))));
        }
      }
    }
    return (IResource[])children.toArray(new IResource[children.size()]);
  }
  
  public ITreeContentProvider getTreeContentProvider()
  {
    new WorkbenchContentProvider()
    {
      public Object[] getChildren(Object o)
      {
        if ((o instanceof IContainer)) {
          return AdaptableHierarchicalResourceList.this.getChildenFor((IContainer)o);
        }
        return super.getChildren(o);
      }
    };
  }
  
  public void setResources(IResource[] resources)
  {
    this.resources = resources;
  }
  
  public void setRoot(IContainer root)
  {
    this.root = root;
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;

public class AdaptableResourceList
  implements IAdaptable, IWorkbenchAdapter
{
  IResource[] resources;
  
  public AdaptableResourceList(IResource[] resources)
  {
    this.resources = resources;
  }
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == IWorkbenchAdapter.class) {
      return this;
    }
    return null;
  }
  
  public Object[] getChildren(Object o)
  {
    return resources;
  }
  
  public ImageDescriptor getImageDescriptor(Object object)
  {
    return null;
  }
  
  public String getLabel(Object o)
  {
    return o == null ? "" : o.toString();
  }
  
  public Object getParent(Object o)
  {
    return null;
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.ui.model.WorkbenchLabelProvider;

class AddToVersionControlDialog$1
  extends WorkbenchLabelProvider
{
  final AddToVersionControlDialog this$0;
  
  AddToVersionControlDialog$1(AddToVersionControlDialog paramAddToVersionControlDialog)
  {
    this$0 = paramAddToVersionControlDialog;
  }
  
  protected String decorateText(String input, Object element)
  {
    if ((element instanceof IResource)) {
      return ((IResource)element).getFullPath().toString();
    }
    return input;
  }
}

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

import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;

class AddToVersionControlDialog$2
  implements ISelectionChangedListener
{
  final AddToVersionControlDialog this$0;
  
  AddToVersionControlDialog$2(AddToVersionControlDialog paramAddToVersionControlDialog)
  {
    this$0 = paramAddToVersionControlDialog;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    AddToVersionControlDialog.access$1(this$0, AddToVersionControlDialog.access$0(this$0).getCheckedElements());
  }
}

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

import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class AddToVersionControlDialog$3
  extends SelectionAdapter
{
  final AddToVersionControlDialog this$0;
  
  AddToVersionControlDialog$3(AddToVersionControlDialog paramAddToVersionControlDialog)
  {
    this$0 = paramAddToVersionControlDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    AddToVersionControlDialog.access$0(this$0).setAllChecked(true);
    AddToVersionControlDialog.access$1(this$0, null);
  }
}

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

import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class AddToVersionControlDialog$4
  extends SelectionAdapter
{
  final AddToVersionControlDialog this$0;
  
  AddToVersionControlDialog$4(AddToVersionControlDialog paramAddToVersionControlDialog)
  {
    this$0 = paramAddToVersionControlDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    AddToVersionControlDialog.access$0(this$0).setAllChecked(false);
    AddToVersionControlDialog.access$1(this$0, new Object[0]);
  }
}

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

import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
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.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;

public class AddToVersionControlDialog
  extends DetailsDialog
{
  private static final int WIDTH_HINT = 350;
  private static final int SELECTION_HEIGHT_HINT = 100;
  private IResource[] unaddedResources;
  private Object[] resourcesToAdd;
  private CheckboxTableViewer listViewer;
  
  public AddToVersionControlDialog(Shell parentShell, IResource[] unaddedResources)
  {
    super(parentShell, CVSUIMessages.AddToVersionControlDialog_title);
    this.unaddedResources = unaddedResources;
  }
  
  protected void createMainDialogArea(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(1808));
    if (unaddedResources.length == 1) {
      createWrappingLabel(composite, NLS.bind(CVSUIMessages.AddToVersionControlDialog_thereIsAnUnaddedResource, new String[] { new Integer(unaddedResources.length).toString() }));
    } else {
      createWrappingLabel(composite, NLS.bind(CVSUIMessages.AddToVersionControlDialog_thereAreUnaddedResources, new String[] { new Integer(unaddedResources.length).toString() }));
    }
  }
  
  protected String getHelpContextId()
  {
    return "org.eclipse.team.cvs.ui.add_to_version_control_dialog_context";
  }
  
  protected Composite createDropDownDialogArea(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    marginHeight = convertVerticalDLUsToPixels(7);
    marginWidth = convertHorizontalDLUsToPixels(7);
    verticalSpacing = convertVerticalDLUsToPixels(4);
    horizontalSpacing = convertHorizontalDLUsToPixels(4);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(1808));
    
    addUnaddedResourcesArea(composite);
    
    return composite;
  }
  
  private void addUnaddedResourcesArea(Composite composite)
  {
    createWrappingLabel(composite, CVSUIMessages.ReleaseCommentDialog_unaddedResources);
    
    listViewer = CheckboxTableViewer.newCheckList(composite, 2048);
    GridData data = new GridData(1808);
    heightHint = 100;
    widthHint = 350;
    listViewer.getTable().setLayoutData(data);
    
    listViewer.setLabelProvider(new WorkbenchLabelProvider()
    {
      protected String decorateText(String input, Object element)
      {
        if ((element instanceof IResource)) {
          return ((IResource)element).getFullPath().toString();
        }
        return input;
      }
    });
    listViewer.setContentProvider(new WorkbenchContentProvider());
    listViewer.setInput(new AdaptableResourceList(unaddedResources));
    if (resourcesToAdd == null) {
      listViewer.setAllChecked(true);
    } else {
      listViewer.setCheckedElements(resourcesToAdd);
    }
    listViewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        resourcesToAdd = listViewer.getCheckedElements();
      }
    });
    addSelectionButtons(composite);
  }
  
  private void addSelectionButtons(Composite composite)
  {
    Composite buttonComposite = new Composite(composite, 131072);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    buttonComposite.setLayout(layout);
    GridData data = 
      new GridData(640);
    grabExcessHorizontalSpace = true;
    composite.setData(data);
    
    Button selectButton = createButton(buttonComposite, 18, CVSUIMessages.ReleaseCommentDialog_selectAll, false);
    SelectionListener listener = new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        listViewer.setAllChecked(true);
        resourcesToAdd = null;
      }
    };
    selectButton.addSelectionListener(listener);
    
    Button deselectButton = createButton(buttonComposite, 19, CVSUIMessages.ReleaseCommentDialog_deselectAll, false);
    listener = new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        listViewer.setAllChecked(false);
        resourcesToAdd = new Object[0];
      }
    };
    deselectButton.addSelectionListener(listener);
  }
  
  protected void updateEnablements() {}
  
  public IResource[] getResourcesToAdd()
  {
    if (resourcesToAdd == null) {
      return unaddedResources;
    }
    List result = Arrays.asList(resourcesToAdd);
    return (IResource[])result.toArray(new IResource[result.size()]);
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    createButton(parent, 2, IDialogConstants.YES_LABEL, true);
    createButton(parent, 3, IDialogConstants.NO_LABEL, true);
    super.createButtonsForButtonBar(parent);
  }
  
  protected boolean includeOkButton()
  {
    return false;
  }
  
  protected void buttonPressed(int id)
  {
    if ((id == 2) || (id == 3))
    {
      setReturnCode(id);
      close();
    }
    else
    {
      super.buttonPressed(id);
    }
  }
}

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

import java.util.List;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.widgets.Text;

class AlternateUserValidationDialog$1
  implements VerifyListener
{
  final AlternateUserValidationDialog this$0;
  
  AlternateUserValidationDialog$1(AlternateUserValidationDialog paramAlternateUserValidationDialog)
  {
    this$0 = paramAlternateUserValidationDialog;
  }
  
  public void verifyText(VerifyEvent e)
  {
    if (this$0.inUpdate) {
      return;
    }
    doit = false;
    this$0.inUpdate = true;
    switch (character)
    {
    case '\b': 
      if (this$0.password.length() > 0) {
        this$0.password = this$0.password.substring(0, this$0.password.length() - 1);
      }
      int numX = ((Integer)this$0.numXs.get(this$0.numXs.size() - 1)).intValue();
      this$0.numXs.remove(this$0.numXs.size() - 1);
      String oldText = this$0.passwordText.getText();
      String newText = oldText.substring(0, oldText.length() - numX);
      this$0.passwordText.setText(newText);
      this$0.passwordText.setSelection(newText.length());
      break;
    default: 
      String oldText = this$0.passwordText.getText();
      String x = this$0.getXs();
      this$0.numXs.add(this$0.numXs.size(), new Integer(x.length()));
      String newText = oldText + x;
      this$0.passwordText.setText(newText);
      this$0.passwordText.setSelection(newText.length());
      this$0.password += character;
    }
    this$0.inUpdate = false;
    this$0.updateImages();
  }
}

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

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class AlternateUserValidationDialog$2
  implements Listener
{
  final AlternateUserValidationDialog this$0;
  
  AlternateUserValidationDialog$2(AlternateUserValidationDialog paramAlternateUserValidationDialog)
  {
    this$0 = paramAlternateUserValidationDialog;
  }
  
  public void handleEvent(Event event)
  {
    AlternateUserValidationDialog.access$0(this$0);
  }
}

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

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class AlternateUserValidationDialog$3
  implements Listener
{
  final AlternateUserValidationDialog this$0;
  
  AlternateUserValidationDialog$3(AlternateUserValidationDialog paramAlternateUserValidationDialog)
  {
    this$0 = paramAlternateUserValidationDialog;
  }
  
  public void handleEvent(Event event)
  {
    this$0.cancelPressed();
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
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.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class AlternateUserValidationDialog
  extends Dialog
{
  String user;
  String password = "";
  List numXs = new ArrayList();
  Label icon1;
  Label icon2;
  Label icon3;
  Label icon4;
  Text passwordText;
  boolean inUpdate = false;
  Image[] images;
  
  public AlternateUserValidationDialog(Shell parentShell, String user)
  {
    super(parentShell);
    this.user = user;
    initializeImages();
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    newShell.setText(CVSUIMessages.AlternateUserValidationDialog_Enter_Password_2);
  }
  
  protected Control createContents(Composite parent)
  {
    Composite main = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 3;
    main.setLayout(layout);
    main.setLayoutData(new GridData(1808));
    
    Composite iconComposite = new Composite(main, 0);
    layout = new GridLayout();
    numColumns = 2;
    iconComposite.setLayout(layout);
    iconComposite.setLayoutData(new GridData());
    
    icon1 = createLabel(iconComposite);
    icon2 = createLabel(iconComposite);
    icon3 = createLabel(iconComposite);
    icon4 = createLabel(iconComposite);
    
    Composite middleComposite = new Composite(main, 0);
    middleComposite.setLayout(new GridLayout());
    middleComposite.setLayoutData(new GridData());
    
    Label l = new Label(middleComposite, 0);
    l.setText(NLS.bind(CVSUIMessages.AlternateUserValidationDialog_message, new String[] { user }));
    l.setLayoutData(new GridData());
    l = new Label(middleComposite, 0);
    l.setText("");
    l.setLayoutData(new GridData());
    passwordText = new Text(middleComposite, 2052);
    GridData data = new GridData();
    widthHint = 250;
    passwordText.setLayoutData(data);
    
    passwordText.addVerifyListener(new VerifyListener()
    {
      public void verifyText(VerifyEvent e)
      {
        if (inUpdate) {
          return;
        }
        doit = false;
        inUpdate = true;
        switch (character)
        {
        case '\b': 
          if (password.length() > 0) {
            password = password.substring(0, password.length() - 1);
          }
          int numX = ((Integer)numXs.get(numXs.size() - 1)).intValue();
          numXs.remove(numXs.size() - 1);
          String oldText = passwordText.getText();
          String newText = oldText.substring(0, oldText.length() - numX);
          passwordText.setText(newText);
          passwordText.setSelection(newText.length());
          break;
        default: 
          String oldText = passwordText.getText();
          String x = getXs();
          numXs.add(numXs.size(), new Integer(x.length()));
          String newText = oldText + x;
          passwordText.setText(newText);
          passwordText.setSelection(newText.length());
          password += character;
        }
        inUpdate = false;
        updateImages();
      }
    });
    Composite buttonComposite = new Composite(main, 0);
    buttonComposite.setLayout(new GridLayout());
    buttonComposite.setLayoutData(new GridData());
    Button b = new Button(buttonComposite, 8);
    b.setText(CVSUIMessages.AlternateUserValidationDialog_OK_6);
    data = new GridData();
    widthHint = 70;
    b.setLayoutData(data);
    b.addListener(13, new Listener()
    {
      public void handleEvent(Event event)
      {
        okPressed();
      }
    });
    buttonComposite.getShell().setDefaultButton(b);
    b = new Button(buttonComposite, 8);
    b.setText(CVSUIMessages.AlternateUserValidationDialog_Cancel_7);
    data = new GridData();
    widthHint = 70;
    b.setLayoutData(data);
    b.addListener(13, new Listener()
    {
      public void handleEvent(Event event)
      {
        cancelPressed();
      }
    });
    Dialog.applyDialogFont(parent);
    return main;
  }
  
  public boolean close()
  {
    boolean result = super.close();
    if (images != null)
    {
      for (int i = 0; i < images.length; i++)
      {
        images[i].dispose();
        images[i] = null;
      }
      images = null;
    }
    return result;
  }
  
  public String getPassword()
  {
    return password;
  }
  
  Label createLabel(Composite parent)
  {
    Label result = new Label(parent, 0);
    GridData data = new GridData();
    widthHint = 22;
    heightHint = 22;
    result.setLayoutData(data);
    result.setImage(getImage());
    return result;
  }
  
  Image getImage()
  {
    double random = Math.random();
    random *= 7.0D;
    long num = Math.round(random);
    return images[((int)num)];
  }
  
  void initializeImages()
  {
    images = new Image[8];
    for (int i = 0; i < images.length; i++) {
      images[i] = CVSUIPlugin.getPlugin().getImageDescriptor("glyphs/glyph" + (i + 1) + ".gif").createImage();
    }
    FontData fd = new FontData();
    fd.setStyle(1);
    fd.setHeight(10);
    if (System.getProperty("os.name").indexOf("Windows") != -1) {
      fd.setName("Microsoft Sans Serif");
    }
  }
  
  void updateImages()
  {
    icon1.setImage(getImage());
    icon2.setImage(getImage());
    icon3.setImage(getImage());
    icon4.setImage(getImage());
  }
  
  public void setUsername(String user)
  {
    this.user = user;
  }
  
  String getXs()
  {
    double random = Math.random();
    random *= 2.0D;
    random += 2.0D;
    long num = Math.round(random);
    switch ((int)num)
    {
    case 2: 
      return "XX";
    case 3: 
      return "XXX";
    case 4: 
      return "XXXX";
    }
    return "X";
  }
  
  protected void cancelPressed()
  {
    password = null;
    super.cancelPressed();
  }
}

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

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class AnnotatePreferencePage
  extends FieldEditorPreferencePage
  implements IWorkbenchPreferencePage
{
  private RadioGroupFieldEditor binaryPrompt = null;
  
  public AnnotatePreferencePage()
  {
    super(1);
    setTitle(CVSUIMessages.AnnotatePreferencePage_AnnotatePrefPageTitle);
    setDescription(CVSUIMessages.AnnotatePreferencePage_AnnotatePrefPageMessage);
    setPreferenceStore(CVSUIPlugin.getPlugin().getPreferenceStore());
  }
  
  public void createControl(Composite parent)
  {
    super.createControl(parent);
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "org.eclipse.team.cvs.ui.annotate_view_context");
  }
  
  public void createFieldEditors()
  {
    binaryPrompt = new RadioGroupFieldEditor("pref_annotate_promptforbinary", CVSUIMessages.AnnotatePreferencePage_AnnotatePrefPageBinaryFileMessage, 3, new String[][] { { CVSUIMessages.CVSPreferencesPage_11, "always" }, { CVSUIMessages.CVSPreferencesPage_12, "never" }, { CVSUIMessages.CVSPreferencesPage_13, "prompt" } }, getFieldEditorParent(), true);
    addField(binaryPrompt);
    
    Dialog.applyDialogFont(getFieldEditorParent());
    getFieldEditorParent().layout(true);
  }
  
  public void init(IWorkbench workbench) {}
  
  public boolean performOk()
  {
    CVSUIPlugin.getPlugin().savePluginPreferences();
    return super.performOk();
  }
}

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

import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.compare.structuremergeviewer.IStructureComparator;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;

class CVSCompareEditorInput$1
  extends Differencer
{
  final CVSCompareEditorInput this$0;
  
  CVSCompareEditorInput$1(CVSCompareEditorInput paramCVSCompareEditorInput)
  {
    this$0 = paramCVSCompareEditorInput;
  }
  
  protected boolean contentsEqual(Object input1, Object input2)
  {
    int compare = this$0.teamEqual(input1, input2);
    if (compare == 0) {
      return true;
    }
    if (compare == 1) {
      return false;
    }
    return super.contentsEqual(input1, input2);
  }
  
  protected void updateProgress(IProgressMonitor progressMonitor, Object node)
  {
    if ((node instanceof ITypedElement))
    {
      ITypedElement element = (ITypedElement)node;
      progressMonitor.subTask(NLS.bind(CVSUIMessages.CompareEditorInput_fileProgress, new String[] { element.getName() }));
      progressMonitor.worked(1);
    }
  }
  
  protected Object[] getChildren(Object input)
  {
    if ((input instanceof IStructureComparator))
    {
      Object[] children = ((IStructureComparator)input).getChildren();
      if (children != null) {
        return children;
      }
    }
    return null;
  }
  
  protected Object visit(Object data, int result, Object ancestor, Object left, Object right)
  {
    return new DiffNode((IDiffContainer)data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
  }
}

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

import org.eclipse.compare.CompareConfiguration;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;

class CVSCompareEditorInput$2
  implements ISelectionChangedListener
{
  final CVSCompareEditorInput this$0;
  
  CVSCompareEditorInput$2(CVSCompareEditorInput paramCVSCompareEditorInput)
  {
    this$0 = paramCVSCompareEditorInput;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    CompareConfiguration cc = this$0.getCompareConfiguration();
    CVSCompareEditorInput.access$0(this$0, cc, (IStructuredSelection)event.getSelection());
  }
}

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

import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.OpenEvent;

class CVSCompareEditorInput$3
  implements IOpenListener
{
  final CVSCompareEditorInput this$0;
  
  CVSCompareEditorInput$3(CVSCompareEditorInput paramCVSCompareEditorInput)
  {
    this$0 = paramCVSCompareEditorInput;
  }
  
  public void open(OpenEvent event)
  {
    ISelection selection = event.getSelection();
    if ((!selection.isEmpty()) && ((selection instanceof IStructuredSelection)))
    {
      Object o = ((IStructuredSelection)selection).getFirstElement();
      if ((o instanceof DiffNode)) {
        this$0.updateLabelsFor((DiffNode)o);
      }
    }
  }
}

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

import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;

class CVSCompareEditorInput$4
  implements IDoubleClickListener
{
  final CVSCompareEditorInput this$0;
  private final Viewer val$viewer;
  
  CVSCompareEditorInput$4(CVSCompareEditorInput paramCVSCompareEditorInput, Viewer paramViewer)
  {
    this$0 = paramCVSCompareEditorInput;val$viewer = paramViewer;
  }
  
  public void doubleClick(DoubleClickEvent event)
  {
    ISelection selection = event.getSelection();
    if ((!selection.isEmpty()) && ((selection instanceof IStructuredSelection)))
    {
      Object o = ((IStructuredSelection)selection).getFirstElement();
      if ((o instanceof DiffNode))
      {
        DiffNode diffNode = (DiffNode)o;
        if (diffNode.hasChildren())
        {
          AbstractTreeViewer atv = (AbstractTreeViewer)val$viewer;
          atv.setExpandedState(o, !atv.getExpandedState(o));
        }
      }
    }
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareEditorInput;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.compare.structuremergeviewer.IStructureComparator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ui.TeamUIPlugin;

public class CVSCompareEditorInput
  extends CompareEditorInput
{
  private ITypedElement left;
  private ITypedElement right;
  private ITypedElement ancestor;
  private Image leftImage;
  private Image rightImage;
  private Image ancestorImage;
  private static final int NODE_EQUAL = 0;
  private static final int NODE_NOT_EQUAL = 1;
  private static final int NODE_UNKNOWN = 2;
  String toolTipText;
  private String title;
  
  public CVSCompareEditorInput(ResourceEditionNode left, ResourceEditionNode right)
  {
    this(left, right, null);
  }
  
  public CVSCompareEditorInput(String title, String toolTip, ResourceEditionNode left, ResourceEditionNode right)
  {
    this(left, right, null);
    this.title = title;
    toolTipText = toolTip;
  }
  
  public CVSCompareEditorInput(ResourceEditionNode left, ResourceEditionNode right, ResourceEditionNode ancestor)
  {
    super(new CompareConfiguration());
    
    this.left = left;
    this.right = right;
    this.ancestor = ancestor;
    if (left != null) {
      leftImage = left.getImage();
    }
    if (right != null) {
      rightImage = right.getImage();
    }
    if (ancestor != null) {
      ancestorImage = ancestor.getImage();
    }
  }
  
  private String getLabel(ITypedElement element)
  {
    if ((element instanceof ResourceEditionNode))
    {
      ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource();
      ICVSResource resource = edition;
      if ((edition instanceof ICVSRemoteFile)) {
        try
        {
          String name = resource.getName();
          String revision = ((ICVSRemoteFile)edition).getRevision();
          String msg = null;
          if (isShowAuthor())
          {
            String author = ((ICVSRemoteFile)edition).getLogEntry(
              new NullProgressMonitor()).getAuthor();
            msg = NLS.bind(CVSUIMessages.nameRevisionAndAuthor, 
              new String[] { name, revision, author });
          }
          return NLS.bind(CVSUIMessages.nameAndRevision, 
            new String[] { name, revision });
        }
        catch (TeamException localTeamException1) {}
      }
      try
      {
        if (edition.isContainer())
        {
          CVSTag tag = ((ICVSRemoteFolder)edition).getTag();
          if (tag == null) {
            return NLS.bind(CVSUIMessages.CVSCompareEditorInput_inHead, new String[] { edition.getName() });
          }
          if (tag.getType() == 1) {
            return NLS.bind(CVSUIMessages.CVSCompareEditorInput_inBranch, new Object[] { edition.getName(), tag.getName() });
          }
          return NLS.bind(CVSUIMessages.CVSCompareEditorInput_repository, new Object[] { edition.getName(), tag.getName() });
        }
        return NLS.bind(CVSUIMessages.CVSCompareEditorInput_repository, new Object[] { edition.getName(), resource.getSyncInfo().getRevision() });
      }
      catch (TeamException e)
      {
        handle(e);
      }
    }
    return element.getName();
  }
  
  private boolean isShowAuthor()
  {
    IPreferenceStore store = TeamUIPlugin.getPlugin().getPreferenceStore();
    return store.getBoolean("org.eclipse.team.ui.show_author_in_compare_editor");
  }
  
  private String getVersionLabel(ITypedElement element)
  {
    if ((element instanceof ResourceEditionNode))
    {
      ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource();
      ICVSResource resource = edition;
      try
      {
        if (edition.isContainer())
        {
          CVSTag tag = ((ICVSRemoteFolder)resource).getTag();
          if (tag == null) {
            return CVSUIMessages.CVSCompareEditorInput_headLabel;
          }
          if (tag.getType() == 1) {
            return NLS.bind(CVSUIMessages.CVSCompareEditorInput_branchLabel, new String[] { tag.getName() });
          }
          return tag.getName();
        }
        return resource.getSyncInfo().getRevision();
      }
      catch (TeamException e)
      {
        handle(e);
      }
    }
    return element.getName();
  }
  
  private String guessResourceName()
  {
    if (left != null) {
      return left.getName();
    }
    if (right != null) {
      return right.getName();
    }
    if (ancestor != null) {
      return ancestor.getName();
    }
    return "";
  }
  
  private Object guessResourcePath()
  {
    if ((left != null) && ((left instanceof ResourceEditionNode))) {
      return ((ResourceEditionNode)left).getRemoteResource().getRepositoryRelativePath();
    }
    if ((right != null) && ((right instanceof ResourceEditionNode))) {
      return ((ResourceEditionNode)right).getRemoteResource().getRepositoryRelativePath();
    }
    if ((ancestor != null) && ((ancestor instanceof ResourceEditionNode))) {
      return ((ResourceEditionNode)ancestor).getRemoteResource().getRepositoryRelativePath();
    }
    return guessResourceName();
  }
  
  private void handle(Exception e)
  {
    Throwable t = e;
    if ((t instanceof InvocationTargetException)) {
      t = ((InvocationTargetException)t).getTargetException();
    }
    IStatus error;
    IStatus error;
    if ((t instanceof CoreException))
    {
      error = ((CoreException)t).getStatus();
    }
    else
    {
      IStatus error;
      if ((t instanceof TeamException)) {
        error = ((TeamException)t).getStatus();
      } else {
        error = new Status(4, "org.eclipse.team.cvs.ui", 1, CVSUIMessages.internal, t);
      }
    }
    setMessage(error.getMessage());
    if (!(t instanceof TeamException)) {
      CVSUIPlugin.log(error.getSeverity(), error.getMessage(), t);
    }
  }
  
  private void initLabels()
  {
    CompareConfiguration cc = getCompareConfiguration();
    setLabels(cc, new StructuredSelection());
    if (title == null) {
      if (ancestor != null)
      {
        title = NLS.bind(CVSUIMessages.CVSCompareEditorInput_titleAncestor, new Object[] { guessResourceName(), getVersionLabel(ancestor), getVersionLabel(left), getVersionLabel(right) });
        toolTipText = NLS.bind(CVSUIMessages.CVSCompareEditorInput_titleAncestor, new Object[] { guessResourcePath(), getVersionLabel(ancestor), getVersionLabel(left), getVersionLabel(right) });
      }
      else
      {
        String leftName = null;
        if (left != null) {
          leftName = left.getName();
        }
        String rightName = null;
        if (right != null) {
          rightName = right.getName();
        }
        if ((leftName != null) && (!leftName.equals(rightName)))
        {
          title = NLS.bind(CVSUIMessages.CVSCompareEditorInput_titleNoAncestorDifferent, new Object[] { leftName, getVersionLabel(left), rightName, getVersionLabel(right) });
        }
        else
        {
          title = NLS.bind(CVSUIMessages.CVSCompareEditorInput_titleNoAncestor, new Object[] { guessResourceName(), getVersionLabel(left), getVersionLabel(right) });
          title = NLS.bind(CVSUIMessages.CVSCompareEditorInput_titleNoAncestor, new Object[] { guessResourcePath(), getVersionLabel(left), getVersionLabel(right) });
        }
      }
    }
    setTitle(title);
  }
  
  private void setLabels(CompareConfiguration cc, IStructuredSelection selection)
  {
    ITypedElement left = this.left;
    ITypedElement right = this.right;
    ITypedElement ancestor = this.ancestor;
    if (left != null)
    {
      cc.setLeftLabel(getLabel(left));
      cc.setLeftImage(leftImage);
    }
    if (right != null)
    {
      cc.setRightLabel(getLabel(right));
      cc.setRightImage(rightImage);
    }
 
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83

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