コード例 #1
0
 protected void performIntroduce() {
   ourLastInitializerPlace = myIntroduceFieldPanel.getInitializerPlace();
   final GosuBaseExpressionToFieldHandler.Settings settings =
       new GosuBaseExpressionToFieldHandler.Settings(
           getInputName(),
           getExpr(),
           getOccurrences(),
           myIntroduceFieldPanel.isReplaceAllOccurrences(),
           myStatic,
           myIntroduceFieldPanel.isDeclareFinal(),
           myIntroduceFieldPanel.getInitializerPlace(),
           myIntroduceFieldPanel.getFieldVisibility(),
           (PsiLocalVariable) getLocalVariable(),
           getType(),
           myIntroduceFieldPanel.isDeleteVariable(),
           myParentClass,
           false,
           false);
   new WriteCommandAction(myProject, getCommandName(), getCommandName()) {
     @Override
     protected void run(Result result) throws Throwable {
       if (getLocalVariable() != null) {
         final GosuLocalToFieldHandler.IntroduceFieldRunnable fieldRunnable =
             new GosuLocalToFieldHandler.IntroduceFieldRunnable(
                 false,
                 (PsiLocalVariable) getLocalVariable(),
                 myParentClass,
                 settings,
                 myStatic,
                 myOccurrences);
         fieldRunnable.run();
       } else {
         final GosuBaseExpressionToFieldHandler.ConvertToFieldRunnable convertToFieldRunnable =
             new GosuBaseExpressionToFieldHandler.ConvertToFieldRunnable(
                 myExpr,
                 settings,
                 settings.getForcedType(),
                 myOccurrences,
                 myOccurrenceManager,
                 getAnchorElementIfAll(),
                 getAnchorElement(),
                 myEditor,
                 myParentClass);
         convertToFieldRunnable.run();
       }
     }
   }.execute();
 }
コード例 #2
0
 @Override
 public boolean isReplaceAllOccurrences() {
   return myIntroduceFieldPanel.isReplaceAllOccurrences();
 }