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

16:47:58.623 INFO  jd.cli.Main - Decompiling org.eclipse.team.ui_3.6.101.R37x_v20111109-0800.jar
package org.eclipse.team.internal.ui;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;

class DefaultUIFileModificationValidator$1
  implements Runnable
{
  final DefaultUIFileModificationValidator this$0;
  private final boolean[] val$ok;
  private final Shell val$shell;
  private final IFile[] val$readOnlyFiles;
  
  DefaultUIFileModificationValidator$1(DefaultUIFileModificationValidator paramDefaultUIFileModificationValidator, boolean[] paramArrayOfBoolean, Shell paramShell, IFile[] paramArrayOfIFile)
  {
    this$0 = paramDefaultUIFileModificationValidator;val$ok = paramArrayOfBoolean;val$shell = paramShell;val$readOnlyFiles = paramArrayOfIFile;
  }
  
  public void run()
  {
    val$ok[0] = MessageDialog.openQuestion(val$shell, TeamUIMessages.DefaultUIFileModificationValidator_3, NLS.bind(TeamUIMessages.DefaultUIFileModificationValidator_4, new String[] { val$readOnlyFiles[0].getFullPath().toString() }));
  }
}

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

import org.eclipse.core.resources.IFile;
import org.eclipse.swt.widgets.Shell;

class DefaultUIFileModificationValidator$2
  implements Runnable
{
  final DefaultUIFileModificationValidator this$0;
  private final boolean[] val$ok;
  private final Shell val$shell;
  private final IFile[] val$readOnlyFiles;
  
  DefaultUIFileModificationValidator$2(DefaultUIFileModificationValidator paramDefaultUIFileModificationValidator, boolean[] paramArrayOfBoolean, Shell paramShell, IFile[] paramArrayOfIFile)
  {
    this$0 = paramDefaultUIFileModificationValidator;val$ok = paramArrayOfBoolean;val$shell = paramShell;val$readOnlyFiles = paramArrayOfIFile;
  }
  
  public void run()
  {
    val$ok[0] = DefaultUIFileModificationValidator.FileListDialog.openQuestion(val$shell, val$readOnlyFiles);
  }
}

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

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.dialogs.DetailsDialog;

public class DefaultUIFileModificationValidator$FileListDialog
  extends DetailsDialog
{
  private final IFile[] files;
  
  public static boolean openQuestion(Shell shell, IFile[] files)
  {
    FileListDialog dialog = new FileListDialog(shell, files);
    int code = dialog.open();
    return code == 0;
  }
  
  public DefaultUIFileModificationValidator$FileListDialog(Shell parentShell, IFile[] files)
  {
    super(parentShell, TeamUIMessages.DefaultUIFileModificationValidator_0);
    this.files = files;
    setImageKey("dialog_warning_image");
  }
  
  protected void createMainDialogArea(Composite parent)
  {
    createWrappingLabel(parent, TeamUIMessages.DefaultUIFileModificationValidator_1);
  }
  
  protected Composite createDropDownDialogArea(Composite parent)
  {
    Composite composite = createComposite(parent);
    createWrappingLabel(composite, TeamUIMessages.DefaultUIFileModificationValidator_2);
    List fileList = new List(composite, 2818);
    GridData data = new GridData();
    heightHint = 75;
    horizontalAlignment = 4;
    grabExcessHorizontalSpace = true;
    fileList.setLayoutData(data);
    fileList.setFont(parent.getFont());
    for (int i = 0; i < files.length; i++) {
      fileList.add(files[i].getFullPath().toString());
    }
    return composite;
  }
  
  protected void updateEnablements() {}
  
  protected boolean includeCancelButton()
  {
    return false;
  }
  
  protected boolean includeOkButton()
  {
    return false;
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    createButton(parent, 2, IDialogConstants.YES_LABEL, true);
    createButton(parent, 3, IDialogConstants.NO_LABEL, true);
    super.createButtonsForButtonBar(parent);
  }
  
  protected void buttonPressed(int id)
  {
    if (2 == id) {
      okPressed();
    } else if (3 == id) {
      cancelPressed();
    } else {
      super.buttonPressed(id);
    }
  }
}

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

import java.util.ArrayList;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourceAttributes;
import org.eclipse.core.resources.team.FileModificationValidationContext;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.core.DefaultFileModificationValidator;
import org.eclipse.team.internal.ui.dialogs.DetailsDialog;

public class DefaultUIFileModificationValidator
  extends DefaultFileModificationValidator
{
  public static class FileListDialog
    extends DetailsDialog
  {
    private final IFile[] files;
    
    public static boolean openQuestion(Shell shell, IFile[] files)
    {
      FileListDialog dialog = new FileListDialog(shell, files);
      int code = dialog.open();
      return code == 0;
    }
    
    public FileListDialog(Shell parentShell, IFile[] files)
    {
      super(TeamUIMessages.DefaultUIFileModificationValidator_0);
      this.files = files;
      setImageKey("dialog_warning_image");
    }
    
    protected void createMainDialogArea(Composite parent)
    {
      createWrappingLabel(parent, TeamUIMessages.DefaultUIFileModificationValidator_1);
    }
    
    protected Composite createDropDownDialogArea(Composite parent)
    {
      Composite composite = createComposite(parent);
      createWrappingLabel(composite, TeamUIMessages.DefaultUIFileModificationValidator_2);
      org.eclipse.swt.widgets.List fileList = new org.eclipse.swt.widgets.List(composite, 2818);
      GridData data = new GridData();
      heightHint = 75;
      horizontalAlignment = 4;
      grabExcessHorizontalSpace = true;
      fileList.setLayoutData(data);
      fileList.setFont(parent.getFont());
      for (int i = 0; i < files.length; i++) {
        fileList.add(files[i].getFullPath().toString());
      }
      return composite;
    }
    
    protected void updateEnablements() {}
    
    protected boolean includeCancelButton()
    {
      return false;
    }
    
    protected boolean includeOkButton()
    {
      return false;
    }
    
    protected void createButtonsForButtonBar(Composite parent)
    {
      createButton(parent, 2, IDialogConstants.YES_LABEL, true);
      createButton(parent, 3, IDialogConstants.NO_LABEL, true);
      super.createButtonsForButtonBar(parent);
    }
    
    protected void buttonPressed(int id)
    {
      if (2 == id) {
        okPressed();
      } else if (3 == id) {
        cancelPressed();
      } else {
        super.buttonPressed(id);
      }
    }
  }
  
  public IStatus validateEdit(IFile[] allFiles, FileModificationValidationContext context)
  {
    IFile[] readOnlyFiles = getReadOnlyFiles(allFiles);
    if ((readOnlyFiles.length > 0) && (context != null))
    {
      Shell shell = getShell(context);
      boolean[] ok = new boolean[1];
      if (readOnlyFiles.length == 1) {
        shell.getDisplay().syncExec(new Runnable()
        {
          private final boolean[] val$ok;
          private final Shell val$shell;
          private final IFile[] val$readOnlyFiles;
          
          public void run()
          {
            val$ok[0] = MessageDialog.openQuestion(val$shell, TeamUIMessages.DefaultUIFileModificationValidator_3, NLS.bind(TeamUIMessages.DefaultUIFileModificationValidator_4, new String[] { val$readOnlyFiles[0].getFullPath().toString() }));
          }
        });
      } else {
        shell.getDisplay().syncExec(new Runnable()
        {
          private final boolean[] val$ok;
          private final Shell val$shell;
          private final IFile[] val$readOnlyFiles;
          
          public void run()
          {
            val$ok[0] = DefaultUIFileModificationValidator.FileListDialog.openQuestion(val$shell, val$readOnlyFiles);
          }
        });
      }
      if (ok[0] != 0) {
        setWritable(readOnlyFiles);
      }
    }
    else if ((readOnlyFiles.length > 0) && (context == null) && 
      (isMakeWrittableWhenContextNotProvided()))
    {
      setWritable(readOnlyFiles);
    }
    return getStatus(readOnlyFiles);
  }
  
  private Shell getShell(FileModificationValidationContext context)
  {
    if (context.getShell() != null) {
      return (Shell)context.getShell();
    }
    return Utils.getShell(null, true);
  }
  
  public IStatus validateSave(IFile file)
  {
    if ((file.isReadOnly()) && (isMakeWrittableWhenContextNotProvided()))
    {
      IFile[] readOnlyFiles = { file };
      setWritable(readOnlyFiles);
      return getStatus(readOnlyFiles);
    }
    return getDefaultStatus(file);
  }
  
  private boolean isMakeWrittableWhenContextNotProvided()
  {
    return TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean("org.eclipse.team.ui.validate_edit_with_no_context");
  }
  
  private IFile[] getReadOnlyFiles(IFile[] files)
  {
    java.util.List result = new ArrayList();
    for (int i = 0; i < files.length; i++)
    {
      IFile file = files[i];
      if (file.isReadOnly()) {
        result.add(file);
      }
    }
    return (IFile[])result.toArray(new IFile[result.size()]);
  }
  
  protected IStatus setWritable(IFile[] files)
  {
    for (int i = 0; i < files.length; i++)
    {
      IFile file = files[i];
      ResourceAttributes attributes = file.getResourceAttributes();
      if (attributes != null) {
        attributes.setReadOnly(false);
      }
      try
      {
        file.setResourceAttributes(attributes);
      }
      catch (CoreException e)
      {
        return e.getStatus();
      }
    }
    return Status.OK_STATUS;
  }
}

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

public abstract interface IHelpContextIds
{
  public static final String PREFIX = "org.eclipse.team.ui.";
  public static final String CONFIGURE_REFRESH_SCHEDULE_DIALOG = "org.eclipse.team.ui.configre_refresh_schedule_dialog_context";
  public static final String IGNORE_PREFERENCE_PAGE = "org.eclipse.team.ui.ignore_preference_page_context";
  public static final String MODEL_PREFERENCE_PAGE = "org.eclipse.team.ui.model_preference_page_context";
  public static final String FILE_TYPE_PREFERENCE_PAGE = "org.eclipse.team.ui.file_type_preference_page_context";
  public static final String SYNC_PREFERENCE_PAGE = "org.eclipse.team.ui.sync_preference_page_context";
  public static final String SYNC_STARTUP_PREFERENCE_PAGE = "org.eclipse.team.ui.sync_startup_preference_page_context";
  public static final String RESOURCE_MODEL_PREFERENCE_PAGE = "org.eclipse.team.ui.resource_model_preference_page_context";
  public static final String SHARE_PROJECT_PAGE = "org.eclipse.team.ui.share_project_page_context";
  public static final String IMPORT_PROJECT_SET_PAGE = "org.eclipse.team.ui.import_project_set_page_context";
  public static final String EXPORT_PROJECT_SET_PAGE = "org.eclipse.team.ui.export_project_set_page_context";
  public static final String SYNC_RESOURCE_SELECTION_PAGE = "org.eclipse.team.ui.sync_resource_selection_page_context";
  public static final String REFRESH_WIZARD_SELECTION_PAGE = "org.eclipse.team.ui.refresh_wizard_selection_page_context";
  public static final String TARGET_CATCHUP_RELEASE_VIEWER = "org.eclipse.team.ui.target_catchup_release_viewer_context";
  public static final String SYNC_GET_ACTION = "org.eclipse.team.ui.sync_get_action_context";
  public static final String SYNC_PUT_ACTION = "org.eclipse.team.ui.sync_put_action_context";
  public static final String SITE_EXPLORER_VIEW = "org.eclipse.team.ui.site_explorer_view_context";
  public static final String SYNC_VIEW = "org.eclipse.team.ui.sync_view_context";
  public static final String LOCAL_HISTORY_PAGE = "org.eclipse.team.ui.local_history_context";
  public static final String ADD_SITE_ACTION = "org.eclipse.team.ui.add_site_action_context";
  public static final String NEW_FOLDER_ACTION = "org.eclipse.team.ui.new_folder_action_context";
  public static final String OPEN_ACTION = "org.eclipse.team.ui.open_action_context";
  public static final String EXPANDALL_ACTION = "org.eclipse.team.ui.expandall_action_context";
  public static final String REMOVE_ACTION = "org.eclipse.team.ui.remove_action_context";
  public static final String NAVIGATOR_SHOW_ACTION = "org.eclipse.team.ui.navigator_show_action_context";
}

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

public abstract interface IPreferenceIds
{
  public static final String PREFIX = "org.eclipse.team.ui.";
  public static final String SYNCVIEW_DEFAULT_LAYOUT = "org.eclipse.team.ui.default_layout";
  public static final String FLAT_LAYOUT = "org.eclipse.team.ui.flay_layout";
  public static final String COMPRESSED_LAYOUT = "org.eclipse.team.ui.compressed_layout";
  public static final String TREE_LAYOUT = "org.eclipse.team.ui.tree_layout";
  public static final String SYNCVIEW_COMPRESS_FOLDERS = "org.eclipse.team.ui.compress_folders";
  public static final String SYNCVIEW_VIEW_SYNCINFO_IN_LABEL = "org.eclipse.team.ui.view_syncinfo_in_label";
  public static final String SHOW_AUTHOR_IN_COMPARE_EDITOR = "org.eclipse.team.ui.show_author_in_compare_editor";
  public static final String MAKE_FILE_WRITTABLE_IF_CONTEXT_MISSING = "org.eclipse.team.ui.validate_edit_with_no_context";
  public static final String REUSE_OPEN_COMPARE_EDITOR = "org.eclipse.team.ui.reuse_open_compare_editors";
  public static final String RUN_IMPORT_IN_BACKGROUND = "org.eclipse.team.ui.run_import_in_background_";
  public static final String APPLY_PATCH_IN_SYNCHRONIZE_VIEW = "org.eclipse.team.ui.apply_patch_in_sychronize_view";
  public static final String SYNCVIEW_DEFAULT_PERSPECTIVE = "org.eclipse.team.ui.syncview_default_perspective";
  public static final String SYNCVIEW_DEFAULT_PERSPECTIVE_NONE = "org.eclipse.team.ui.sync_view_perspective_none";
  public static final String SYNCHRONIZING_COMPLETE_PERSPECTIVE = "org.eclipse.team.ui.sychronizing_default_perspective_to_show";
  public static final String SYNCHRONIZING_DEFAULT_PARTICIPANT = "org.eclipse.team.ui.sychronizing_default_participant";
  public static final String SYNCHRONIZING_DEFAULT_PARTICIPANT_SEC_ID = "org.eclipse.team.ui.sychronizing_default_participant_sec_id";
  public static final String SYNCVIEW_REMOVE_FROM_VIEW_NO_PROMPT = "org.eclipse.team.ui.remove_from_view_without_prompt";
  public static final String PREF_WORKSPACE_FIRST_TIME = "org.eclipse.team.ui.first_time";
  public static final String PREF_GROUPBYDATE_MODE = "org.eclipse.team.ui.group_bydate_mode";
}

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

public abstract interface ITeamUIImages
{
  public static final String IMG_DLG_SYNC_INCOMING = "elcl16/incom_synch.gif";
  public static final String IMG_DLG_SYNC_OUTGOING = "elcl16/outgo_synch.gif";
  public static final String IMG_DLG_SYNC_CONFLICTING = "elcl16/conflict_synch.gif";
  public static final String IMG_REFRESH = "elcl16/refresh.gif";
  public static final String IMG_REFRESH_REMOTE = "elcl16/refresh_remote.gif";
  public static final String IMG_LINK_WITH = "elcl16/synced.gif";
  public static final String IMG_IGNORE_WHITESPACE = "elcl16/ignorews_edit.gif";
  public static final String IMG_COLLAPSE_ALL = "elcl16/collapseall.gif";
  public static final String IMG_SYNC_MODE_CATCHUP = "elcl16/catchup_rls.gif";
  public static final String IMG_SYNC_MODE_RELEASE = "elcl16/release_rls.gif";
  public static final String IMG_SYNC_MODE_FREE = "elcl16/catchuprelease_rls.gif";
  public static final String IMG_DLG_SYNC_INCOMING_DISABLED = "dlcl16/incom_synch.gif";
  public static final String IMG_DLG_SYNC_OUTGOING_DISABLED = "dlcl16/outgo_synch.gif";
  public static final String IMG_DLG_SYNC_CONFLICTING_DISABLED = "dlcl16/conflict_synch.gif";
  public static final String IMG_REFRESH_DISABLED = "dlcl16/refresh.gif";
  public static final String IMG_REFRESH_REMOTE_DISABLED = "dlcl16/refresh_remote.gif";
  public static final String IMG_LINK_WITH_DISABLED = "dlcl16/synced.gif";
  public static final String IMG_IGNORE_WHITESPACE_DISABLED = "dlcl16/ignorews_edit.gif";
  public static final String IMG_COLLAPSE_ALL_DISABLED = "dlcl16/collapseall.gif";
  public static final String IMG_SYNC_MODE_CATCHUP_DISABLED = "dlcl16/catchup_rls.gif";
  public static final String IMG_SYNC_MODE_RELEASE_DISABLED = "dlcl16/release_rls.gif";
  public static final String IMG_SYNC_MODE_FREE_DISABLED = "dlcl16/catchuprelease_rls.gif";
  public static final String IMG_DLG_SYNC_INCOMING_ENABLED = "elcl16/incom_synch.gif";
  public static final String IMG_DLG_SYNC_OUTGOING_ENABLED = "elcl16/outgo_synch.gif";
  public static final String IMG_DLG_SYNC_CONFLICTING_ENABLED = "elcl16/conflict_synch.gif";
  public static final String IMG_REFRESH_ENABLED = "elcl16/refresh.gif";
  public static final String IMG_REFRESH_REMOTE_ENABLED = "elcl16/refresh_remote.gif";
  public static final String IMG_LINK_WITH_ENABLED = "elcl16/synced.gif";
  public static final String IMG_IGNORE_WHITESPACE_ENABLED = "elcl16/ignorews_edit.gif";
  public static final String IMG_COLLAPSE_ALL_ENABLED = "elcl16/collapseall.gif";
  public static final String IMG_SYNC_MODE_CATCHUP_ENABLED = "elcl16/catchup_rls.gif";
  public static final String IMG_SYNC_MODE_RELEASE_ENABLED = "elcl16/release_rls.gif";
  public static final String IMG_SYNC_MODE_FREE_ENABLED = "elcl16/catchuprelease_rls.gif";
  public static final String IMG_WIZBAN_SHARE = "wizban/share_wizban.png";
  public static final String IMG_PROJECTSET_IMPORT_BANNER = "wizban/import_projectset_wizban.png";
  public static final String IMG_PROJECTSET_EXPORT_BANNER = "wizban/export_projectset_wizban.png";
  public static final String IMG_KEY_LOCK = "wizban/keylock.gif";
  public static final String IMG_PINNED = "elcl16/pin.gif";
  public static final String IMG_PREVIOUS = "elcl16/prev_nav.gif";
  public static final String IMG_SITE_ELEMENT = "elcl16/site_element.gif";
  public static final String IMG_CHANGE_FILTER = "elcl16/change_filter.gif";
  public static final String IMG_COMPRESSED_FOLDER = "obj/compressed_folder_obj.gif";
  public static final String IMG_HIERARCHICAL = "elcl16/hierarchicalLayout.gif";
  public static final String IMG_FLAT = "elcl16/flatLayout.gif";
  public static final String IMG_SYNC_VIEW = "eview16/synch_synch.gif";
  public static final String IMG_CHANGE_SET = "obj/changeset_obj.gif";
  public static final String IMG_COMPARE_VIEW = "eview16/compare_view.gif";
  public static final String IMG_DATES_CATEGORY = "obj/dates.gif";
  public static final String IMG_LOCALREVISION_TABLE = "obj/local_entry_tbl.gif";
}

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

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.graphics.FontMetrics;

public class PixelConverter
{
  private final FontMetrics fFontMetrics;
  
  /* Error */
  public PixelConverter(org.eclipse.swt.widgets.Control control)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 51	java/lang/Object:<init>	()V
    //   4: new 26	org/eclipse/swt/graphics/GC
    //   7: dup
    //   8: aload_1
    //   9: invokespecial 57	org/eclipse/swt/graphics/GC:<init>	(Lorg/eclipse/swt/graphics/Drawable;)V
    //   12: astore_2
    //   13: aload_2
    //   14: aload_1
    //   15: invokevirtual 60	org/eclipse/swt/widgets/Control:getFont	()Lorg/eclipse/swt/graphics/Font;
    //   18: invokevirtual 58	org/eclipse/swt/graphics/GC:setFont	(Lorg/eclipse/swt/graphics/Font;)V
    //   21: aload_0
    //   22: aload_2
    //   23: invokevirtual 59	org/eclipse/swt/graphics/GC:getFontMetrics	()Lorg/eclipse/swt/graphics/FontMetrics;
    //   26: putfield 50	org/eclipse/team/internal/ui/PixelConverter:fFontMetrics	Lorg/eclipse/swt/graphics/FontMetrics;
    //   29: goto +10 -> 39
    //   32: astore_3
    //   33: aload_2
    //   34: invokevirtual 56	org/eclipse/swt/graphics/GC:dispose	()V
    //   37: aload_3
    //   38: athrow
    //   39: aload_2
    //   40: invokevirtual 56	org/eclipse/swt/graphics/GC:dispose	()V
    //   43: return
    // Line number table:
    //   Java source line #22	-> byte code offset #0
    //   Java source line #23	-> byte code offset #4
    //   Java source line #25	-> byte code offset #13
    //   Java source line #26	-> byte code offset #21
    //   Java source line #27	-> byte code offset #32
    //   Java source line #28	-> byte code offset #33
    //   Java source line #29	-> byte code offset #37
    //   Java source line #28	-> byte code offset #39
    //   Java source line #30	-> byte code offset #43
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	44	0	this	PixelConverter
    //   0	44	1	control	org.eclipse.swt.widgets.Control
    //   12	28	2	gc	org.eclipse.swt.graphics.GC
    //   32	6	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   13	32	32	finally
  }
  
  public int convertHeightInCharsToPixels(int chars)
  {
    return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars);
  }
  
  public int convertHorizontalDLUsToPixels(int dlus)
  {
    return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus);
  }
  
  public int convertVerticalDLUsToPixels(int dlus)
  {
    return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
  }
  
  public int convertWidthInCharsToPixels(int chars)
  {
    return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
  }
}

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

import java.util.ResourceBundle;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;

public class Policy
{
  public static boolean DEBUG_SYNC_MODELS = false;
  public static boolean DEBUG_HISTORY = false;
  public static boolean DEBUG_DND = false;
  private static String ACTION_BUNDLE = "org.eclipse.team.internal.ui.actions.actions";
  private static ResourceBundle actionBundle = null;
  
  public static ResourceBundle getActionBundle()
  {
    ResourceBundle tmpBundle = actionBundle;
    if (tmpBundle != null) {
      return tmpBundle;
    }
    return actionBundle = ResourceBundle.getBundle(ACTION_BUNDLE);
  }
  
  static
  {
    if (TeamUIPlugin.getPlugin().isDebugging())
    {
      DEBUG_SYNC_MODELS = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.team.ui/syncmodels"));
      DEBUG_HISTORY = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.team.ui/history"));
      DEBUG_DND = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.team.ui/dnd"));
    }
  }
  
  public static void checkCanceled(IProgressMonitor monitor)
  {
    if (monitor.isCanceled()) {
      throw new OperationCanceledException();
    }
  }
  
  public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks)
  {
    if (monitor == null) {
      return new NullProgressMonitor();
    }
    if ((monitor instanceof NullProgressMonitor)) {
      return monitor;
    }
    return new SubProgressMonitor(monitor, ticks);
  }
  
  public static IProgressMonitor monitorFor(IProgressMonitor monitor)
  {
    if (monitor == null) {
      return new NullProgressMonitor();
    }
    return monitor;
  }
}

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

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class ProjectSetContentHandler
  extends DefaultHandler
{
  boolean inPsf = false;
  boolean inProvider = false;
  boolean inProject = false;
  Map map;
  String id;
  List references;
  boolean isVersionOne = false;
  
  public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
    throws SAXException
  {
    String elementName = getElementName(namespaceURI, localName, qName);
    if (elementName.equals("psf"))
    {
      map = new HashMap();
      inPsf = true;
      String version = atts.getValue("version");
      isVersionOne = version.equals("1.0");
      return;
    }
    if (isVersionOne) {
      return;
    }
    if (elementName.equals("provider"))
    {
      if (!inPsf) {
        throw new SAXException(TeamUIMessages.ProjectSetContentHandler_Element_provider_must_be_contained_in_element_psf_4);
      }
      inProvider = true;
      id = atts.getValue("id");
      references = new ArrayList();
      return;
    }
    if (elementName.equals("project"))
    {
      if (!inProvider) {
        throw new SAXException(TeamUIMessages.ProjectSetContentHandler_Element_project_must_be_contained_in_element_provider_7);
      }
      inProject = true;
      String reference = atts.getValue("reference");
      references.add(reference);
      return;
    }
  }
  
  public void endElement(String namespaceURI, String localName, String qName)
    throws SAXException
  {
    String elementName = getElementName(namespaceURI, localName, qName);
    if (elementName.equals("psf"))
    {
      inPsf = false;
      return;
    }
    if (isVersionOne) {
      return;
    }
    if (elementName.equals("provider"))
    {
      map.put(id, references);
      references = null;
      inProvider = false;
      return;
    }
    if (elementName.equals("project"))
    {
      inProject = false;
      return;
    }
  }
  
  public Map getReferences()
  {
    return map;
  }
  
  public boolean isVersionOne()
  {
    return isVersionOne;
  }
  
  private String getElementName(String namespaceURI, String localName, String qName)
  {
    if ((localName != null) && (localName.length() > 0)) {
      return localName;
    }
    return qName;
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class ProjectSetImporter$1
  extends SelectionAdapter
{
  final ProjectSetImporter.AdviceDialog this$1;
  private final Button val$checkBox;
  
  ProjectSetImporter$1(ProjectSetImporter.AdviceDialog paramAdviceDialog, Button paramButton)
  {
    this$1 = paramAdviceDialog;val$checkBox = paramButton;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$1.applyToAll = val$checkBox.getSelection();
  }
}

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

class ProjectSetImporter$2
  implements Runnable
{
  private final ProjectSetImporter.AdviceDialog val$dialog;
  
  ProjectSetImporter$2(ProjectSetImporter.AdviceDialog paramAdviceDialog)
  {
    val$dialog = paramAdviceDialog;
  }
  
  public void run()
  {
    val$dialog.open();
  }
}

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

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

class ProjectSetImporter$AdviceDialog
  extends MessageDialog
{
  boolean applyToAll;
  
  public ProjectSetImporter$AdviceDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex)
  {
    super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
  }
  
  protected Control createCustomArea(Composite parent)
  {
    Button checkBox = new Button(parent, 32);
    checkBox.setText(TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_applyToAll);
    checkBox.addSelectionListener(new ProjectSetImporter.1(this, checkBox));
    
    return checkBox;
  }
}

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

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
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.Shell;
import org.eclipse.team.core.IProjectSetSerializer;
import org.eclipse.team.core.ProjectSetCapability;
import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.Team;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.core.TeamPlugin;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.XMLMemento;

public class ProjectSetImporter
{
  public static IProject[] importProjectSetFromString(String psfContents, String filename, Shell shell, IProgressMonitor monitor)
    throws InvocationTargetException
  {
    XMLMemento xmlMemento = stringToXMLMemento(psfContents);
    return importProjectSet(xmlMemento, filename, shell, monitor);
  }
  
  public static IProject[] importProjectSet(String filename, Shell shell, IProgressMonitor monitor)
    throws InvocationTargetException
  {
    XMLMemento xmlMemento = filenameToXMLMemento(filename);
    return importProjectSet(xmlMemento, filename, shell, monitor);
  }
  
  private static IProject[] importProjectSet(XMLMemento xmlMemento, String filename, Shell shell, IProgressMonitor monitor)
    throws InvocationTargetException
  {
    try
    {
      String version = xmlMemento.getString("version");
      
      List newProjects = new ArrayList();
      if (version.equals("1.0"))
      {
        IProjectSetSerializer serializer = Team.getProjectSetSerializer("versionOneSerializer");
        if (serializer != null)
        {
          IProject[] projects = serializer.addToWorkspace(new String[0], filename, shell, monitor);
          if (projects != null) {
            newProjects.addAll(Arrays.asList(projects));
          }
        }
      }
      else
      {
        UIProjectSetSerializationContext context = new UIProjectSetSerializationContext(shell, filename);
        List errors = new ArrayList();
        ArrayList referenceStrings = new ArrayList();
        IMemento[] providers = xmlMemento.getChildren("provider");
        for (int i = 0; i < providers.length; i++)
        {
          IMemento[] projects = providers[i].getChildren("project");
          for (int j = 0; j < projects.length; j++) {
            referenceStrings.add(projects[j].getString("reference"));
          }
          try
          {
            String id = providers[i].getString("id");
            TeamCapabilityHelper.getInstance().processRepositoryId(id, 
              PlatformUI.getWorkbench().getActivitySupport());
            RepositoryProviderType providerType = RepositoryProviderType.getProviderType(id);
            if (providerType == null) {
              providerType = TeamPlugin.getAliasType(id);
            }
            if (providerType == null) {
              throw new TeamException(new Status(4, "org.eclipse.team.ui", 0, NLS.bind(TeamUIMessages.ProjectSetImportWizard_0, new String[] { id }), null));
            }
            ProjectSetCapability serializer = providerType.getProjectSetCapability();
            ProjectSetCapability.ensureBackwardsCompatible(providerType, serializer);
            if (serializer != null)
            {
              IProject[] allProjects = serializer.addToWorkspace((String[])referenceStrings.toArray(new String[referenceStrings.size()]), context, monitor);
              if (allProjects != null) {
                newProjects.addAll(Arrays.asList(allProjects));
              }
            }
            referenceStrings.clear();
          }
          catch (TeamException e)
          {
            errors.add(e);
          }
        }
        if (!errors.isEmpty())
        {
          if (errors.size() == 1) {
            throw ((TeamException)errors.get(0));
          }
          TeamException[] exceptions = (TeamException[])errors.toArray(new TeamException[errors.size()]);
          IStatus[] status = new IStatus[exceptions.length];
          for (int i = 0; i < exceptions.length; i++) {
            status[i] = exceptions[i].getStatus();
          }
          throw new TeamException(new MultiStatus("org.eclipse.team.ui", 0, status, TeamUIMessages.ProjectSetImportWizard_1, null));
        }
        IMemento[] sets = xmlMemento.getChildren("workingSets");
        IWorkingSetManager wsManager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
        boolean replaceAll = false;
        boolean mergeAll = false;
        boolean skipAll = false;
        for (int i = 0; i < sets.length; i++)
        {
          IWorkingSet newWs = wsManager.createWorkingSet(sets[i]);
          if (newWs != null)
          {
            IWorkingSet oldWs = wsManager.getWorkingSet(newWs
              .getName());
            if (oldWs == null)
            {
              wsManager.addWorkingSet(newWs);
            }
            else if (replaceAll)
            {
              replaceWorkingSet(wsManager, newWs, oldWs);
            }
            else if (mergeAll)
            {
              mergeWorkingSets(newWs, oldWs);
            }
            else if (!skipAll)
            {
              String title = TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_title;
              String msg = 
                NLS.bind(
                TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_message, 
                newWs.getName());
              String[] buttons = {
                TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_replace, 
                TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_merge, 
                TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_skip, 
                IDialogConstants.CANCEL_LABEL };
              AdviceDialog dialog = new AdviceDialog(
                shell, title, null, msg, 
                3, buttons, 0);
              
              shell.getDisplay().syncExec(new Runnable()
              {
                public void run()
                {
                  open();
                }
              });
              switch (dialog.getReturnCode())
              {
              case 0: 
                replaceWorkingSet(wsManager, newWs, oldWs);
                replaceAll = applyToAll;
                break;
              case 1: 
                mergeWorkingSets(newWs, oldWs);
                mergeAll = applyToAll;
                break;
              case 2: 
                skipAll = applyToAll;
                break;
              case 3: 
              default: 
                throw new OperationCanceledException();
              }
            }
          }
        }
      }
      return (IProject[])newProjects.toArray(new IProject[newProjects.size()]);
    }
    catch (TeamException e)
    {
      throw new InvocationTargetException(e);
    }
  }
  
  private static XMLMemento filenameToXMLMemento(String filename)
    throws InvocationTargetException
  {
    InputStreamReader reader = null;
    try
    {
      reader = new InputStreamReader(new FileInputStream(filename), "UTF-8");
      return XMLMemento.createReadRoot(reader);
    }
    catch (UnsupportedEncodingException e)
    {
      throw new InvocationTargetException(e);
    }
    catch (FileNotFoundException e)
    {
      throw new InvocationTargetException(e);
    }
    catch (WorkbenchException e)
    {
      throw new InvocationTargetException(e);
    }
    finally
    {
      if (reader != null) {
        try
        {
          reader.close();
        }
        catch (IOException e)
        {
          throw new InvocationTargetException(e);
        }
      }
    }
  }
  
  private static XMLMemento stringToXMLMemento(String stringContents)
    throws InvocationTargetException
  {
    StringReader reader = null;
    try
    {
      reader = new StringReader(stringContents);
      return XMLMemento.createReadRoot(reader);
    }
    catch (WorkbenchException e)
    {
      throw new InvocationTargetException(e);
    }
    finally
    {
      if (reader != null) {
        reader.close();
      }
    }
  }
  
  public static boolean isValidProjectSetFile(String filename)
  {
    try
    {
      return filenameToXMLMemento(filename).getString("version") != null;
    }
    catch (InvocationTargetException localInvocationTargetException) {}
    return false;
  }
  
  public static boolean isValidProjectSetString(String psfContent)
  {
    if (psfContent == null) {
      return false;
    }
    try
    {
      return stringToXMLMemento(psfContent).getString("version") != null;
    }
    catch (InvocationTarg
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