リファクタリングの名前の変更

Visual COBOL では、変数、セクション、および段落 (ネイティブ COBOL)、識別子 (マネージ COBOL)、または Java コードで参照される COBOL 形式 (あるいはその逆) のワークスペース内におけるすべてまたは選択した出現について、名前を変更できます。

リファクタリングの名前の変更に関する設定

Eclipse では、エディターで直接名前を変更することができ、識別子のすべての出現について名前を変更できます。また、[Rename] ダイアログ ボックスによる名前の変更も可能で、変更を適用する前に確認して承認できます。

名前の変更に [Rename] ダイアログ ボックスを使用するかどうかを指定するには、[ウィンドウ > 設定 > Micro Focus > COBOL > Editor] をクリックし、[Rename in editor without dialog] (デフォルトでは有効) をオンまたはオフにします。

コード内の識別子の名前変更

識別子の名前を変更するには、次の操作を行います。

  1. エディターで名前を変更する項目を右クリックし、[Refactor > Rename] をクリックします。

    または、メイン メニューから [Refactor > Rename] をクリックするか、[Outline] または [Program Outline] ビューで識別子を右クリックし、[Refactor > Rename] をクリックします。

    クイック形式の名前変更用に IDE が構成されている場合:

    • エディターで新しい名前を入力するよう求めるメッセージが表示されます。

    • 新しい名前を入力して Enter を押すと、その名前のすべての参照について名前が変更されます。

      必要に応じて、名前変更ツールチップのドロップダウン メニューからコマンドを使用して、[Rename] ダイアログを呼び出し、提示された変更を適用する前に確認します。

    [Rename] ダイアログ ボックスを使用して名前を変更するように IDE が構成されている場合:

    1. [New name] フィールドに新しい名前を指定します。
    2. [Update references] がオンになっていることを確認します。
    3. [Preview] をクリックして、変更を表示および承認します。

      必要な変更が適用されていることを確認し、[OK] をクリックします。

変更を元に戻すには、[Edit > Undo Rename COBOL Element] クリックします。

制約事項

The following restrictions apply to rename refactoring:

  • It is not possible to rename identifiers in a copybook which is referenced using the COBCPY environment variable but is not located in the workspace.
  • It is not possible to rename identifiers in copybooks referenced using a COPY...使用すべきではありません。
  • It is not possible to rename typedef members.
  • It is not possible to rename identifiers in any resources that are outside the current workspace.
  • It is not possible to rename identifiers defined using the AS phrase.
  • It is not possible to rename a program name or an entry-point.
  • Rename using a COBOL reserved word is not supported.The IDE does not issue a warning if you use a reserved word to rename an identifier and will rename the instances of the identifier.Trying to build your application, however, will fail.

The following restrictions apply to native COBOL only:

  • It is not possible to rename copybooks from the editor.You can rename copybooks from COBOL Explorer.This, however, does not change any of the references to the copybooks in the code.