コード例 #1
0
 public PyInplaceFieldIntroducer(
     PyTargetExpression target, IntroduceOperation operation, List<PsiElement> occurrences) {
   super(
       target,
       operation.getEditor(),
       operation.getProject(),
       "Introduce Field",
       occurrences.toArray(new PsiElement[occurrences.size()]),
       null);
   myTarget = target;
   myOperation = operation;
   if (operation.getAvailableInitPlaces().size() > 1) {
     myPanel = new PyIntroduceFieldPanel(myProject, operation.getAvailableInitPlaces());
   } else {
     myPanel = null;
   }
 }
コード例 #2
0
 @Override
 protected boolean checkEnabled(IntroduceOperation operation) {
   if (PyUtil.getContainingClassOrSelf(operation.getElement()) == null) {
     CommonRefactoringUtil.showErrorHint(
         operation.getProject(),
         operation.getEditor(),
         "Cannot introduce field: not in class",
         myDialogTitle,
         getHelpId());
     return false;
   }
   if (dependsOnLocalScopeValues(operation.getElement())) {
     operation.removeAvailableInitPlace(InitPlace.CONSTRUCTOR);
     operation.removeAvailableInitPlace(InitPlace.SET_UP);
   }
   return true;
 }