Intellij:是什么导致深绿色检查突出显示?

时间:2020-06-18 00:44:09

标签: java intellij-idea ide

在搜索论坛和stackoverflow之后,我看不出要检查的重点试图提醒我什么:

here

选择/将鼠标悬停在突出显示的文本上,除了标准的上下文操作外,什么也不会返回。

最初,这些变量在构造函数之前声明并实例化。 (要执行的动作)当我使用上下文动作“将初始化移动到构造函数”时,构造函数中的初始化以深绿色突出显示。请参阅附件的img。

有人知道这是怎么回事吗?

示例:

public class HoaQueueEditorDialog extends ListDialogBase implements Mutable {

    private static final String SAVE = "Save";
    private static final String CANCEL = "Cancel";
    private static final String CHAR_DELIMITER = ",";
    private static final String[] COL_NAMES = {"Workflow Step Name"};
    private static final Color NORM_BACKGROUND = TRexUIManager.getColor(TRexUIManager.CONTENT_BACKGROUND);
    private static final Color NORM_FOREGROUND = Color.black;
    private static final int[] COL_WIDTHS = {325};
    private static final ArrayList<AppOptionsUtil.WorkflowStepInfo> SUPPORTED_STEPS_LIST = AppOptionsUtil.getDisplayHoaInfoWfStepsSupportedList();

    // UI Elements
    private TButton saveButton;
    private TButton cancelButton;
    private JPanel parentPanel;
    private JPanel buttonPanelRight;
    private JPanel buttonPanelLeft;

    // Stores the data necessary to build a table row and it's corresponding checkbox object.
    protected HashMap<AppOptionsUtil.WorkflowStepInfo, TCheckBox> checkBoxMap;

    private TTable wfQueuesTable;
    private DefaultTableModel tableModel;

    private TChangeListener changeListener = null;

    private boolean escKeyPressedInsideYesNoCancel = false;

    private String originalAppOptionValues = null;
    private String returnAppOptionValues = null;

    public HoaQueueEditorDialog() {
        try {
            this.tableModel = new DefaultTableModel(new Object[][]{{}}, COL_NAMES);
            this.wfQueuesTable = new TTable();
            wfQueuesTable.setModel(tableModel);
            wfQueuesTable.setBackground(NORM_BACKGROUND);
            wfQueuesTable.setRowHeight(42);
            wfQueuesTable.getSelectionModel().addListSelectionListener(new DocumentTableSelectionListener());

            init();
            initMVC();
            this.setResizable(true);
        } catch (Exception ex) {
            TRexToolkit.showErrorMessage("Error initializing Document Print Screen.", "Error", ex);
        }
        buttonPanelLeft = new JPanel(new FlowLayout(LEFT));
        buttonPanelRight = new JPanel(new FlowLayout(RIGHT));
        parentPanel = new JPanel();
    }

1 个答案:

答案 0 :(得分:2)

IntelliJ IDEA将突出显示您调用Move initialization to constructor意图时所做的更改。因为更改离光标很远,否则您可能看不到它们。按 Escape 将删除突出显示。