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

t element, String property)
  {
    Item item = (Item)element;
    if ("mode".equals(property))
    {
      if (mode == 2) {
        return new Integer(0);
      }
      if (mode == 1) {
        return new Integer(1);
      }
    }
    if ((fShowSaveColumn) && ("save".equals(property))) {
      return new Integer(save ? 0 : 1);
    }
    return null;
  }
  
  public boolean canModify(Object element, String property)
  {
    return ("mode".equals(property)) || ((fShowSaveColumn) && ("save".equals(property)));
  }
  
  public void modify(Object element, String property, Object value)
  {
    IStructuredSelection selection = (IStructuredSelection)fTableViewer.getSelection();
    Item item = (Item)selection.getFirstElement();
    if (item == null) {
      return;
    }
    int comboIndex = ((Integer)value).intValue();
    if ("mode".equals(property))
    {
      if (comboIndex == 0) {
        mode = 2;
      }
      if (comboIndex == 1) {
        mode = 1;
      }
    }
    if ((fShowSaveColumn) && ("save".equals(property))) {
      save = (comboIndex == 0);
    }
    fTableViewer.refresh(item);
  }
  
  public Image getColumnImage(Object element, int columnIndex)
  {
    return null;
  }
  
  public String getColumnText(Object element, int columnIndex)
  {
    Item item = (Item)element;
    if (columnIndex == 0)
    {
      String label = ((item instanceof Extension) ? "*." : "") + name;
      label = TextProcessor.process(label, ".*");
      return label;
    }
    if (columnIndex == 1)
    {
      if (mode == 2) {
        return MODES_TEXT[0];
      }
      if (mode == 1) {
        return MODES_TEXT[1];
      }
    }
    if ((columnIndex == 2) && 
      (fShowSaveColumn)) {
      return SAVE_TEXT[1];
    }
    return null;
  }
  
  public void addListener(ILabelProviderListener listener) {}
  
  public void dispose() {}
  
  public boolean isLabelProperty(Object element, String property)
  {
    return false;
  }
  
  public void removeListener(ILabelProviderListener listener) {}
  
  public Object[] getElements(Object inputElement)
  {
    return ((Collection)inputElement).toArray();
  }
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
  
  public IStructuredSelection getSelection()
  {
    return (IStructuredSelection)fTableViewer.getSelection();
  }
  
  public void setInput(List items)
  {
    fItems.clear();
    fItems.addAll(items);
    fTableViewer.refresh();
  }
  
  public TableViewer getViewer()
  {
    return fTableViewer;
  }
}

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

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

class IgnorePreferencePage$1
  implements Listener
{
  final IgnorePreferencePage this$0;
  
  IgnorePreferencePage$1(IgnorePreferencePage paramIgnorePreferencePage)
  {
    this$0 = paramIgnorePreferencePage;
  }
  
  public void handleEvent(Event e)
  {
    IgnorePreferencePage.access$0(this$0);
  }
}

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

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

class IgnorePreferencePage$2
  implements Listener
{
  final IgnorePreferencePage this$0;
  
  IgnorePreferencePage$2(IgnorePreferencePage paramIgnorePreferencePage)
  {
    this$0 = paramIgnorePreferencePage;
  }
  
  public void handleEvent(Event e)
  {
    IgnorePreferencePage.access$1(this$0);
  }
}

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

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

class IgnorePreferencePage$3
  implements Listener
{
  final IgnorePreferencePage this$0;
  
  IgnorePreferencePage$3(IgnorePreferencePage paramIgnorePreferencePage)
  {
    this$0 = paramIgnorePreferencePage;
  }
  
  public void handleEvent(Event e)
  {
    IgnorePreferencePage.access$2(this$0);
  }
}

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

import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

class IgnorePreferencePage$4
  extends InputDialog
{
  final IgnorePreferencePage this$0;
  
  IgnorePreferencePage$4(IgnorePreferencePage paramIgnorePreferencePage, Shell $anonymous0, String $anonymous1, String $anonymous2, String $anonymous3, IInputValidator $anonymous4)
  {
    super($anonymous0, $anonymous1, $anonymous2, $anonymous3, $anonymous4);this$0 = paramIgnorePreferencePage;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Control control = super.createDialogArea(parent);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(control, "org.eclipse.team.ui.ignore_preference_page_context");
    return control;
  }
}

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

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.osgi.util.TextProcessor;
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.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.team.core.IIgnoreInfo;
import org.eclipse.team.core.Team;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class IgnorePreferencePage
  extends PreferencePage
  implements IWorkbenchPreferencePage
{
  private Table ignoreTable;
  private Button addButton;
  private Button removeButton;
  
  public void init(IWorkbench workbench)
  {
    setDescription(TeamUIMessages.IgnorePreferencePage_description);
  }
  
  protected Control createContents(Composite ancestor)
  {
    Composite parent = new Composite(ancestor, 0);
    GridLayout layout = new GridLayout();
    marginWidth = 0;
    marginHeight = 0;
    numColumns = 2;
    parent.setLayout(layout);
    GridData data = new GridData();
    verticalAlignment = 4;
    horizontalAlignment = 4;
    parent.setLayoutData(data);
    
    Label l1 = new Label(parent, 0);
    l1.setText(TeamUIMessages.IgnorePreferencePage_ignorePatterns);
    data = new GridData(2);
    horizontalSpan = 2;
    l1.setLayoutData(data);
    
    ignoreTable = new Table(parent, 2082);
    GridData gd = new GridData(1808);
    
    heightHint = 300;
    ignoreTable.setLayoutData(gd);
    ignoreTable.addListener(13, new Listener()
    {
      public void handleEvent(Event e)
      {
        IgnorePreferencePage.this.handleSelection();
      }
    });
    Composite buttons = new Composite(parent, 0);
    buttons.setLayoutData(new GridData(2));
    layout = new GridLayout();
    marginHeight = 0;
    marginWidth = 0;
    buttons.setLayout(layout);
    
    addButton = new Button(buttons, 8);
    addButton.setText(TeamUIMessages.IgnorePreferencePage_add);
    addButton.addListener(13, new Listener()
    {
      public void handleEvent(Event e)
      {
        IgnorePreferencePage.this.addIgnore();
      }
    });
    removeButton = new Button(buttons, 8);
    removeButton.setText(TeamUIMessages.IgnorePreferencePage_remove);
    removeButton.setEnabled(false);
    removeButton.addListener(13, new Listener()
    {
      public void handleEvent(Event e)
      {
        IgnorePreferencePage.this.removeIgnore();
      }
    });
    fillTable(Team.getAllIgnores());
    Dialog.applyDialogFont(ancestor);
    setButtonLayoutData(addButton);
    setButtonLayoutData(removeButton);
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "org.eclipse.team.ui.ignore_preference_page_context");
    
    return parent;
  }
  
  public boolean performOk()
  {
    int count = ignoreTable.getItemCount();
    String[] patterns = new String[count];
    boolean[] enabled = new boolean[count];
    TableItem[] items = ignoreTable.getItems();
    for (int i = 0; i < count; i++)
    {
      patterns[i] = items[i].getText();
      enabled[i] = items[i].getChecked();
    }
    Team.setAllIgnores(patterns, enabled);
    TeamUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, "org.eclipse.team.uiglobal_ignores_changed", null, null));
    return true;
  }
  
  protected void performDefaults()
  {
    super.performDefaults();
    ignoreTable.removeAll();
    IIgnoreInfo[] ignore = Team.getDefaultIgnores();
    fillTable(ignore);
  }
  
  private void fillTable(IIgnoreInfo[] ignore)
  {
    for (int i = 0; i < ignore.length; i++)
    {
      IIgnoreInfo info = ignore[i];
      TableItem item = new TableItem(ignoreTable, 0);
      item.setText(TextProcessor.process(info.getPattern(), ".*"));
      item.setChecked(info.getEnabled());
    }
  }
  
  private void addIgnore()
  {
    InputDialog dialog = new InputDialog(getShell(), TeamUIMessages.IgnorePreferencePage_enterPatternShort, TeamUIMessages.IgnorePreferencePage_enterPatternLong, null, null)
    {
      protected Control createDialogArea(Composite parent)
      {
        Control control = super.createDialogArea(parent);
        PlatformUI.getWorkbench().getHelpSystem().setHelp(control, "org.eclipse.team.ui.ignore_preference_page_context");
        return control;
      }
    };
    dialog.open();
    if (dialog.getReturnCode() != 0) {
      return;
    }
    String pattern = dialog.getValue();
    if (pattern.equals("")) {
      return;
    }
    TableItem[] items = ignoreTable.getItems();
    for (int i = 0; i < items.length; i++) {
      if (items[i].getText().equals(pattern))
      {
        MessageDialog.openWarning(getShell(), TeamUIMessages.IgnorePreferencePage_patternExistsShort, TeamUIMessages.IgnorePreferencePage_patternExistsLong);
        return;
      }
    }
    TableItem item = new TableItem(ignoreTable, 0);
    item.setText(TextProcessor.process(pattern, ".*"));
    item.setChecked(true);
  }
  
  private void removeIgnore()
  {
    int[] selection = ignoreTable.getSelectionIndices();
    ignoreTable.remove(selection);
  }
  
  private void handleSelection()
  {
    if (ignoreTable.getSelectionCount() > 0) {
      removeButton.setEnabled(true);
    } else {
      removeButton.setEnabled(false);
    }
  }
}

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

import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class ResourceModelPreferencePage
  extends FieldEditorPreferencePage
  implements IWorkbenchPreferencePage, IPreferenceIds
{
  private RadioGroupFieldEditor defaultLayout;
  
  public ResourceModelPreferencePage()
  {
    super(1);
    setTitle(TeamUIMessages.SynchronizationCompareAdapter_0);
    setDescription(TeamUIMessages.ResourceModelPreferencePage_0);
    setPreferenceStore(TeamUIPlugin.getPlugin().getPreferenceStore());
  }
  
  public void createControl(Composite parent)
  {
    super.createControl(parent);
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "org.eclipse.team.ui.resource_model_preference_page_context");
  }
  
  protected void createFieldEditors()
  {
    defaultLayout = new RadioGroupFieldEditor("org.eclipse.team.ui.default_layout", 
      TeamUIMessages.SyncViewerPreferencePage_0, 3, 
      new String[][] {
      { TeamUIMessages.SyncViewerPreferencePage_1, "org.eclipse.team.ui.flay_layout" }, 
      { TeamUIMessages.SyncViewerPreferencePage_2, "org.eclipse.team.ui.tree_layout" }, 
      { TeamUIMessages.SyncViewerPreferencePage_3, "org.eclipse.team.ui.compressed_layout" } }, 
      
      getFieldEditorParent(), true);
    addField(defaultLayout);
  }
  
  public void init(IWorkbench workbench) {}
  
  public boolean performOk()
  {
    TeamUIPlugin.getPlugin().savePluginPreferences();
    return super.performOk();
  }
}

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

import com.ibm.icu.text.Collator;
import java.util.Comparator;
import org.eclipse.ui.IPerspectiveDescriptor;

class SyncViewerPreferencePage$PerspectiveDescriptorComparator
  implements Comparator
{
  SyncViewerPreferencePage$PerspectiveDescriptorComparator(PerspectiveDescriptorComparator paramPerspectiveDescriptorComparator)
  {
    this();
  }
  
  public int compare(Object o1, Object o2)
  {
    if (((o1 instanceof IPerspectiveDescriptor)) && ((o2 instanceof IPerspectiveDescriptor)))
    {
      String id1 = ((IPerspectiveDescriptor)o1).getLabel();
      String id2 = ((IPerspectiveDescriptor)o2).getLabel();
      return Collator.getInstance().compare(id1, id2);
    }
    return 0;
  }
  
  private SyncViewerPreferencePage$PerspectiveDescriptorComparator() {}
}

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

import com.ibm.icu.text.Collator;
import java.util.Arrays;
import java.util.Comparator;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IPerspectiveRegistry;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class SyncViewerPreferencePage
  extends FieldEditorPreferencePage
  implements IWorkbenchPreferencePage, IPreferenceIds
{
  private BooleanFieldEditor showSyncInLabels = null;
  private RadioGroupFieldEditor synchronizePerspectiveSwitch = null;
  private RadioGroupFieldEditor defaultLayout = null;
  private boolean includeDefaultLayout = true;
  
  private static class PerspectiveDescriptorComparator
    implements Comparator
  {
    PerspectiveDescriptorComparator(PerspectiveDescriptorComparator paramPerspectiveDescriptorComparator)
    {
      this();
    }
    
    public int compare(Object o1, Object o2)
    {
      if (((o1 instanceof IPerspectiveDescriptor)) && ((o2 instanceof IPerspectiveDescriptor)))
      {
        String id1 = ((IPerspectiveDescriptor)o1).getLabel();
        String id2 = ((IPerspectiveDescriptor)o2).getLabel();
        return Collator.getInstance().compare(id1, id2);
      }
      return 0;
    }
    
    private PerspectiveDescriptorComparator() {}
  }
  
  public SyncViewerPreferencePage()
  {
    super(1);
    setTitle(TeamUIMessages.SyncViewerPreferencePage_6);
    setDescription(TeamUIMessages.SyncViewerPreferencePage_7);
    setPreferenceStore(TeamUIPlugin.getPlugin().getPreferenceStore());
  }
  
  public void createControl(Composite parent)
  {
    super.createControl(parent);
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "org.eclipse.team.ui.sync_preference_page_context");
  }
  
  public void createFieldEditors()
  {
    showSyncInLabels = new BooleanFieldEditor("org.eclipse.team.ui.view_syncinfo_in_label", TeamUIMessages.SyncViewerPreferencePage_19, 0, getFieldEditorParent());
    addField(showSyncInLabels);
    
    addField(new BooleanFieldEditor(
      "org.eclipse.team.ui.show_author_in_compare_editor", 
      TeamUIMessages.SyncViewerPreferencePage_43, 
      0, 
      getFieldEditorParent()));
    
    addField(new BooleanFieldEditor(
      "org.eclipse.team.ui.validate_edit_with_no_context", 
      TeamUIMessages.SyncViewerPreferencePage_44, 
      0, 
      getFieldEditorParent()));
    
    addField(new BooleanFieldEditor(
      "org.eclipse.team.ui.reuse_open_compare_editors", 
      TeamUIMessages.SyncViewerPreferencePage_45, 
      0, 
      getFieldEditorParent()));
    
    addField(new BooleanFieldEditor(
      "org.eclipse.team.ui.run_import_in_background_", 
      TeamUIMessages.SyncViewerPreferencePage_46, 
      0, 
      getFieldEditorParent()));
    
    addField(new BooleanFieldEditor(
      "org.eclipse.team.ui.apply_patch_in_sychronize_view", 
      TeamUIMessages.SyncViewerPreferencePage_47, 
      0, 
      getFieldEditorParent()));
    if (isIncludeDefaultLayout())
    {
      defaultLayout = new RadioGroupFieldEditor("org.eclipse.team.ui.default_layout", 
        TeamUIMessages.SyncViewerPreferencePage_0, 3, 
        new String[][] {
        { TeamUIMessages.SyncViewerPreferencePage_1, "org.eclipse.team.ui.flay_layout" }, 
        { TeamUIMessages.SyncViewerPreferencePage_2, "org.eclipse.team.ui.tree_layout" }, 
        { TeamUIMessages.SyncViewerPreferencePage_3, "org.eclipse.team.ui.compressed_layout" } }, 
        
        getFieldEditorParent(), true);
      addField(defaultLayout);
    }
    synchronizePerspectiveSwitch = new RadioGroupFieldEditor("org.eclipse.team.ui.sychronizing_default_perspective_to_show", TeamUIMessages.SyncViewerPreferencePage_13, 3, 
      new String[][] {
      { TeamUIMessages.SyncViewerPreferencePage_14, "always" }, 
      { TeamUIMessages.SyncViewerPreferencePage_42, "never" }, 
      { TeamUIMessages.SyncViewerPreferencePage_16, "prompt" } }, 
      
      getFieldEditorParent(), true);
    addField(synchronizePerspectiveSwitch);
    
    Group perspectiveGroup = createGroup(getFieldEditorParent(), TeamUIMessages.SyncViewerPreferencePage_15);
    
    createLabel(perspectiveGroup, TeamUIMessages.SynchronizationViewPreference_defaultPerspectiveDescription, 1);
    
    handleDeletedPerspectives();
    String[][] perspectiveNamesAndIds = getPerspectiveNamesAndIds();
    ComboFieldEditor comboEditor = new ComboFieldEditor(
      "org.eclipse.team.ui.syncview_default_perspective", 
      TeamUIMessages.SynchronizationViewPreference_defaultPerspectiveLabel, 
      perspectiveNamesAndIds, 
      perspectiveGroup);
    addField(comboEditor);
    
    Dialog.applyDialogFont(getFieldEditorParent());
    updateLayout(perspectiveGroup);
    getFieldEditorParent().layout(true);
  }
  
  private Label createLabel(Composite parent, String title, int spacer)
  {
    Label l = new Label(parent, 64);
    l.setFont(parent.getFont());
    GridData data = new GridData();
    horizontalSpan = 2;
    if (spacer != 0) {
      verticalSpan = spacer;
    }
    horizontalAlignment = 4;
    l.setLayoutData(data);
    if (title != null) {
      l.setText(title);
    }
    return l;
  }
  
  private Group createGroup(Composite parent, String title)
  {
    Group display = new Group(parent, 0);
    updateLayout(display);
    GridData data = new GridData();
    horizontalSpan = 2;
    horizontalAlignment = 4;
    display.setLayoutData(data);
    display.setText(title);
    return display;
  }
  
  private void updateLayout(Composite composite)
  {
    GridLayout layout = new GridLayout();
    numColumns = 2;
    marginWidth = 5;
    marginHeight = 5;
    horizontalSpacing = 5;
    verticalSpacing = 5;
    composite.setLayout(layout);
  }
  
  public void init(IWorkbench workbench) {}
  
  public void propertyChange(PropertyChangeEvent event)
  {
    super.propertyChange(event);
  }
  
  public boolean performOk()
  {
    TeamUIPlugin.getPlugin().savePluginPreferences();
    return super.performOk();
  }
  
  protected void initialize()
  {
    super.initialize();
    updateEnablements();
  }
  
  protected void updateEnablements() {}
  
  private String[][] getPerspectiveNamesAndIds()
  {
    IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry();
    IPerspectiveDescriptor[] perspectiveDescriptors = registry.getPerspectives();
    
    Arrays.sort(perspectiveDescriptors, new PerspectiveDescriptorComparator(null));
    
    String[][] table = new String[perspectiveDescriptors.length + 1][2];
    table[0][0] = TeamUIMessages.SynchronizationViewPreference_defaultPerspectiveNone;
    table[0][1] = "org.eclipse.team.ui.sync_view_perspective_none";
    for (int i = 0; i < perspectiveDescriptors.length; i++)
    {
      table[(i + 1)][0] = perspectiveDescriptors[i].getLabel();
      table[(i + 1)][1] = perspectiveDescriptors[i].getId();
    }
    return table;
  }
  
  private static void handleDeletedPerspectives()
  {
    IPreferenceStore store = TeamUIPlugin.getPlugin().getPreferenceStore();
    String id = store.getString("org.eclipse.team.ui.syncview_default_perspective");
    if (PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id) == null) {
      store.putValue("org.eclipse.team.ui.syncview_default_perspective", "org.eclipse.team.ui.sync_view_perspective_none");
    }
  }
  
  public boolean isIncludeDefaultLayout()
  {
    return includeDefaultLayout;
  }
  
  public void setIncludeDefaultLayout(boolean includeDefaultLayout)
  {
    this.includeDefaultLayout = includeDefaultLayout;
  }
}

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

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

class TextPreferencePage$1
  implements Listener
{
  final TextPreferencePage this$0;
  
  TextPreferencePage$1(TextPreferencePage paramTextPreferencePage)
  {
    this$0 = paramTextPreferencePage;
  }
  
  public void handleEvent(Event e)
  {
    this$0.handleSelection();
  }
}

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

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.TableViewer;

class TextPreferencePage$2
  implements IDoubleClickListener
{
  final TextPreferencePage this$0;
  
  TextPreferencePage$2(TextPreferencePage paramTextPreferencePage)
  {
    this$0 = paramTextPreferencePage;
  }
  
  public void doubleClick(DoubleClickEvent event)
  {
    ISelection selection = event.getSelection();
    if ((selection == null) || (!(selection instanceof IStructuredSelection))) {
      return;
    }
    this$0.fTable.getViewer().editElement(((IStructuredSelection)selection).getFirstElement(), 1);
  }
}

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

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

class TextPreferencePage$3
  implements Listener
{
  final TextPreferencePage this$0;
  
  TextPreferencePage$3(TextPreferencePage paramTextPreferencePage)
  {
    this$0 = paramTextPreferencePage;
  }
  
  public void handleEvent(Event e)
  {
    this$0.addExtension();
  }
}

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

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

class TextPreferencePage$4
  implements Listener
{
  final TextPreferencePage this$0;
  
  TextPreferencePage$4(TextPreferencePage paramTextPreferencePage)
  {
    this$0 = paramTextPreferencePage;
  }
  
  public void handleEvent(Event e)
  {
    this$0.addName();
  }
}

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

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

class TextPreferencePage$5
  implements Listener
{
  final TextPreferencePage this$0;
  
  TextPreferencePage$5(TextPreferencePage paramTextPreferencePage)
  {
    this$0 = paramTextPreferencePage;
  }
  
  public void handleEvent(Event e)
  {
    this$0.changePattern();
  }
}

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

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

class TextPreferencePage$6
  implements Listener
{
  final TextPreferencePage this$0;
  
  TextPreferencePage$6(TextPreferencePage paramTextPreferencePage)
  {
    this$0 = paramTextPreferencePage;
  }
  
  public void handleEvent(Event e)
  {
    this$0.removePattern();
  }
}

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

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

final class TextPreferencePage$ExtensionValidator
  implements IInputValidator
{
  TextPreferencePage$ExtensionValidator(ExtensionValidator paramExtensionValidator)
  {
    this();
  }
  
  public String isValid(String newText)
  {
    if (newText.trim().length() == 0) {
      return "";
    }
    if (!isComplete(newText)) {
      return TeamUIMessages.TextPreferencePage_ExtensionNotCompleted;
    }
    newText = strip(newText);
    if (newText.indexOf('*') >= 0) {
      return TeamUIMessages.TextPreferencePage_2;
    }
    if (newText.indexOf('.') >= 0) {
      return TeamUIMessages.TextPreferencePage_3;
    }
    return null;
  }
  
  public String strip(String newText)
  {
    newText = newText.trim();
    if (newText.startsWith("*")) {
      newText = newText.substring(1);
    }
    if (newText.startsWith(".")) {
      newText = newText.substring(1);
    }
    return newText;
  }
  
  public boolean isComplete(String text)
  {
    if ((text.equals("*")) || (text.equals("*.")) || (text.equals("."))) {
      return false;
    }
    return true;
  }
  
  private TextPreferencePage$ExtensionValidator() {}
}

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

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

final class TextPreferencePage$FilenameValidator
  implements IInputValidator
{
  TextPreferencePage$FilenameValidator(FilenameValidator paramFilenameValidator)
  {
    this();
  }
  
  public String isValid(String newText)
  {
    if (newText.trim().length() == 0) {
      return "";
    }
    if (newText.indexOf('*') >= 0) {
      return TeamUIMessages.TextPreferencePage_5;
    }
    return null;
  }
  
  private TextPreferencePage$FilenameValidator() {}
}

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

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.util.PropertyChangeEvent;
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.TableViewer;
import org.eclipse.swt.layout.GridData;
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.Listener;
import org.eclipse.team.core.IFileContentManager;
import org.eclipse.team.core.IStringMapping;
import org.eclipse.team.core.Team;
import org.eclipse.team.internal.ui.PixelConverter;
import org.eclipse.team.internal.ui.SWTUtils;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class TextPreferencePage
  extends PreferencePage
  implements IWorkbenchPreferencePage
{
  private final List fItems;
  private Button fRemoveButton;
  private Button fChangeButton;
  protected FileTypeTable fTable;
  
  private static final class ExtensionValidator
    implements IInputValidator
  {
    ExtensionValidator(ExtensionValidator paramExtensionValidator)
    {
      this();
    }
    
    public String isValid(String newText)
    {
      if (newText.trim().length() == 0) {
        return "";
      }
      if (!isComplete(newText)) {
        return TeamUIMessages.TextPreferencePage_ExtensionNotCompleted;
      }
      newText = strip(newText);
      if (newText.indexOf('*') >= 0) {
        return TeamUIMessages.TextPreferencePage_2;
      }
      if (newText.indexOf('.') >= 0) {
        return TeamUIMessages.TextPreferencePage_3;
      }
      return null;
    }
    
    public String strip(String newText)
    {
      newText = newText.trim();
      if (newText.startsWith("*")) {
        newText = newText.substring(1);
      }
      if (newText.startsWith(".")) {
        newText = newText.substring(1);
      }
      return newText;
    }
    
    public boolean isComplete(String text)
    {
      if ((text.equals("*")) || (text.equals("*.")) || (text.equals("."))) {
        return false;
      }
      return true;
    }
    
    private ExtensionValidator() {}
  }
  
  private static final class FilenameValidator
    implements IInputValidator
  {
    FilenameValidator(FilenameValidator paramFilenameValidator)
    {
      this();
    }
    
    public String isValid(String newText)
    {
      if (newText.trim().length() == 0) {
        return "";
      }
      if (newText.indexOf('*') >= 0) {
        return TeamUIMessages.TextPreferencePage_5;
      }
      return null;
    }
    
    private FilenameValidator() {}
  }
  
  public TextPreferencePage()
  {
    fItems = new ArrayList();
    initializeItems();
  }
  
  private void initializeItems()
  {
    fItems.clear();
    
    IFileContentManager manager = Team.getFileContentManager();
    
    IStringMapping[] extensionInfoArray = manager.getExtensionMappings();
    IStringMapping[] nameInfoArray = manager.getNameMappings();
    
    Set fPluginNames = makeSetOfStrings(manager.getDefaultNameMappings());
    Set fPluginExtensions = makeSetOfStrings(manager.getDefaultExtensionMappings());
    for (int i = 0; i < extensionInfoArray.length; i++)
    {
      IStringMapping info = extensionInfoArray[i];
      FileTypeTable.Extension extension = new FileTypeTable.Extension(info.getString(), fPluginExtensions.contains(info.getString()));
      mode = info.getType();
      fItems.add(extension);
    }
    for (int i = 0; i < nameInfoArray.length; i++)
    {
      IStringMapping info = nameInfoArray[i];
      FileTypeTable.Name name = new FileTypeTable.Name(info.getString(), fPluginNames.contains(info.getString()));
      mode = info.getType();
      fItems.add(name);
    }
  }
  
  private static Set makeSetOfStrings(IStringMapping[] mappings)
  {
    Set set = new HashSet(mappings.length);
    for (int i = 0; i < mappings.length; i++) {
      set.add(mappings[i].getString());
    }
    return set;
  }
  
  public void init(IWorkbench workbench) {}
  
  protected Control createContents(Composite parent)
  {
    initializeDialogUnits(parent);
    
    PixelConverter converter = SWTUtils.createDialogPixelConverter(parent);
    
    Composite composite = SWTUtils.createHVFillComposite(parent, 0, 2);
    
    fTable = new FileTypeTable(composite, fItems, false);
    
    fTable.getViewer().getControl().addListener(13, new Listener()
    {
      public void handleEvent(Event e)
      {
        handleSelection();
      }
    });
    fTable.getViewer().addDoubleClickListener(new IDoubleClickListener()
    {
      public void doubleClick(DoubleClickEvent event)
      {
        ISelection selection = event.getSelection();
        if ((selection == null) || (!(selection instanceof IStructuredSelection))) {
          return;
        }
        fTable.getViewer().editElement(((IStructuredSelection)selection).getFirstElement(), 1);
      }
    });
    Composite buttonsComposite = new Composite(composite, 0);
    buttonsComposite.setLayoutData(new GridData(4, 128, false, false));
    buttonsComposite.setLayout(SWTUtils.createGridLayout(1, converter, 0));
    
    Button addExtensionButton = new Button(buttonsComposite, 8);
    addExtensionButton.setText(TeamUIMessages.TextPreferencePage_add);
    Button addNameButton = new Button(buttonsComposite, 8);
    addNameButton.setText(TeamUIMessages.TextPreferencePage_0);
    fChangeButton = new Button(buttonsComposite, 8);
    fChangeButton.setText(TeamUIMessages.TextPreferencePage_change);
    fRemoveButton = new Button(buttonsComposite, 8);
    fRemoveButton.setText(TeamUIMessages.TextPreferencePage_remove);
    
    SWTUtils.createLabel(composite, TeamUIMessages.TextPreferencePage_1, 2);
    
    applyDialogFont(composite);
    int buttonWidth = SWTUtils.calculateControlSize(converter, new Button[] { addExtensionButton, addNameButton, fChangeButton, fRemoveButton });
    addExtensionButton.setLayoutData(SWTUtils.createGridData(buttonWidth, -1, 4, 4, false, false));
    addNameButton.setLayoutData(SWTUtils.createGridData(buttonWidth, -1, 4, 4, false, false));
    fChangeButton.setLayoutData(SWTUtils.createGridData(buttonWidth, -1, 4, 4, false, false));
    fRemoveButton.setLayoutData(SWTUtils.createGridData(buttonWidth, -1, 4, 4, false, false));
    
    addExtensionButton.addListener(13, new Listener()
    {
      public void handleEvent(Event e)
      {
        addExtension();
      }
    });
    addNameButton.addListener(13, new Listener()
    {
      public void handleEvent(Event e)
      {
        addName();
      }
    });
    fChangeButton.setEnabled(false);
    fChangeButton.addListener(13, new Listener()
    {
      public void handleEvent(Event e)
      {
        changePattern();
      }
    });
    fRemoveButton.setEnabled(false);
    fRemoveButton.addListener(13, new Listener()
    {
      public void handleEvent(Event e)
      {
        removePattern();
      }
    });
    Dialog.applyDialogFont(parent);
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "org.eclipse.team.ui.file_type_preference_page_context");
    
    return composite;
  }
  
  protected void performDefaults()
  {
    super.performDefaults();
    initializeItems();
    if (fTable != null) {
      fTable.getViewer().refresh();
    }
  }
  
  public boolean performOk()
  {
    ArrayList extensionsList = new ArrayList();
    ArrayList extensionsModesList = new ArrayList();
    
    ArrayList namesList = new ArrayList();
    ArrayList namesModesList = new ArrayList();
    for (Iterator iter = fItems.iterator(); iter.hasNext();)
    {
      FileTypeTable.Item item = (FileTypeTable.Item)iter.next();
      if ((item instanceof FileTypeTable.Extension))
      {
        extensionsList.add(name);
        extensionsModesList.add(new Integer(mode));
      }
      else if ((item instanceof FileTypeTable.Name))
      {
        namesList.add(name);
        namesModesList.add(new Integer(mode));
      }
    }
    String[] extensions = (String[])extensionsList.toArray(new String[extensionsList.size()]);
    String[] names = (String[])namesList.toArray(new String[namesList.size()]);
    
    int[] extensionsModes = integerListToIntArray(extensionsModesList);
    int[] namesModes = integerListToIntArray(namesModesList);
    
    Team.getFileContentManager().setExtensionMappings(extensions, extensionsModes);
    Team.getFileContentManager().setNameMappings(names, namesModes);
    
    TeamUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, "org.eclipse.team.uiglobal_file_types_changed", null, null));
    
    return true;
  }
  
  private static int[] integerListToIntArray(List integers)
  {
    int[] array = new int[integers.size()];
    int index = 0;
    for (Iterator iter = integers.iterator(); iter.hasNext();) {
      array[(index++)] = ((Integer)iter.next()).intValue();
    }
    return array;
  }
  
  void addExtension()
  {
    ExtensionValidator validator = new ExtensionValidator(null);
    InputDialog dialog = new InputDialog(getShell(), TeamUIMessages.TextPreferencePage_enterExtensionShort, TeamUIMessages.TextPreferencePage_enterExtensionLong, null, validator);
    if (dialog.open() != 0) {
      return;
    }
    String extension = validator.strip(dialog.getValue());
    
    Iterator it = fItems.iterator();
    while (it.hasNext())
    {
      FileTypeTable.Item item = (FileTypeTable.Item)it.next();
      if (((item instanceof FileTypeTable.Extension)) && (name.equals(extension)))
      {
        MessageDialog.openWarning(getShell(), TeamUIMessages.TextPreferencePage_extensionExistsShort, TeamUIMessages.TextPreferencePage
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