public static IExternalRefactoringDetector GetDummyRefactoringDetectorByType(RefactoringType type)
 {
     switch (type)
     {
         case RefactoringType.EXTRACT_METHOD:
             return new SimpleExtractMethodDetector();
         case RefactoringType.INLINE_METHOD:
             return new InlineMethodDetector(InMethodInlineDetectorFactory.
                 GetDummyDetector());
         default:
             throw new Exception("Unsupported refactoring type.");
     }
 }
 public static IRefactoringConditionsList GetConditionsListByRefactoringType(RefactoringType type)
 {
     switch (type)
     {
         case RefactoringType.RENAME:
             return RenameConditionsList.GetInstance();
         case RefactoringType.INLINE_METHOD:
             return InlineMethodConditionCheckersList.GetInstance();
         case RefactoringType.EXTRACT_METHOD:
             return ExtractMethodConditionsList.CreateInstance();
         case RefactoringType.CHANGE_METHOD_SIGNATURE:
             return ChangeMethodSignatureConditionsList.GetInstance();
         default:
             throw new Exception("Unsupported Condition list.");
     }
 }
 /* Whether a given refactoring RefactoringType is supported by GhostFactor. */
 public static bool IsSupported(RefactoringType type)
 {
     switch (type)
     {
         case RefactoringType.RENAME:
             return false;
         case RefactoringType.EXTRACT_METHOD:
             return true;
         case RefactoringType.CHANGE_METHOD_SIGNATURE:
             return true;
         case RefactoringType.INLINE_METHOD:
             return true;
         default:
             throw new Exception("Unknown Refactoring Type.");
     }
 }
 /* Get the search depth for different refactoring types, how many snapshots to look back. */
 public static int GetSearchDepth(RefactoringType type)
 {
     switch (type)
     {
         case RefactoringType.RENAME:
             return 30;
         case RefactoringType.EXTRACT_METHOD:
             return 30;
         case RefactoringType.CHANGE_METHOD_SIGNATURE:
             return 30;
         case RefactoringType.INLINE_METHOD:
             return 30;
         default:
             throw new Exception("Unknown Refactoring Type.");
     }
 }
Esempio n. 5
0
 public static string GetRefactoringTypeName(RefactoringType type)
 {
     var converter = new RefactoringType2StringConverter();
     return (string) converter.Convert(type, null, null, null);
 }
 /// <summary>
 /// Whether a given refactoring RefactoringType is supported by GhostFactor.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public bool IsSupported(RefactoringType type)
 {
     lock (supportedTypes)
     {
         return supportedTypes.Contains(type);
     }
 }
 public static IExternalRefactoringDetector GetRefactoringDetectorByType(RefactoringType type)
 {
     switch (type)
     {
         case RefactoringType.RENAME:
             return new RenameDetector();
         case RefactoringType.INLINE_METHOD:
             return new InlineMethodDetector(InMethodInlineDetectorFactory.GetInlineDetectorByStatement());
         case RefactoringType.EXTRACT_METHOD:
             return new ExtractMethodDetector(InMethodExtractMethodDetectorFactory.
                 GetInMethodExtractMethodDetectorWithoutInvocation());
         case RefactoringType.CHANGE_METHOD_SIGNATURE:
             return new ChangeMethodSignatureDetector();
         default:
             throw new Exception("Unknown refactoring type.");
     }
 }
 private void SetOnlySupportedRefactoringTypeIfRadioButtonChecked(object sender, RefactoringType type)
 {
     var rb = sender as RadioButton;
     if (rb != null && rb.Checked)
     {
         GhostFactorComponents.configurationComponent.RemoveSupportedRefactoringTypes
             (RefactoringTypeUtil.GetAllValidRefactoringTypes());
         GhostFactorComponents.configurationComponent.AddSupportedRefactoringTypes
             (new[] {type});
     }
 }